public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Kevin Buettner <kevinb@redhat.com>
To: gdb-patches@sourceware.org
Cc: John Baldwin <jhb@FreeBSD.org>
Subject: Re: [PATCH 1/2] Add an optional "alias" attribute to syscall entries.
Date: Fri, 12 Oct 2018 06:13:00 -0000	[thread overview]
Message-ID: <20181011231342.61e12b99@pinnacle.lan> (raw)
In-Reply-To: <20181003173005.19581-2-jhb@FreeBSD.org>

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.)

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

  reply	other threads:[~2018-10-12  6:13 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 1/2] Add an optional "alias" attribute to syscall entries John Baldwin
2018-10-12  6:13   ` Kevin Buettner [this message]
2018-10-17 18:49     ` John Baldwin
2018-10-13  1:52   ` Sergio Durigan Junior
2018-10-17 19:13     ` John Baldwin
2018-10-03 17:30 ` [PATCH 2/2] Update the FreeBSD system call table to match FreeBSD 12.0 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=20181011231342.61e12b99@pinnacle.lan \
    --to=kevinb@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jhb@FreeBSD.org \
    /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).