patches/gdb/7.4.1/00_all_ptrace_setsiginfo.patch
changeset 3059 1e5fe55974bc
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/patches/gdb/7.4.1/00_all_ptrace_setsiginfo.patch	Sun Sep 23 11:53:02 2012 +0900
     1.3 @@ -0,0 +1,314 @@
     1.4 +fix from upstream for building with newer kernel headers
     1.5 +
     1.6 +From a7f9ca9cb797d653dc7919538e1dfa0c26010331 Mon Sep 17 00:00:00 2001
     1.7 +From: tschwinge <tschwinge>
     1.8 +Date: Wed, 21 Mar 2012 13:43:50 +0000
     1.9 +Subject: [PATCH] struct siginfo vs. siginfo_t
    1.10 +
    1.11 +gdb/
    1.12 +	* amd64-linux-nat.c (amd64_linux_siginfo_fixup): Use siginfo_t instead
    1.13 +	of struct siginfo.
    1.14 +	* arm-linux-nat.c (arm_linux_stopped_data_address): Likewise.
    1.15 +	* ia64-linux-nat.c (ia64_linux_stopped_data_address): Likewise.
    1.16 +	* linux-nat.c (linux_nat_siginfo_fixup, siginfo_fixup)
    1.17 +	(linux_xfer_siginfo, linux_nat_set_siginfo_fixup)
    1.18 +	(linux_nat_get_siginfo): Likewise.
    1.19 +	* linux-nat.h (struct lwp_info, linux_nat_set_siginfo_fixup)
    1.20 +	(linux_nat_get_siginfo): Likewise.
    1.21 +	* linux-tdep.c (linux_get_siginfo_type): Likewise.
    1.22 +	* ppc-linux-nat.c (ppc_linux_stopped_data_address): Likewise.
    1.23 +	* procfs.c (gdb_siginfo_t): Likewise.
    1.24 +
    1.25 +gdbserver/
    1.26 +	* linux-arm-low.c (arm_stopped_by_watchpoint): Use siginfo_t instead of
    1.27 +	struct siginfo.
    1.28 +	* linux-low.c (siginfo_fixup, linux_xfer_siginfo): Likewise.
    1.29 +	* linux-x86-low.c (x86_siginfo_fixup): Likewise.
    1.30 +	* linux-low.h: Include <signal.h>.
    1.31 +	(struct siginfo): Remove forward declaration.
    1.32 +	(struct linux_target_ops) <siginfo_fixup>: Use siginfo_t instead of
    1.33 +	struct siginfo.
    1.34 +---
    1.35 + gdb/ChangeLog                 |   15 +++++++++++++++
    1.36 + gdb/amd64-linux-nat.c         |    4 ++--
    1.37 + gdb/arm-linux-nat.c           |    2 +-
    1.38 + gdb/gdbserver/ChangeLog       |   11 +++++++++++
    1.39 + gdb/gdbserver/linux-arm-low.c |    2 +-
    1.40 + gdb/gdbserver/linux-low.c     |   10 +++++-----
    1.41 + gdb/gdbserver/linux-low.h     |    5 ++---
    1.42 + gdb/gdbserver/linux-x86-low.c |    4 ++--
    1.43 + gdb/ia64-linux-nat.c          |    2 +-
    1.44 + gdb/linux-nat.c               |   16 ++++++++--------
    1.45 + gdb/linux-nat.h               |    6 +++---
    1.46 + gdb/ppc-linux-nat.c           |    2 +-
    1.47 + gdb/procfs.c                  |    2 +-
    1.48 + 13 files changed, 53 insertions(+), 28 deletions(-)
    1.49 +
    1.50 +diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
    1.51 +index f954483..5ebba3a 100644
    1.52 +--- a/gdb/amd64-linux-nat.c
    1.53 ++++ b/gdb/amd64-linux-nat.c
    1.54 +@@ -731,13 +731,13 @@ siginfo_from_compat_siginfo (siginfo_t *to, compat_siginfo_t *from)
    1.55 +    INF.  */
    1.56 + 
    1.57 + static int
    1.58 +-amd64_linux_siginfo_fixup (struct siginfo *native, gdb_byte *inf, int direction)
    1.59 ++amd64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
    1.60 + {
    1.61 +   /* Is the inferior 32-bit?  If so, then do fixup the siginfo
    1.62 +      object.  */
    1.63 +   if (gdbarch_addr_bit (get_frame_arch (get_current_frame ())) == 32)
    1.64 +     {
    1.65 +-      gdb_assert (sizeof (struct siginfo) == sizeof (compat_siginfo_t));
    1.66 ++      gdb_assert (sizeof (siginfo_t) == sizeof (compat_siginfo_t));
    1.67 + 
    1.68 +       if (direction == 0)
    1.69 + 	compat_siginfo_from_siginfo ((struct compat_siginfo *) inf, native);
    1.70 +diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
    1.71 +index c5ce21c..f9f6ba5 100644
    1.72 +--- a/gdb/arm-linux-nat.c
    1.73 ++++ b/gdb/arm-linux-nat.c
    1.74 +@@ -1137,7 +1137,7 @@ arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
    1.75 + static int
    1.76 + arm_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
    1.77 + {
    1.78 +-  struct siginfo *siginfo_p = linux_nat_get_siginfo (inferior_ptid);
    1.79 ++  siginfo_t *siginfo_p = linux_nat_get_siginfo (inferior_ptid);
    1.80 +   int slot = siginfo_p->si_errno;
    1.81 + 
    1.82 +   /* This must be a hardware breakpoint.  */
    1.83 +diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
    1.84 +index ff2437d..01208ef 100644
    1.85 +--- a/gdb/gdbserver/linux-arm-low.c
    1.86 ++++ b/gdb/gdbserver/linux-arm-low.c
    1.87 +@@ -631,7 +631,7 @@ static int
    1.88 + arm_stopped_by_watchpoint (void)
    1.89 + {
    1.90 +   struct lwp_info *lwp = get_thread_lwp (current_inferior);
    1.91 +-  struct siginfo siginfo;
    1.92 ++  siginfo_t siginfo;
    1.93 + 
    1.94 +   /* We must be able to set hardware watchpoints.  */
    1.95 +   if (arm_linux_get_hw_watchpoint_count () == 0)
    1.96 +diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
    1.97 +index d2d4c1d..4734f15 100644
    1.98 +--- a/gdb/gdbserver/linux-low.c
    1.99 ++++ b/gdb/gdbserver/linux-low.c
   1.100 +@@ -4779,7 +4779,7 @@ linux_qxfer_osdata (const char *annex,
   1.101 +    layout of the inferiors' architecture.  */
   1.102 + 
   1.103 + static void
   1.104 +-siginfo_fixup (struct siginfo *siginfo, void *inf_siginfo, int direction)
   1.105 ++siginfo_fixup (siginfo_t *siginfo, void *inf_siginfo, int direction)
   1.106 + {
   1.107 +   int done = 0;
   1.108 + 
   1.109 +@@ -4791,9 +4791,9 @@ siginfo_fixup (struct siginfo *siginfo, void *inf_siginfo, int direction)
   1.110 +   if (!done)
   1.111 +     {
   1.112 +       if (direction == 1)
   1.113 +-	memcpy (siginfo, inf_siginfo, sizeof (struct siginfo));
   1.114 ++	memcpy (siginfo, inf_siginfo, sizeof (siginfo_t));
   1.115 +       else
   1.116 +-	memcpy (inf_siginfo, siginfo, sizeof (struct siginfo));
   1.117 ++	memcpy (inf_siginfo, siginfo, sizeof (siginfo_t));
   1.118 +     }
   1.119 + }
   1.120 + 
   1.121 +@@ -4802,8 +4802,8 @@ linux_xfer_siginfo (const char *annex, unsigned char *readbuf,
   1.122 + 		    unsigned const char *writebuf, CORE_ADDR offset, int len)
   1.123 + {
   1.124 +   int pid;
   1.125 +-  struct siginfo siginfo;
   1.126 +-  char inf_siginfo[sizeof (struct siginfo)];
   1.127 ++  siginfo_t siginfo;
   1.128 ++  char inf_siginfo[sizeof (siginfo_t)];
   1.129 + 
   1.130 +   if (current_inferior == NULL)
   1.131 +     return -1;
   1.132 +diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
   1.133 +index 677d261..3aeae70 100644
   1.134 +--- a/gdb/gdbserver/linux-low.h
   1.135 ++++ b/gdb/gdbserver/linux-low.h
   1.136 +@@ -20,6 +20,7 @@
   1.137 + #ifdef HAVE_THREAD_DB_H
   1.138 + #include <thread_db.h>
   1.139 + #endif
   1.140 ++#include <signal.h>
   1.141 + 
   1.142 + #include "gdb_proc_service.h"
   1.143 + 
   1.144 +@@ -46,8 +47,6 @@ struct regset_info
   1.145 + extern struct regset_info target_regsets[];
   1.146 + #endif
   1.147 + 
   1.148 +-struct siginfo;
   1.149 +-
   1.150 + struct process_info_private
   1.151 + {
   1.152 +   /* Arch-specific additions.  */
   1.153 +@@ -109,7 +108,7 @@ struct linux_target_ops
   1.154 +      Returns true if any conversion was done; false otherwise.
   1.155 +      If DIRECTION is 1, then copy from INF to NATIVE.
   1.156 +      If DIRECTION is 0, copy from NATIVE to INF.  */
   1.157 +-  int (*siginfo_fixup) (struct siginfo *native, void *inf, int direction);
   1.158 ++  int (*siginfo_fixup) (siginfo_t *native, void *inf, int direction);
   1.159 + 
   1.160 +   /* Hook to call when a new process is created or attached to.
   1.161 +      If extra per-process architecture-specific data is needed,
   1.162 +diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
   1.163 +index ed1f8a8..b466b5d 100644
   1.164 +--- a/gdb/gdbserver/linux-x86-low.c
   1.165 ++++ b/gdb/gdbserver/linux-x86-low.c
   1.166 +@@ -918,13 +918,13 @@ siginfo_from_compat_siginfo (siginfo_t *to, compat_siginfo_t *from)
   1.167 +    INF.  */
   1.168 + 
   1.169 + static int
   1.170 +-x86_siginfo_fixup (struct siginfo *native, void *inf, int direction)
   1.171 ++x86_siginfo_fixup (siginfo_t *native, void *inf, int direction)
   1.172 + {
   1.173 + #ifdef __x86_64__
   1.174 +   /* Is the inferior 32-bit?  If so, then fixup the siginfo object.  */
   1.175 +   if (register_size (0) == 4)
   1.176 +     {
   1.177 +-      if (sizeof (struct siginfo) != sizeof (compat_siginfo_t))
   1.178 ++      if (sizeof (siginfo_t) != sizeof (compat_siginfo_t))
   1.179 + 	fatal ("unexpected difference in siginfo");
   1.180 + 
   1.181 +       if (direction == 0)
   1.182 +diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
   1.183 +index 8773195..19b827f 100644
   1.184 +--- a/gdb/ia64-linux-nat.c
   1.185 ++++ b/gdb/ia64-linux-nat.c
   1.186 +@@ -637,7 +637,7 @@ static int
   1.187 + ia64_linux_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
   1.188 + {
   1.189 +   CORE_ADDR psr;
   1.190 +-  struct siginfo *siginfo_p;
   1.191 ++  siginfo_t *siginfo_p;
   1.192 +   struct regcache *regcache = get_current_regcache ();
   1.193 + 
   1.194 +   siginfo_p = linux_nat_get_siginfo (inferior_ptid);
   1.195 +diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
   1.196 +index f80c0c1..d81d55e 100644
   1.197 +--- a/gdb/linux-nat.c
   1.198 ++++ b/gdb/linux-nat.c
   1.199 +@@ -188,7 +188,7 @@ static void (*linux_nat_prepare_to_resume) (struct lwp_info *);
   1.200 + /* The method to call, if any, when the siginfo object needs to be
   1.201 +    converted between the layout returned by ptrace, and the layout in
   1.202 +    the architecture of the inferior.  */
   1.203 +-static int (*linux_nat_siginfo_fixup) (struct siginfo *,
   1.204 ++static int (*linux_nat_siginfo_fixup) (siginfo_t *,
   1.205 + 				       gdb_byte *,
   1.206 + 				       int);
   1.207 + 
   1.208 +@@ -4232,7 +4232,7 @@ linux_nat_mourn_inferior (struct target_ops *ops)
   1.209 +    layout of the inferiors' architecture.  */
   1.210 + 
   1.211 + static void
   1.212 +-siginfo_fixup (struct siginfo *siginfo, gdb_byte *inf_siginfo, int direction)
   1.213 ++siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo, int direction)
   1.214 + {
   1.215 +   int done = 0;
   1.216 + 
   1.217 +@@ -4244,9 +4244,9 @@ siginfo_fixup (struct siginfo *siginfo, gdb_byte *inf_siginfo, int direction)
   1.218 +   if (!done)
   1.219 +     {
   1.220 +       if (direction == 1)
   1.221 +-	memcpy (siginfo, inf_siginfo, sizeof (struct siginfo));
   1.222 ++	memcpy (siginfo, inf_siginfo, sizeof (siginfo_t));
   1.223 +       else
   1.224 +-	memcpy (inf_siginfo, siginfo, sizeof (struct siginfo));
   1.225 ++	memcpy (inf_siginfo, siginfo, sizeof (siginfo_t));
   1.226 +     }
   1.227 + }
   1.228 + 
   1.229 +@@ -4256,8 +4256,8 @@ linux_xfer_siginfo (struct target_ops *ops, enum target_object object,
   1.230 + 		    const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
   1.231 + {
   1.232 +   int pid;
   1.233 +-  struct siginfo siginfo;
   1.234 +-  gdb_byte inf_siginfo[sizeof (struct siginfo)];
   1.235 ++  siginfo_t siginfo;
   1.236 ++  gdb_byte inf_siginfo[sizeof (siginfo_t)];
   1.237 + 
   1.238 +   gdb_assert (object == TARGET_OBJECT_SIGNAL_INFO);
   1.239 +   gdb_assert (readbuf || writebuf);
   1.240 +@@ -5266,7 +5266,7 @@ linux_nat_set_new_thread (struct target_ops *t,
   1.241 +    inferior.  */
   1.242 + void
   1.243 + linux_nat_set_siginfo_fixup (struct target_ops *t,
   1.244 +-			     int (*siginfo_fixup) (struct siginfo *,
   1.245 ++			     int (*siginfo_fixup) (siginfo_t *,
   1.246 + 						   gdb_byte *,
   1.247 + 						   int))
   1.248 + {
   1.249 +@@ -5285,7 +5285,7 @@ linux_nat_set_prepare_to_resume (struct target_ops *t,
   1.250 + }
   1.251 + 
   1.252 + /* Return the saved siginfo associated with PTID.  */
   1.253 +-struct siginfo *
   1.254 ++siginfo_t *
   1.255 + linux_nat_get_siginfo (ptid_t ptid)
   1.256 + {
   1.257 +   struct lwp_info *lp = find_lwp_pid (ptid);
   1.258 +diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
   1.259 +index c9878d9..d87f0cf 100644
   1.260 +--- a/gdb/linux-nat.h
   1.261 ++++ b/gdb/linux-nat.h
   1.262 +@@ -78,7 +78,7 @@ struct lwp_info
   1.263 + 
   1.264 +   /* Non-zero si_signo if this LWP stopped with a trap.  si_addr may
   1.265 +      be the address of a hardware watchpoint.  */
   1.266 +-  struct siginfo siginfo;
   1.267 ++  siginfo_t siginfo;
   1.268 + 
   1.269 +   /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
   1.270 +      watchpoint trap.  */
   1.271 +@@ -184,7 +184,7 @@ void linux_nat_set_new_thread (struct target_ops *, void (*) (struct lwp_info *)
   1.272 +    that ptrace returns, and the layout in the architecture of the
   1.273 +    inferior.  */
   1.274 + void linux_nat_set_siginfo_fixup (struct target_ops *,
   1.275 +-				  int (*) (struct siginfo *,
   1.276 ++				  int (*) (siginfo_t *,
   1.277 + 					   gdb_byte *,
   1.278 + 					   int));
   1.279 + 
   1.280 +@@ -198,7 +198,7 @@ void linux_nat_set_prepare_to_resume (struct target_ops *,
   1.281 + void linux_nat_switch_fork (ptid_t new_ptid);
   1.282 + 
   1.283 + /* Return the saved siginfo associated with PTID.  */
   1.284 +-struct siginfo *linux_nat_get_siginfo (ptid_t ptid);
   1.285 ++siginfo_t *linux_nat_get_siginfo (ptid_t ptid);
   1.286 + 
   1.287 + /* Compute and return the processor core of a given thread.  */
   1.288 + int linux_nat_core_of_thread_1 (ptid_t ptid);
   1.289 +diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
   1.290 +index 1bd157b..9bd11fd 100644
   1.291 +--- a/gdb/ppc-linux-nat.c
   1.292 ++++ b/gdb/ppc-linux-nat.c
   1.293 +@@ -2218,7 +2218,7 @@ ppc_linux_thread_exit (struct thread_info *tp, int silent)
   1.294 + static int
   1.295 + ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
   1.296 + {
   1.297 +-  struct siginfo *siginfo_p;
   1.298 ++  siginfo_t *siginfo_p;
   1.299 + 
   1.300 +   siginfo_p = linux_nat_get_siginfo (inferior_ptid);
   1.301 + 
   1.302 +diff --git a/gdb/procfs.c b/gdb/procfs.c
   1.303 +index 903621d..cb4bc7c 100644
   1.304 +--- a/gdb/procfs.c
   1.305 ++++ b/gdb/procfs.c
   1.306 +@@ -266,7 +266,7 @@ typedef struct sigaction gdb_sigaction_t;
   1.307 + #ifdef HAVE_PR_SIGINFO64_T
   1.308 + typedef pr_siginfo64_t gdb_siginfo_t;
   1.309 + #else
   1.310 +-typedef struct siginfo gdb_siginfo_t;
   1.311 ++typedef siginfo_t gdb_siginfo_t;
   1.312 + #endif
   1.313 + 
   1.314 + /* On mips-irix, praddset and prdelset are defined in such a way that
   1.315 +-- 
   1.316 +1.7.9.7
   1.317 +