Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: gdb-patches@sourceware.org
Subject: [PATCH 5/6] Fix remaining GDBserver issues with !HAVE_THREAD_DB_H.
Date: Wed, 17 Apr 2013 02:54:00 -0000	[thread overview]
Message-ID: <20130416183118.540.36291.stgit@brno.lan> (raw)
In-Reply-To: <20130416183043.540.32214.stgit@brno.lan>

The previous patches are still not sufficient to build gdbserver with
our copy of thread_db.h.

../../../src/gdb/gdbserver/thread-db.c: In function ‘find_one_thread’:
../../../src/gdb/gdbserver/thread-db.c:316:6: error: ‘struct lwp_info’ has no member named ‘th’
../../../src/gdb/gdbserver/thread-db.c: In function ‘attach_thread’:
../../../src/gdb/gdbserver/thread-db.c:341:6: error: ‘struct lwp_info’ has no member named ‘th’
../../../src/gdb/gdbserver/thread-db.c: In function ‘thread_db_get_tls_address’:
../../../src/gdb/gdbserver/thread-db.c:514:47: error: ‘struct lwp_info’ has no member named ‘th’
make: *** [thread-db.o] Error 1

First, linux-low.h is including <thread_db.h> directly instead of our
gdb_thread_db.h, although thread-db.c includes the latter.  Then the
'th' field of struct lwp_info is only defined if HAVE_THREAD_DB_H is
defined, which is not true if we're using our replacement copy of
thread_db.h.  We have a USE_THREAD_DB symbol defined if we're building
thread-db.c that's ideal for this, however, it's currently only
defined when compiling linux-low.c (through a Makefile rule).  The
patch makes it defined when compiling any file.

gdb/gdbserver/
2013-04-16  Pedro Alves  <palves@redhat.com>

	* Makefile.in (INTERNAL_CFLAGS): Add @USE_THREAD_DB@.
	(linux-low.o): Delete rule.
	* linux-low.h: Always include "gdb_thread_db.h" instead of
	conditionally including thread_db.h.
	(struct lwp_info) <th>: Guard with #ifdef USE_THREAD_DB instead of
	HAVE_THREAD_DB_H.
---
 gdb/gdbserver/Makefile.in |    8 ++------
 gdb/gdbserver/linux-low.h |    6 ++----
 2 files changed, 4 insertions(+), 10 deletions(-)

diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 6c3d7bd..a2281cb 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -123,7 +123,8 @@ CFLAGS = @CFLAGS@
 INTERNAL_CFLAGS_BASE =  ${CFLAGS} ${GLOBAL_CFLAGS} \
 	${PROFILE_CFLAGS} ${INCLUDE_CFLAGS}
 INTERNAL_WARN_CFLAGS =  ${INTERNAL_CFLAGS_BASE} $(WARN_CFLAGS)
-INTERNAL_CFLAGS =  ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) -DGDBSERVER
+INTERNAL_CFLAGS =  ${INTERNAL_WARN_CFLAGS} $(WERROR_CFLAGS) \
+	@USE_THREAD_DB@ -DGDBSERVER
 
 # LDFLAGS is specifically reserved for setting from the command line
 # when running make.
@@ -559,11 +560,6 @@ vsnprintf.o: $(srcdir)/../../libiberty/vsnprintf.c
 	$(POSTCOMPILE)
 
 i386_low_h = $(srcdir)/i386-low.h
-
-linux-low.o: linux-low.c
-	$(COMPILE) $< @USE_THREAD_DB@
-	$(POSTCOMPILE)
-
 win32_low_h = $(srcdir)/win32-low.h
 
 aarch64.c : $(srcdir)/../regformats/aarch64.dat $(regdat_sh)
diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
index 27dd3b5..834dd91 100644
--- a/gdb/gdbserver/linux-low.h
+++ b/gdb/gdbserver/linux-low.h
@@ -16,9 +16,7 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#ifdef HAVE_THREAD_DB_H
-#include <thread_db.h>
-#endif
+#include "gdb_thread_db.h"
 #include <signal.h>
 
 #include "gdbthread.h"
@@ -270,7 +268,7 @@ struct lwp_info
   int need_step_over;
 
   int thread_known;
-#ifdef HAVE_THREAD_DB_H
+#ifdef USE_THREAD_DB
   /* The thread handle, used for e.g. TLS access.  Only valid if
      THREAD_KNOWN is set.  */
   td_thrhandle_t th;


  parent reply	other threads:[~2013-04-16 18:31 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-04-17  0:32 [PATCH 0/6] thread_db.h issues Pedro Alves
2013-04-17  0:55 ` [PATCH 1/6] PR build/11881: LIBTHREAD_DB_SO can be undefined Pedro Alves
2013-04-17  1:04 ` [PATCH 2/6] Move glibc's fallback thread_db.h to a separate file Pedro Alves
2013-04-17  1:58 ` [PATCH 3/6] Update glibc_thread_db.h from upstream Pedro Alves
2013-04-17  2:42 ` [PATCH 4/6] copyright.py: Don't update glibc_thread_db.h Pedro Alves
2013-04-17  2:54 ` Pedro Alves [this message]
2013-04-17  4:56   ` [PATCH 5/6] Fix remaining GDBserver issues with !HAVE_THREAD_DB_H Tom Tromey
2013-04-17 15:54     ` Use AC_DEFINE for USE_THREAD_DB (was: Re: [PATCH 5/6] Fix remaining GDBserver issues with !HAVE_THREAD_DB_H.) Pedro Alves
2013-04-17  2:54 ` [PATCH 6/6] Only define 'struct lwp_info'::thread_known if using libthread-db Pedro Alves

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=20130416183118.540.36291.stgit@brno.lan \
    --to=palves@redhat.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