Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: "Jose E. Marchesi" <jose.marchesi@oracle.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH] Support for the $_siginfo convenience var in sparc64
Date: Tue, 03 Dec 2013 17:06:00 -0000	[thread overview]
Message-ID: <529E0F77.6030608@redhat.com> (raw)
In-Reply-To: <87d2lew3fb.fsf@oracle.com>

On 12/03/2013 11:59 AM, Jose E. Marchesi wrote:
> 
> ping
> 
>         > The following patch adds support for the $_siginfo convenience variable
>         > to sparc64-*-linux-gnu targets.
>         
>         I take it from the patch that linux-tdep.c:linux_get_siginfo_type wouldn't
>         work for sparc64?  Why is that?  What's different?
>     
>     These are the differences of glibc's bits/siginfo.h in sparc with
>     respect to bits/siginfo.h in x86:
>     
>     - The _sigfault struct has an additional field `int si_trapno'.
>     - The `si_band' field in the `_sigpoll' struct is of type `int' instead
>       of `long int'.
>     
>     It would be nice to avoid all that code repetition, but since glibc
>     maintains per-target bits/signinfo.h files more differences could be
>     introduced in the future...

It just looks like the glibc code is waiting to be cleaned up:

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$ diff -up ./sysdeps/unix/sysv/linux/bits/siginfo.h ./sysdeps/unix/sysv/linux/sparc/bits/siginfo.h
-/* siginfo_t, sigevent and constants.  Linux version.
+/* siginfo_t, sigevent and constants.  Linux/SPARC version.
    Copyright (C) 1997-2013 Free Software Foundation, Inc.
    This file is part of the GNU C Library.

@@ -95,13 +95,14 @@ typedef struct
        struct
          {
            void *si_addr;      /* Faulting insn/memory ref.  */
+           int si_trapno;
            short int si_addr_lsb;      /* Valid LSB of the reported address.  */
          } _sigfault;

        /* SIGPOLL.  */
        struct
          {
-           long int si_band;   /* Band event for SIGPOLL.  */
+           int si_band;        /* Band event for SIGPOLL.  */
            int si_fd;
          } _sigpoll;
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

On the kernel side, archs just define a couple macros for those minor
differences, sharing most of the definitions:

http://lxr.free-electrons.com/source/include/uapi/asm-generic/siginfo.h

 28
 29 /*
 30  * The default "si_band" type is "long", as specified by POSIX.
 31  * However, some architectures want to override this to "int"
 32  * for historical compatibility reasons, so we allow that.
 33  */
 34 #ifndef __ARCH_SI_BAND_T
 35 #define __ARCH_SI_BAND_T long
 36 #endif
...
 87                 /* SIGILL, SIGFPE, SIGSEGV, SIGBUS */
 88                 struct {
 89                         void __user *_addr; /* faulting insn/memory ref. */
 90 #ifdef __ARCH_SI_TRAPNO
 91                         int _trapno;    /* TRAP # which caused the signal */
 92 #endif


Seems like we should be able to share similarly (though with runtime
switches, of course).

-- 
Pedro Alves


      reply	other threads:[~2013-12-03 17:06 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-22 13:09 Jose E. Marchesi
2013-10-22 13:21 ` Pedro Alves
2013-10-22 13:36   ` Jose E. Marchesi
2013-12-03 11:59     ` Jose E. Marchesi
2013-12-03 17:06       ` Pedro Alves [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=529E0F77.6030608@redhat.com \
    --to=palves@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jose.marchesi@oracle.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox