patches/gdb/7.4.1/00_all_ptrace_setsiginfo.patch
author Jang, Bongseo <graycells@gmail.com>
Sun Sep 23 11:53:02 2012 +0900 (2012-09-23)
changeset 3059 1e5fe55974bc
permissions -rw-r--r--
debug/gdb: fix from upstream with newer glibc(siginfo vs siginfo_t, Gentoo gdb-7.4.1 patch)

This is for when you failed to build gdb-native with the error:

gdb-7.4.1/gdb/linux-nat.h:79:18: error: field 'siginfo' has incomplete type"

This is from mirror://gentoo/distfiles/gdb-7.4.1-patches-2.tar.xz

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