4

I am working on some JIT compiler and I am using GDB to debut it, my code crashes at some point (segment fault), but it crashes at the jitted code (they are generated on the fly) so I do not get the stack frame information, But I got the following backtrace:

#0  0x0000000001d98f22 in ?? () // JITTED CODE
#1  0x000000000000001d in ?? () // JITTED CODE
#2  ...callattribuite function....

I am wondering if it is possible for GDB to disassemble the code at location 0x0000000001d98f22 and display it to me. I tried disas 0x0000000001d98f22 but GDB complained No function contains specified address.


EDIT: I also fixed this myself, the disas command needs a end address to work properly.

Bob Fang
  • 6,963
  • 10
  • 39
  • 72

1 Answers1

5

if it is possible for GDB to disassemble the code at location 0x0000000001d98f22

Yes: (gdb) x/20i 0x0000000001d98f22

If your JIT is done by Java, you should also read this answer.

Community
  • 1
  • 1
Employed Russian
  • 199,314
  • 34
  • 295
  • 362
  • A word of warning though: on a machine with a variable instruction encoding (such as x86 and x86-64) you must pay attention to the offset you start disassembling at, particularly if the break was caused by a SIGILL or similar. Otherwise you may get an incorrect disassembly. – Martin Törnwall Jan 04 '15 at 14:05