Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: John Baldwin <jhb@FreeBSD.org>
To: Simon Marchi <simon.marchi@polymtl.ca>, gdb-patches@sourceware.org
Subject: Re: [PATCH] Report additional details for signals received on FreeBSD.
Date: Thu, 3 Jun 2021 10:01:03 -0700	[thread overview]
Message-ID: <25c1c5b7-5081-1bdb-c8a2-0b95ae22fa28@FreeBSD.org> (raw)
In-Reply-To: <ef8f5255-3d66-0c02-4bd0-094b3094e2b9@polymtl.ca>

On 5/31/21 5:49 PM, Simon Marchi wrote:
> On 2021-05-31 12:33 p.m., John Baldwin wrote:
>> On 5/31/21 9:29 AM, John Baldwin wrote:
>>> 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.
>>>
>>> gdb/ChangeLog:
>>>
>>>      * fbsd-tdep.c (fbsd_signal_cause, fbsd_report_signal_info): New.
>>>      (fbsd_init_abi): Use fbsd_report_signal_info as gdbarch
>>>      report_signal_info method.
>>> ---
>>>    gdb/ChangeLog   |   6 ++
>>>    gdb/fbsd-tdep.c | 272 ++++++++++++++++++++++++++++++++++++++++++++++++
>>>    2 files changed, 278 insertions(+)
>>>
>>> diff --git a/gdb/ChangeLog b/gdb/ChangeLog
>>> index b0f448a35e..0f5ec65680 100644
>>> --- a/gdb/ChangeLog
>>> +++ b/gdb/ChangeLog
>>> @@ -1,3 +1,9 @@
>>> +2021-05-30  John Baldwin  <jhb@FreeBSD.org>
>>> +
>>> +    * fbsd-tdep.c (fbsd_signal_cause, fbsd_report_signal_info): New.
>>> +    (fbsd_init_abi): Use fbsd_report_signal_info as gdbarch
>>> +    report_signal_info method.
>>> +
>>>    2021-05-30  John Baldwin  <jhb@FreeBSD.org>
>>>          * infrun.c (handle_inferior_event): Only call
>>> diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
>>> index 6cab31dde8..3fe4c5c595 100644
>>> --- a/gdb/fbsd-tdep.c
>>> +++ b/gdb/fbsd-tdep.c
>>> @@ -75,6 +75,63 @@ enum
>>>        FREEBSD_SIGRTMAX = 126,
>>>      };
>>>    +/* Constants for values of si_code as defined in FreeBSD's
>>> +   <sys/signal.h>.  */
>>> +
>>> +#define    FBSD_SI_USER        0x10001
>>> +#define    FBSD_SI_QUEUE        0x10002
>>> +#define    FBSD_SI_TIMER        0x10003
>>> +#define    FBSD_SI_ASYNCIO        0x10004
>>> +#define    FBSD_SI_MESGQ        0x10005
>>> +#define    FBSD_SI_KERNEL        0x10006
>>> +#define    FBSD_SI_LWP        0x10007
>>> +
>>> +#define    FBSD_ILL_ILLOPC        1
>>> +#define    FBSD_ILL_ILLOPN        2
>>> +#define    FBSD_ILL_ILLADR        3
>>> +#define    FBSD_ILL_ILLTRP        4
>>> +#define    FBSD_ILL_PRVOPC        5
>>> +#define    FBSD_ILL_PRVREG        6
>>> +#define    FBSD_ILL_COPROC        7
>>> +#define    FBSD_ILL_BADSTK        8
>>> +
>>> +#define    FBSD_BUS_ADRALN        1
>>> +#define    FBSD_BUS_ADRERR        2
>>> +#define    FBSD_BUS_OBJERR        3
>>> +#define    FBSD_BUS_OOMERR        100
>>> +
>>> +#define    FBSD_SEGV_MAPERR    1
>>> +#define    FBSD_SEGV_ACCERR    2
>>> +#define    FBSD_SEGV_PKUERR    100
>>> +
>>> +#define    FBSD_FPE_INTOVF        1
>>> +#define    FBSD_FPE_INTDIV        2
>>> +#define    FBSD_FPE_FLTDIV        3
>>> +#define    FBSD_FPE_FLTOVF        4
>>> +#define    FBSD_FPE_FLTUND        5
>>> +#define    FBSD_FPE_FLTRES        6
>>> +#define    FBSD_FPE_FLTINV        7
>>> +#define    FBSD_FPE_FLTSUB        8
>>> +
>>> +#define    FBSD_TRAP_BRKPT        1
>>> +#define    FBSD_TRAP_TRACE        2
>>> +#define    FBSD_TRAP_DTRACE    3
>>> +#define    FBSD_TRAP_CAP        4
>>> +
>>> +#define    FBSD_CLD_EXITED        1
>>> +#define    FBSD_CLD_KILLED        2
>>> +#define    FBSD_CLD_DUMPED        3
>>> +#define    FBSD_CLD_TRAPPED    4
>>> +#define    FBSD_CLD_STOPPED    5
>>> +#define    FBSD_CLD_CONTINUED    6
>>> +
>>> +#define    FBSD_POLL_IN        1
>>> +#define    FBSD_POLL_OUT        2
>>> +#define    FBSD_POLL_MSG        3
>>> +#define    FBSD_POLL_ERR        4
>>> +#define    FBSD_POLL_PRI        5
>>> +#define    FBSD_POLL_HUP        6
>>
>> Do I need to list all of these new #define's individually in the changelog
>> or is there a more concise way to list them?
> 
> I don't really have an opinion.  But you can probably automate a bit of
> it with grep / sed.

Ok, I'll just list them all.

> In any case the patch LGTM.  It would be nice if you could include an
> example output for one of the cases, to get an idea of the user-visible
> improvement.

Hmm, would you like it in the commit log?  Here are some sample before/after
comparisons:

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.

-- 
John Baldwin

  reply	other threads:[~2021-06-03 17:01 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-31 16:29 John Baldwin
2021-05-31 16:33 ` John Baldwin
2021-06-01  0:49   ` Simon Marchi via Gdb-patches
2021-06-03 17:01     ` John Baldwin [this message]
2021-06-03 17:06       ` Simon Marchi via Gdb-patches

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=25c1c5b7-5081-1bdb-c8a2-0b95ae22fa28@FreeBSD.org \
    --to=jhb@freebsd.org \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    /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