Bug 13011 - GDB fails to build against Linux libc's (e.g. musl) without dladdr and libthread_db
Summary: GDB fails to build against Linux libc's (e.g. musl) without dladdr and libthr...
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: build (show other bugs)
Version: 7.2
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-21 16:19 UTC by Josef Mutzenbacher
Modified: 2015-09-26 05:13 UTC (History)
3 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Josef Mutzenbacher 2011-07-21 16:19:04 UTC
it wrongly assumes that any system out there has the same internals as glibc.
if it uses those internals at all, it should at least check if they are available and if not choose an alternate implementation that doesn't rely on those internals (even it if its just a "sorry, this function is not available" implementation).

tested against musl libc 0.7.2

linux-thread-db.Tpo linux-thread-db.c
linux-thread-db.c: In function `dladdr_to_soname':
linux-thread-db.c:618: error: `Dl_info' undeclared (first use in this function)
linux-thread-db.c:618: error: (Each undeclared identifier is reported only once
linux-thread-db.c:618: error: for each function it appears in.)
linux-thread-db.c:618: error: syntax error before "info"
linux-thread-db.c:620: warning: implicit declaration of function `dladdr'
linux-thread-db.c:620: error: `info' undeclared (first use in this function)
linux-thread-db.c: In function `try_thread_db_load_1':
linux-thread-db.c:717: error: `LIBTHREAD_DB_SO' undeclared (first use in this function)
linux-thread-db.c: In function `thread_db_load_search':
linux-thread-db.c:803: error: `LIBTHREAD_DB_SO' undeclared (first use in this function)
linux-thread-db.c: In function `thread_db_load':
linux-thread-db.c:890: error: `LIBTHREAD_DB_SO' undeclared (first use in this function)
linux-thread-db.c: In function `thread_db_pid_to_str':
linux-thread-db.c:1488: warning: long unsigned int format, thread_t arg (arg 4)
linux-thread-db.c: In function `thread_db_find_thread_from_tid':
linux-thread-db.c:1597: warning: comparison between pointer and integer
linux-thread-db.c: In function `_initialize_thread_db':
linux-thread-db.c:1676: error: `LIBTHREAD_DB_SEARCH_PATH' undeclared (first use in this function)
Comment 1 Paul Pluzhnikov 2011-07-31 18:59:53 UTC
This doesn't have anything to do with glibc internals -- dladdr() is a published *external* glibc interface.
Comment 2 Rich Felker 2012-10-21 14:37:00 UTC
It's true that it's a published external interface, but gdb should not use it without testing for its existence. FYI we now provide dladdr in musl, but I have not seen any good documentation on how to provide the thread debugging hooks gdb wants, and it seems highly nontrivial. It would be helpful to have this fixed, and for gdb to provide some minimal level of thread debugging support without including half of the debugger in the program being debugged...
Comment 3 Doug Evans 2015-09-26 05:13:44 UTC
gdb and gdbserver build with musl now.
gdb requires a couple of minor patches, but they're not libthread_db related.

There's still a plethora of other issues of course.