This is the mail archive of the gdb-patches@sourceware.org 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]

[commit 2/2] Remove redundant lp->siginfo [Re: ping: [patch 4/4]#3 Remove redundant lp->siginfo]


On Thu, 19 May 2011 20:51:11 +0200, Pedro Alves wrote:
> Looks good.

Therefore checked in after your fixed/improved former patch 4/5.

No regressions on {x86_64,x86_64-m32,i686}-fedorarawhide-linux-gnu.


Thanks,
Jan


http://sourceware.org/ml/gdb-cvs/2012-07/msg00053.html

--- src/gdb/ChangeLog	2012/07/06 16:49:42	1.14445
+++ src/gdb/ChangeLog	2012/07/06 16:52:19	1.14446
@@ -1,5 +1,16 @@
 2012-07-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
 
+	* linux-nat.c (resume_lwp, linux_nat_resume): Remove LP->SIGINFO
+	clearing.
+	(save_siginfo): Remove.
+	(stop_wait_callback, linux_nat_filter_event): Remove the save_siginfo
+	call.
+	(resume_stopped_resumed_lwps): Remove LP->SIGINFO clearing.
+	(linux_nat_get_siginfo): Use PTRACE_GETSIGINFO.
+	* linux-nat.h (struct lwp_info): Remove field siginfo.
+
+2012-07-06  Jan Kratochvil  <jan.kratochvil@redhat.com>
+
 	Code cleanup for the next patch.
 	* arm-linux-nat.c (arm_linux_stopped_data_address): Change variable
 	siginfo_p to siginfo, update its users incl. the linux_nat_get_siginfo
--- src/gdb/linux-nat.c	2012/07/06 16:49:43	1.252
+++ src/gdb/linux-nat.c	2012/07/06 16:52:20	1.253
@@ -1933,7 +1933,6 @@
 				step, signo);
 	  lp->stopped = 0;
 	  lp->step = step;
-	  memset (&lp->siginfo, 0, sizeof (lp->siginfo));
 	  lp->stopped_by_watchpoint = 0;
 	}
       else
@@ -2092,7 +2091,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)
@@ -2646,22 +2644,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
@@ -2904,9 +2886,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)
@@ -3284,12 +3263,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))
@@ -3942,7 +3916,6 @@
       linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
 			    lp->step, GDB_SIGNAL_0);
       lp->stopped = 0;
-      memset (&lp->siginfo, 0, sizeof (lp->siginfo));
       lp->stopped_by_watchpoint = 0;
     }
 
@@ -5192,12 +5165,19 @@
 int
 linux_nat_get_siginfo (ptid_t ptid, siginfo_t *siginfo)
 {
-  struct lwp_info *lp = find_lwp_pid (ptid);
-
-  gdb_assert (lp != NULL);
+  int pid;
 
-  *siginfo = lp->siginfo;
+  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 0;
+    }
   return 1;
 }
 
--- src/gdb/linux-nat.h	2012/07/06 16:49:43	1.47
+++ src/gdb/linux-nat.h	2012/07/06 16:52:20	1.48
@@ -76,10 +76,6 @@
   /* Non-zero if we were stepping this LWP.  */
   int 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;


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