This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Support for the $_siginfo convenience var in sparc64


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]