Skip to content
Ken Bannister edited this page Sep 3, 2020 · 15 revisions

Setup

Set /proc/sys/kernel/yama/ptrace_scope to 0 to allow debug as unprivileged user.

$ sudo sysctl -w kernel/yama/ptrace_scope=0

Compile the program with debug symbols:

$ make all-debug

As of 2020-08 I usually install gdbgui in a pip3 virtual environment, in ~/dev/pip3venv/gdbgui-venv. So, activate that environment first, with:

$ . ~/dev/pip3venv/gdbgui-venv/bin/activate

Then start gdbgui as described in its documentation. For example, to have gdbgui load the executable and break at the first line in main using network interface tap0:

$ gdbgui "bin/native/gcoap_example.elf tap0"

Running

  • For a CLI-based app, delete the initial breakpoint in main().
  • Set breakpoint using gdb CLI, for example "break _icmpv6_ping".
  • Run the program using gdb CLI, "run".
  • For a CLI-based app, you can enter a command at the CLI command line.
  • Click Pause button to enter a gdb command.