August 12, 2022

Raspberry Pi Pico - GDB - GDB -tui

This is built into gdb. You get it by invoking gdb with the -tui switch. It is a curses based interface to gdb.

"TUI" stands for "text user interface".

You should compile with the -g switch to get debugging symbols. When I do this, I get this when I start gdb -tui:
Reading symbols from /u1/Projects/rp2040/Archive/blink1/blink.elf...
Dwarf Error: wrong version in compilation unit header (is 5, should be 2, 3, or 4)
 [in module /u1/Projects/rp2040/Archive/blink1/blink.elf]
(no debugging symbols found)...done.
The solution is to use a more recent version of gdb or tell gcc to use some other dwarf version for debug information.
From the gcc man page:
       -gdwarf
       -gdwarf-version
           Produce debugging information in DWARF format (if that is supported).  The value of version may be either 2, 3, 4 or 5; the default version for
           most targets is 5 (with the exception of VxWorks, TPF and Darwin/Mac OS X, which default to version 2, and AIX, which defaults to version 4).

           Note that with DWARF Version 2, some ports require and always use some non-conflicting DWARF 3 extensions in the unwind tables.

           Version 4 may require GDB 7.0 and -fvar-tracking-assignments for maximum benefit. Version 5 requires GDB 8.0 or higher.
I recompile with no -O2 and -gdwarf-4. I not longer get a warning about a Dwarf error, but I still get "No Source Available".

I type "info sources" and get:

Source files for which symbols have been read in:

Source files for which symbols will be read in on demand:
    /u1/Projects/rp2040/Archive/blink1/blink.c,
    /u1/Projects/rp2040/Archive/blink1/start.S
Aha! so it knows about my source file, but has not read symbols from it for some reason. Using --readnow tells it to read symbols at startup, and it does, but still no source shown.


Have any comments? Questions? Drop me a line!

Tom's electronics pages / tom@mmto.org