Report additional details for signals received on FreeBSD.
authorJohn Baldwin <jhb@FreeBSD.org>
Thu, 3 Jun 2021 17:32:04 +0000 (10:32 -0700)
committerJohn Baldwin <jhb@FreeBSD.org>
Thu, 3 Jun 2021 17:32:20 +0000 (10:32 -0700)
commit83810881192e950dce39be4d55e21d52ba68fb60
tree3d70a57317deee72f0fcd3d36aaa27bb02106c86
parent4c958d7911cad25699b345f82d74411918588399
Report additional details for signals received on FreeBSD.

Provide a description for si_code values as a sigcode-meaning field.
For signals raised by a system call, provide the pid and user ID of
the sending process.  For signals raised by a POSIX timer exparation,
provide the id of the timer.  For signals raised by a POSIX message
queue, provide the id of the message queue.  For SIGCHLD provide the
pid and user ID of the child process along with the exit status or
relevant signal number.

Sample output for SIGUSR1 raised by kill():

before:

Program received signal SIGUSR1, User defined signal 1.
kill () at kill.S:4
4       RSYSCALL(kill)

after:

Program received signal SIGUSR1, User defined signal 1.
Sent by kill() from pid 30529 and user 1001.
kill () at kill.S:4
4       RSYSCALL(kill)

SIGCHLD for exited process:

before:

Program received signal SIGCHLD, Child status changed.

after:

Program received signal SIGCHLD, Child status changed.
Child has exited: pid 31929, uid 1001, exit status 0.

SIGALRM raised by a POSIX timer (timer_create):

before:

Program received signal SIGALRM, Alarm clock.

after:

Program received signal SIGALRM, Alarm clock.
Timer expired: timerid 3.

gdb/ChangeLog:

* fbsd-tdep.c (FBSD_SI_USER, FBSD_SI_QUEUE, FBSD_SI_TIMER)
(FBSD_SI_ASYNCIO, FBSD_SI_MESGQ, FBSD_SI_KERNEL, FBSD_SI_LWP)
(FBSD_ILL_ILLOPC, FBSD_ILL_ILLOPN, FBSD_ILL_ILLADR)
(FBSD_ILL_ILLTRP, FBSD_ILL_PRVOPC, FBSD_ILL_PRVREG)
(FBSD_ILL_COPROC, FBSD_ILL_BADSTK, FBSD_BUS_ADRALN)
(FBSD_BUS_ADRERR, FBSD_BUS_OBJERR, FBSD_BUS_OOMERR)
(FBSD_SEGV_MAPERR, FBSD_SEGV_ACCERR, FBSD_SEGV_PKUERR)
(FBSD_FPE_INTOVF, FBSD_FPE_INTDIV, FBSD_FPE_FLTDIV)
(FBSD_FPE_FLTOVF, FBSD_FPE_FLTUND, FBSD_FPE_FLTRES)
(FBSD_FPE_FLTINV, FBSD_FPE_FLTSUB, FBSD_TRAP_BRKPT)
(FBSD_TRAP_TRACE, FBSD_TRAP_DTRACE, FBSD_TRAP_CAP)
(FBSD_CLD_EXITED, FBSD_CLD_KILLED, FBSD_CLD_DUMPED)
(FBSD_CLD_TRAPPED, FBSD_CLD_STOPPED, FBSD_CLD_CONTINUED)
(FBSD_POLL_IN, FBSD_POLL_OUT, FBSD_POLL_MSG, FBSD_POLL_ERR)
(FBSD_POLL_PRI, FBSD_POLL_HUP, fbsd_signal_cause)
(fbsd_report_signal_info): New.
(fbsd_init_abi): Use fbsd_report_signal_info as gdbarch
report_signal_info method.
gdb/ChangeLog
gdb/fbsd-tdep.c