> > I wrote a compiler for brainfuck to x86.
> > The result is quite fast but I was curious if I could tune it even more.
> > So I ran it in callgrind but this resulted in:
...
> > ==77043== Process terminating with default action of signal 4 (SIGILL)
> > ==77043== Illegal opcode at address 0x40274E
> > ==77043== at 0x40274E: ??? (in /home/folkert/Projects/bf-compiler/test)
> > ==77043== by 0x4020EE: ??? (in /home/folkert/Projects/bf-compiler/test)
...
> > If you're curious what is going wrong here, the source assembly and the
> > x86 binary can be retrieved from
> > https://vanheusden.com/permshare/callgrind-error.tar.xz
...
> Using an online disassembler, I found that the initial bytes decode to
> int 0x80, which (under Linux) is a system call. Maybe you're making a
> system call that valgrind does not recognize? One would need to know
> register contents to go further with that.
The 2 calls it does are:
print_char:
movb (%esi), %al
movb %al, buffer
movl $4, %eax
movl $1, %ebx
movl $buffer, %ecx
movl $1, %edx
int $0x80
ret
exit:
movl $1, %eax
movl $0, %ebx
int $0x80
When the program is ran directly from the command, it runs fine. So
that's not the problem.
_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users