This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC PATCH 2/3] Add support to catch groups of syscalls.
- From: Sergio Durigan Junior <sergiodj at redhat dot com>
- To: Doug Evans <dje at google dot com>
- Cc: Gabriel Krisman Bertazi <gabriel at krisman dot be>, gdb-patches <gdb-patches at sourceware dot org>
- Date: Wed, 08 Oct 2014 16:06:03 -0400
- Subject: Re: [RFC PATCH 2/3] Add support to catch groups of syscalls.
- Authentication-results: sourceware.org; auth=none
- References: <1412736678-2760-1-git-send-email-gabriel at krisman dot be> <1412736678-2760-3-git-send-email-gabriel at krisman dot be> <87h9zebcsb dot fsf at redhat dot com> <CADPb22Q6Uw0qf9iOBzNHvqn6iRiqx7+c5_HfjGwJB495F0d_tQ at mail dot gmail dot com>
On Wednesday, October 08 2014, Doug Evans wrote:
> Regarding:
>> # catch syscalls write, read, chdir, and groups network and signal
>> (gdb) catch syscall write read chdir -g network,signal
>> # or maybe without comma-separated values for groups, to keep consistency
>> (gdb) catch syscall write read chdir -g network signal
>
> I dislike "network,signal" if we don't also accept "read,write". I
> gather the comma is there to remove ambiguity as to what "-g network
> signal" means.
Yeah.
> I also kinda dislike interpreting "-g" to mean all remaining arguments
> (for a few reasons).
Since there are very few groups (compared to syscalls names), I also
thought that "-g" could be used multiple times, like:
(gdb) catch syscall -g network -g signal
But...
> "catch syscall write -g network" feels clumsy if I can't also do
> something like "catch syscall -g network -s write" or some such).
... this comment also applies even if we consider "-g" to refer to the
next argument.
However, while I understand your feeling that having "-g" without having
"-s" seems odd, I don't think I completely agree. I think that syscall
groups are meta-information, and deserved to be treated differently.
The command name "catch syscall" makes the user understand immediately
what kind of argument the command expects (i.e., a syscall). It would
be weird to make the user need to issue a "-s" to specify a syscall
name.
I am trying to think what would happen if we were talking about
breakpoints and breakpoint groups. I think it would be fairly
reasonable to have a syntax like:
(gdb) break -g mygroup
And not expect something like:
(gdb) break -b function
Do you see what I mean?
> One could just say that syscall names and syscall group names share
> the same namespace, but
> I can imagine a system that happens to have a syscall that is the name
> of a group on another system.
Yes, that is the rationale behind my proposal. And I don't think
syscall group names and syscall names share the same namespace, as
explained above.
> E.g., maybe there's a system where "signal" is a syscall. It's a
> logical name for the group.
> Then if one happened to be unfortunate enough to work with two systems
> where "signal" is a syscall name on one system and a group name on
> another system, I can imagine tripping over the use of the same name
> to mean different things and getting frustrated.
>
> How about appending "-group" or some such to group names?
Hm, it seems OK, but I am thinking about one specific syscall that might
make things confusing here: exit_group(2). Consider:
(gdb) catch syscall signal-group exit_group
This can be very confusing for the user.
> [I don't want to have too long a discussion or be too picky.
> OTOH I also don't want to just pick something and then regret it.]
Yeah, I understand your reasons.
Along the lines of your proposal above, I guess we can add a "g:" prefix
to group names:
(gdb) catch syscall read chdir g:network g:signal signal
WDYT?
--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/