Re: [RFC PATCH 2/3] Add support to catch groups of syscalls.

Sergio Durigan Junior
2014-10-08T20:48:52Z

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