From: John Baldwin <jhb@FreeBSD.org>
To: Kevin Buettner <kevinb@redhat.com>, gdb-patches@sourceware.org
Subject: Re: [PATCH 1/2] Add an optional "alias" attribute to syscall entries.
Date: Wed, 17 Oct 2018 18:49:00 -0000 [thread overview]
Message-ID: <0619e9c1-adf8-b9f6-1ee0-1a2ada1e0b58@FreeBSD.org> (raw)
In-Reply-To: <20181011231342.61e12b99@pinnacle.lan>
On 10/11/18 11:13 PM, Kevin Buettner wrote:
> Hi John,
>
> On Wed, 3 Oct 2018 10:30:04 -0700
> John Baldwin <jhb@FreeBSD.org> 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
                                                                           Â
next prev parent reply other threads:[~2018-10-17 18:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-10-03 17:30 [PATCH 0/2] Update FreeBSD's syscall table John Baldwin
2018-10-03 17:30 ` [PATCH 2/2] Update the FreeBSD system call table to match FreeBSD 12.0 John Baldwin
2018-10-03 17:30 ` [PATCH 1/2] Add an optional "alias" attribute to syscall entries John Baldwin
2018-10-12 6:13 ` Kevin Buettner
2018-10-17 18:49 ` John Baldwin [this message]
2018-10-13 1:52 ` Sergio Durigan Junior
2018-10-17 19:13 ` John Baldwin
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=0619e9c1-adf8-b9f6-1ee0-1a2ada1e0b58@FreeBSD.org \
--to=jhb@freebsd.org \
--cc=gdb-patches@sourceware.org \
--cc=kevinb@redhat.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).