From: dje@google.com (Doug Evans)
To: gdb-patches@sourceware.org
Subject: [RFA] Check for dladdr in gdbserver
Date: Mon, 21 Dec 2009 18:12:00 -0000 [thread overview]
Message-ID: <20091221181234.2CBBD84412@ruffy.mtv.corp.google.com> (raw)
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;
next reply other threads:[~2009-12-21 18:12 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-21 18:12 Doug Evans [this message]
2009-12-21 18:35 ` Joel Brobecker
2009-12-21 20:20 ` Daniel Jacobowitz
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=20091221181234.2CBBD84412@ruffy.mtv.corp.google.com \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
/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