Debugging Embedded Devices with GDB: Lessons Learned

Added:

GDB Setup
GDB Interfaces
GDB Automation
Controlling Execution
Inspect Memory
Remote Debugging
Trace Syscalls
Profiling Tools
Kernel Tracing

GDB Setup

0:00
Playing Section
  • 1

    Covers compiling with GDB debug flags like -g and -ggdb3.

  • 2

    Explains debug formats and benefits of separate symbols.

  • 3

    Discusses the caveats of higher optimization with debug levels.

Proficiency in C or C++ programming, as these are the primary languages used in embedded systems development.
Fundamental understanding of microcontroller architecture, including registers, memory-mapped I/O, and the distinction between Flash and RAM.
Familiarity with the compilation and linking process, specifically how debug symbols (such as the -g flag in GCC) map source code to binary instructions.
Basic command-line interface (CLI) navigation and experience executing terminal commands.
Hardware-level debugging protocols and interfaces, such as JTAG/SWD, and configuring debug servers like OpenOCD or Segger J-Link.
Real-Time Operating System (RTOS) debugging, including task-aware debugging, analyzing race conditions, and identifying thread scheduling issues.
Advanced post-mortem analysis, such as reading and diagnosing system crashes from core dumps and handling micro-controller hardware faults.
Automation of debugging and testing workflows using the GDB Python API to script custom analysis tools and facilitate hardware-in-the-loop (HIL) testing.
18.3K views393likes1:37:24@LinuxfoundationOrgOriginal Release: 2020-09-11

This tutorial covers essential GDB techniques for embedded device debugging, including compiler debug flags (-g, -ggdb3), TUI mode for source/assembly viewing, breakpoint types (software, hardware, conditional, watchpoints), remote debugging with gdbserver, and profiling tools like strace, ltrace, gprof, valgrind, and ftrace for analyzing system calls, library calls, and kernel behavior.