Using Ubuntu Debug Packages in GDB

I will use openssl library as example. Here’s a simplest source:

Now build and start your GDB, note the ‘-g’ option is necessary:

GDB cannot step into openssl source code, since there’s no debug symbol found. In Ubuntu, we can install it using apt-get. I’m using Hardy(8.04):

Launch our GDB again:

Symbols are found, GDB prompt for missing source files! We can install by typing:

The source files will be downloaded and extracted in openssl-0.9.8g folder. Now we wanna attach the source files when debugging.

Oh! Everything works!

Leave a Reply

Your email address will not be published. Required fields are marked *