Debug - Getting Traces

From ArchWiki
Revision as of 12:31, 20 May 2007 by Kapy (Talk | contribs) (Page created, general info how to build package with debug trace support)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

This article will try to give you an idea how to create Arch package which provides debug and traces information, when you are requested to provide some debug info while reporting a bug, for example after use of Bug-Buddy.

Discovering name of package(s)

A few facts of debug messages

When looking at debug message, such as (stripped):

Backtrace was generated from '/usr/bin/epiphany'

(no debugging symbols found)
Using host libthread_db library "/lib/".
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread -1241265952 (LWP 12630)]
(no debugging symbols found)
0xb7f25410 in __kernel_vsyscall ()
#0  0xb7f25410 in __kernel_vsyscall ()
#1  0xb741b45b in ?? () from /lib/

you can see ?? at the place where debugging info is missing and the name of library or executable which called the function. Simirarly, when line (no debugging symbols found) appears in message, it means that you have to look for a file whichs name is stated nearly.

Finding package

Use Pacman to retrieve name of package:

# pacman -Qo /lib/
/lib/ is owned by glibc 2.5-8

We have found that package is called glibc in version 2.5-8. By repeating this step we are able to create a list of packages which we have to compile ourselves to get full stack trace.

Obtaining PKGBUILD

In order to build a package from source, PKGBUILD file is required. The location from which you can obtain is in general:

  1. ArchLinux User-community Repository (AUR) or
  2. ABS

Using AUR

Use AUR search page to find package. If it is not present, the package is stored in one of the official repository trees of ArchLinux. In case of its presence click on its name and at the following page download Tarball. Store it in location of your choise. Use tar to extract it and change directory:

$ tar xvzf name_of_tarball.tar.gz
$ cd name_of_tarball

Using ABS

If package is a part of official tree, install ABS and use <copy>abs</copy> command to obtain a copy of directory structure:

# abs

Use find or slocate locate command to find package name:

$ find /var/abs -name "glibc"


$ slocate glibc | grep ^/var/abs

In any case, you'll find that package foo is part of extra and multimedia (for example) copy the foo's PKGBUILD file to /var/abs/local/foo:

 # cp -r /var/abs/extra/multimedia/foo /var/abs/local/foo
 # cd /var/abs/local/foo

Compilation settings

At this stage, you can modify global configuration file of makepkg if you will be using it only for debug purposes. In other case, you should modify package's PKGBUILD file only for each package you would like to rebuild.

Global settings

Modify makepkg's configuration file /etc/makepkg.conf to contain following lines:

CFLAGS="-g -march=i686 -O2 -pipe"
CXXFLAGS="-g -march=i686 -O2 -pipe"


OPTIONS=(!strip !docs libtool emptydirs)

These settings (in bold) will force compilation with debugging information and will disable stripping of executable.

One package settings only

Modify foo's PKGBUILD file to contain following lines:


Into the build() function add following lines at its very beginning:

export CFLAGS="$CFLAGS -g"

Building and installing package

Build package from source using makepkg while in directory with PKGBUILD. This could take some time:

# makepkg

Install built package:

# pacman -U glibc-2.5-8-i686.pkg.tar.gz


Use completed stack trace to inform developers of the bug you have discovered before. This will be highly appreciated by them and you will help to improve your favorite program.