Reputation: 177
What I'm attempting to do is to record the values stored in registers at each assembly instruction of a function. All I have is just the executable file to work with. I've figured how to get the asm layout but just having a hard time with stepping through that. When I use "b 1" command to set a break point that I could start stepping through from, I get an error "No line 1 in file "../sysdeps/i386/dl-procinfo.c". Here's a screenshot to show the commands I've entered so far:
Upvotes: 0
Views: 1787
Reputation: 9331
Use a function name or a memory address when putting a breakpoint instead or compile without optimizations if you want line numbers.
(gdb) b main // will put a break point at start of function main
(gdb) r // run
Alternatively, use start
command which sets a temporary breakpoint on main() and starts executing.
Use n
to move to next instruction and si
to step into a function / label.
To display the registers
, you can use info regs
command or i r
. Alternatively, use registers layout, which is much better. To get the value inside a particular register, use print
, e.g print $rax
.
(gdb) layout regs
Upvotes: 2