]> git.pld-linux.org Git - packages/gdb.git/blob - gdb-bz592031-siginfo-lost-5of5.patch
- updated (performance fixes).
[packages/gdb.git] / gdb-bz592031-siginfo-lost-5of5.patch
1 http://sourceware.org/ml/gdb-patches/2010-09/msg00361.html
2 Subject: [patch 4/4]#3 Remove redundant lp->siginfo
3
4 Hi,
5
6 this is a simplification which should not affect GDB behavior.  As linux-nat
7 now stops on each received signal without any reordering of them then
8 PTRACE_GETSIGINFO is enough to access siginfo, without any need to copy it in
9 advance.
10
11
12 Thanks,
13 Jan
14
15
16 gdb/
17 2010-09-20  Jan Kratochvil  <jan.kratochvil@redhat.com>
18
19         * linux-nat.c (resume_callback) <lp->stopped && lp->status == 0>
20         (linux_nat_resume): Remove LP->SIGINFO clearing.
21         (save_siginfo): Remove.
22         (stop_wait_callback) <WSTOPSIG (status) != SIGSTOP>
23         (linux_nat_filter_event) <linux_nat_status_is_event (status)>: Remove
24         the save_siginfo call.
25         (resume_stopped_resumed_lwps): Remove LP->SIGINFO clearing.
26         (linux_nat_set_siginfo_fixup): Use PTRACE_GETSIGINFO.
27         * linux-nat.h (struct lwp_info) <siginfo>: Remove.
28
29 Index: gdb-7.4.50.20111218/gdb/linux-nat.c
30 ===================================================================
31 --- gdb-7.4.50.20111218.orig/gdb/linux-nat.c    2011-12-19 02:17:05.000000000 +0100
32 +++ gdb-7.4.50.20111218/gdb/linux-nat.c 2011-12-19 02:17:43.188466854 +0100
33 @@ -1883,7 +1883,6 @@ resume_lwp (struct lwp_info *lp, int ste
34                                 step, TARGET_SIGNAL_0);
35           lp->stopped = 0;
36           lp->step = step;
37 -         memset (&lp->siginfo, 0, sizeof (lp->siginfo));
38           lp->stopped_by_watchpoint = 0;
39         }
40        else
41 @@ -2027,7 +2026,6 @@ linux_nat_resume (struct target_ops *ops
42    if (linux_nat_prepare_to_resume != NULL)
43      linux_nat_prepare_to_resume (lp);
44    linux_ops->to_resume (linux_ops, ptid, step, signo);
45 -  memset (&lp->siginfo, 0, sizeof (lp->siginfo));
46    lp->stopped_by_watchpoint = 0;
47  
48    if (debug_linux_nat)
49 @@ -2612,22 +2610,6 @@ wait_lwp (struct lwp_info *lp)
50    return status;
51  }
52  
53 -/* Save the most recent siginfo for LP.  This is currently only called
54 -   for SIGTRAP; some ports use the si_addr field for
55 -   target_stopped_data_address.  In the future, it may also be used to
56 -   restore the siginfo of requeued signals.  */
57 -
58 -static void
59 -save_siginfo (struct lwp_info *lp)
60 -{
61 -  errno = 0;
62 -  ptrace (PTRACE_GETSIGINFO, GET_LWP (lp->ptid),
63 -         (PTRACE_TYPE_ARG3) 0, &lp->siginfo);
64 -
65 -  if (errno != 0)
66 -    memset (&lp->siginfo, 0, sizeof (lp->siginfo));
67 -}
68 -
69  /* Send a SIGSTOP to LP.  */
70  
71  static int
72 @@ -2872,9 +2854,6 @@ stop_wait_callback (struct lwp_info *lp,
73         {
74           /* The thread was stopped with a signal other than SIGSTOP.  */
75  
76 -         /* Save the trap's siginfo in case we need it later.  */
77 -         save_siginfo (lp);
78 -
79           save_sigtrap (lp);
80  
81           if (debug_linux_nat)
82 @@ -3278,12 +3257,7 @@ linux_nat_filter_event (int lwpid, int s
83      }
84  
85    if (linux_nat_status_is_event (status))
86 -    {
87 -      /* Save the trap's siginfo in case we need it later.  */
88 -      save_siginfo (lp);
89 -
90 -      save_sigtrap (lp);
91 -    }
92 +    save_sigtrap (lp);
93  
94    /* Check if the thread has exited.  */
95    if ((WIFEXITED (status) || WIFSIGNALED (status))
96 @@ -3961,7 +3935,6 @@ resume_stopped_resumed_lwps (struct lwp_
97        linux_ops->to_resume (linux_ops, pid_to_ptid (GET_LWP (lp->ptid)),
98                             lp->step, TARGET_SIGNAL_0);
99        lp->stopped = 0;
100 -      memset (&lp->siginfo, 0, sizeof (lp->siginfo));
101        lp->stopped_by_watchpoint = 0;
102      }
103  
104 @@ -6029,11 +6002,19 @@ linux_nat_set_prepare_to_resume (struct
105  struct siginfo *
106  linux_nat_get_siginfo (ptid_t ptid)
107  {
108 -  struct lwp_info *lp = find_lwp_pid (ptid);
109 +  static struct siginfo siginfo;
110 +  int pid;
111  
112 -  gdb_assert (lp != NULL);
113 +  pid = GET_LWP (ptid);
114 +  if (pid == 0)
115 +    pid = GET_PID (ptid);
116 +
117 +  errno = 0;
118 +  ptrace (PTRACE_GETSIGINFO, pid, (PTRACE_TYPE_ARG3) 0, &siginfo);
119 +  if (errno != 0)
120 +    memset (&siginfo, 0, sizeof (siginfo));
121  
122 -  return &lp->siginfo;
123 +  return &siginfo;
124  }
125  
126  /* Provide a prototype to silence -Wmissing-prototypes.  */
127 Index: gdb-7.4.50.20111218/gdb/linux-nat.h
128 ===================================================================
129 --- gdb-7.4.50.20111218.orig/gdb/linux-nat.h    2011-12-18 23:40:59.000000000 +0100
130 +++ gdb-7.4.50.20111218/gdb/linux-nat.h 2011-12-19 02:17:21.355548276 +0100
131 @@ -77,10 +77,6 @@ struct lwp_info
132    /* The kind of stepping of this LWP.  */
133    enum resume_step step;
134  
135 -  /* Non-zero si_signo if this LWP stopped with a trap.  si_addr may
136 -     be the address of a hardware watchpoint.  */
137 -  struct siginfo siginfo;
138 -
139    /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
140       watchpoint trap.  */
141    int stopped_by_watchpoint;
This page took 0.048987 seconds and 3 git commands to generate.