Module Name:    src
Committed By:   christos
Date:           Wed Apr 11 21:41:59 UTC 2012

Modified Files:
        src/external/gpl3/gdb/dist/gdb: nbsd-thread.c

Log Message:
- In the thread activation code, mutate the main thread (lid=0) to lid=1 like
  the kernel does.
- Remove - 1 hack
- Remove more ifdef notdef code


To generate a diff of this commit:
cvs rdiff -u -r1.14 -r1.15 src/external/gpl3/gdb/dist/gdb/nbsd-thread.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/external/gpl3/gdb/dist/gdb/nbsd-thread.c
diff -u src/external/gpl3/gdb/dist/gdb/nbsd-thread.c:1.14 src/external/gpl3/gdb/dist/gdb/nbsd-thread.c:1.15
--- src/external/gpl3/gdb/dist/gdb/nbsd-thread.c:1.14	Wed Apr 11 16:21:35 2012
+++ src/external/gpl3/gdb/dist/gdb/nbsd-thread.c	Wed Apr 11 17:41:59 2012
@@ -88,7 +88,7 @@ static void nbsd_find_new_threads (struc
 
 #define IS_LWP(ptid)		(GET_LWP (ptid) != 0)
 
-#define BUILD_LWP(lwp, ptid)	ptid_build (GET_PID(ptid), (lwp) - 1, 0)
+#define BUILD_LWP(lwp, ptid)	ptid_build (GET_PID(ptid), (lwp), 0)
 
 static td_proc_t *main_ta;
 
@@ -143,6 +143,7 @@ nbsd_thread_activate (void)
   nbsd_thread_active = 1;
   main_ptid = inferior_ptid;
   cached_thread = minus_one_ptid;
+  thread_change_ptid(inferior_ptid, BUILD_LWP(1, inferior_ptid));
   nbsd_find_new_threads (NULL);
   inferior_ptid = find_active_thread ();
 }
@@ -279,8 +280,6 @@ find_active_thread (void)
       while ((val != -1) && (pl.pl_lwpid != 0) &&
 	     (pl.pl_event != PL_EVENT_SIGNAL))
 	val = ptrace (PT_LWPINFO, GET_PID(inferior_ptid), (void *)&pl, sizeof(pl));
-      if (pl.pl_lwpid == 0)
-	 pl.pl_lwpid = 1;
     }
   else
     {
@@ -529,9 +528,6 @@ nbsd_find_new_threads (struct target_ops
 {
   int retval;
   ptid_t ptid;
-#ifdef notyet
-  td_thread_t *thread;
-#endif
 
   if (nbsd_thread_active == 0)
 	  return;
@@ -550,9 +546,6 @@ nbsd_find_new_threads (struct target_ops
       while ((retval != -1) && pl.pl_lwpid != 0)
 	{
 	  ptid = BUILD_LWP (pl.pl_lwpid, main_ptid);
-#ifdef notyet
-	  td_map_lwp2thr (main_ta, pl.pl_lwpid, &thread);
-#endif
 	  if (!in_thread_list (ptid))
 	    add_thread (ptid);
 	  retval = ptrace (PT_LWPINFO, GET_PID(inferior_ptid), (void *)&pl, sizeof(pl));

Reply via email to