ChatGPT解决这个技术问题 Extra ChatGPT

How to break on assembly instruction at a given address in gdb?

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?

why breaki? is that a typo?
@Blauhirn Perhaps as a supposed analogy with stepi and nexti, which are used for single-stepping at the instruction level.

L
Laurent G

try break *0x0000000000400448


Probably because * is required to specify an address. see sourceware.org/gdb/current/onlinedocs/gdb/…
And of course you can remove the leading zeroes and abbreviate break, give b *0x400448.
To disambiguate with function or data named 0x0000000000400448 (unusual as that would be!)
@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.
j
jyz

Another way:

break *main+4

This will add a breakpoint at 0x000000000040044c
I think this is easier than writing the whole address!