B.4 The GNU Debugger (gdb)

The following tables list some useful commands of the GNU Debugger (gdb). For a complete list of available commands, see the gdb online documentation.[94]

Starting and Stopping gdb

Command

Description

gdb program

Starts gdb with program to debug.

quit

Exits the debugger.

General Commands

Command

Description

run arguments

Starts debugged program (with arguments).

attach processID

Attaches the debugger to the running process with processID.

Breakpoints

Command

Description

break <file:> function

Sets a breakpoint at the beginning of the specified function (in file).

break <file:> line number

Sets a breakpoint at the start of the code for that line number (in file).

break *address

Sets a breakpoint at the specified address.

info breakpoints

Lists ...

Get A Bug Hunter's Diary now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.