How to break on assembly instruction at a given address in gdb?
92,328
Solution 1
try break *0x0000000000400448
Solution 2
Another way:
break *main+4
This will add a breakpoint at 0x000000000040044c
I think this is easier than writing the whole address!
Related videos on Youtube
Author by
compile-fan
Updated on July 08, 2022Comments
-
compile-fan almost 2 years
0x0000000000400448 <main+0>: push %rbp 0x0000000000400449 <main+1>: mov %rsp,%rbp 0x000000000040044c <main+4>: mov $0x6,%eax 0x0000000000400451 <main+9>: leaveq 0x0000000000400452 <main+10>: retq
I tried:
breaki 0x0000000000400448
but it seems that there not such command.
Does gdb have such a feature?
-
phil294 almost 7 yearswhy
breaki
? is that a typo? -
Per Lundberg over 6 years@Blauhirn Perhaps as a supposed analogy with
stepi
andnexti
, which are used for single-stepping at the instruction level.
-
-
Laurent G about 13 yearsProbably because * is required to specify an address. see sourceware.org/gdb/current/onlinedocs/gdb/…
-
user202729 almost 6 yearsAnd of course you can remove the leading zeroes and abbreviate
break
, giveb *0x400448
. -
Dan Anderson almost 5 yearsTo disambiguate with function or data named
0x0000000000400448
(unusual as that would be!) -
ifexploit over 4 years@compile-fan break *address Set a breakpoint at address address. You can use this to set breakpoints in parts of your program which do not have debugging information or source files. ftp.gnu.org/old-gnu/Manuals/gdb/html_node/gdb_28.html I was debugging a assembly code and reached here for the same question which you asked.