How to debug a TUI application

As I always forget how to get a backtrace of profanity (or any other TUI application) I write down an example.


The following requirements must be installed:

  • gdb
  • gdbserver
  • debug symbols (depending on your distribution they might already be included)
    • e.g. profanity-dbgsym (for profanity when using debian)
    • e.g. libstrophe0-dbgsym (for profanity when using debian)
    • e.g. libexpat1-dbgsym (for profanity when using debian)

Run the application

  • Open terminal #1
    • Run gdbserver localhost:1234 /usr/bin/profanity
  • Open terminal #2
    • Run gdb /usr/bin/profanity
    • Enter target remote localhost:1234
    • Enter c
  • The application (profanity in this example) opens in terminal #1
    • Reproduce crash
  • A gdb command line opens in terminal #2
    • Enter bt or bt full 1
  • Copy the output and go molesting the developers. 😁

  1. bt full gives a much more detailled output but in most cases bt is enough for the dev to know what’s going on. ↩︎


Teilen: E-Mail

Hinterlasse einen Kommentar oder diskutiere im OSBN-Chat.

In den Kommentaren können folgende Formatierungen genutzt werden.