diff options
author | Eugene Syromyatnikov <evgsyr@gmail.com> | 2018-11-25 13:38:31 +0100 |
---|---|---|
committer | Eugene Syromyatnikov <evgsyr@gmail.com> | 2018-11-25 13:38:31 +0100 |
commit | a6ace08dbc096936ce6d087af5c29436a2bdd537 (patch) | |
tree | 1aaec3ac19307ec81bf8fe891211b2a423d5992c | |
parent | e44ae68ae48a908a023929e57d926da1fa7912d3 (diff) | |
download | strace-a6ace08dbc096936ce6d087af5c29436a2bdd537.tar.gz |
printsiginfo: decode si_trapno
* xlat/alpha_gentrap.in: New file.
* configure.ac (AC_CHECK_MEMBERS): Add check for siginfo_t.si_trapno.
* printsiginfo.c [ALPHA]: Include <asm/gentrap.h>, "xlat/alpha_gentrap.h".
(print_si_info): Add SIGTRAP to the SIGILL/SIGFPE/SIGSEGV/SIGBUS/SIGEMT
case.
[HAVE_SIGINFO_T_SI_TRAPNO] (print_si_info) <case SIGTRAP>: Decode
si_trapno field.
-rw-r--r-- | configure.ac | 3 | ||||
-rw-r--r-- | printsiginfo.c | 31 | ||||
-rw-r--r-- | xlat/alpha_gentrap.in | 27 |
3 files changed, 60 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index 39b6150fa..0ef041c14 100644 --- a/configure.ac +++ b/configure.ac @@ -355,7 +355,8 @@ AC_CHECK_MEMBERS([struct utsname.domainname],,, [#include <sys/utsname.h>]) AC_CHECK_MEMBERS(m4_normalize([ siginfo_t.si_syscall, siginfo_t.si_timerid, - siginfo_t.si_overrun + siginfo_t.si_overrun, + siginfo_t.si_trapno ]),,, [#include <signal.h>]) AC_CHECK_MEMBERS(m4_normalize([ diff --git a/printsiginfo.c b/printsiginfo.c index 89f0d8f12..2ed7b7d16 100644 --- a/printsiginfo.c +++ b/printsiginfo.c @@ -66,6 +66,11 @@ #include "xlat/sigsys_codes.h" #include "xlat/sigtrap_codes.h" +#ifdef ALPHA +# include <asm/gentrap.h> +# include "xlat/alpha_gentrap.h" +#endif /* ALPHA */ + #ifdef SIGEMT # include "xlat/sigemt_codes.h" #endif @@ -206,11 +211,37 @@ print_si_info(struct tcb *tcp, const siginfo_t *sip) break; case SIGILL: case SIGFPE: case SIGSEGV: case SIGBUS: + case SIGTRAP: #ifdef SIGEMT case SIGEMT: #endif tprints(", si_addr="); printaddr(ptr_to_kulong(sip->si_addr)); +#ifdef HAVE_SIGINFO_T_SI_TRAPNO +# if defined(SPARC) + if ((sip->si_signo == SIGILL && sip->si_code == ILLTRP) + || sip->si_trapno) +# elif defined(ALPHA) + /* + * See arch/alpha/kernel/traps.c:do_entIF, gentrap + * handling, and arch/alpha/include/uapi/asm/gentrap.h + */ + if (sip->si_trapno + || sip->si_signo == SIGFPE + || (sip->si_signo == SIGTRAP + && sip->si_code == TRAP_UNK)) +# endif + { + tprints(", si_trapno="); +# ifdef ALPHA + printxval_d(alpha_gentraps, sip->si_trapno, + sip->si_trapno ? "GEN_???" : NULL); +# else /* !ALPHA */ + tprintf("%d") +# endif ALPHA + } +#endif /* HAVE_SIGINFO_T_SI_TRAPNO */ + break; case SIGPOLL: switch (sip->si_code) { diff --git a/xlat/alpha_gentrap.in b/xlat/alpha_gentrap.in new file mode 100644 index 000000000..cbb96e817 --- /dev/null +++ b/xlat/alpha_gentrap.in @@ -0,0 +1,27 @@ +#sorted +#val_type int +GEN_SUBRNG7 -25 +GEN_SUBRNG6 -24 +GEN_SUBRNG5 -23 +GEN_SUBRNG4 -22 +GEN_SUBRNG3 -21 +GEN_SUBRNG2 -20 +GEN_SUBRNG1 -19 +GEN_SUBRNG -18 +GEN_RANGERR -17 +GEN_SUBSTRERR -16 +GEN_STRLENERR -15 +GEN_STKOVF -14 +GEN_NULPTRERR -13 +GEN_ASSERTERR -12 +GEN_ROPRAND -11 +GEN_DECINV -10 +GEN_DECDIV -9 +GEN_DECOVF -8 +GEN_FLTINE -7 +GEN_FLTINV -6 +GEN_FLTUND -5 +GEN_FLTDIV -4 +GEN_FLTOVF -3 +GEN_INTDIV -2 +GEN_INTOVF -1 |