Thursday, April 24, 2014

Bash Symbols

Debugging an issue where our preloaded vogl shared object is crashing bash. These are the steps I did to get the bash symbols on Linux Mint 16:

echo "deb $(lsb_release -cs) main restricted universe multiverse
deb $(lsb_release -cs)-updates main restricted universe multiverse
deb $(lsb_release -cs)-security main restricted universe multiverse
deb $(lsb_release -cs)-proposed main restricted universe multiverse" | \
sudo tee -a /etc/apt/sources.list.d/ddebs.list

# NOTE: Since I'm on Linux Mint (Petra) I then had to edit ddebs.list and change petra to saucy.

sudo apt-key adv --keyserver --recv-keys 428D7C01

wget -q

sudo apt-key add dbgsym-release-key.asc

sudo apt-get update

apt-cache policy bash

# Returns something like this:

> bash:
>   Installed: 4.2-5ubuntu3
>   Candidate: 4.2-5ubuntu3
> ...

sudo apt-get install bash-dbgsym=4.2-5ubuntu3

# Grab the source:

apt-get source bash

cd bash-4.2

# Untar the source (I use atool, feel free to use tar xf or whatever):

atool -x bash-4.2.tar.xz

# Now in gdb (or your .gdbinit) you can point to the bash source. For me:

directory /home/mikesart/src/bash-4.2/bash-4.2

# Here are a couple of good of good links for all this.


  1. Okay, now. Make pretend you are talking to your grandmother.

    What is this? And why did you do it?

  2. Hi Dietrich.

    It comes down to debugging with significantly more information vs without. Here is a quick example with gdb and bash:

    The red lines are the result of debugging without bash symbols and the green lines with. Notice that you don't get source line information, you don't get local symbols, and when you ask for a backtrace (bt command) you can get a lot more useful and accurate information as well.

    The short of it is symbols can give you a lot of potentially very useful debugging information.

    Hopefully that helps...