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.
This commit is contained in:
Eugene Syromyatnikov 2018-11-25 13:38:31 +01:00
parent e44ae68ae4
commit a6ace08dbc
3 changed files with 60 additions and 1 deletions

View File

@ -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([

View File

@ -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) {

27
xlat/alpha_gentrap.in Normal file
View File

@ -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