How to get a backtrace on Unix with the bash or tcsh shell

Skip to end of metadata
Go to start of metadata

Table of Contents

How to get a Unix backtrace for a crashed application in a shell

Step #1 - Set your allowed core dump size to an unlimited value (you can check this  with ulimit -a).

In bash:

ulimit -c unlimited

In tcsh:

limit core unlimited

Step #2 - Turn off the Squish crash handler by setting this environment variable:


Step #3 - In the same shell, start the Squish IDE, and reproduce the crash.

Step #4 - Start gdb with the path and file name of the crashed binary and the path and file name of the core file.

General format to invoke gdb for this:

gdb path_and_file_name_of_crashed_binary path_and_file_name_of_core_file

For example if /home/myuser/myautv1/bin/myautbinary crashed and the core file /home/myuser/myautv1/bin/core got created this should be used:

gdb /home/myuser/myautv1/bin/myautbinary /home/myuser/myautv1/bin/core

(To find out which binary file the core file is from execute "file /home/myuser/myautv1/bin/core"

IMPORTANT: For correct backtraces it is mandatory to use the newly generated core file and the correct file name and path of the binary that crashed.

Step #5 - When you get a prompt, enter:

bt full

(To quit gdb type q then press Enter.)

Send the output of this command to Squish support. (Please do not send the actual core file!)

Locating the generated core file

Unix systems allow for the tuning of the file name pattern and location of core files. As a result the core file mentioned above might be named differently or not be found in the current working directory of an application that has crashed.

The following instructions apply to Linux systems only. Please ask froglogic support for equivalent instructions for other operating systems.

If the following statement returns a non-zero value the file name will be with xyz denoting the pid of the process that crashed.

cat /proc/sys/kernel/core_uses_pid

The setting revealed by this statement denotes the directory and file name pattern. By default it is just core.

cat /proc/sys/kernel/core_pattern
diagnostic diagnostic Delete
crash crash Delete
unix unix Delete
backtrace backtrace Delete
bash bash Delete
gdb gdb Delete
core core Delete
tcsh tcsh Delete
Enter labels to add to this page:
Please wait 
Looking for a label? Just start typing.