I'm debugging a binary without debugging information on linux with gdb. I want to break just before the first call to puts
but not enter the function.
I have tried the following:
gdb> b puts
gdb> r
or
gdb> b main
gdb> b puts
gdb> r
gdb> c
But gdb always enters puts
instead of breaking before the syscall.
But gdb always enters puts instead of breaking before the syscall.
That's what you asked GDB to do.
If you want to stop before the CALL puts
instruction, you need to disas main
, find the CALL puts
instruction, and set a breakpoint on that instruction:
(gdb) start # stop in main to get the binary relocated
(gdb) disas
...
0x0000555555555147 <+14>: callq 0x555555555030 <puts@plt>
...
(gdb) break *0x0000555555555147
(gdb) cont
Breakpoint 2, 0x0000555555555147 in main ()
(gdb) x/i $pc
=> 0x555555555147 <main+14>: callq 0x555555555030 <puts@plt>
PS syscall
means something else entirely.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.