How to generate a backtrace

Having trouble with the game? Report issues and get help here. Read this first!

Moderators: Forum Moderators, Developers

Forum rules
Before reporting issues in this section, you must read the following topic:

How to generate a backtrace

Postby Development Team » April 29th, 2007, 9:30 pm

If you are running an appropriate operating system or Wesnoth build, then you can provide even more information in your bug report by including a backtrace of the game’s call stack, which can help us pinpoint the cause of the bug faster.

Linux, other Unix variants

  1. (Optional, but highly recommended) Build Wesnoth with the build=debug (SCons) or -DCMAKE_BUILD_TYPE=Debug (CMake) options, to enable inclusion of debug information and disable all optimizations that could change the code structure. If you are running a prebuilt package from a system distribution, you can check instead if they provide a -debug or -dbg version of the package to install the required debug symbols.
  2. Install gdb, the GNU Debugger.
  3. On a terminal emulator, run gdb wesnoth.
  4. Type run and press Enter.
  5. Once Wesnoth crashes, the application will break at the fault point in the debugger. Switch back to your terminal emulator and type bt in the gdb prompt, and press Enter.
  6. If Wesnoth does not crash but hangs up/enters an infinite loop instead, you can press Ctrl+C on the terminal while gdb is running to interrupt Wesnoth and obtain a backtrace. Typing c and pressing Enter will then resume execution. Other useful basic commands include k (kill the process being debugged) and q (quit the debugger).

Once you obtain a backtrace, copy and paste it into your forum post or bug report, or (greatly recommended) attach it as a separate text file.

Note: As an alternative to running wesnoth through gdb, you might use a “core dump” to get the backtrace from gdb, as described on the wiki.


macOS

  1. Run the application “Console” found in /Applications/Utilities.
  2. Click on User Reports in the side bar.
  3. Select the Wesnoth crash report with the correct date and time. It will have a filename such as Wesnoth_2017-05-23-114735_xxxx.crash.


Windows

Unfortunately, the official Wesnoth release builds for Windows do not ship with debug symbols, so backtraces made on that platform tend to be nearly useless.

If you know how to make a custom build of your own, however, you can compile Wesnoth with the -gdb3 or -g3 switches passed to the compiler and linker, and avoid any options that would strip symbols from the executable file. Using the -O0 switch to disable all optimizations is also necessary to tell the compiler to not try inlining functions or changing the code flow in ways that would also make the backtrace useless for us.
Last edited by shadowm on May 28th, 2017, 3:38 am, edited 1 time in total.
User avatar
Development Team
Battle for Wesnoth
 
Location: #wesnoth @ irc.freenode.net

Return to Technical Support

Who is online

Users browsing this forum: No registered users and 4 guests