source-level debugger
GNU_gdb_12.1_screenshot.png
The GNU Debugger (GDB) is a portable debugger that runs on many Unix-like systems and works for many programming languages, including Ada, Assembly, C, C++, D, Fortran, Haskell, Go, Objective-C, OpenCL C, โ€ฆ Wikipedia
Factsheet
Developer GNU Project
Release 1986; 40 years ago (1986)
Stable release 17.2
/ 10 May 2026
Factsheet
Developer GNU Project
Release 1986; 40 years ago (1986)
Stable release 17.2
/ 10 May 2026
๐ŸŒ
Wikipedia
en.wikipedia.org โ€บ wiki โ€บ GNU_Debugger
GNU Debugger - Wikipedia
1 month ago - The GNU Debugger (GDB) is a portable debugger that runs on many Unix-like systems and works for many programming languages, including Ada, Assembly, C, C++, D, Fortran, Haskell, Go, Objective-C, OpenCL C, Modula-2, Pascal, Rust, and partially others. It detects problems in a program while letting ...
๐ŸŒ
Red Hat
docs.redhat.com โ€บ en โ€บ documentation โ€บ red_hat_developer_toolset โ€บ 9 โ€บ html โ€บ user_guide โ€บ chap-gdb
Chapter 8. GNU Debugger (GDB) | User Guide | Red Hat Developer Toolset | 9 | Red Hat Documentation
It allows you to inspect memory within the code being debugged, control the execution state of the code, detect the execution of particular sections of code, and much more. Red Hat Developer Toolset is distributed with GDB 8.3. This version is more recent than the version included in Red Hat ...
๐ŸŒ
Kauffman77
kauffman77.github.io โ€บ tutorials โ€บ gdb.html
Quick Guide to gdb: The GNU Debugger
April 4, 2025 - The below sample run in gdb illustrates the basics of running puzzlebox in the debugger. See the next section for some details on commands like next / run / break. >> gdb -tui ./puzzlebox # Start gdb with text user interface on the puzzlebox GNU gdb (GDB) 8.1 ...
๐ŸŒ
GNU Project
sourceware.org โ€บ gdb
GDB: The GNU Project Debugger
May 10, 2026 - GDB, the GNU Project debugger, allows you to see what is going on `inside' another program while it executes -- or what another program was doing at the moment it crashed.
๐ŸŒ
NASA HECC
nas.nasa.gov โ€บ hecc โ€บ support โ€บ kb โ€บ gnu-debugger-(gdb)_97.html
GNU Debugger (GDB) - HECC Knowledge Base
October 21, 2019 - Computing power to answer NASA's complex science and engineering questions ยท The GNU Debugger (GDB) is available on HECC systems in the /usr/bin directory. GDB can be used to debug programs written in C, C++, Fortran, and Modula-a
๐ŸŒ
Kit
nhr.kit.edu โ€บ userdocs โ€บ horeka โ€บ debugging_gdb
Debugging with GNU gdb - NHR@KIT User Documentation
The GNU Debugger (GDB) is a standard debugger for serial programs, although it can be used for parallel and even distributed programs with few processes too.
Find elsewhere
๐ŸŒ
Linux Man Pages
man7.org โ€บ linux โ€บ man-pages โ€บ man1 โ€บ gdb.1.html
gdb(1) - Linux manual page
May 30, 2026 - Here are some of the most frequently needed GDB commands: break [file:][function|line] Set a breakpoint at function or line (in file). run [arglist] Start your program (with arglist, if specified). bt Backtrace: display the program stack. print expr Display the value of an expression. c Continue running your program (after stopping, e.g. at a breakpoint). next Execute next program line (after stopping); step over any function calls in the line. edit [file:]function look at the program line where it is presently stopped. list [file:]function type the text of the program in the vicinity of where
๐ŸŒ
GNU Project
sourceware.org โ€บ gdb โ€บ current โ€บ onlinedocs โ€บ gdb
Debugging with GDB
Debugging Pascal programs which use sets, subranges, file variables, or nested functions does not currently work. GDB does not support entering expressions, printing values, or similar features using Pascal syntax. GDB can be used to debug programs written in Fortran, although it may be necessary to refer to some variables with a trailing underscore. GDB can be used to debug programs written in Objective-C, using either the Apple/NeXT or the GNU ...
๐ŸŒ
Kali Linux
kali.org โ€บ tools โ€บ gdb
gdb | Kali Linux Tools
May 25, 2026 - GNU Debugger GDB is a source-level debugger, capable of breaking programs at any specific line, displaying variable values, and determining where errors occurred. Currently, gdb supports C, C++, D, Objective-C, Fortran, Java, OpenCL C, Pascal, ...
๐ŸŒ
Medium
medium.com โ€บ @saransivakumar89 โ€บ a-beginners-guide-to-gdb-the-gnu-debugger-57bd6e01e9e4
A Beginnerโ€™s Guide to GDB: The GNU Debugger | by Saran Sivakumar | Medium
February 24, 2025 - Debugging is an essential skill for any software developer, and when it comes to debugging C and C++ programs, GDB (GNU Debugger) is one of the most powerful tools available. GDB allows you to inspect and control program execution, analyze crashes, ...
๐ŸŒ
Northern Illinois University
faculty.cs.niu.edu โ€บ ~hutchins โ€บ csci241 โ€บ gdebug.htm
GDB -- The GNU Debugger
The GNU debugger (GDB) allows a programmer to examine the internal operation of a running program. Variables and expressions can be printed and values changed. The program can be executed a line at a time or be forced to pause at specific locations. For programs that step outside the bounds ...
Top answer
1 of 5
12

As I remember it I had some trouble with the straight load command too, so I switched to "flash write_image erase my_project.hex 0 ihex" .. obviously I was using hex files but it looks like elf files should work to, see http://openocd.org/doc/html/Flash-Commands.html ... the good thing about this command is it also erases only the flash sections that are being written to which is really handy and you don't need an erase

Before you run the above command you will need to run "stm32f1x unlock 0" to ensure the chip is unlocked and your allowed to wire to the flash ... See The datasheet about this

Also for getting started the command "stm32f1x mass_erase 0" will erase the chip fully and quickly so it's good to ensure you start in a known state

I know some of these commands say they are for the f1's but trust me they work for the f4 series to

Btw this file contains most of the command I use to flash my f4 so it might be a good reference https://github.com/othane/mos/blob/master/hal/stm32f373/stm32f373.mk

I Hope that gets you unstuck

2 of 5
3

This is a little brief and not great stackoverflow style but I would point you to my code where I have set this up for my "mos" library for the STM32F4 and STM32F1 (https://github.com/othane/mos) ... This is a big topic to answer so I though an example might be better

In short, my project is a tree of Makefiles, since you have your code compiling the main one of interest for you is found here https://github.com/othane/mos/blob/master/hal/stm32f373/stm32f373.mk ... basically you need openocd and then I have a series of commands to allow erasing the chip, or flashing and debugging the new code etc by simply typing make .erase or make .flash or make .debug

finally if you look in my unit tests (these are basically example programs) you will find the Makefile to build it + a gdbinit file like this one https://github.com/othane/mos/blob/master/utest/gpio/debug_gpio_utest.gdbinit ... then you simply do "make && make .flash && make .debug" in one terminal, and call your cross compilers gdb like this "arm-none-eabi-gdb -x ./debug_gpio_utest.gdbinit" in another ... this will start gdb after flashing the code and you can use the normal break and list commands from gdb etc to interact with the code (note how I defined a reset command in the .gdbinit file, checkout the help for the mon command ... basically it will let you send commands through gdb directly to openocd and is really useful)

Sorry the answer is quite brief and lots of links, but I hope it gets you going.

๐ŸŒ
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.
๐ŸŒ
Arch Linux Forums
bbs.archlinux.org โ€บ viewtopic.php
Gnu debugger tutorials / Programming & Scripting / Arch Linux Forums
March 19, 2008 - Probably the most definitive source of information is Debugging with GDB. It does a pretty good job of showing you how to do things with gdb. Of course you will need to already be familiar with debugging in general: stepping through code, watches, breakpoints, etc.
๐ŸŒ
OnlineGDB
onlinegdb.com
GDB online Debugger | Compiler - Code, Compile, Run, Debug online C, C++
Online GDB is online compiler and debugger for C/C++. You can compile, run and debug code with gdb online. Using gcc/g++ as compiler and gdb as debugger. Currently C and C++ languages are supported.
๐ŸŒ
Kutztown University
kutztown.edu โ€บ Departments-Offices โ€บ A-F โ€บ ComputerScienceInformationTechnology โ€บ Documents โ€บ Student Resources โ€บ gdbDebugWorkshop โ€บ gdbInEmacs_DebugWorkshop.pdf pdf
Gnu Debugger (gdb)
Gnu Debugger (gdb) Debuggers are used to: โ€ข ยท Find semantic errors ยท โ€ข ยท Locate seg faults and bus errors ยท โ€ข ยท NOTE: gdb in Emacs is now invoked using gud-gdb ยท (See Slide 6 โ€“ used to be just gdb) Prepared by Dr. Spiegel ยท Using GDB ยท โ€ข When to use a debugger?