Gdb parse one line

I want to parse only one specific line of code in gdb; for this I need the memory address of the specified string. How can I get the address of a specific line of code in gdb? Or better yet, is there a command in gdb to disassemble by line number?

+5
source share
2 answers

Put a break on the line you want to parse, and then you can try to get the current instruction.

disp/i $pc

This always works for me when I debug binary files without debugging information. You can also just get the current pcone print $pc, either info registers, or just use the instruction x. eg:.

x/10i address  //displays the first 10 instructions in assembly starting from address

or

x/10i register //displays the first 10 instructions starting from address stored in register
+3
source

: set disassemble-next-line on . , , .

+2

All Articles