Search code examples
gdbbreakpoints

What is the gdb command for setting a breakpoint with gdb?


What is the gdb command for setting a breakpoint with gdb?
Could I set a breakpoint for a specific function, without supplying its line number as a parameter?


Solution

  • You can set a breakpoint with the GNU Debugger with any of the following commands:

    b <addr_or_function_symbol>
    b <function name>
    b *<instruction address>
    b <filename:line number>
    b <line number>
    

    Note that the GDB must be initialized with a binary/file (obviously).