๐ŸŒ
University of Michigan
web.eecs.umich.edu โ€บ ~sugih โ€บ pointers โ€บ summary.html
GDB Tutorial
So, if your program is in a source file called memsim.c and you want to put the executable in the file memsim, then you would compile with the following command: ... To start gdb, just type gdb at the unix prompt. Gdb will give you a prompt that looks like this: (gdb).
๐ŸŒ
University of Toronto
cs.toronto.edu โ€บ ~krueger โ€บ csc209h โ€บ tut โ€บ gdb_tutorial.html
gdb tutorial
As programmers, we all make errors. Certainly, most of us at least have tried placing "printf" statements in our code hoping to catch the errors, however, we need to know more than that. Debugger is a good tool for tracing bugs. In this tutorial, we will show you how to use gdb -- a "GNU" debugger.
Discussions

A quick intro to gdb.
This Red Hat Tutorial learns you the finer points. More on reddit.com
๐ŸŒ r/C_Programming
4
40
May 28, 2023
Properly Learning GDB
A course would be overkill. Look for a cheat sheet, then use it to do some actual debugging. You'll find yourself looking up specific things and soon enough you will have explored everything. I will say, if you're on windows, I'd strongly suggest using the rad debugger (shameless self plug) by epic games / rad tools. It's on GitHub. More on reddit.com
๐ŸŒ r/C_Programming
21
46
December 10, 2024
Learning C with gdb
But that should be in the first paragraph. TUI mode shows the source code and the current line. This is like the difference between `ed` and `vi`: you can see the source code that you're debugging instead of mashing `bt` or whatever again and again ยท To use gdb's TUI mode, simply include the ... More on news.ycombinator.com
๐ŸŒ news.ycombinator.com
24
238
May 20, 2015
gdb step debugging a C program - Stack Overflow
If I understand correctly, you want to "step back". This is supported by GDB since version 7. See manual, tutorial or related Stackoverflow topic. More on stackoverflow.com
๐ŸŒ stackoverflow.com
๐ŸŒ
Medium
medium.com โ€บ havingfun โ€บ debugging-c-code-with-gdb-90adb2f3da96
Debugging C code With GDB | Having Fun | Having Fun
May 15, 2022 - Inside a function, another variation of the info command prints the arguments passed to that function: ... ... was the address of the function, removed for legibility's sake. It looks like this: 0x0000000100003f6c ... (gdb) next 5 int incremented = sum + 1; (gdb) next 6 return incremented; (gdb) info locals sum = 5 incremented = 6
๐ŸŒ
Red Hat
developers.redhat.com โ€บ articles โ€บ the-gdb-developers-gnu-debugger-tutorial-part-1-getting-started-with-the-debugger
The GDB developer's GNU Debugger tutorial, Part 1: Getting started with the debugger | Red Hat Developer
February 27, 2024 - This article is the first in a series demonstrating how to use the GNU Debugger (GDB) effectively to debug applications in C and C++. If you have limited or no experience using GDB, this series will teach you how to debug your code more efficiently.
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ c language โ€บ gdb-step-by-step-introduction
GDB (Step by Step Introduction) - GeeksforGeeks
January 10, 2025 - In this article we have discussed GDB (GNU Debugger) which is a powerful tool in Linux used for debugging C programs. We have discussed some of the following steps so that we can compile your code with debugging information, run GDB, set breakpoint, examine variables, and analyze program behavior.
๐ŸŒ
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.

๐ŸŒ
Kauffman77
kauffman77.github.io โ€บ tutorials โ€บ gdb.html
Quick Guide to gdb: The GNU Debugger
April 4, 2025 - In a terminal, run gdb with a "text user interface" >> make puzzlebox gcc -Wall -g -c puzzlebox.c gcc -Wall -g -o puzzlebox puzzlebox.o # Note the -g option while compiling which adds debugging symbols for # the debugger: very useful # Start gdb with the text user interface on program puzzlebox >> gdb -tui ./puzzlebox
Find elsewhere
๐ŸŒ
Cornell Virtual Workshop
cvw.cac.cornell.edu โ€บ cintro โ€บ wrapping-up โ€บ gdb
Cornell Virtual Workshop > Introduction to C Programming > Wrapping Up > Debugging with GDB
A debugging tool like GDB has ... once with the -g flag, whereas printf() may require multiple compiles. In this tutorial, we run GDB on a small C program as an exercise....
๐ŸŒ
UCSD
cseweb.ucsd.edu โ€บ classes โ€บ fa09 โ€บ cse141 โ€บ tutorial_gcc_gdb.html
Tutorial of gcc and gdb
You may also watch the value of any variable at run-time. In additon, it also helps to identify the place and the reason making the program crash. All program to be debugged in gdb must be compiled by gcc with the option "-g" turning on.
๐ŸŒ
Purdue University
cs.purdue.edu โ€บ homes โ€บ cs240 โ€บ resources โ€บ gdb-tutorial.pdf pdf
CS 240: Programming in C Spring 2019 GDB Tutorial
Type "apropos word" to search for commands related to "word"... Reading symbols from main...done. ... Alright! Reading symbols from main...done. means that GDB was able to successfully read
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ gnu_debugger โ€บ index.htm
GNU Debugger Tutorial
GDB, short for GNU Debugger, is the most popular debugger for UNIX systems to debug C and C++ programs. This tutorial provides a brief introduction on how to use GDB commands to ensure the programs are error-free.
๐ŸŒ
BetterExplained
betterexplained.com โ€บ articles โ€บ debugging-with-gdb
Debugging with GDB โ€“ BetterExplained
Compiles myprogram.c with the debugging option (-g). You still get an a.out, but it contains debugging information that lets you use variables and function names inside GDB, rather than raw memory locations (not fun).
๐ŸŒ
Umd
umiacs.umd.edu โ€บ user.php
Using GDB for Reverse Engineering
As a last resort, you can use (Ctrl-C) to stop the program and panic out. But this is not recommended and is usually not necessary, as long as you positioned our breakpoints appropriately. ... To exit gdb and return to the shell prompt: (gdb) quit Note that exiting gdb means you lose all of ...
๐ŸŒ
Suchprogramming
suchprogramming.com โ€บ debugging-with-gdb-part-1
Such Programming - Debugging C Programs with GDB โ€“ Part 1
February 21, 2018 - Looking at this listing, I think a good place to pause and look around would be at the printf() call within my for loop. To have GDB stop here Iโ€™ll use the break command and Iโ€™ll give it the argument 10 to indicate Iโ€™d like to set a breakpoint at line 10.
๐ŸŒ
GNU Project
sourceware.org โ€บ gdb
GDB: The GNU Project Debugger
This means printing the help text for all sub-commands, unless the prefix command is a 'show' command, in which case the value of all sub-commands is printed. Eliding the #:doc string from make-parameter now means that GDB will use a default documentation string.
๐ŸŒ
Hacker News
news.ycombinator.com โ€บ item
Learning C with gdb | Hacker News
May 20, 2015 - But that should be in the first paragraph. TUI mode shows the source code and the current line. This is like the difference between `ed` and `vi`: you can see the source code that you're debugging instead of mashing `bt` or whatever again and again ยท To use gdb's TUI mode, simply include the ...
๐ŸŒ
Stanford University
web.stanford.edu โ€บ class โ€บ cs107 โ€บ resources โ€บ gdb
CS107 GDB and Debugging
This page will list the basic gdb commands you will need to use as you progress through CS107. However, it takes practice to become proficient in using the tool, and gdb is a large program that has a tremendous number of features.