* [RFA] Check for dladdr in gdbserver
@ 2009-12-21 18:12 Doug Evans
2009-12-21 18:35 ` Joel Brobecker
2009-12-21 20:20 ` Daniel Jacobowitz
0 siblings, 2 replies; 3+ messages in thread
From: Doug Evans @ 2009-12-21 18:12 UTC (permalink / raw)
To: gdb-patches
Hi.
gdbserver uses dladdr which is glibc-specific which android doesn't have.
Ok to check in?
NOTE: There's similar code in gdb/linux-thread-db.c but it isn't
compiled for android (android is a cross target) so I didn't change it.
I can add a similar patch there if required.
2009-12-21 Doug Evans <dje@google.com>
* configure.ac: Check for dladdr.
* config.in: Regenerate.
* configure: Regenerate.
* thread-db.c (dladdr_to_soname): Only define ifdef HAVE_DLADDR.
(try_thread_db_load): Update.
Index: configure.ac
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/configure.ac,v
retrieving revision 1.30
diff -u -p -r1.30 configure.ac
--- configure.ac 17 Nov 2009 17:58:15 -0000 1.30
+++ configure.ac 21 Dec 2009 18:00:44 -0000
@@ -1,5 +1,5 @@
dnl Autoconf configure script for GDB server.
-dnl Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+dnl Copyright (C) 2000, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009
dnl Free Software Foundation, Inc.
dnl
dnl This file is part of GDB.
@@ -45,6 +45,15 @@ AC_CHECK_HEADERS(sgtty.h termio.h termio
AC_CHECK_FUNCS(pread pwrite pread64)
AC_REPLACE_FUNCS(memmem)
+dnl dladdr is glibc-specific. It is used by thread-db.c but only for
+dnl debugging messages. It lives in -ldl which is handled below so we don't
+dnl use AC_CHECK_LIB (or AC_SEARCH_LIBS) here. Instead we just temporarily
+dnl augment LIBS.
+old_LIBS="$LIBS"
+LIBS="$LIBS -ldl"
+AC_CHECK_FUNCS(dladdr)
+LIBS="$old_LIBS"
+
have_errno=no
AC_MSG_CHECKING(for errno)
AC_TRY_LINK([
Index: thread-db.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbserver/thread-db.c,v
retrieving revision 1.30
diff -u -p -r1.30 thread-db.c
--- thread-db.c 19 Dec 2009 00:29:11 -0000 1.30
+++ thread-db.c 21 Dec 2009 18:00:44 -0000
@@ -596,6 +596,8 @@ try_thread_db_load_1 (void *handle)
return 1;
}
+#ifdef HAVE_DLADDR
+
/* Lookup a library in which given symbol resides.
Note: this is looking in the GDBSERVER process, not in the inferior.
Returns library name, or NULL. */
@@ -610,6 +612,8 @@ dladdr_to_soname (const void *addr)
return NULL;
}
+#endif
+
static int
try_thread_db_load (const char *library)
{
@@ -626,6 +630,7 @@ try_thread_db_load (const char *library)
return 0;
}
+#ifdef HAVE_DLADDR
if (debug_threads && strchr (library, '/') == NULL)
{
void *td_init;
@@ -640,6 +645,7 @@ try_thread_db_load (const char *library)
library, libpath);
}
}
+#endif
if (try_thread_db_load_1 (handle))
return 1;
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [RFA] Check for dladdr in gdbserver
2009-12-21 18:12 [RFA] Check for dladdr in gdbserver Doug Evans
@ 2009-12-21 18:35 ` Joel Brobecker
2009-12-21 20:20 ` Daniel Jacobowitz
1 sibling, 0 replies; 3+ messages in thread
From: Joel Brobecker @ 2009-12-21 18:35 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
Not enough experience with the gdbserver code, especially on Linux
targets, so can't really review the patch itself, even if it looks OK
to me. However:
> NOTE: There's similar code in gdb/linux-thread-db.c but it isn't
> compiled for android (android is a cross target) so I didn't change it.
> I can add a similar patch there if required.
IMO: I would leave it be until it because a bona fide issue (when
someone tries to port GDB to a Linux system without a glibc).
--
Joel
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RFA] Check for dladdr in gdbserver
2009-12-21 18:12 [RFA] Check for dladdr in gdbserver Doug Evans
2009-12-21 18:35 ` Joel Brobecker
@ 2009-12-21 20:20 ` Daniel Jacobowitz
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Jacobowitz @ 2009-12-21 20:20 UTC (permalink / raw)
To: Doug Evans; +Cc: gdb-patches
On Mon, Dec 21, 2009 at 10:12:34AM -0800, Doug Evans wrote:
> 2009-12-21 Doug Evans <dje@google.com>
>
> * configure.ac: Check for dladdr.
> * config.in: Regenerate.
> * configure: Regenerate.
> * thread-db.c (dladdr_to_soname): Only define ifdef HAVE_DLADDR.
> (try_thread_db_load): Update.
OK.
--
Daniel Jacobowitz
CodeSourcery
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-12-21 20:20 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-12-21 18:12 [RFA] Check for dladdr in gdbserver Doug Evans
2009-12-21 18:35 ` Joel Brobecker
2009-12-21 20:20 ` Daniel Jacobowitz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox