4

gnome-shell appears to be crashing with unsavoury results and the developers have asked me to provide a backtrace, what exactly is a backtrace and how do I get them what they need? I am running Ubuntu GNOME 16.04 with GNOME 3.20.

2 Answers 2

4

A backtrace shows a list of an applications active functions. As functions are nested within each other when they are called the application must record where it left one function to get into another within it. This is done on the stack, we then dump the stack for the backtrace.


Preparation

  1. In order to prepare your system for doing one, you must first make sure that apport is turned off as it normally replaces gdb. In order to do this simply change the line enabled=1 to enabled=0 in the /etc/default/apport file (after you have done with getting the backtrace manually you should re-enable apport by reversing the changes to the file), then restart your machine.

  2. You now need to make sure that the relevant dubug symbols are installed, in order to do this for most packages just add the -dbg at the end, for instance with gnome-shell just run the following to install them:

    sudo apt-get install gnome-shell-dbg
    

    Go here for information on manually installing debug symbols not available through this manner.

  3. Now you need to make sure that you have gdb installed:

    sudo apt-get install gdb
    

Generation type 1 (application needing to be started)

  1. Start the application under the control of gdb in Terminal (if the application requires to be run as root then use sudo before the gdb command):

    gdb <application> 2>&1 | tee ~/gdb-<application>.txt
    
  2. Then enter the following lines after each one you shall press ENTER (after run you may enter any arguments necessary that you need to run with the application):

    handle SIG33 pass nostop noprint
    set pagination 0
    run
    

Now see Final steps section.


Generation type 2 (application not currently running)

  1. Find the PID of the application:

    pidof <application>
    
  2. Start gdb in Terminal (if the application requires to be run as root then use sudo before the gdb command):

    gdb 2>&1 | tee gdb-<application>.txt
    
  3. Run the following as previously instructed (pressing ENTER after each line):

    handle SIG33 pass nostop noprint
    set pagination 0
    attach <PID>
    continue
    

Now see Final steps section.


Generation type 3 (backtrace from core dump)

  1. Load the core dump into gdb:

    gdb -c <coreDump> 2>&1 | tee gdb-<program>.txt
    

Final steps

If you used generation type 1 or 2, then you may now do whatever you need with the application to reproduce the bug you are reporting. After you have finished, if the program doesn't crash, press CTRL + C, and then run the following lines as with the previous provided (if the program crashes you still need to run the following lines to get the backtrace):

backtrace full
info registers
x/16i $pc
thread apply all backtrace
Quit

You now have your backtrace, attach it to your bug report (the ~/gdb-<application>.txt file).


Source: Ubuntu Wiki: Backtrace

2

I don't use gnome-shell so I'm sorta guessing but the following is true isn csh, bash and bash.

Set the ulimit -c 5000. This will allow a core dump. The number set the maximum size of the dump. You might have to vary the number so that the command will work. If the gnome-shell window closes, the ulimit command MUST be re-entered.

Ubuntu should really turn this feature on for the early LTS distributions and development machines.

Now run gnome-shell and cause the dump. There now should be a core file in the current directory.

Run gdb $(which gnome-shell) core. There should be some kind of stack trace that shows up. Send them stack trace. If gnome-shell was compiled with the debug -g there might be statement numbers and functions calls in the traceback.

You must log in to answer this question.