Debugging C extensions on Gentoo

  • Thread starter Lonnie Princehouse
  • Start date
L

Lonnie Princehouse

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
trick:

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.3.4.20041102-r1
^^^^^^^^^^^^^^^^^^^^^^^
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-2.3.4.20050125-r1.ebuild
2005-02-19 21:48:06.000000000 +0100
+++ /usr/local/portage/sys-libs/glibc/glibc-2.3.4.20050125-r1.ebuild
2005-02-24 23:54:34.000000000 +0100
@@ -371,8 +371,10 @@
fi

# now, strip everything but the thread libs #46186
mkdir -p ${T}/thread-backup
mv ${D}$(alt_libdir)/lib{pthread,thread_db}*
${T}/thread-backup/
+ # 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")
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,069
Latest member
SimplyleanKetoReviews

Latest Threads

Top