119
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?

Ciro Santilli OurBigBook.com
  • 347,512
  • 102
  • 1,199
  • 985
compile-fan
  • 16,885
  • 22
  • 59
  • 73

2 Answers2

206

try break *0x0000000000400448

Laurent G
  • 2,994
  • 1
  • 18
  • 10
  • 19
    Probably because * is required to specify an address. see http://sourceware.org/gdb/current/onlinedocs/gdb/Specify-Location.html#Specify-Location – Laurent G Mar 28 '11 at 13:38
  • 5
    And of course you can remove the leading zeroes and abbreviate `break`, give `b *0x400448`. – user202729 Jun 16 '18 at 08:56
  • To disambiguate with function or data named `0x0000000000400448` (unusual as that would be!) – Dan Anderson Jun 03 '19 at 18:21
  • 2
    @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. https://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. – ifexploit Aug 03 '19 at 09:59
83

Another way:

break *main+4

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

jyz
  • 6,011
  • 3
  • 29
  • 37