1. backtrace full: Complete backtrace with local variables
  2. up, down, frame: Move through frames
  3. watch: Suspend the process when a certain condition is met
  4. set print pretty on: Prints out prettily formatted C source code
  5. set logging on: Log debugging session to show to others for support
  6. set print array on: Pretty array printing
  7. finish: Continue till end of function
  8. enable and disable: Enable/disable breakpoints
  9. tbreak: Break once, and then remove the breakpoint
  10. where: Line number currently being executed
  11. info locals: View all local variables
  12. info args: View all function arguments
  13. list: view source
  14. rbreak: break on function matching regular expression
🌐
TutorialsPoint
tutorialspoint.com › gnu_debugger › gdb_commands.htm
GDB - Commands
GDB offers a big list of commands, however the following commands are the ones used most frequently:
🌐
University of Texas at Austin
users.ece.utexas.edu › ~adnan › gdb-refcard.pdf pdf
GDB QUICK REFERENCE GDB Version 4 Essential Commands gdb program [core]
gdb --help · describe command line options · Stopping GDB · quit · exit GDB; also q or EOF (eg C-d) INTERRUPT · (eg C-c) terminate current command, or · send to running process · Getting Help · help · list classes of commands · help class · one-line descriptions for commands in ·
🌐
GeeksforGeeks
geeksforgeeks.org › linux-unix › gdb-command-in-linux-with-examples
gdb command in Linux with examples - GeeksforGeeks
September 2, 2024 - These command creates a new process and keep that process in the suspended mode and prints the created process's process id. For example, in the above execution, the breakpoint is kept at function findSquare and the program was executed with the arguments "1 10 100". When the function is called initially with a = 1, the breakpoint happens. Now we create a checkpoint and hence gdb returns a process id(4272), keeps it in the suspended mode and resumes the original thread once the continue command is invoked.
🌐
VisualGDB
visualgdb.com › gdbreference › commands
GDB Command Reference - Index page
This page contains a reference of most frequently used GDB commands. The commands described here can be used with the command-line GDB as well as under VisualGDB.
🌐
Yolinux
yolinux.com › TUTORIALS › GDB-Commands.html
Linux Tutorial - GNU GDB Debugger Command Cheat Sheet
To execute a shell command: ! command or shell command · GDB command completion: Use TAB key info bre + TAB will complete the command resulting in info breakpoints Press TAB twice to see all available options if more than one option is available or type "M-?" + RETURN.
🌐
USC CS and ECE
bytes.usc.edu › cs104 › wiki › gdb
GDB Cheat Sheet
Breakpoint 1, Skirmish (protectors=0x61a0a0, invaders=0x61a220, n=2, m=3, skirmishLine=1, numReserves=@0x7fffffffd970: 0, outputFile=...) at game_of_pointers_student2.cpp:110 110 bool protectorLost = false; (gdb) n 111 if (invader->weapon == protector->weapon) (gdb) print invader->weapon $3 = "axe" (gdb) print protector->weapon $4 = "axe" (gdb) n 113 if (invader->power < protector->power) (gdb) print invader->power $5 = 30 (gdb) print protector->power $6 = 100 (gdb) n 115 protectorLost = true; (gdb) c
Find elsewhere
🌐
Linux Man Pages
man7.org › linux › man-pages › man1 › gdb.1.html
gdb(1) - Linux manual page
You can run "gdb" with no arguments ... option -p you can omit the program filename. Here are some of the most frequently needed GDB commands: break [file:][function|line] Set a breakpoint at function or line (in file)....
🌐
Stanford CCRMA
ccrma.stanford.edu › ~jos › stkintro › Useful_commands_gdb.html
Useful commands in gdb
Below is a useful subset of gdb commands, listed roughly in the order they might be needed. The first column gives the command, with optional characters enclosed in [square brackets]. For example, the run command can be abbreviated r. The second column gives a short description of the command.
🌐
GNU Project
sourceware.org › gdb › current › onlinedocs › gdb.html › Command-Files.html
Command Files (Debugging with GDB)
You can request the execution of a command file with the source command. Note that the source command is also used to evaluate scripts that are not Command Files. The exact behavior can be configured using the script-extension setting. See Extending GDB.
🌐
Richard Johnsonbaugh
condor.depaul.edu › glancast › 373class › docs › gdb.html
Quick Gdb Guide
Note that listsize's value can be change with the set command. ... List lines of source code centered around a particular line. Example. List the lines centered around line 41. ... Show the next statement that will be executed. (gdb) where #0 mystrcpy (copyto=0x259fc6c "*", copyfrom=0x259fddc "ABC") at printch.cpp:27 #1 0x4010c8 in main (argc=3, argv=0x25b0cb8) at printch.cpp:40
🌐
Darkdust
darkdust.net › files › GDB Cheat Sheet.pdf pdf
Running # gdb
Print all directories in which GDB sear- ches for source files. show listsize · Print how many are shown in the „list“ · command. whatis variable_name · Print type of named variable. GDB cheatsheet - page 2 ·
🌐
Brendan Gregg
brendangregg.com › blog › 2016-08-09 › gdb-example-ncurses.html
gdb Debugging Full Example (Tutorial): ncurses
August 9, 2016 - Breakpoint 1, 0x00007ffff34ad2e0 in doupdate () from /lib/x86_64-linux-gnu/libncursesw.so.5 (gdb) b *doupdate + 289 Breakpoint 2 at 0x7ffff34ad401 (gdb) c Continuing. Breakpoint 2, 0x00007ffff34ad401 in doupdate () from /lib/x86_64-linux-gnu/libncursesw.so.5 · We've arrived at our breakpoint. If you haven't done this before, the r (run) command takes arguments that will be passed to the gdb target we specified earlier on the command line (python).
🌐
GNU Project
sourceware.org › gdb › current › onlinedocs › gdb
Debugging with GDB
Run in batch mode. Exit with status 0 after processing all the command files specified with ‘-x’ (and all commands from initialization files, if not inhibited with ‘-n’). Exit with nonzero status if an error occurs in executing the GDB commands in the command files.
🌐
GNU Project
sourceware.org › gdb › current › onlinedocs › gdb.html › Define.html
Define (Debugging with GDB)
List all user-defined commands and all python commands defined in class COMMAND_USER. The first line of the documentation or docstring is included (if any). ... Display the GDB commands used to define commandname (but not its documentation). If no commandname is given, display the definitions for all user-defined commands.
🌐
ST Wiki
wiki.st.com › stm32mpu › wiki › GDB_commands
GDB commands - stm32mpu
The command help target lists all the possible targets rather than the current ones. ... Symbols from "target:/usr/local/bin/hello_world_example". Remote serial target in gdb-specific protocol: Debugging a target over a serial line. While running this, the GDB does not access memory from...
🌐
Brown
cs.brown.edu › courses › cs033 › docs › guides › gdb.pdf pdf
CSCI0330 Intro Computer Systems Doeppner gdb Cheatsheet Fall 2018
A variation of this command is the ​display​ command. This command takes the same · arguments, but repeats execution every time ​gdb​ waits for input.
🌐
Reddit
reddit.com › r/c_programming › a quick intro to gdb.
r/C_Programming on Reddit: A quick intro to gdb.
May 28, 2023 -

GDB Quick Guide

I found out I didn't need cgdb by the way, it was better to just gdb -tui on Debian. Less modem noise in the form of uninterpreted escape sequences too.

So it paid up to do gdb -help.

The guide doesn't mention watch or watch -l but it points to Debugging with GDB where you can find everything.

It is a good quick start, with a couple of examples.

🌐
GNU Project
sourceware.org › gdb › current › onlinedocs › gdb.html › Commands.html
Commands (Debugging with GDB)
You can abbreviate a GDB command to the first few letters of the command name, if that abbreviation is unambiguous; and you can repeat certain GDB commands by typing just RET.
🌐
GNU
gcc.gnu.org › onlinedocs › gcc-9.1.0 › gnat_ugn › Introduction-to-GDB-Commands.html
GNAT User’s Guide for Native Platforms: Introduction to GDB Commands
GDB contains a large repertoire of commands. See Debugging with GDB for extensive documentation on the use of these commands, together with examples of their use. Furthermore, the command `help' invoked from within GDB activates a simple help facility which summarizes the available commands ...