Skip to content

Reporting a crash using gdb

Alexey Yakovenko edited this page Feb 23, 2022 · 1 revision

TL;DR

  1. Make a debug build of deadbeef.
  2. Run deadbeef in GDB: gdb deadbeef.
  3. In GDB command prompt, type r and press Return.
  4. Make deadbeef crash, and go back to GDB command prompt
  5. Type thread apply all backtrace and press Return.
  6. Copy and paste the complete output into your bug report (it may be multiple pages).

Introduction

Backtrace is a chain of function calls in the program at a given moment.

It allows developers to investigate crashes or hangs that they can't reproduce on their computers.

To make a good backtrace, you need a proper build, which contains debug information.

The difference between a "normal" build and a debug build is that the debug build will show the line numbers in every line of the backtrace, while the "normal" build will lack the line numbers, and may also lack all the function and variable names, so the backtrace will only contain memory addresses, which are different for each build, and useless to the developers.

Anyway, even if you're not a programmer - you can make a backtrace, and get the bug fixed. Just follow the instrunctions.

You need to know how to run a terminal application, and how to execute a few commands in it. You should also be familiar with compilation basics. The Main Page in this wiki contains instructions how to compile deadbeef on different operating systems.

1. Making the debug build

At the very least it should be not stripped, which usually means that you need to compile your own build, because most of the pre-built packages are stripped ("strip --strip-unneeded deadbeef" was called by compile script), and the debug information such as line numbers was lost.

Ideally, the build also needs to be compiled with -O0 (disable optimization) and -g (enable debug info) flags, but that usually is not necessary.

Simply doing ./configure && make && sudo make install is sufficient, but if you want to debug beyond simple backtraces, you'll want to export CFLAGS="-O0 -g" before calling configure. that will allow watching variable values, function arguments, etc. otherwise they will be optimized out, and unavailable.

2. Generating the backtrace

  • install GDB, e.g. apt-get install gdb;
  • run gdb deadbeef, and execute r command in the GDB shell (the player should start);
  • reproduce a crash, or press CTRL+c in GDB after the hang occurs;
  • in GDB, execute thread apply all backtrace command
  • copy the output into email/pastebin/textfile, etc, and send to devs

3. After you've got the backtrace

Perhaps you should wait for the developer's response before deleting the build -- maybe he needs additional information that you can acquire from the debug build you have. Having the build would significantly speed up fixing the problem you have.

When the bug is fixed, and you don't need the debug build anymore (of course you'll grab the new one from git, which has the fix!) -- just compile it normally, sudo make install will overwrite the debug build you've had. Or run sudo make uninstall from the source folder, and it should clean up your install folder.

THANKS FOR READING