How to create useful backtrace on Linux

Symptoms

When working on Linux, it can sometimes happen that BricsCAD suddenly crashes and disappears.

When running BricsCAD from Terminal, a short error message is printed (often it will be "Segmentation fault"), but this does not provide helpful information about why the crash happens.

In this case, a backtrace (stack trace) becomes very useful for the technical support team to identify the cause of the crash. It shows the current stack of nested function calls at the moment of the crash.

Cause

BricsCAD crashes without useful information about the crash.

Solution

To obtain the backtrace, follow these steps:
  1. In a Terminal instance, run BricsCAD inside gdb with the following command:
    LD_LIBRARY_PATH=/opt/bricsys/bricscad/vXX GDK_BACKEND=x11 QT_QPA_PLATFORM=xcb gdb 
    /opt/bricsys/bricscad/vXX/bricscad
    Note: vXX will be replaced with the major BricsCAD version number, for example V24.
  2. In the window, type run and press Enter to start the program.
  3. Reproduce the crash. After crashing, the BricsCAD window simply freezes, but it does not disappear.
  4. Switch back to the Terminal, type bt and press Enter to get a backtrace.

    If bt does not work, it means BricsCAD might be hanging rather than crashing. In that case, press CTRL+C to pause BricsCAD, then bt should work.

    The complete backtrace might not fit the screen. In that case, the last line reads like this:
    ---Type  < return >  to continue, or q < return > to quit---
  5. Copy the relevant part of the backtrace into a text editor and attach it to a support request, or post it directly into the support request.
  6. Type q and press Enter into the Terminal window.
  7. Type y and press Enter to confirm.