By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,616 Members | 1,184 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,616 IT Pros & Developers. It's quick & easy.

Debugging C extensions on Gentoo

P: n/a
I've spent the last couple of hours trying to figure out how to set
breakpoints in Python C extensions under gdb 6.2 using Gentoo Linux,
and finally figured it out. So for posterity (aka Google), here's the

If GDB is giving you the message "Unable to find dynamic linker
breakpoint function", it's because the ebuild for glibc strips the
dynamic linker which makes it impossible to set breakpoints in shared
libraries. You need to patch the ebuild. Do this:

1. Find the ebuild that emerge is going to use:

$ emerge -p
These are the packages that I would merge, in order:

Calculating dependencies ...done!
[ebuild R ] sys-libs/glibc-
2. Edit the corresponding .ebuild file in /usr/portage/sys-libs/glibc

You need to add one line of code, described by this patch submitted by
Benno Schulenberg (thanks!) on linux.gentoo.user in a thread from
Februrary titled "Mysterious GDB Error" (the line numbers will be
different for your different ebuild version)

--- /usr/portage/sys-libs/glibc/glibc-
2005-02-19 21:48:06.000000000 +0100
+++ /usr/local/portage/sys-libs/glibc/glibc-
2005-02-24 23:54:34.000000000 +0100
@@ -371,8 +371,10 @@

# now, strip everything but the thread libs #46186
mkdir -p ${T}/thread-backup
mv ${D}$(alt_libdir)/lib{pthread,thread_db}*
+ # Also, don't strip the dynamic linker:
+ mv ${D}/$(get_libdir)/ld-* ${T}/thread-backup
if use !nptlonly && want_nptl ; then
mkdir -p ${T}/thread-backup/tls

3. emerge glibc (or "have a beer while you watch compiler messages
scroll by for half an hour")

Jul 19 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.