public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 2/2] gdb: Add missing #ifdef USE_THREAD_DB to gdbserver
  2017-12-15  0:04 [PATCH 1/2] gdb: Fix ia64 defining TRAP_HWBKPT before including gdb_wait.h James Clarke
@ 2017-12-15  0:04 ` James Clarke
  2018-01-19 16:48   ` Pedro Alves
  2018-01-19 16:34 ` [PATCH 1/2] gdb: Fix ia64 defining TRAP_HWBKPT before including gdb_wait.h James Clarke
  2018-01-19 16:43 ` Pedro Alves
  2 siblings, 1 reply; 8+ messages in thread
From: James Clarke @ 2017-12-15  0:04 UTC (permalink / raw)
  To: gdb-patches; +Cc: James Clarke

gdb/ChangeLog:
	* gdbserver/linux-low.c (handle_extended_wait): Surround call to
	thread_db_notice_clone with #ifdef USE_THREAD_DB.
---
[Originally erroneously sent to the binutils mailing list]

 gdb/gdbserver/linux-low.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index f6a52d5..398cd70 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -661,7 +661,9 @@ handle_extended_wait (struct lwp_info **orig_event_lwp, int wstat)
 	  new_lwp->status_pending = status;
 	}

+#ifdef USE_THREAD_DB
       thread_db_notice_clone (event_thr, ptid);
+#endif

       /* Don't report the event.  */
       return 1;
--
1.7.10.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/2] gdb: Fix ia64 defining TRAP_HWBKPT before including gdb_wait.h
@ 2017-12-15  0:04 James Clarke
  2017-12-15  0:04 ` [PATCH 2/2] gdb: Add missing #ifdef USE_THREAD_DB to gdbserver James Clarke
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: James Clarke @ 2017-12-15  0:04 UTC (permalink / raw)
  To: gdb-patches; +Cc: James Clarke

On ia64, gdb_wait.h eventually includes siginfo-consts-arch.h, which
contains an enum with TRAP_HWBKPT, along with a #define. Thus we cannot
define TRAP_HWBKPT to 4 beforehand, and so gdb_wait.h must be included
earlier; include it from linux-ptrace.h so it can never come afterwards.

gdb/ChangeLog:

	* nat/linux-ptrace.c: Remove unnecessary reinclusion of
	gdb_ptrace.h, and move including gdb_wait.h ...
	* nat/linux-ptrace.h: ... to here.
---
[Originally erroneously sent to the binutils mailing list]

 gdb/nat/linux-ptrace.c |    2 --
 gdb/nat/linux-ptrace.h |    1 +
 2 files changed, 1 insertion(+), 2 deletions(-)

diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
index 438177f..1240eea 100644
--- a/gdb/nat/linux-ptrace.c
+++ b/gdb/nat/linux-ptrace.c
@@ -21,8 +21,6 @@
 #include "linux-procfs.h"
 #include "linux-waitpid.h"
 #include "buffer.h"
-#include "gdb_wait.h"
-#include "gdb_ptrace.h"
 #ifdef HAVE_SYS_PROCFS_H
 #include <sys/procfs.h>
 #endif
diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
index 5954945..6faa89b 100644
--- a/gdb/nat/linux-ptrace.h
+++ b/gdb/nat/linux-ptrace.h
@@ -21,6 +21,7 @@
 struct buffer;

 #include "nat/gdb_ptrace.h"
+#include "gdb_wait.h"

 #ifdef __UCLIBC__
 #if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_HAS_MMU__))
--
1.7.10.4

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] gdb: Fix ia64 defining TRAP_HWBKPT before including gdb_wait.h
  2017-12-15  0:04 [PATCH 1/2] gdb: Fix ia64 defining TRAP_HWBKPT before including gdb_wait.h James Clarke
  2017-12-15  0:04 ` [PATCH 2/2] gdb: Add missing #ifdef USE_THREAD_DB to gdbserver James Clarke
@ 2018-01-19 16:34 ` James Clarke
  2018-01-19 16:43 ` Pedro Alves
  2 siblings, 0 replies; 8+ messages in thread
From: James Clarke @ 2018-01-19 16:34 UTC (permalink / raw)
  To: gdb-patches

On 15 Dec 2017, at 00:04, James Clarke <jrtc27@jrtc27.com> wrote:
> 
> On ia64, gdb_wait.h eventually includes siginfo-consts-arch.h, which
> contains an enum with TRAP_HWBKPT, along with a #define. Thus we cannot
> define TRAP_HWBKPT to 4 beforehand, and so gdb_wait.h must be included
> earlier; include it from linux-ptrace.h so it can never come afterwards.
> 
> gdb/ChangeLog:
> 
> 	* nat/linux-ptrace.c: Remove unnecessary reinclusion of
> 	gdb_ptrace.h, and move including gdb_wait.h ...
> 	* nat/linux-ptrace.h: ... to here.

Ping (for the series).

James

> ---
> [Originally erroneously sent to the binutils mailing list]
> 
> gdb/nat/linux-ptrace.c |    2 --
> gdb/nat/linux-ptrace.h |    1 +
> 2 files changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/gdb/nat/linux-ptrace.c b/gdb/nat/linux-ptrace.c
> index 438177f..1240eea 100644
> --- a/gdb/nat/linux-ptrace.c
> +++ b/gdb/nat/linux-ptrace.c
> @@ -21,8 +21,6 @@
> #include "linux-procfs.h"
> #include "linux-waitpid.h"
> #include "buffer.h"
> -#include "gdb_wait.h"
> -#include "gdb_ptrace.h"
> #ifdef HAVE_SYS_PROCFS_H
> #include <sys/procfs.h>
> #endif
> diff --git a/gdb/nat/linux-ptrace.h b/gdb/nat/linux-ptrace.h
> index 5954945..6faa89b 100644
> --- a/gdb/nat/linux-ptrace.h
> +++ b/gdb/nat/linux-ptrace.h
> @@ -21,6 +21,7 @@
> struct buffer;
> 
> #include "nat/gdb_ptrace.h"
> +#include "gdb_wait.h"
> 
> #ifdef __UCLIBC__
> #if !(defined(__UCLIBC_HAS_MMU__) || defined(__ARCH_HAS_MMU__))
> --
> 1.7.10.4
> 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] gdb: Fix ia64 defining TRAP_HWBKPT before including gdb_wait.h
  2017-12-15  0:04 [PATCH 1/2] gdb: Fix ia64 defining TRAP_HWBKPT before including gdb_wait.h James Clarke
  2017-12-15  0:04 ` [PATCH 2/2] gdb: Add missing #ifdef USE_THREAD_DB to gdbserver James Clarke
  2018-01-19 16:34 ` [PATCH 1/2] gdb: Fix ia64 defining TRAP_HWBKPT before including gdb_wait.h James Clarke
@ 2018-01-19 16:43 ` Pedro Alves
  2 siblings, 0 replies; 8+ messages in thread
From: Pedro Alves @ 2018-01-19 16:43 UTC (permalink / raw)
  To: James Clarke, gdb-patches

On 12/15/2017 12:04 AM, James Clarke wrote:
> On ia64, gdb_wait.h eventually includes siginfo-consts-arch.h, which
> contains an enum with TRAP_HWBKPT, along with a #define. Thus we cannot
> define TRAP_HWBKPT to 4 beforehand, and so gdb_wait.h must be included
> earlier; include it from linux-ptrace.h so it can never come afterwards.

OK.

This allows moving the linux-specific __WCLONE from
gdb_wait.h > linux-ptrace.h, to have it live near where its
sibling __WALL is defined, I think.  (not sure we still support
any system where those two are missing, though.  Maybe we could
just zap them too.)

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] gdb: Add missing #ifdef USE_THREAD_DB to gdbserver
  2017-12-15  0:04 ` [PATCH 2/2] gdb: Add missing #ifdef USE_THREAD_DB to gdbserver James Clarke
@ 2018-01-19 16:48   ` Pedro Alves
  2018-01-19 16:55     ` James Clarke
  0 siblings, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2018-01-19 16:48 UTC (permalink / raw)
  To: James Clarke, gdb-patches

On 12/15/2017 12:04 AM, James Clarke wrote:
> gdb/ChangeLog:
> 	* gdbserver/linux-low.c (handle_extended_wait): Surround call to
> 	thread_db_notice_clone with #ifdef USE_THREAD_DB.
> ---
> [Originally erroneously sent to the binutils mailing list]

Looks OK, but could you remind me what goes wrong if we
don't do this?  Does gdbserver fail to link?

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] gdb: Add missing #ifdef USE_THREAD_DB to gdbserver
  2018-01-19 16:48   ` Pedro Alves
@ 2018-01-19 16:55     ` James Clarke
  2018-01-19 16:57       ` Pedro Alves
  0 siblings, 1 reply; 8+ messages in thread
From: James Clarke @ 2018-01-19 16:55 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On 19 Jan 2018, at 16:48, Pedro Alves <palves@redhat.com> wrote:
> On 12/15/2017 12:04 AM, James Clarke wrote:
>> gdb/ChangeLog:
>> 	* gdbserver/linux-low.c (handle_extended_wait): Surround call to
>> 	thread_db_notice_clone with #ifdef USE_THREAD_DB.
>> ---
>> [Originally erroneously sent to the binutils mailing list]
> 
> Looks OK, but could you remind me what goes wrong if we
> don't do this?  Does gdbserver fail to link?

Yes, with the expected:

> [...]/linux-low.c:664: undefined reference to `thread_db_notice_clone(thread_info*, ptid_t)'

Every other use of thread_db_* is guarded by USE_THREAD_DB, so I assume it's
fine to do here too.

Regards,
James

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] gdb: Add missing #ifdef USE_THREAD_DB to gdbserver
  2018-01-19 16:55     ` James Clarke
@ 2018-01-19 16:57       ` Pedro Alves
  2018-01-19 17:01         ` James Clarke
  0 siblings, 1 reply; 8+ messages in thread
From: Pedro Alves @ 2018-01-19 16:57 UTC (permalink / raw)
  To: James Clarke; +Cc: gdb-patches

On 01/19/2018 04:55 PM, James Clarke wrote:
> On 19 Jan 2018, at 16:48, Pedro Alves <palves@redhat.com> wrote:
>> On 12/15/2017 12:04 AM, James Clarke wrote:
>>> gdb/ChangeLog:
>>> 	* gdbserver/linux-low.c (handle_extended_wait): Surround call to
>>> 	thread_db_notice_clone with #ifdef USE_THREAD_DB.
>>> ---
>>> [Originally erroneously sent to the binutils mailing list]
>>
>> Looks OK, but could you remind me what goes wrong if we
>> don't do this?  Does gdbserver fail to link?
> 
> Yes, with the expected:
> 
>> [...]/linux-low.c:664: undefined reference to `thread_db_notice_clone(thread_info*, ptid_t)'
> 
> Every other use of thread_db_* is guarded by USE_THREAD_DB, so I assume it's
> fine to do here too.

Thanks for the clarification.  Please add that to the commit log,
and push it in.

Thanks,
Pedro Alves

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 2/2] gdb: Add missing #ifdef USE_THREAD_DB to gdbserver
  2018-01-19 16:57       ` Pedro Alves
@ 2018-01-19 17:01         ` James Clarke
  0 siblings, 0 replies; 8+ messages in thread
From: James Clarke @ 2018-01-19 17:01 UTC (permalink / raw)
  To: Pedro Alves; +Cc: gdb-patches

On 19 Jan 2018, at 16:57, Pedro Alves <palves@redhat.com> wrote:
> On 01/19/2018 04:55 PM, James Clarke wrote:
>> On 19 Jan 2018, at 16:48, Pedro Alves <palves@redhat.com> wrote:
>>> On 12/15/2017 12:04 AM, James Clarke wrote:
>>>> gdb/ChangeLog:
>>>> 	* gdbserver/linux-low.c (handle_extended_wait): Surround call to
>>>> 	thread_db_notice_clone with #ifdef USE_THREAD_DB.
>>>> ---
>>>> [Originally erroneously sent to the binutils mailing list]
>>> 
>>> Looks OK, but could you remind me what goes wrong if we
>>> don't do this?  Does gdbserver fail to link?
>> 
>> Yes, with the expected:
>> 
>>> [...]/linux-low.c:664: undefined reference to `thread_db_notice_clone(thread_info*, ptid_t)'
>> 
>> Every other use of thread_db_* is guarded by USE_THREAD_DB, so I assume it's
>> fine to do here too.
> 
> Thanks for the clarification.  Please add that to the commit log,
> and push it in.

I don't have push rights, so I'll email a v2 to be committed on my behalf.

Regards,
James

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-01-19 17:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-12-15  0:04 [PATCH 1/2] gdb: Fix ia64 defining TRAP_HWBKPT before including gdb_wait.h James Clarke
2017-12-15  0:04 ` [PATCH 2/2] gdb: Add missing #ifdef USE_THREAD_DB to gdbserver James Clarke
2018-01-19 16:48   ` Pedro Alves
2018-01-19 16:55     ` James Clarke
2018-01-19 16:57       ` Pedro Alves
2018-01-19 17:01         ` James Clarke
2018-01-19 16:34 ` [PATCH 1/2] gdb: Fix ia64 defining TRAP_HWBKPT before including gdb_wait.h James Clarke
2018-01-19 16:43 ` Pedro Alves

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).