From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14154 invoked by alias); 17 Oct 2018 18:49:55 -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 14038 invoked by uid 89); 17 Oct 2018 18:49:54 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.7 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_SOFTFAIL autolearn=no version=3.3.2 spammy=HContent-Transfer-Encoding:8bit X-HELO: mail.baldwin.cx Received: from bigwig.baldwin.cx (HELO mail.baldwin.cx) (96.47.65.170) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 Oct 2018 18:49:52 +0000 Received: from John-Baldwins-MacBook-Pro-2.local (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id DB93910AFD2; Wed, 17 Oct 2018 14:49:49 -0400 (EDT) Subject: Re: [PATCH 1/2] Add an optional "alias" attribute to syscall entries. To: Kevin Buettner , gdb-patches@sourceware.org References: <20181003173005.19581-1-jhb@FreeBSD.org> <20181003173005.19581-2-jhb@FreeBSD.org> <20181011231342.61e12b99@pinnacle.lan> From: John Baldwin Message-ID: <0619e9c1-adf8-b9f6-1ee0-1a2ada1e0b58@FreeBSD.org> Date: Wed, 17 Oct 2018 18:49:00 -0000 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: <20181011231342.61e12b99@pinnacle.lan> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00384.txt.bz2 On 10/11/18 11:13 PM, Kevin Buettner wrote: > 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.) Oof, I'll expand it out instead. -- John Baldwin                                                                            Â