This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[RFA] Fix compiling amd64-linux-nat.c on old glibcs [was Re: new siginfo support doesn't build on glibc 2.2.2]
- From: Doug Evans <dje at google dot com>
- To: Pedro Alves <pedro at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 16 Mar 2009 17:05:01 -0700
- Subject: [RFA] Fix compiling amd64-linux-nat.c on old glibcs [was Re: new siginfo support doesn't build on glibc 2.2.2]
On Mon, Feb 9, 2009 at 3:55 PM, Pedro Alves <pedro@codesourcery.com> wrote:
> On Monday 09 February 2009 21:07:41, Doug Evans wrote:
>> fyi, glibc 2.2.2 doesn't have si_timerid, si_overrun. compilation of
>> amd64-linux-nat.c fails.
>
> Bummer. According to sigaction(2), those exist only since kernel
> 2.6. Those are defines, we could #ifdef on them, assuming we're
> ok with a gdb built on that platform and then moved to some more
> recent glibc will not translate those fields.
>
> I don't know if the siginfo layout in that version is the same
> as defined by the gdbarch callback, or even if your glibc's siginfo_t
> declaration matches your kernel's siginfo_t object layout --- there's
> a history of breakage on these matters.
>
>> Dunno how old a glibc we intend to support for 7.0.
>
> Could you try ifdefing those fields, and see what comes out of
> $_siginfo; and taking a peek at your headers, to see if we're
> doing something reasonable? We have a couple of siginfo related
> testcases that may help as small test apps.
>
> --
> Pedro Alves
>
How about this?
2009-03-16 Doug Evans <dje@google.com>
* amd64-linux-nat.c (si_timerid,si_overrun): Provide definition for
glibc 2.3.2 and earlier.
Index: amd64-linux-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/amd64-linux-nat.c,v
retrieving revision 1.24
diff -u -p -u -p -r1.24 amd64-linux-nat.c
--- amd64-linux-nat.c 23 Feb 2009 00:03:48 -0000 1.24
+++ amd64-linux-nat.c 17 Mar 2009 00:00:40 -0000
@@ -501,6 +501,15 @@ typedef struct compat_siginfo
#define cpt_si_band _sifields._sigpoll._band
#define cpt_si_fd _sifields._sigpoll._fd
+/* glibc at least up to 2.3.2 doesn't have si_timerid, si_overrun.
+ In their place is si_timer1,si_timer2. */
+#ifndef si_timerid
+#define si_timerid si_timer1
+#endif
+#ifndef si_overrun
+#define si_overrun si_timer2
+#endif
+
static void
compat_siginfo_from_siginfo (compat_siginfo_t *to, siginfo_t *from)
{