QNX Technical Articles
QNX® Software Development Platform 6.4.1: Debugging Information
Date of this edition: May 13, 2009
Starting with QNX SDP 6.4.1, we're generating binaries with debugging information (-g) and map files. With few exceptions, all binaries are available with debugging information, but this data as well as the .ident information are stripped and stored in a separate binaryName.sym file. These files are linked together, so gdb understands where to find the symbol data.
There's now no need for a separate debug version of all the binaries. There's a separate tar file containing all the .sym files that will untarred alongside each binary. This file is available in the Download area of our website, as well as in the debugging_info directory on the QNX SDP 6.4.1 DVD.
What it means to you:
- The target binaries are now stripped.
- The target binaries don't have any SRCVERSION information in them (i.e. use -s won't work).
- All Neutrino binaries are built with -g (i.e. full debug).
- We now produce linker map files for all Neutrino binaries.
- The full debug symbols for a binary called some_binary (along with the SRCVERSION information) are stored in a file called some_binary-buildid.sym.
- The binary and its associated symbol file are “linked” so gdb knows how to find the symbols.
These *-buildid.sym files are in CPU-specific tar files. The usage of these tar files is straightforward. Suppose you want to debug the ls command for x86. You could just add the entire set of debug files to your target (you need to be root, of course):
- Get the target-x86-debug-date.tgz file.
- cd $QNX_TARGET
- tar -zxf path/target-x86-debug-date.tgz
Then ntox86-gdb $QNX_TARGET/bin/ls would load the debugging symbols from the .sym file automatically. Since this is the full debugging information, you can point gdb at the location of source for ls.
You don't have to extract the entire tar file. In fact all that matters is that the .sym file be in the same directory as the binary. So you could simply copy $QNX_TARGET/x86/bin/ls and the x86/bin/ls-*.sym file (from the debug tar file) to your current directory, and then run gdb there.
In order to get a list of the source files used to build a binary (e.g. to determine the associated licensing), use the .sym file instead of the binary. So continuing with the example above, to get a list of the source files used in building ls, type:
use -s $QNX_TARGET/x86/bin/ls-*.sym