Blob Blame History Raw
diff -Naur insight-7.4.50.orig/gdb/linux-nat.c insight-7.4.50.new/gdb/linux-nat.c
--- insight-7.4.50.orig/gdb/linux-nat.c	2012-04-04 17:15:50.598799525 +0200
+++ insight-7.4.50.new/gdb/linux-nat.c	2012-04-04 17:16:29.086109710 +0200
@@ -1928,7 +1928,6 @@
 				step, TARGET_SIGNAL_0);
 	  lp->stopped = 0;
 	  lp->step = step;
-	  memset (&lp->siginfo, 0, sizeof (lp->siginfo));
 	  lp->stopped_by_watchpoint = 0;
 	}
       else
@@ -2070,7 +2069,6 @@
   if (linux_nat_prepare_to_resume != NULL)
     linux_nat_prepare_to_resume (lp);
   linux_ops->to_resume (linux_ops, ptid, step, signo);
-  memset (&lp->siginfo, 0, sizeof (lp->siginfo));
   lp->stopped_by_watchpoint = 0;
 
   if (debug_linux_nat)
@@ -2624,22 +2622,6 @@
   return status;
 }
 
-/* Save the most recent siginfo for LP.  This is currently only called
-   for SIGTRAP; some ports use the si_addr field for
-   target_stopped_data_address.  In the future, it may also be used to
-   restore the siginfo of requeued signals.  */
-
-static void
-save_siginfo (struct lwp_info *lp)
-{
-  errno = 0;
-  ptrace (PTRACE_GETSIGINFO, GET_LWP (lp->ptid),
-	  (PTRACE_TYPE_ARG3) 0, &lp->siginfo);
-
-  if (errno != 0)
-    memset (&lp->siginfo, 0, sizeof (lp->siginfo));
-}
-
 /* Send a SIGSTOP to LP.  */
 
 static int
@@ -2884,9 +2866,6 @@
 	{
 	  /* The thread was stopped with a signal other than SIGSTOP.  */
 
-	  /* Save the trap's siginfo in case we need it later.  */
-	  save_siginfo (lp);
-
 	  save_sigtrap (lp);
 
 	  if (debug_linux_nat)
@@ -3290,12 +3269,7 @@
     }
 
   if (linux_nat_status_is_event (status))
-    {
-      /* Save the trap's siginfo in case we need it later.  */
-      save_siginfo (lp);
-
-      save_sigtrap (lp);
-    }
+    save_sigtrap (lp);
 
   /* Check if the thread has exited.  */
   if ((WIFEXITED (status) || WIFSIGNALED (status))
@@ -3949,7 +3923,6 @@
       linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
 			    lp->step, TARGET_SIGNAL_0);
       lp->stopped = 0;
-      memset (&lp->siginfo, 0, sizeof (lp->siginfo));
       lp->stopped_by_watchpoint = 0;
     }
 
@@ -5226,11 +5199,19 @@
 siginfo_t *
 linux_nat_get_siginfo (ptid_t ptid)
 {
-  struct lwp_info *lp = find_lwp_pid (ptid);
+  static struct siginfo siginfo;
+  int pid;
 
-  gdb_assert (lp != NULL);
+  pid = GET_LWP (ptid);
+  if (pid == 0)
+    pid = GET_PID (ptid);
+
+  errno = 0;
+  ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
+  if (errno != 0)
+    memset (&siginfo, 0, sizeof (siginfo));
 
-  return &lp->siginfo;
+  return &siginfo;
 }
 
 /* Provide a prototype to silence -Wmissing-prototypes.  */
diff -Naur insight-7.4.50.orig/gdb/linux-nat.h insight-7.4.50.new/gdb/linux-nat.h
--- insight-7.4.50.orig/gdb/linux-nat.h	2012-04-04 17:15:50.442806374 +0200
+++ insight-7.4.50.new/gdb/linux-nat.h	2012-04-04 17:18:17.892332585 +0200
@@ -76,10 +76,6 @@
   /* The kind of stepping of this LWP.  */
   enum resume_step step;
 
-  /* Non-zero si_signo if this LWP stopped with a trap.  si_addr may
-     be the address of a hardware watchpoint.  */
-  siginfo_t siginfo;
-
   /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
      watchpoint trap.  */
   int stopped_by_watchpoint;