From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 7N/VHuUKuWBlIAAAWB0awg (envelope-from ) for ; Thu, 03 Jun 2021 13:01:25 -0400 Received: by simark.ca (Postfix, from userid 112) id 6FD111F163; Thu, 3 Jun 2021 13:01:25 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.6 required=5.0 tests=MAILING_LIST_MULTI, RDNS_DYNAMIC autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id D9B3C1E54D for ; Thu, 3 Jun 2021 13:01:19 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 51522398FC3B for ; Thu, 3 Jun 2021 17:01:19 +0000 (GMT) Received: from mx2.freebsd.org (mx2.freebsd.org [96.47.72.81]) by sourceware.org (Postfix) with ESMTPS id A16D4385380F for ; Thu, 3 Jun 2021 17:01:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A16D4385380F Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=FreeBSD.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [96.47.72.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits)) (Client CN "mx1.freebsd.org", Issuer "R3" (verified OK)) by mx2.freebsd.org (Postfix) with ESMTPS id 3B7DF9C59C; Thu, 3 Jun 2021 17:01:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Fwsc10y8sz3r1j; Thu, 3 Jun 2021 17:01:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id A556922B6A; Thu, 3 Jun 2021 17:01:04 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: [PATCH] Report additional details for signals received on FreeBSD. To: Simon Marchi , gdb-patches@sourceware.org References: <20210531162940.10841-1-jhb@FreeBSD.org> <46124956-89f0-4da0-00cd-476584b50e98@FreeBSD.org> From: John Baldwin Message-ID: <25c1c5b7-5081-1bdb-c8a2-0b95ae22fa28@FreeBSD.org> Date: Thu, 3 Jun 2021 10:01:03 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:78.0) Gecko/20100101 Thunderbird/78.10.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" 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 >>> + >>> + * 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 >>> * 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 >>> + . */ >>> + >>> +#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