How to put a break on an instruction specified by address in gdb?

16,543

Solution 1

You just need to add the hex prefix:

b *0x9048f23

Solution 2

By default, you'll need the 0x prefix to specify a hex number (as Igor says; +1).

If you prefer hex to be used for numeric input in general (without needing a prefix), you can change the default with:

set input-radix 16

You can also change the default output radix with set output-radix, or both at the same time with set radix; see the relevant section of the gdb documentation for details.

(And you can put these commands in your ~/.gdbinit file if you want them to apply automatically to every gdb session.)

Share:
16,543
Admin
Author by

Admin

Updated on June 08, 2022

Comments

  • Admin
    Admin about 2 years

    How can I put a break point to that instruction. When I write either:

    break 9048f23
    break *9048f23
    

    It does not work.

    How I can put a break point to that instruction.

    9048f23:    8a 51 e6                mov    0x12(%esp),%eax  
    

    Platform: Linux.