patches/gdb/7.4.1/00_all_ptrace_setsiginfo.patch
author danielrubiob@gmail.com
Tue Feb 11 21:34:48 2014 +0100 (2014-02-11)
changeset 3285 a8cb9039fade
permissions -rw-r--r--
complibs/cloog: bump version

Signed-off-by: Daniel Rubio Bonilla <danielrubiob@gmail.com>
[yann.morin.1998@free.fr: re-order versions]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Cc: Cody P Schafer <dev@codyps.com>
Message-Id: <c2de3964cd6d5e4173cc.1391984023@uemo>
Patchwork-Id: 318637
     1 fix from upstream for building with newer kernel headers
     2 
     3 From a7f9ca9cb797d653dc7919538e1dfa0c26010331 Mon Sep 17 00:00:00 2001
     4 From: tschwinge <tschwinge>
     5 Date: Wed, 21 Mar 2012 13:43:50 +0000
     6 Subject: [PATCH] struct siginfo vs. siginfo_t
     7 
     8 gdb/
     9 	* amd64-linux-nat.c (amd64_linux_siginfo_fixup): Use siginfo_t instead
    10 	of struct siginfo.
    11 	* arm-linux-nat.c (arm_linux_stopped_data_address): Likewise.
    12 	* ia64-linux-nat.c (ia64_linux_stopped_data_address): Likewise.
    13 	* linux-nat.c (linux_nat_siginfo_fixup, siginfo_fixup)
    14 	(linux_xfer_siginfo, linux_nat_set_siginfo_fixup)
    15 	(linux_nat_get_siginfo): Likewise.
    16 	* linux-nat.h (struct lwp_info, linux_nat_set_siginfo_fixup)
    17 	(linux_nat_get_siginfo): Likewise.
    18 	* linux-tdep.c (linux_get_siginfo_type): Likewise.
    19 	* ppc-linux-nat.c (ppc_linux_stopped_data_address): Likewise.
    20 	* procfs.c (gdb_siginfo_t): Likewise.
    21 
    22 gdbserver/
    23 	* linux-arm-low.c (arm_stopped_by_watchpoint): Use siginfo_t instead of
    24 	struct siginfo.
    25 	* linux-low.c (siginfo_fixup, linux_xfer_siginfo): Likewise.
    26 	* linux-x86-low.c (x86_siginfo_fixup): Likewise.
    27 	* linux-low.h: Include <signal.h>.
    28 	(struct siginfo): Remove forward declaration.
    29 	(struct linux_target_ops) <siginfo_fixup>: Use siginfo_t instead of
    30 	struct siginfo.
    31 ---
    32  gdb/ChangeLog                 |   15 +++++++++++++++
    33  gdb/amd64-linux-nat.c         |    4 ++--
    34  gdb/arm-linux-nat.c           |    2 +-
    35  gdb/gdbserver/ChangeLog       |   11 +++++++++++
    36  gdb/gdbserver/linux-arm-low.c |    2 +-
    37  gdb/gdbserver/linux-low.c     |   10 +++++-----
    38  gdb/gdbserver/linux-low.h     |    5 ++---
    39  gdb/gdbserver/linux-x86-low.c |    4 ++--
    40  gdb/ia64-linux-nat.c          |    2 +-
    41  gdb/linux-nat.c               |   16 ++++++++--------
    42  gdb/linux-nat.h               |    6 +++---
    43  gdb/ppc-linux-nat.c           |    2 +-
    44  gdb/procfs.c                  |    2 +-
    45  13 files changed, 53 insertions(+), 28 deletions(-)
    46 
    47 diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
    48 index f954483..5ebba3a 100644
    49 --- a/gdb/amd64-linux-nat.c
    50 +++ b/gdb/amd64-linux-nat.c
    51 @@ -731,13 +731,13 @@ siginfo_from_compat_siginfo (siginfo_t *to, compat_siginfo_t *from)
    52     INF.  */
    53  
    54  static int
    55 -amd64_linux_siginfo_fixup (struct siginfo *native, gdb_byte *inf, int direction)
    56 +amd64_linux_siginfo_fixup (siginfo_t *native, gdb_byte *inf, int direction)
    57  {
    58    /* Is the inferior 32-bit?  If so, then do fixup the siginfo
    59       object.  */
    60    if (gdbarch_addr_bit (get_frame_arch (get_current_frame ())) == 32)
    61      {
    62 -      gdb_assert (sizeof (struct siginfo) == sizeof (compat_siginfo_t));
    63 +      gdb_assert (sizeof (siginfo_t) == sizeof (compat_siginfo_t));
    64  
    65        if (direction == 0)
    66  	compat_siginfo_from_siginfo ((struct compat_siginfo *) inf, native);
    67 diff --git a/gdb/arm-linux-nat.c b/gdb/arm-linux-nat.c
    68 index c5ce21c..f9f6ba5 100644
    69 --- a/gdb/arm-linux-nat.c
    70 +++ b/gdb/arm-linux-nat.c
    71 @@ -1137,7 +1137,7 @@ arm_linux_remove_watchpoint (CORE_ADDR addr, int len, int rw,
    72  static int
    73  arm_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
    74  {
    75 -  struct siginfo *siginfo_p = linux_nat_get_siginfo (inferior_ptid);
    76 +  siginfo_t *siginfo_p = linux_nat_get_siginfo (inferior_ptid);
    77    int slot = siginfo_p->si_errno;
    78  
    79    /* This must be a hardware breakpoint.  */
    80 diff --git a/gdb/gdbserver/linux-arm-low.c b/gdb/gdbserver/linux-arm-low.c
    81 index ff2437d..01208ef 100644
    82 --- a/gdb/gdbserver/linux-arm-low.c
    83 +++ b/gdb/gdbserver/linux-arm-low.c
    84 @@ -631,7 +631,7 @@ static int
    85  arm_stopped_by_watchpoint (void)
    86  {
    87    struct lwp_info *lwp = get_thread_lwp (current_inferior);
    88 -  struct siginfo siginfo;
    89 +  siginfo_t siginfo;
    90  
    91    /* We must be able to set hardware watchpoints.  */
    92    if (arm_linux_get_hw_watchpoint_count () == 0)
    93 diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
    94 index d2d4c1d..4734f15 100644
    95 --- a/gdb/gdbserver/linux-low.c
    96 +++ b/gdb/gdbserver/linux-low.c
    97 @@ -4779,7 +4779,7 @@ linux_qxfer_osdata (const char *annex,
    98     layout of the inferiors' architecture.  */
    99  
   100  static void
   101 -siginfo_fixup (struct siginfo *siginfo, void *inf_siginfo, int direction)
   102 +siginfo_fixup (siginfo_t *siginfo, void *inf_siginfo, int direction)
   103  {
   104    int done = 0;
   105  
   106 @@ -4791,9 +4791,9 @@ siginfo_fixup (struct siginfo *siginfo, void *inf_siginfo, int direction)
   107    if (!done)
   108      {
   109        if (direction == 1)
   110 -	memcpy (siginfo, inf_siginfo, sizeof (struct siginfo));
   111 +	memcpy (siginfo, inf_siginfo, sizeof (siginfo_t));
   112        else
   113 -	memcpy (inf_siginfo, siginfo, sizeof (struct siginfo));
   114 +	memcpy (inf_siginfo, siginfo, sizeof (siginfo_t));
   115      }
   116  }
   117  
   118 @@ -4802,8 +4802,8 @@ linux_xfer_siginfo (const char *annex, unsigned char *readbuf,
   119  		    unsigned const char *writebuf, CORE_ADDR offset, int len)
   120  {
   121    int pid;
   122 -  struct siginfo siginfo;
   123 -  char inf_siginfo[sizeof (struct siginfo)];
   124 +  siginfo_t siginfo;
   125 +  char inf_siginfo[sizeof (siginfo_t)];
   126  
   127    if (current_inferior == NULL)
   128      return -1;
   129 diff --git a/gdb/gdbserver/linux-low.h b/gdb/gdbserver/linux-low.h
   130 index 677d261..3aeae70 100644
   131 --- a/gdb/gdbserver/linux-low.h
   132 +++ b/gdb/gdbserver/linux-low.h
   133 @@ -20,6 +20,7 @@
   134  #ifdef HAVE_THREAD_DB_H
   135  #include <thread_db.h>
   136  #endif
   137 +#include <signal.h>
   138  
   139  #include "gdb_proc_service.h"
   140  
   141 @@ -46,8 +47,6 @@ struct regset_info
   142  extern struct regset_info target_regsets[];
   143  #endif
   144  
   145 -struct siginfo;
   146 -
   147  struct process_info_private
   148  {
   149    /* Arch-specific additions.  */
   150 @@ -109,7 +108,7 @@ struct linux_target_ops
   151       Returns true if any conversion was done; false otherwise.
   152       If DIRECTION is 1, then copy from INF to NATIVE.
   153       If DIRECTION is 0, copy from NATIVE to INF.  */
   154 -  int (*siginfo_fixup) (struct siginfo *native, void *inf, int direction);
   155 +  int (*siginfo_fixup) (siginfo_t *native, void *inf, int direction);
   156  
   157    /* Hook to call when a new process is created or attached to.
   158       If extra per-process architecture-specific data is needed,
   159 diff --git a/gdb/gdbserver/linux-x86-low.c b/gdb/gdbserver/linux-x86-low.c
   160 index ed1f8a8..b466b5d 100644
   161 --- a/gdb/gdbserver/linux-x86-low.c
   162 +++ b/gdb/gdbserver/linux-x86-low.c
   163 @@ -918,13 +918,13 @@ siginfo_from_compat_siginfo (siginfo_t *to, compat_siginfo_t *from)
   164     INF.  */
   165  
   166  static int
   167 -x86_siginfo_fixup (struct siginfo *native, void *inf, int direction)
   168 +x86_siginfo_fixup (siginfo_t *native, void *inf, int direction)
   169  {
   170  #ifdef __x86_64__
   171    /* Is the inferior 32-bit?  If so, then fixup the siginfo object.  */
   172    if (register_size (0) == 4)
   173      {
   174 -      if (sizeof (struct siginfo) != sizeof (compat_siginfo_t))
   175 +      if (sizeof (siginfo_t) != sizeof (compat_siginfo_t))
   176  	fatal ("unexpected difference in siginfo");
   177  
   178        if (direction == 0)
   179 diff --git a/gdb/ia64-linux-nat.c b/gdb/ia64-linux-nat.c
   180 index 8773195..19b827f 100644
   181 --- a/gdb/ia64-linux-nat.c
   182 +++ b/gdb/ia64-linux-nat.c
   183 @@ -637,7 +637,7 @@ static int
   184  ia64_linux_stopped_data_address (struct target_ops *ops, CORE_ADDR *addr_p)
   185  {
   186    CORE_ADDR psr;
   187 -  struct siginfo *siginfo_p;
   188 +  siginfo_t *siginfo_p;
   189    struct regcache *regcache = get_current_regcache ();
   190  
   191    siginfo_p = linux_nat_get_siginfo (inferior_ptid);
   192 diff --git a/gdb/linux-nat.c b/gdb/linux-nat.c
   193 index f80c0c1..d81d55e 100644
   194 --- a/gdb/linux-nat.c
   195 +++ b/gdb/linux-nat.c
   196 @@ -188,7 +188,7 @@ static void (*linux_nat_prepare_to_resume) (struct lwp_info *);
   197  /* The method to call, if any, when the siginfo object needs to be
   198     converted between the layout returned by ptrace, and the layout in
   199     the architecture of the inferior.  */
   200 -static int (*linux_nat_siginfo_fixup) (struct siginfo *,
   201 +static int (*linux_nat_siginfo_fixup) (siginfo_t *,
   202  				       gdb_byte *,
   203  				       int);
   204  
   205 @@ -4232,7 +4232,7 @@ linux_nat_mourn_inferior (struct target_ops *ops)
   206     layout of the inferiors' architecture.  */
   207  
   208  static void
   209 -siginfo_fixup (struct siginfo *siginfo, gdb_byte *inf_siginfo, int direction)
   210 +siginfo_fixup (siginfo_t *siginfo, gdb_byte *inf_siginfo, int direction)
   211  {
   212    int done = 0;
   213  
   214 @@ -4244,9 +4244,9 @@ siginfo_fixup (struct siginfo *siginfo, gdb_byte *inf_siginfo, int direction)
   215    if (!done)
   216      {
   217        if (direction == 1)
   218 -	memcpy (siginfo, inf_siginfo, sizeof (struct siginfo));
   219 +	memcpy (siginfo, inf_siginfo, sizeof (siginfo_t));
   220        else
   221 -	memcpy (inf_siginfo, siginfo, sizeof (struct siginfo));
   222 +	memcpy (inf_siginfo, siginfo, sizeof (siginfo_t));
   223      }
   224  }
   225  
   226 @@ -4256,8 +4256,8 @@ linux_xfer_siginfo (struct target_ops *ops, enum target_object object,
   227  		    const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
   228  {
   229    int pid;
   230 -  struct siginfo siginfo;
   231 -  gdb_byte inf_siginfo[sizeof (struct siginfo)];
   232 +  siginfo_t siginfo;
   233 +  gdb_byte inf_siginfo[sizeof (siginfo_t)];
   234  
   235    gdb_assert (object == TARGET_OBJECT_SIGNAL_INFO);
   236    gdb_assert (readbuf || writebuf);
   237 @@ -5266,7 +5266,7 @@ linux_nat_set_new_thread (struct target_ops *t,
   238     inferior.  */
   239  void
   240  linux_nat_set_siginfo_fixup (struct target_ops *t,
   241 -			     int (*siginfo_fixup) (struct siginfo *,
   242 +			     int (*siginfo_fixup) (siginfo_t *,
   243  						   gdb_byte *,
   244  						   int))
   245  {
   246 @@ -5285,7 +5285,7 @@ linux_nat_set_prepare_to_resume (struct target_ops *t,
   247  }
   248  
   249  /* Return the saved siginfo associated with PTID.  */
   250 -struct siginfo *
   251 +siginfo_t *
   252  linux_nat_get_siginfo (ptid_t ptid)
   253  {
   254    struct lwp_info *lp = find_lwp_pid (ptid);
   255 diff --git a/gdb/linux-nat.h b/gdb/linux-nat.h
   256 index c9878d9..d87f0cf 100644
   257 --- a/gdb/linux-nat.h
   258 +++ b/gdb/linux-nat.h
   259 @@ -78,7 +78,7 @@ struct lwp_info
   260  
   261    /* Non-zero si_signo if this LWP stopped with a trap.  si_addr may
   262       be the address of a hardware watchpoint.  */
   263 -  struct siginfo siginfo;
   264 +  siginfo_t siginfo;
   265  
   266    /* STOPPED_BY_WATCHPOINT is non-zero if this LWP stopped with a data
   267       watchpoint trap.  */
   268 @@ -184,7 +184,7 @@ void linux_nat_set_new_thread (struct target_ops *, void (*) (struct lwp_info *)
   269     that ptrace returns, and the layout in the architecture of the
   270     inferior.  */
   271  void linux_nat_set_siginfo_fixup (struct target_ops *,
   272 -				  int (*) (struct siginfo *,
   273 +				  int (*) (siginfo_t *,
   274  					   gdb_byte *,
   275  					   int));
   276  
   277 @@ -198,7 +198,7 @@ void linux_nat_set_prepare_to_resume (struct target_ops *,
   278  void linux_nat_switch_fork (ptid_t new_ptid);
   279  
   280  /* Return the saved siginfo associated with PTID.  */
   281 -struct siginfo *linux_nat_get_siginfo (ptid_t ptid);
   282 +siginfo_t *linux_nat_get_siginfo (ptid_t ptid);
   283  
   284  /* Compute and return the processor core of a given thread.  */
   285  int linux_nat_core_of_thread_1 (ptid_t ptid);
   286 diff --git a/gdb/ppc-linux-nat.c b/gdb/ppc-linux-nat.c
   287 index 1bd157b..9bd11fd 100644
   288 --- a/gdb/ppc-linux-nat.c
   289 +++ b/gdb/ppc-linux-nat.c
   290 @@ -2218,7 +2218,7 @@ ppc_linux_thread_exit (struct thread_info *tp, int silent)
   291  static int
   292  ppc_linux_stopped_data_address (struct target_ops *target, CORE_ADDR *addr_p)
   293  {
   294 -  struct siginfo *siginfo_p;
   295 +  siginfo_t *siginfo_p;
   296  
   297    siginfo_p = linux_nat_get_siginfo (inferior_ptid);
   298  
   299 diff --git a/gdb/procfs.c b/gdb/procfs.c
   300 index 903621d..cb4bc7c 100644
   301 --- a/gdb/procfs.c
   302 +++ b/gdb/procfs.c
   303 @@ -266,7 +266,7 @@ typedef struct sigaction gdb_sigaction_t;
   304  #ifdef HAVE_PR_SIGINFO64_T
   305  typedef pr_siginfo64_t gdb_siginfo_t;
   306  #else
   307 -typedef struct siginfo gdb_siginfo_t;
   308 +typedef siginfo_t gdb_siginfo_t;
   309  #endif
   310  
   311  /* On mips-irix, praddset and prdelset are defined in such a way that
   312 -- 
   313 1.7.9.7
   314