From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16523 invoked by alias); 12 Oct 2018 06:13:47 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 16501 invoked by uid 89); 12 Oct 2018 06:13:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Oct 2018 06:13:45 +0000 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 453133B3C2; Fri, 12 Oct 2018 06:13:44 +0000 (UTC) Received: from pinnacle.lan (ovpn-117-243.phx2.redhat.com [10.3.117.243]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1A74C4520; Fri, 12 Oct 2018 06:13:43 +0000 (UTC) Date: Fri, 12 Oct 2018 06:13:00 -0000 From: Kevin Buettner To: gdb-patches@sourceware.org Cc: John Baldwin Subject: Re: [PATCH 1/2] Add an optional "alias" attribute to syscall entries. Message-ID: <20181011231342.61e12b99@pinnacle.lan> In-Reply-To: <20181003173005.19581-2-jhb@FreeBSD.org> References: <20181003173005.19581-1-jhb@FreeBSD.org> <20181003173005.19581-2-jhb@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00290.txt.bz2 Hi John, On Wed, 3 Oct 2018 10:30:04 -0700 John Baldwin wrote: > When setting a syscall catchpoint by name, catch syscalls whose name > or alias matches the requested string. > > When the ABI of a system call is changed in the FreeBSD kernel, this > is implemented by leaving a compatability system call using the old > ABI at the existing "slot" and allocating a new system call for the > version using the new ABI. For example, new fields were added to the > 'struct kevent' used by the kevent() system call in FreeBSD 12. The > previous kevent() system call in FreeBSD 12 kernels is now called > freebsd11_kevent() and is still used by older binaries compiled > against the older ABI. The freebsd11_kevent() system call can be > tagged with an "alias" attribute of "kevent" permitting 'catch syscall > kevent' to catch both system calls and providing the expected user > behavior for both old and new binaries. It also provides the expected > behavior if GDB is compiled on an older host (such as a FreeBSD 11 > host). Very nice. I read through your patch. The only problem I found was this use of a GNU extension involving the use of the ternary ?: operator without the middle operand. > char *groups) > { > - syscall_desc *sysdesc = new syscall_desc (number, name); > + syscall_desc *sysdesc = new syscall_desc (number, name, alias ?: ""); > > syscalls_info->syscalls.emplace_back (sysdesc); > In addition, the GDB coding standard specifies that pointer variables should have explicit comparisons against NULL or nullptr. So, even if it weren't a GNU extension, GDB's coding standard would force you to write that expression using an explicit comparison - which in turn would necessitate adding the middle argument. (Which is kind of unfortunate, because I like the compactness of that expression.) Anyway, here's a link to the relevant section of the GDB coding standard: https://sourceware.org/gdb/wiki/Internals%20GDB-C-Coding-Standards#Comparison_With_NULL_And_Zero Kevin