This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] SYS_gettid

This patch does two things
  1) include <sys/syscall.h> in which SYS_gettid is defined, otherwise
helper_thread_id has no change to set, and in-proc-agent will go to
endless loop (in tracepoint.c:gdb_ust_init).
  2) remove preprocessor conditional.  If SYS_gettid is not defined,
compiler can emit an error, which is better than leaving
helper_thread_id unset and get an error at runtime.

With this patch, program doesn't hang there at start up.  OK for mainline?

Yao (éå)

2011-12-12  Yao Qi  <>

	* tracepoint.c: Include sys/syscall.h.
	(gdb_ust_thread): Remove preprocessor conditional.
 gdb/gdbserver/tracepoint.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c
index 585f18d..c595cb5 100644
--- a/gdb/gdbserver/tracepoint.c
+++ b/gdb/gdbserver/tracepoint.c
@@ -8028,6 +8028,8 @@ cmd_qtstmat (char *packet)
   return -1;
+#include <sys/syscall.h>
 static void *
 gdb_ust_thread (void *arg)
@@ -8037,10 +8039,8 @@ gdb_ust_thread (void *arg)
       listen_fd = gdb_ust_socket_init ();
-#ifdef SYS_gettid
       if (helper_thread_id == 0)
 	helper_thread_id = syscall (SYS_gettid);
       if (listen_fd == -1)

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]