From: Simon Marchi <simon.marchi@polymtl.ca>
To: Kip Warner <kip@thevertigo.com>
Cc: gdb@sourceware.org
Subject: Re: Stepping into glibc
Date: Wed, 14 Jan 2015 23:00:00 -0000 [thread overview]
Message-ID: <CAFXXi0=ccaEB517XmJYAqoVoFyWf__JeCPoveeDZ1sTb2SzZmg@mail.gmail.com> (raw)
In-Reply-To: <1421274213.29961.12.camel@thevertigo.com>
On 14 January 2015 at 17:23, Kip Warner <kip@thevertigo.com> wrote:
> Hey list,
>
> I'm trying to debug some code with Nemiver (a Gtk+ frontend for GDB).
> When I try to step into glibc functions, it complains about not being
> able to find its source. e.g.
>
> Cannot find file '/build/buildd/glibc-2.19/posix/getopt1.c'.
>
> I have installed libc6-dbg and glibc-source packages (using Ubuntu
> 14.10).
>
> Is there something I need to add to my ~/.gdbinit, such as a directory
> / set solib-absolute-prefix / set sysroot or what have you?
>
> I could always download the source of my distro's version of glibc into
> the above location, but I'm sure there is a more elegant way of
> handling this.
>
> Respectfully,
>
> --
> Kip Warner -- Senior Software Engineer
> OpenPGP encrypted/signed mail preferred
> http://www.thevertigo.com
You are looking for "set substitute-path" [1].
On Ubuntu/Debian, you can easily download the exact source of a
package you are running (including distribution-specific patches), by
using "apt-get source". In your case, it would be:
$ apt-get source libc6
You would then use set substitute-path to tell gdb to replace the
"/build/buildd" part, which is the path where the source was on
Ubuntu's server when the package was built, with your own path. For
example, assuming that you download package sources in
/home/kip/package-sources:
$ set substitute-path /build/buildd /home/kip/package-sources
I might be forgetting something, but that's the idea.
Also, if it happens that you want to debug a program that does not
have a *-dbg version, you can use the dbgsym which is built
automatically for every Ubuntu package [2].
Simon
[1] https://sourceware.org/gdb/onlinedocs/gdb/Source-Path.html#set%20substitute-path
[2] https://wiki.ubuntu.com/DebuggingProgramCrash#Non-built-in_debug_symbol_packages_.28.2A-dbgsym.29
next prev parent reply other threads:[~2015-01-14 23:00 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-01-14 22:23 Kip Warner
2015-01-14 23:00 ` Simon Marchi [this message]
2015-01-14 23:12 ` Kip Warner
2015-01-15 13:12 ` Jan Kratochvil
2015-01-15 17:53 ` Kip Warner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAFXXi0=ccaEB517XmJYAqoVoFyWf__JeCPoveeDZ1sTb2SzZmg@mail.gmail.com' \
--to=simon.marchi@polymtl.ca \
--cc=gdb@sourceware.org \
--cc=kip@thevertigo.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox