[Ubuntu Wiki] Update of "Debug Symbol Packages" by staticd-growthecommons
Ubuntu Wiki
noreply at ubuntu.com
Mon Mar 10 14:47:17 UTC 2014
Dear Wiki user,
You have subscribed to a wiki page or wiki category on "Ubuntu Wiki" for change notification.
The "Debug Symbol Packages" page has been changed by staticd-growthecommons:
http://wiki.ubuntu.com/Debug%20Symbol%20Packages?action=diff&rev1=1&rev2=2
Comment:
rewrite for ease of use. write intro.
Debugging a program or analyzing stack traces can be very hard because most of the information that can be extracted from them will be in the form of offsets into the binary machine code of the executable. The extra information that allows mapping a machine instruction in a complex module to a function and line number in a corresponding C file is stored in the debug symbol packages.
- The maintainers of a project usually place the {{{*-dbg.deb}}} packages alongside their binary package in the same repository. Installing them will just involve finding the appropriate package name based on the version of that is installed. However, not all maintainers do this and they may not be up to date. During compilation on the ubuntu servers debug packages are also [[https://launchpad.net/ubuntu/+source/pkg-create-dbgsym|created automatically]] for each binary package. These are named {{{*-dbgsym.ddeb}}} and are stored in a separate archive. This is because these packages are used relatively rarely compared to the main repositories and need not be mirrored as much. ([[AptElfDebugSymbols|the spec for this]]) Either one of these can be used.
+ The maintainers of a project usually place the {{{*-dbg.deb}}} packages alongside their binary package in the same repository. Installing them will just involve finding the appropriate package name based on the version of that is installed. However, not all maintainers do this and they may not be up to date. During compilation on the ubuntu servers debug packages are also [[https://launchpad.net/ubuntu/+source/pkg-create-dbgsym|created automatically]] for each binary package. These are named {{{*-dbgsym.ddeb}}} and are stored in a separate archive. This is because these packages are used relatively rarely compared to the main repositories and need not be mirrored as much. ([[AptElfDebugSymbols|the spec for this]]) Either one of these can be used, but for a given package only one can be used at a time.
+ === Getting -dbgsym.ddeb packages ===
+ In case the {{{-dbg}}} package is not available for the version of the package you are using, you might have to use the {{{-dbgsym}}} packages. When a large number of dependancies need to have their symbols retrieved it might become necessary to enable the {{{-dbgsym}}} repositories anyway.
-
- First, check if there is a package with a -dbg suffix in the main Ubuntu repositories. These are the debug symbol packages, and are equivalent to '-dbgsym' described below. You can safely use either one, but not both at once. Try installing the package, adding -dbg to its name, for example:
- {{{
- sudo apt-get install xserver-xorg-core-dbg
- }}}
- if the package in question is the ''xserver-xorg-core'' package.
-
- If there is no -dbg package:
1. Create an `/etc/apt/sources.list.d/ddebs.list` by running the following line at a terminal:
- {{{
+ {{{#!highlight bash
- echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse" | \
+ echo "deb http://ddebs.ubuntu.com $(lsb_release -cs) main restricted universe multiverse
- sudo tee -a /etc/apt/sources.list.d/ddebs.list
- }}}
- 1. Stable releases (not alphas and betas) require three more lines adding to the same file, which is done by the following terminal command:
- {{{
- echo "deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse
+ deb http://ddebs.ubuntu.com $(lsb_release -cs)-updates main restricted universe multiverse
deb http://ddebs.ubuntu.com $(lsb_release -cs)-security main restricted universe multiverse
deb http://ddebs.ubuntu.com $(lsb_release -cs)-proposed main restricted universe multiverse" | \
sudo tee -a /etc/apt/sources.list.d/ddebs.list
}}}
+ The last three repositories may not be needed on a testing (alpha, beta daily build etc) releases.
- You may also add these lines using the Synaptic Package Manager:
- * Choose ''Synaptic'' via the ''System > Administration'' menu.
- * Choose ''Software Sources'' or ''Repositories'' via the ''Settings'' menu, and click on the ''Third-Party Software'' tab.
- * Click the ''Add'' button and enter each ''deb ...'' line as above one by one and click the ''Add Source'' button (you will have to add these lines one at a time).
- 1. Import the debug symbol archive signing key:
+ You can also add these repositories in your software sources from the Ubuntu software center or from synaptic. (see [[https://help.ubuntu.com/community/Repositories/Ubuntu|this article]] especially the section on [[https://help.ubuntu.com/community/Repositories/Ubuntu#Adding_Other_Repositories |adding other repositories]])
+ You will need to add lines like
{{{
+ deb http://ddebs.ubuntu.com trusty main restricted universe multiverse}}}
+
+ 1. Import the debug symbol archive [[https://help.ubuntu.com/community/Repositories/Ubuntu#Authentication_Tab|signing key]] from the ubuntu server:
+ {{{#!highlight bash
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 428D7C01
}}}
- 1. Then run
- {{{
+ 1. Then run the following to update your package list or click the ''Reload'' button if you used the Synaptic Package Manager.
+ {{{#!highlight bash
sudo apt-get update
}}}
- to update your package list or click the ''Reload'' button if you used the Synaptic Package Manager.
+
+ === Manual install of debug packages ===
+ If the package in question is the ''xserver-xorg-core'' package you can try
+ {{{
+ sudo apt-get install xserver-xorg-core-dbg
+ }}}
- 1. The debug symbol packages have the '-dbgsym' suffix attached, so to install the debug symbols for the package 'yelp', you first run:
+ or
{{{
- apt-cache policy yelp
+ sudo apt-get install xserver-xorg-core-dbgsym
}}}
- This will show you the version number currently installed (we'll use 2.22.1-0ubuntu2.8.04.1 in this example).
- '''NOTE:''' 'yelp' [which is the package name of "Help and Support" located under the 'System' menu] is ''just an example'' and '''not''' a part of the command: 'yelp' is only used to demonstrate the procedure. You must replace 'yelp' with the name of the package you want to debug.
+ === Automatic Resolution / Installation of necessary packages ===
+ The above procedure will install the debug symbol package for a single package only. Chances are that the binary uses shared libraries in other packages and debug symbols for them might be required in order to obtain a readable stack trace or perform other debugging tasks.
- 1. Install the debug symbols:
- {{{
- sudo apt-get install yelp-dbgsym=2.22.1-0ubuntu2.8.04.1
- }}}
- You can also use the Synaptic Package Manager to search for 'yelp-dbgsym' and install it from there.
- The above procedure will install the debug symbol package for yelp only. Chances are that yelp uses shared libraries in other packages and debug symbols for them might be required in order to obtain a readable stack trace or perform other debugging tasks.
-
- You can download the following [[attachment:list-symbols-packages-v2.1.sh |shell script (list-symbols-packages-v2.1.sh)]] to resolve all the dependencies. Attaching a debugger to an already running process may require elevated privileges even if you own the process. The following invocation will print out the list of files to install.
+ You can download the following [[attachment:list-symbols-packages-v2.1.sh |shell script (list-symbols-packages-v2.1.sh)]] to resolve all the dependencies. Attaching a debugger to an already running process may require elevated privileges even if you own the process. The following invocation will print out the list of files to install. If you want to debug an instance of evince use:
{{{#!highlight bash
sudo bash ./list-symbols-packages-v2.sh -p $(pidof yelp)}}}
- To automatically install them apt can be called with the input from the script. The script is invoked with {{{-t}}} for a terse output without the descriptions of the packages and error messages are suppressed.
+ To automatically install them apt can be called with the input from the script. The script is invoked with {{{-t}}} for a terse output without the descriptions of the packages and error messages are suppressed.
{{{#!highlight bash
sudo bash ./list-symbols-packages-v2.sh -t -p $(pidof yelp) 2>/dev/null|\
xargs -d $'\n' sudo apt-get install }}}
- /!\ Version 2 of this script makes it compatible with the newer GDB (which no longer loads all libraries at startup by default). -v2 currently only works if you run it against a currently-executing binary (i.e., with '-p $(pidof <whatever>'). The [[attachment:list-symbols-packages.sh|older version]] of the script is also available.
+ /!\ Version 2 of this script makes it compatible with the newer GDB (which no longer loads all libraries at startup by default). -v2 currently only works if you run it against a currently-executing binary (i.e., with '-p $(pidof <whatever>'). The [[attachment:list-symbols-packages.sh|older version]] of the script is also available.
----
CategoryBugSquad CategoryDebugging
More information about the Ubuntu-bugsquad
mailing list