* [RFC PATCH 1/3] Implemement support for groups of syscalls in the xml-syscall interface.
2014-10-08 2:51 [RFC PATCH 0/3] Catch syscall group Gabriel Krisman Bertazi
2014-10-08 2:51 ` [RFC PATCH 2/3] Add support to catch groups of syscalls Gabriel Krisman Bertazi
@ 2014-10-08 2:51 ` Gabriel Krisman Bertazi
2014-10-08 17:21 ` Sergio Durigan Junior
2014-10-08 2:52 ` [RFC PATCH 3/3] Create syscall groups for x86_64 Gabriel Krisman Bertazi
` (2 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: Gabriel Krisman Bertazi @ 2014-10-08 2:51 UTC (permalink / raw)
To: gdb-patches; +Cc: Gabriel Krisman Bertazi
This implements support for groups of syscalls in the xml-syscall
interface.
It is done by maintaining a list of syscall_group_desc for each syscall
group inside the syscalls_info structure. Inside each
syscall_group_desc we have a vector of pointers to the syscalls that are
part of that group.
I also experimented with storing the group info inside each syscall_desc
element, but that wasn't very practical when dealing with syscalls that
are part of more than one group. :)
gdb/
* syscalls/gdb-syscalls.dtd: Include group attribute to the
syscall element.
* xml-syscall.c (get_syscall_names_by_group): New.
(get_syscall_group_names): New.
(struct syscall_group_desc): New structure to store group data.
(struct syscalls_info): Include field to store the group list.
(sysinfo_free_syscall_group_desc): New.
(free_syscalls_info): Free group list.
(syscall_group_create_syscall_group_desc): New.
(syscall_group_add_syscall): New.
(syscall_create_syscall_desc): Add syscall to its groups.
(syscall_start_syscall): Load group attribute.
(syscall_group_get_group_by_name): New.
(xml_list_of_syscalls): Add filter by group name.
(xml_list_of_groups): New.
(get_syscall_names): Call xml_list_of_syscalls with a NULL group
filter string.
* xml-syscall.h (get_syscall_names_by_group): Export function
to retrieve a list of syscalls filtered by the group name.
(get_syscall_group_names): Export function to retrieve the list of
syscall groups.
---
gdb/syscalls/gdb-syscalls.dtd | 1 +
gdb/xml-syscall.c | 183 ++++++++++++++++++++++++++++++++++++++++--
gdb/xml-syscall.h | 12 +++
3 files changed, 190 insertions(+), 6 deletions(-)
diff --git a/gdb/syscalls/gdb-syscalls.dtd b/gdb/syscalls/gdb-syscalls.dtd
index 3ad3625..5255869 100644
--- a/gdb/syscalls/gdb-syscalls.dtd
+++ b/gdb/syscalls/gdb-syscalls.dtd
@@ -10,5 +10,6 @@
<!ELEMENT syscall EMPTY>
<!ATTLIST syscall
+ groups CDATA #OPTIONAL
name CDATA #REQUIRED
number CDATA #REQUIRED>
diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
index 3824468..39d3f02 100644
--- a/gdb/xml-syscall.c
+++ b/gdb/xml-syscall.c
@@ -76,6 +76,20 @@ get_syscall_names (void)
return NULL;
}
+const char **
+get_syscall_names_by_group (const char *group)
+{
+ syscall_warn_user ();
+ return NULL;
+}
+
+const char **
+get_syscall_group_names (void)
+{
+ syscall_warn_user ();
+ return NULL;
+}
+
#else /* ! HAVE_LIBEXPAT */
/* Variable that will hold the last known data-directory. This is useful to
@@ -95,12 +109,29 @@ typedef struct syscall_desc
} *syscall_desc_p;
DEF_VEC_P(syscall_desc_p);
+/* Structure of a syscall group. */
+typedef struct syscall_group_desc
+{
+ /* The group name. */
+
+ char *name;
+
+ /* The syscalls that are part of the group. */
+
+ VEC(syscall_desc_p) *syscalls;
+} *syscall_group_desc_p;
+DEF_VEC_P(syscall_group_desc_p);
+
/* Structure that represents syscalls information. */
struct syscalls_info
{
/* The syscalls. */
VEC(syscall_desc_p) *syscalls;
+
+ /* The syscall groups. */
+
+ VEC(syscall_group_desc_p) *groups;
};
/* Callback data for syscall information parsing. */
@@ -134,17 +165,32 @@ sysinfo_free_syscalls_desc (struct syscall_desc *sd)
}
static void
+sysinfo_free_syscall_group_desc (struct syscall_group_desc *sd)
+{
+ VEC_free (syscall_desc_p, sd->syscalls);
+ xfree (sd->name);
+}
+
+static void
free_syscalls_info (void *arg)
{
struct syscalls_info *sysinfo = arg;
struct syscall_desc *sysdesc;
+ struct syscall_group_desc *groupdesc;
int i;
for (i = 0;
VEC_iterate (syscall_desc_p, sysinfo->syscalls, i, sysdesc);
i++)
sysinfo_free_syscalls_desc (sysdesc);
+
+ for (i = 0;
+ VEC_iterate (syscall_group_desc_p, sysinfo->groups, i, groupdesc);
+ i++)
+ sysinfo_free_syscall_group_desc (groupdesc);
+
VEC_free (syscall_desc_p, sysinfo->syscalls);
+ VEC_free (syscall_group_desc_p, sysinfo->groups);
xfree (sysinfo);
}
@@ -155,15 +201,59 @@ make_cleanup_free_syscalls_info (struct syscalls_info *sysinfo)
return make_cleanup (free_syscalls_info, sysinfo);
}
+static struct syscall_group_desc *
+syscall_group_create_syscall_group_desc (struct syscalls_info *sysinfo,
+ const char *group)
+{
+ struct syscall_group_desc *groupdesc = XCNEW (struct syscall_group_desc);
+
+ groupdesc->name = strdup (group);
+
+ VEC_safe_push (syscall_group_desc_p, sysinfo->groups, groupdesc);
+
+ return groupdesc;
+}
+
+static void
+syscall_group_add_syscall (struct syscalls_info *sysinfo,
+ struct syscall_desc *syscall,
+ const char *group)
+{
+ struct syscall_group_desc *groupdesc;
+ int i;
+
+ /* Search for an existing group. */
+ for (i = 0;
+ VEC_iterate (syscall_group_desc_p, sysinfo->groups, i, groupdesc);
+ i++)
+ if (strcmp (groupdesc->name, group) == 0)
+ break;
+
+ if (groupdesc == NULL)
+ {
+ /* Create new group. */
+ groupdesc = syscall_group_create_syscall_group_desc (sysinfo, group);
+ }
+
+ VEC_safe_push (syscall_desc_p, groupdesc->syscalls, syscall);
+}
+
static void
syscall_create_syscall_desc (struct syscalls_info *sysinfo,
- const char *name, int number)
+ const char *name, int number,
+ char *groups)
{
struct syscall_desc *sysdesc = XCNEW (struct syscall_desc);
+ char *group;
sysdesc->name = xstrdup (name);
sysdesc->number = number;
+ /* Add syscall to its groups. */
+ if (groups != NULL)
+ for (group = strtok (groups, ","); group; group = strtok (NULL, ","))
+ syscall_group_add_syscall (sysinfo, sysdesc, group);
+
VEC_safe_push (syscall_desc_p, sysinfo->syscalls, sysdesc);
}
@@ -179,6 +269,7 @@ syscall_start_syscall (struct gdb_xml_parser *parser,
/* syscall info. */
char *name = NULL;
int number = 0;
+ char *groups = NULL;
len = VEC_length (gdb_xml_value_s, attributes);
@@ -188,13 +279,15 @@ syscall_start_syscall (struct gdb_xml_parser *parser,
name = attrs[i].value;
else if (strcmp (attrs[i].name, "number") == 0)
number = * (ULONGEST *) attrs[i].value;
+ else if (strcmp (attrs[i].name, "groups") == 0)
+ groups = attrs[i].value;
else
internal_error (__FILE__, __LINE__,
_("Unknown attribute name '%s'."), attrs[i].name);
}
gdb_assert (name);
- syscall_create_syscall_desc (data->sysinfo, name, number);
+ syscall_create_syscall_desc (data->sysinfo, name, number, groups);
}
@@ -202,6 +295,7 @@ syscall_start_syscall (struct gdb_xml_parser *parser,
static const struct gdb_xml_attribute syscall_attr[] = {
{ "number", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
{ "name", GDB_XML_AF_NONE, NULL, NULL },
+ { "groups", GDB_XML_AF_OPTIONAL, NULL, NULL },
{ NULL, GDB_XML_AF_NONE, NULL, NULL }
};
@@ -315,6 +409,26 @@ init_sysinfo (void)
my_gdb_datadir = xstrdup (gdb_datadir);
}
+static struct syscall_group_desc *
+syscall_group_get_group_by_name (const struct syscalls_info *sysinfo,
+ const char *group)
+{
+ struct syscall_group_desc *groupdesc;
+ int i;
+
+ if (sysinfo == NULL)
+ return NULL;
+
+ /* Search for existing group. */
+ for (i = 0;
+ VEC_iterate (syscall_group_desc_p, sysinfo->groups, i, groupdesc);
+ i++)
+ if (strcmp (groupdesc->name, group) == 0)
+ return groupdesc;
+
+ return NULL;
+}
+
static int
xml_get_syscall_number (const struct syscalls_info *sysinfo,
const char *syscall_name)
@@ -356,8 +470,10 @@ xml_get_syscall_name (const struct syscalls_info *sysinfo,
}
static const char **
-xml_list_of_syscalls (const struct syscalls_info *sysinfo)
+xml_list_of_syscalls (const struct syscalls_info *sysinfo,
+ const char *group_filter)
{
+ VEC(syscall_desc_p) *syscall_list = NULL;
struct syscall_desc *sysdesc;
const char **names = NULL;
int nsyscalls;
@@ -366,11 +482,26 @@ xml_list_of_syscalls (const struct syscalls_info *sysinfo)
if (sysinfo == NULL)
return NULL;
- nsyscalls = VEC_length (syscall_desc_p, sysinfo->syscalls);
+ if (group_filter == NULL)
+ {
+ /* We use the general list that includes every syscall. */
+ syscall_list = sysinfo->syscalls;
+ }
+ else
+ {
+ struct syscall_group_desc *groupdesc;
+
+ groupdesc = syscall_group_get_group_by_name (sysinfo,
+ group_filter);
+ if (groupdesc != NULL)
+ syscall_list = groupdesc->syscalls;
+ }
+
+ nsyscalls = VEC_length (syscall_desc_p, syscall_list);
names = xmalloc ((nsyscalls + 1) * sizeof (char *));
for (i = 0;
- VEC_iterate (syscall_desc_p, sysinfo->syscalls, i, sysdesc);
+ VEC_iterate (syscall_desc_p, syscall_list, i, sysdesc);
i++)
names[i] = sysdesc->name;
@@ -379,6 +510,30 @@ xml_list_of_syscalls (const struct syscalls_info *sysinfo)
return names;
}
+static const char **
+xml_list_of_groups (const struct syscalls_info *sysinfo)
+{
+ struct syscall_group_desc *groupdesc;
+ const char **names = NULL;
+ int i;
+ int ngroups;
+
+ if (sysinfo == NULL)
+ return NULL;
+
+ ngroups = VEC_length (syscall_group_desc_p, sysinfo->groups);
+ names = xmalloc ((ngroups + 1) * sizeof (char *));
+
+ for (i = 0;
+ VEC_iterate (syscall_group_desc_p, sysinfo->groups, i, groupdesc);
+ i++)
+ names[i] = groupdesc->name;
+
+ names[i] = NULL;
+
+ return names;
+}
+
void
set_xml_syscall_file_name (const char *name)
{
@@ -410,7 +565,23 @@ get_syscall_names (void)
{
init_sysinfo ();
- return xml_list_of_syscalls (sysinfo);
+ return xml_list_of_syscalls (sysinfo, NULL);
+}
+
+const char **
+get_syscall_names_by_group (const char *group)
+{
+ init_sysinfo ();
+
+ return xml_list_of_syscalls (sysinfo, group);
+}
+
+const char **
+get_syscall_group_names (void)
+{
+ init_sysinfo ();
+
+ return xml_list_of_groups (sysinfo);
}
#endif /* ! HAVE_LIBEXPAT */
diff --git a/gdb/xml-syscall.h b/gdb/xml-syscall.h
index dff389d..903a758 100644
--- a/gdb/xml-syscall.h
+++ b/gdb/xml-syscall.h
@@ -47,4 +47,16 @@ void get_syscall_by_name (const char *syscall_name, struct syscall *s);
const char **get_syscall_names (void);
+/* Function used to retrieve the list of syscalls of a given group in
+ the system. If group is NULL, return every syscall. The vector is
+ returned as an array of strings terminated by a NULL element.
+ Returns the list of syscalls of a group, or NULL otherwise. */
+
+const char **get_syscall_names_by_group (const char *group);
+
+/* Function used to retrieve the list of syscall groups in the system.
+ Returns an array of strings terminated by a NULL element. */
+
+const char **get_syscall_group_names (void);
+
#endif /* XML_SYSCALL_H */
--
1.9.3
^ permalink raw reply [flat|nested] 19+ messages in thread
* [RFC PATCH 0/3] Catch syscall group
@ 2014-10-08 2:51 Gabriel Krisman Bertazi
2014-10-08 2:51 ` [RFC PATCH 2/3] Add support to catch groups of syscalls Gabriel Krisman Bertazi
` (4 more replies)
0 siblings, 5 replies; 19+ messages in thread
From: Gabriel Krisman Bertazi @ 2014-10-08 2:51 UTC (permalink / raw)
To: gdb-patches; +Cc: Gabriel Krisman Bertazi
Hello,
This multi-part patch implements on top of the 'catch syscall' command
the ability to catch a group of related syscalls using a single
command.
The idea is to be able to catch a group of syscalls with a single
command, just like we can do with the "-e trace" option in strace. We
separate the syscalls in groups according to their functionality and
allow users to say:
(gdb) catch syscall network
This creates a catchpoint for every network related syscall, such as
bind, accept, connect...
(Please note that adding this feature to GDB was first suggested by Tom
Tromey on PR 15879. :-)
<https://sourceware.org/bugzilla/show_bug.cgi?id=15879>).
Right now, I've created syscall groups only for x86_64 and sorted the
syscalls among them by using the same groups that strace has.
I am sending this as an RFC because I still have a few questions before
proposing this as a patch:
1) Whether a feature like this would be acceptable on GDB?
2) About the command to catch syscall groups: I think it is more
practical to just say "catch syscall network", instead of "catch syscall
group network" or something like that. What would be the GDB way to do
that? (I implemented the former, but I'd be happy to rewrite
this part of the patch.)
3) I think it is nice to have a command to list the syscall groups
available. Maybe by saying "catch syscall group" with no arguments.
What do you think?
4) What kind of documentation should be updated when proposing the
patch? Do I have to update only the GDB manual or should I provide
patches for other documentation as well?
5) Regarding the code design I propose here, do you have any concerns
that I should fix right away before submiting this as a patch? Please
share your thoughts :)
This patch series is divided as follows: Part 1 updates the xml-syscall
interface to support the syscall group feature; Part 2 has the actual
catchpoint code; Finally, Part 3 has the updated x86_64 xml, which
defines the syscall groups for this architecture, and includes tests for
this feature on x86_64.
This presents no regressions on Fedora 20 x86 and x86_64.
Thanks!
Gabriel Krisman Bertazi (3):
Implemement support for groups of syscalls in the xml-syscall
interface.
Add support to catch groups of syscalls.
Create syscall groups for x86_64.
gdb/breakpoint.c | 73 +++++--
gdb/syscalls/amd64-linux.xml | 362 +++++++++++++++----------------
gdb/syscalls/gdb-syscalls.dtd | 1 +
gdb/testsuite/gdb.base/catch-syscall.exp | 25 +++
gdb/xml-syscall.c | 183 +++++++++++++++-
gdb/xml-syscall.h | 12 +
6 files changed, 453 insertions(+), 203 deletions(-)
--
1.9.3
^ permalink raw reply [flat|nested] 19+ messages in thread
* [RFC PATCH 2/3] Add support to catch groups of syscalls.
2014-10-08 2:51 [RFC PATCH 0/3] Catch syscall group Gabriel Krisman Bertazi
@ 2014-10-08 2:51 ` Gabriel Krisman Bertazi
2014-10-08 19:07 ` Sergio Durigan Junior
2014-10-08 2:51 ` [RFC PATCH 1/3] Implemement support for groups of syscalls in the xml-syscall interface Gabriel Krisman Bertazi
` (3 subsequent siblings)
4 siblings, 1 reply; 19+ messages in thread
From: Gabriel Krisman Bertazi @ 2014-10-08 2:51 UTC (permalink / raw)
To: gdb-patches; +Cc: Gabriel Krisman Bertazi
This implements the catchpoint side. While parsing 'catch syscall'
arguments, we verify if the argument is a syscall group and expand it to
a list of syscalls that are part of that group.
gdb/
* breakpoint.c (catch_syscall_split_args): Verify if argument
is a syscall group and expand it to a list of syscalls when
creating catchpoints.
(catch_syscall_completer): Include syscall groups to the list of
word completion.
---
gdb/breakpoint.c | 73 +++++++++++++++++++++++++++++++++++++++++++-------------
1 file changed, 57 insertions(+), 16 deletions(-)
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index e2170b4..5243916 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -12117,22 +12117,50 @@ catch_syscall_split_args (char *arg)
/* Check if the user provided a syscall name or a number. */
syscall_number = (int) strtol (cur_name, &endptr, 0);
if (*endptr == '\0')
- get_syscall_by_number (syscall_number, &s);
+ {
+ get_syscall_by_number (syscall_number, &s);
+
+ /* Ok, it's valid. */
+ VEC_safe_push (int, result, s.number);
+ }
else
{
- /* We have a name. Let's check if it's valid and convert it
- to a number. */
- get_syscall_by_name (cur_name, &s);
-
- if (s.number == UNKNOWN_SYSCALL)
- /* Here we have to issue an error instead of a warning,
- because GDB cannot do anything useful if there's no
- syscall number to be caught. */
+ const char **syscall_list;
+
+ /* If we have a syscall group, expand it to a list of
+ syscalls. */
+ syscall_list = get_syscall_names_by_group (cur_name);
+
+ if (syscall_list == NULL)
error (_("Unknown syscall name '%s'."), cur_name);
- }
- /* Ok, it's valid. */
- VEC_safe_push (int, result, s.number);
+ if (syscall_list[0] == NULL)
+ {
+ /* If syscall_list is empty, cur_name is a syscall name
+ instead of a group. We push it into the group
+ list. */
+ syscall_list[0] = cur_name;
+ syscall_list[1] = NULL;
+ }
+
+ for (i = 0; syscall_list[i]; i++)
+ {
+ get_syscall_by_name (syscall_list[i], &s);
+
+ if (s.number == UNKNOWN_SYSCALL)
+ {
+ /* Here we have to issue an error instead of a warning,
+ because GDB cannot do anything useful if there's no
+ syscall number to be caught. */
+ error (_("Unknown syscall name '%s'."), syscall_list[i]);
+ }
+
+ /* Ok, it's valid. */
+ VEC_safe_push (int, result, s.number);
+ }
+
+ xfree (syscall_list);
+ }
}
discard_cleanups (cleanup);
@@ -15615,11 +15643,24 @@ static VEC (char_ptr) *
catch_syscall_completer (struct cmd_list_element *cmd,
const char *text, const char *word)
{
- const char **list = get_syscall_names ();
- VEC (char_ptr) *retlist
- = (list == NULL) ? NULL : complete_on_enum (list, word, word);
+ VEC (char_ptr) *retlist;
+ const char **syscall_list = get_syscall_names ();
+ const char **group_list = get_syscall_group_names ();
+
+ VEC (char_ptr) *sys_retlist
+ = (syscall_list == NULL) ? NULL : complete_on_enum (syscall_list,
+ word, word);
+
+ VEC (char_ptr) *group_retlist
+ = (group_list == NULL) ? NULL : complete_on_enum (group_list, word, word);
+
+ retlist = VEC_merge (char_ptr, sys_retlist, group_retlist);
+
+ xfree (syscall_list);
+ xfree (group_list);
+ VEC_free (char_ptr, sys_retlist);
+ VEC_free (char_ptr, group_retlist);
- xfree (list);
return retlist;
}
--
1.9.3
^ permalink raw reply [flat|nested] 19+ messages in thread
* [RFC PATCH 3/3] Create syscall groups for x86_64.
2014-10-08 2:51 [RFC PATCH 0/3] Catch syscall group Gabriel Krisman Bertazi
2014-10-08 2:51 ` [RFC PATCH 2/3] Add support to catch groups of syscalls Gabriel Krisman Bertazi
2014-10-08 2:51 ` [RFC PATCH 1/3] Implemement support for groups of syscalls in the xml-syscall interface Gabriel Krisman Bertazi
@ 2014-10-08 2:52 ` Gabriel Krisman Bertazi
2014-10-08 19:00 ` Sergio Durigan Junior
2014-10-08 16:10 ` [RFC PATCH 0/3] Catch syscall group Sergio Durigan Junior
2014-10-08 16:12 ` Doug Evans
4 siblings, 1 reply; 19+ messages in thread
From: Gabriel Krisman Bertazi @ 2014-10-08 2:52 UTC (permalink / raw)
To: gdb-patches; +Cc: Gabriel Krisman Bertazi
This commit introduces the following syscall groups for the x86_64
architecture: memory, ipc, process, descriptor, signal and file.
Please note that the sorting of the syscalls among these several groups
follows the same structure used in strace.
This also introduces tests for catching groups of syscalls on the x86_64
architecture.
gdb/syscalls/
* amd64-linux.xml: Add 'groups' attribute to several syscalls on
x86_64. Create groups memory, ipc, file, descriptor, process
and signal.
gdb/testsuite/
* gdb.base/catch-syscall.exp (do_syscall_tests): Add call
to test_catch_syscall_group.
(test_catch_syscall_group): New.
---
gdb/syscalls/amd64-linux.xml | 362 +++++++++++++++----------------
gdb/testsuite/gdb.base/catch-syscall.exp | 25 +++
2 files changed, 206 insertions(+), 181 deletions(-)
diff --git a/gdb/syscalls/amd64-linux.xml b/gdb/syscalls/amd64-linux.xml
index 6a04218..974c5b5 100644
--- a/gdb/syscalls/amd64-linux.xml
+++ b/gdb/syscalls/amd64-linux.xml
@@ -14,101 +14,101 @@
The file mentioned above belongs to the Linux Kernel. -->
<syscalls_info>
- <syscall name="read" number="0"/>
- <syscall name="write" number="1"/>
- <syscall name="open" number="2"/>
- <syscall name="close" number="3"/>
- <syscall name="stat" number="4"/>
- <syscall name="fstat" number="5"/>
- <syscall name="lstat" number="6"/>
- <syscall name="poll" number="7"/>
- <syscall name="lseek" number="8"/>
- <syscall name="mmap" number="9"/>
- <syscall name="mprotect" number="10"/>
- <syscall name="munmap" number="11"/>
- <syscall name="brk" number="12"/>
- <syscall name="rt_sigaction" number="13"/>
- <syscall name="rt_sigprocmask" number="14"/>
- <syscall name="rt_sigreturn" number="15"/>
- <syscall name="ioctl" number="16"/>
- <syscall name="pread64" number="17"/>
- <syscall name="pwrite64" number="18"/>
- <syscall name="readv" number="19"/>
- <syscall name="writev" number="20"/>
- <syscall name="access" number="21"/>
- <syscall name="pipe" number="22"/>
- <syscall name="select" number="23"/>
+ <syscall name="read" number="0" groups="descriptor"/>
+ <syscall name="write" number="1" groups="descriptor"/>
+ <syscall name="open" number="2" groups="descriptor,file"/>
+ <syscall name="close" number="3" groups="descriptor"/>
+ <syscall name="stat" number="4" groups="file"/>
+ <syscall name="fstat" number="5" groups="descriptor"/>
+ <syscall name="lstat" number="6" groups="file"/>
+ <syscall name="poll" number="7" groups="descriptor"/>
+ <syscall name="lseek" number="8" groups="descriptor"/>
+ <syscall name="mmap" number="9" groups="descriptor,memory"/>
+ <syscall name="mprotect" number="10" groups="memory"/>
+ <syscall name="munmap" number="11" groups="memory"/>
+ <syscall name="brk" number="12" groups="memory"/>
+ <syscall name="rt_sigaction" number="13" groups="signal"/>
+ <syscall name="rt_sigprocmask" number="14" groups="signal"/>
+ <syscall name="rt_sigreturn" number="15" groups="signal"/>
+ <syscall name="ioctl" number="16" groups="descriptor"/>
+ <syscall name="pread64" number="17" groups="descriptor"/>
+ <syscall name="pwrite64" number="18" groups="descriptor"/>
+ <syscall name="readv" number="19" groups="descriptor"/>
+ <syscall name="writev" number="20" groups="descriptor"/>
+ <syscall name="access" number="21" groups="file"/>
+ <syscall name="pipe" number="22" groups="descriptor"/>
+ <syscall name="select" number="23" groups="descriptor"/>
<syscall name="sched_yield" number="24"/>
- <syscall name="mremap" number="25"/>
- <syscall name="msync" number="26"/>
- <syscall name="mincore" number="27"/>
- <syscall name="madvise" number="28"/>
- <syscall name="shmget" number="29"/>
- <syscall name="shmat" number="30"/>
- <syscall name="shmctl" number="31"/>
- <syscall name="dup" number="32"/>
- <syscall name="dup2" number="33"/>
- <syscall name="pause" number="34"/>
+ <syscall name="mremap" number="25" groups="memory"/>
+ <syscall name="msync" number="26" groups="memory"/>
+ <syscall name="mincore" number="27" groups="memory"/>
+ <syscall name="madvise" number="28" groups="memory"/>
+ <syscall name="shmget" number="29" groups="ipc"/>
+ <syscall name="shmat" number="30" groups="memory,ipc"/>
+ <syscall name="shmctl" number="31" groups="ipc"/>
+ <syscall name="dup" number="32" groups="descriptor"/>
+ <syscall name="dup2" number="33" groups="descriptor"/>
+ <syscall name="pause" number="34" groups="signal"/>
<syscall name="nanosleep" number="35"/>
<syscall name="getitimer" number="36"/>
<syscall name="alarm" number="37"/>
<syscall name="setitimer" number="38"/>
<syscall name="getpid" number="39"/>
- <syscall name="sendfile" number="40"/>
- <syscall name="socket" number="41"/>
- <syscall name="connect" number="42"/>
- <syscall name="accept" number="43"/>
- <syscall name="sendto" number="44"/>
- <syscall name="recvfrom" number="45"/>
- <syscall name="sendmsg" number="46"/>
- <syscall name="recvmsg" number="47"/>
- <syscall name="shutdown" number="48"/>
- <syscall name="bind" number="49"/>
- <syscall name="listen" number="50"/>
- <syscall name="getsockname" number="51"/>
- <syscall name="getpeername" number="52"/>
- <syscall name="socketpair" number="53"/>
- <syscall name="setsockopt" number="54"/>
- <syscall name="getsockopt" number="55"/>
- <syscall name="clone" number="56"/>
- <syscall name="fork" number="57"/>
- <syscall name="vfork" number="58"/>
- <syscall name="execve" number="59"/>
- <syscall name="exit" number="60"/>
- <syscall name="wait4" number="61"/>
- <syscall name="kill" number="62"/>
+ <syscall name="sendfile" number="40" groups="network,descriptor"/>
+ <syscall name="socket" number="41" groups="network"/>
+ <syscall name="connect" number="42" groups="network"/>
+ <syscall name="accept" number="43" groups="network"/>
+ <syscall name="sendto" number="44" groups="network"/>
+ <syscall name="recvfrom" number="45" groups="network"/>
+ <syscall name="sendmsg" number="46" groups="network"/>
+ <syscall name="recvmsg" number="47" groups="network"/>
+ <syscall name="shutdown" number="48" groups="network"/>
+ <syscall name="bind" number="49" groups="network"/>
+ <syscall name="listen" number="50" groups="network"/>
+ <syscall name="getsockname" number="51" groups="network"/>
+ <syscall name="getpeername" number="52" groups="network"/>
+ <syscall name="socketpair" number="53" groups="network"/>
+ <syscall name="setsockopt" number="54" groups="network"/>
+ <syscall name="getsockopt" number="55" groups="network"/>
+ <syscall name="clone" number="56" groups="process"/>
+ <syscall name="fork" number="57" groups="process"/>
+ <syscall name="vfork" number="58" groups="process"/>
+ <syscall name="execve" number="59" groups="process,file"/>
+ <syscall name="exit" number="60" groups="process"/>
+ <syscall name="wait4" number="61" groups="process"/>
+ <syscall name="kill" number="62" groups="signal"/>
<syscall name="uname" number="63"/>
- <syscall name="semget" number="64"/>
- <syscall name="semop" number="65"/>
- <syscall name="semctl" number="66"/>
- <syscall name="shmdt" number="67"/>
- <syscall name="msgget" number="68"/>
- <syscall name="msgsnd" number="69"/>
- <syscall name="msgrcv" number="70"/>
- <syscall name="msgctl" number="71"/>
- <syscall name="fcntl" number="72"/>
- <syscall name="flock" number="73"/>
- <syscall name="fsync" number="74"/>
- <syscall name="fdatasync" number="75"/>
- <syscall name="truncate" number="76"/>
- <syscall name="ftruncate" number="77"/>
- <syscall name="getdents" number="78"/>
- <syscall name="getcwd" number="79"/>
- <syscall name="chdir" number="80"/>
- <syscall name="fchdir" number="81"/>
- <syscall name="rename" number="82"/>
- <syscall name="mkdir" number="83"/>
- <syscall name="rmdir" number="84"/>
- <syscall name="creat" number="85"/>
- <syscall name="link" number="86"/>
- <syscall name="unlink" number="87"/>
- <syscall name="symlink" number="88"/>
- <syscall name="readlink" number="89"/>
- <syscall name="chmod" number="90"/>
- <syscall name="fchmod" number="91"/>
- <syscall name="chown" number="92"/>
- <syscall name="fchown" number="93"/>
- <syscall name="lchown" number="94"/>
+ <syscall name="semget" number="64" groups="ipc"/>
+ <syscall name="semop" number="65" groups="ipc"/>
+ <syscall name="semctl" number="66" groups="ipc"/>
+ <syscall name="shmdt" number="67" groups="memory,ipc"/>
+ <syscall name="msgget" number="68" groups="ipc"/>
+ <syscall name="msgsnd" number="69" groups="ipc"/>
+ <syscall name="msgrcv" number="70" groups="ipc"/>
+ <syscall name="msgctl" number="71" groups="ipc"/>
+ <syscall name="fcntl" number="72" groups="descriptor"/>
+ <syscall name="flock" number="73" groups="descriptor"/>
+ <syscall name="fsync" number="74" groups="descriptor"/>
+ <syscall name="fdatasync" number="75" groups="descriptor"/>
+ <syscall name="truncate" number="76" groups="file"/>
+ <syscall name="ftruncate" number="77" groups="descriptor"/>
+ <syscall name="getdents" number="78" groups="descriptor"/>
+ <syscall name="getcwd" number="79" groups="file"/>
+ <syscall name="chdir" number="80" groups="file"/>
+ <syscall name="fchdir" number="81" groups="descriptor"/>
+ <syscall name="rename" number="82" groups="file"/>
+ <syscall name="mkdir" number="83" groups="file"/>
+ <syscall name="rmdir" number="84" groups="file"/>
+ <syscall name="creat" number="85" groups="file,descriptor"/>
+ <syscall name="link" number="86" groups="file"/>
+ <syscall name="unlink" number="87" groups="file"/>
+ <syscall name="symlink" number="88" groups="file"/>
+ <syscall name="readlink" number="89" groups="file"/>
+ <syscall name="chmod" number="90" groups="file"/>
+ <syscall name="fchmod" number="91" groups="descriptor"/>
+ <syscall name="chown" number="92" groups="file"/>
+ <syscall name="fchown" number="93" groups="descriptor"/>
+ <syscall name="lchown" number="94" groups="file"/>
<syscall name="umask" number="95"/>
<syscall name="gettimeofday" number="96"/>
<syscall name="getrlimit" number="97"/>
@@ -141,18 +141,18 @@
<syscall name="getsid" number="124"/>
<syscall name="capget" number="125"/>
<syscall name="capset" number="126"/>
- <syscall name="rt_sigpending" number="127"/>
- <syscall name="rt_sigtimedwait" number="128"/>
- <syscall name="rt_sigqueueinfo" number="129"/>
- <syscall name="rt_sigsuspend" number="130"/>
- <syscall name="sigaltstack" number="131"/>
- <syscall name="utime" number="132"/>
- <syscall name="mknod" number="133"/>
- <syscall name="uselib" number="134"/>
+ <syscall name="rt_sigpending" number="127" groups="signal"/>
+ <syscall name="rt_sigtimedwait" number="128" groups="signal"/>
+ <syscall name="rt_sigqueueinfo" number="129" groups="signal"/>
+ <syscall name="rt_sigsuspend" number="130" groups="signal"/>
+ <syscall name="sigaltstack" number="131" groups="signal"/>
+ <syscall name="utime" number="132" groups="file"/>
+ <syscall name="mknod" number="133" groups="file"/>
+ <syscall name="uselib" number="134" groups="file"/>
<syscall name="personality" number="135"/>
<syscall name="ustat" number="136"/>
- <syscall name="statfs" number="137"/>
- <syscall name="fstatfs" number="138"/>
+ <syscall name="statfs" number="137" groups="file"/>
+ <syscall name="fstatfs" number="138" groups="descriptor"/>
<syscall name="sysfs" number="139"/>
<syscall name="getpriority" number="140"/>
<syscall name="setpriority" number="141"/>
@@ -163,26 +163,26 @@
<syscall name="sched_get_priority_max" number="146"/>
<syscall name="sched_get_priority_min" number="147"/>
<syscall name="sched_rr_get_interval" number="148"/>
- <syscall name="mlock" number="149"/>
- <syscall name="munlock" number="150"/>
- <syscall name="mlockall" number="151"/>
- <syscall name="munlockall" number="152"/>
+ <syscall name="mlock" number="149" groups="memory"/>
+ <syscall name="munlock" number="150" groups="memory"/>
+ <syscall name="mlockall" number="151" groups="memory"/>
+ <syscall name="munlockall" number="152" groups="memory"/>
<syscall name="vhangup" number="153"/>
<syscall name="modify_ldt" number="154"/>
- <syscall name="pivot_root" number="155"/>
+ <syscall name="pivot_root" number="155" groups="file"/>
<syscall name="_sysctl" number="156"/>
<syscall name="prctl" number="157"/>
- <syscall name="arch_prctl" number="158"/>
+ <syscall name="arch_prctl" number="158" groups="process"/>
<syscall name="adjtimex" number="159"/>
<syscall name="setrlimit" number="160"/>
- <syscall name="chroot" number="161"/>
+ <syscall name="chroot" number="161" groups="file"/>
<syscall name="sync" number="162"/>
- <syscall name="acct" number="163"/>
+ <syscall name="acct" number="163" groups="file"/>
<syscall name="settimeofday" number="164"/>
- <syscall name="mount" number="165"/>
- <syscall name="umount2" number="166"/>
- <syscall name="swapon" number="167"/>
- <syscall name="swapoff" number="168"/>
+ <syscall name="mount" number="165" groups="file"/>
+ <syscall name="umount2" number="166" groups="file"/>
+ <syscall name="swapon" number="167" groups="file"/>
+ <syscall name="swapoff" number="168" groups="file"/>
<syscall name="reboot" number="169"/>
<syscall name="sethostname" number="170"/>
<syscall name="setdomainname" number="171"/>
@@ -193,7 +193,7 @@
<syscall name="delete_module" number="176"/>
<syscall name="get_kernel_syms" number="177"/>
<syscall name="query_module" number="178"/>
- <syscall name="quotactl" number="179"/>
+ <syscall name="quotactl" number="179" groups="file"/>
<syscall name="nfsservctl" number="180"/>
<syscall name="getpmsg" number="181"/>
<syscall name="putpmsg" number="182"/>
@@ -201,20 +201,20 @@
<syscall name="tuxcall" number="184"/>
<syscall name="security" number="185"/>
<syscall name="gettid" number="186"/>
- <syscall name="readahead" number="187"/>
- <syscall name="setxattr" number="188"/>
- <syscall name="lsetxattr" number="189"/>
- <syscall name="fsetxattr" number="190"/>
- <syscall name="getxattr" number="191"/>
- <syscall name="lgetxattr" number="192"/>
- <syscall name="fgetxattr" number="193"/>
- <syscall name="listxattr" number="194"/>
- <syscall name="llistxattr" number="195"/>
- <syscall name="flistxattr" number="196"/>
- <syscall name="removexattr" number="197"/>
- <syscall name="lremovexattr" number="198"/>
- <syscall name="fremovexattr" number="199"/>
- <syscall name="tkill" number="200"/>
+ <syscall name="readahead" number="187" groups="descriptor"/>
+ <syscall name="setxattr" number="188" groups="file"/>
+ <syscall name="lsetxattr" number="189" groups="file"/>
+ <syscall name="fsetxattr" number="190" groups="descriptor"/>
+ <syscall name="getxattr" number="191" groups="file"/>
+ <syscall name="lgetxattr" number="192" groups="file"/>
+ <syscall name="fgetxattr" number="193" groups="descriptor"/>
+ <syscall name="listxattr" number="194" groups="file"/>
+ <syscall name="llistxattr" number="195" groups="file"/>
+ <syscall name="flistxattr" number="196" groups="descriptor"/>
+ <syscall name="removexattr" number="197" groups="file"/>
+ <syscall name="lremovexattr" number="198" groups="file"/>
+ <syscall name="fremovexattr" number="199" groups="descriptor"/>
+ <syscall name="tkill" number="200" groups="signal"/>
<syscall name="time" number="201"/>
<syscall name="futex" number="202"/>
<syscall name="sched_setaffinity" number="203"/>
@@ -227,15 +227,15 @@
<syscall name="io_cancel" number="210"/>
<syscall name="get_thread_area" number="211"/>
<syscall name="lookup_dcookie" number="212"/>
- <syscall name="epoll_create" number="213"/>
+ <syscall name="epoll_create" number="213" groups="descriptor"/>
<syscall name="epoll_ctl_old" number="214"/>
<syscall name="epoll_wait_old" number="215"/>
- <syscall name="remap_file_pages" number="216"/>
- <syscall name="getdents64" number="217"/>
+ <syscall name="remap_file_pages" number="216" groups="memory"/>
+ <syscall name="getdents64" number="217" groups="descriptor"/>
<syscall name="set_tid_address" number="218"/>
<syscall name="restart_syscall" number="219"/>
- <syscall name="semtimedop" number="220"/>
- <syscall name="fadvise64" number="221"/>
+ <syscall name="semtimedop" number="220" groups="ipc"/>
+ <syscall name="fadvise64" number="221" groups="descriptor"/>
<syscall name="timer_create" number="222"/>
<syscall name="timer_settime" number="223"/>
<syscall name="timer_gettime" number="224"/>
@@ -245,15 +245,15 @@
<syscall name="clock_gettime" number="228"/>
<syscall name="clock_getres" number="229"/>
<syscall name="clock_nanosleep" number="230"/>
- <syscall name="exit_group" number="231"/>
- <syscall name="epoll_wait" number="232"/>
- <syscall name="epoll_ctl" number="233"/>
- <syscall name="tgkill" number="234"/>
- <syscall name="utimes" number="235"/>
+ <syscall name="exit_group" number="231" groups="process"/>
+ <syscall name="epoll_wait" number="232" groups="descriptor"/>
+ <syscall name="epoll_ctl" number="233" groups="descriptor"/>
+ <syscall name="tgkill" number="234" groups="signal"/>
+ <syscall name="utimes" number="235" groups="file"/>
<syscall name="vserver" number="236"/>
- <syscall name="mbind" number="237"/>
- <syscall name="set_mempolicy" number="238"/>
- <syscall name="get_mempolicy" number="239"/>
+ <syscall name="mbind" number="237" groups="memory"/>
+ <syscall name="set_mempolicy" number="238" groups="memory"/>
+ <syscall name="get_mempolicy" number="239" groups="memory"/>
<syscall name="mq_open" number="240"/>
<syscall name="mq_unlink" number="241"/>
<syscall name="mq_timedsend" number="242"/>
@@ -261,54 +261,54 @@
<syscall name="mq_notify" number="244"/>
<syscall name="mq_getsetattr" number="245"/>
<syscall name="kexec_load" number="246"/>
- <syscall name="waitid" number="247"/>
+ <syscall name="waitid" number="247" groups="process"/>
<syscall name="add_key" number="248"/>
<syscall name="request_key" number="249"/>
<syscall name="keyctl" number="250"/>
<syscall name="ioprio_set" number="251"/>
<syscall name="ioprio_get" number="252"/>
- <syscall name="inotify_init" number="253"/>
- <syscall name="inotify_add_watch" number="254"/>
- <syscall name="inotify_rm_watch" number="255"/>
- <syscall name="migrate_pages" number="256"/>
- <syscall name="openat" number="257"/>
- <syscall name="mkdirat" number="258"/>
- <syscall name="mknodat" number="259"/>
- <syscall name="fchownat" number="260"/>
- <syscall name="futimesat" number="261"/>
- <syscall name="newfstatat" number="262"/>
- <syscall name="unlinkat" number="263"/>
- <syscall name="renameat" number="264"/>
- <syscall name="linkat" number="265"/>
- <syscall name="symlinkat" number="266"/>
- <syscall name="readlinkat" number="267"/>
- <syscall name="fchmodat" number="268"/>
- <syscall name="faccessat" number="269"/>
- <syscall name="pselect6" number="270"/>
- <syscall name="ppoll" number="271"/>
- <syscall name="unshare" number="272"/>
+ <syscall name="inotify_init" number="253" groups="descriptor"/>
+ <syscall name="inotify_add_watch" number="254" groups="descriptor"/>
+ <syscall name="inotify_rm_watch" number="255" groups="descriptor"/>
+ <syscall name="migrate_pages" number="256" groups="memory"/>
+ <syscall name="openat" number="257" groups="file,descriptor"/>
+ <syscall name="mkdirat" number="258" groups="file,descriptor"/>
+ <syscall name="mknodat" number="259" groups="file,descriptor"/>
+ <syscall name="fchownat" number="260" groups="file,descriptor"/>
+ <syscall name="futimesat" number="261" groups="file,descriptor"/>
+ <syscall name="newfstatat" number="262" groups="file,descriptor"/>
+ <syscall name="unlinkat" number="263" groups="file,descriptor"/>
+ <syscall name="renameat" number="264" groups="file,descriptor"/>
+ <syscall name="linkat" number="265" groups="file,descriptor"/>
+ <syscall name="symlinkat" number="266" groups="file,descriptor"/>
+ <syscall name="readlinkat" number="267" groups="file,descriptor"/>
+ <syscall name="fchmodat" number="268" groups="file,descriptor"/>
+ <syscall name="faccessat" number="269" groups="file,descriptor"/>
+ <syscall name="pselect6" number="270" groups="descriptor"/>
+ <syscall name="ppoll" number="271" groups="descriptor"/>
+ <syscall name="unshare" number="272" groups="process"/>
<syscall name="set_robust_list" number="273"/>
<syscall name="get_robust_list" number="274"/>
- <syscall name="splice" number="275"/>
- <syscall name="tee" number="276"/>
- <syscall name="sync_file_range" number="277"/>
- <syscall name="vmsplice" number="278"/>
- <syscall name="move_pages" number="279"/>
- <syscall name="utimensat" number="280"/>
- <syscall name="epoll_pwait" number="281"/>
- <syscall name="signalfd" number="282"/>
- <syscall name="timerfd_create" number="283"/>
- <syscall name="eventfd" number="284"/>
- <syscall name="fallocate" number="285"/>
- <syscall name="timerfd_settime" number="286"/>
- <syscall name="timerfd_gettime" number="287"/>
- <syscall name="accept4" number="288"/>
- <syscall name="signalfd4" number="289"/>
- <syscall name="eventfd2" number="290"/>
- <syscall name="epoll_create1" number="291"/>
- <syscall name="dup3" number="292"/>
- <syscall name="pipe2" number="293"/>
- <syscall name="inotify_init1" number="294"/>
- <syscall name="preadv" number="295"/>
- <syscall name="pwritev" number="296"/>
+ <syscall name="splice" number="275" groups="descriptor"/>
+ <syscall name="tee" number="276" groups="descriptor"/>
+ <syscall name="sync_file_range" number="277" groups="descriptor"/>
+ <syscall name="vmsplice" number="278" groups="descriptor"/>
+ <syscall name="move_pages" number="279" groups="memory"/>
+ <syscall name="utimensat" number="280" groups="file,descriptor"/>
+ <syscall name="epoll_pwait" number="281" groups="descriptor"/>
+ <syscall name="signalfd" number="282" groups="signal,descriptor"/>
+ <syscall name="timerfd_create" number="283" groups="descriptor"/>
+ <syscall name="eventfd" number="284" groups="descriptor"/>
+ <syscall name="fallocate" number="285" groups="descriptor"/>
+ <syscall name="timerfd_settime" number="286" groups="descriptor"/>
+ <syscall name="timerfd_gettime" number="287" groups="descriptor"/>
+ <syscall name="accept4" number="288" groups="network"/>
+ <syscall name="signalfd4" number="289" groups="signal,descriptor"/>
+ <syscall name="eventfd2" number="290" groups="descriptor"/>
+ <syscall name="epoll_create1" number="291" groups="descriptor"/>
+ <syscall name="dup3" number="292" groups="descriptor"/>
+ <syscall name="pipe2" number="293" groups="descriptor"/>
+ <syscall name="inotify_init1" number="294" groups="descriptor"/>
+ <syscall name="preadv" number="295" groups="descriptor"/>
+ <syscall name="pwritev" number="296" groups="descriptor"/>
</syscalls_info>
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
index a70534c..93117cc 100644
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
@@ -275,6 +275,28 @@ proc test_catch_syscall_fail_nodatadir {} {
}
}
+proc test_catch_syscall_group {} {
+ global decimal
+
+ # Until we have syscall groups to test on other targets.
+ if { ![istarget "x86_64-*-linux*"] } then {
+ return
+ }
+ set sysnum "\\\[\[0-9\]+\\\]"
+
+ gdb_test "catch syscall process" \
+ "Catchpoint $decimal \\(syscalls (\'(clone|fork|execve|exit)\' $sysnum)+.*" \
+ "set catchpoint on a group of syscalls"
+
+ gdb_test "catch syscall process read" \
+ "Catchpoint $decimal \\(syscalls (\'(clone|fork|execve|exit)\' $sysnum)+.*read.*\\)" \
+ "set catchpoints on a group of syscalls and on a single syscall"
+
+ gdb_test "complete catch syscall proc" \
+ "catch syscall process" \
+ "complete catch syscall group"
+}
+
proc do_syscall_tests {} {
# NOTE: We don't have to point gdb at the correct data-directory.
# For the build tree that is handled by INTERNAL_GDBFLAGS.
@@ -311,6 +333,9 @@ proc do_syscall_tests {} {
# Testing the 'catch' syscall command during a restart of
# the inferior.
if [runto_main] then { test_catch_syscall_restarting_inferior }
+
+ # Testing the 'catch' syscall command for a group of syscalls.
+ if [runto_main] then { test_catch_syscall_group }
}
proc test_catch_syscall_without_args_noxml {} {
--
1.9.3
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 0/3] Catch syscall group
2014-10-08 2:51 [RFC PATCH 0/3] Catch syscall group Gabriel Krisman Bertazi
` (2 preceding siblings ...)
2014-10-08 2:52 ` [RFC PATCH 3/3] Create syscall groups for x86_64 Gabriel Krisman Bertazi
@ 2014-10-08 16:10 ` Sergio Durigan Junior
2014-10-12 21:12 ` Gabriel Krisman Bertazi
2014-10-08 16:12 ` Doug Evans
4 siblings, 1 reply; 19+ messages in thread
From: Sergio Durigan Junior @ 2014-10-08 16:10 UTC (permalink / raw)
To: Gabriel Krisman Bertazi; +Cc: gdb-patches
On Tuesday, October 07 2014, Gabriel Krisman Bertazi wrote:
> Hello,
>
> This multi-part patch implements on top of the 'catch syscall' command
> the ability to catch a group of related syscalls using a single
> command.
Thanks for the patch :-).
> The idea is to be able to catch a group of syscalls with a single
> command, just like we can do with the "-e trace" option in strace. We
> separate the syscalls in groups according to their functionality and
> allow users to say:
>
> (gdb) catch syscall network
>
> This creates a catchpoint for every network related syscall, such as
> bind, accept, connect...
As we have talked before, I think it would be nice if "catch syscall"
took an argument in this case, specifying that you are going to pass
groups to it.
# catch syscall group network
(gdb) catch syscall -g network
This syntax could also be expanded for when the user wants to provide a
group *and* a syscall to be caught:
# catch syscall write and group network
(gdb) catch syscall write -g network
And also for when the user wants to specify multiple syscalls and/or
groups:
# 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
> (Please note that adding this feature to GDB was first suggested by Tom
> Tromey on PR 15879. :-)
> <https://sourceware.org/bugzilla/show_bug.cgi?id=15879>).
It is good to mention the bug in the ChangeLog, even if you are not
directly fixing it.
> Right now, I've created syscall groups only for x86_64 and sorted the
> syscalls among them by using the same groups that strace has.
I will make comments in the patch itself, but it would be nice if you
could do that for the other existing XML files as well. You didn't
mention if you intend to do so or not.
I know it will be kind of boring, but unfortunately those XML files are
not being really maintained nowadays (a problem I intend to address soon
with some patches and proposals), so if you don't touch those files now
they will probably be forgotten for quite some time...
However, this is just a request, so if you don't have the time to do
that now I'd still vote for including this feature on GDB.
> I am sending this as an RFC because I still have a few questions before
> proposing this as a patch:
>
> 1) Whether a feature like this would be acceptable on GDB?
Certainly.
> 2) About the command to catch syscall groups: I think it is more
> practical to just say "catch syscall network", instead of "catch syscall
> group network" or something like that. What would be the GDB way to do
> that? (I implemented the former, but I'd be happy to rewrite
> this part of the patch.)
I think I covered this question above, but the "de facto" way is to
implement parameters to be passed to commands. In this case, "-g GROUP"
would be the best approach, IMO.
I think providing the group name without having some specifier like "-g"
can be very confusing to the users.
> 3) I think it is nice to have a command to list the syscall groups
> available. Maybe by saying "catch syscall group" with no arguments.
> What do you think?
I agree it is nice to have such a command. And since I proposed using
"-g", I guess just "catch syscall -g" should list the available groups.
> 4) What kind of documentation should be updated when proposing the
> patch? Do I have to update only the GDB manual or should I provide
> patches for other documentation as well?
You need to update:
- doc/gdb.texinfo (the GDB official manual), specifically in the part of
the "catch syscall" command (search for "catch syscall", it will be
the first match). As you will see, this part contains several
examples of how to use the command, so you will want to add one or
more examples of the group feature there as well.
- gdb/NEWS, mentioning the new feature for "catch syscall"
- gdb/breakpoint.c:_initialize_breakpoint, specifically the part that
adds the "catch syscall" command (search for add_catch_command
("syscall"). There, you will see the help string that gets printed
when the user issues a "help catch syscall". You will need to mention
the new arguments there. Look for BREAK_ARGS_HELP if you want to see
some examples.
> 5) Regarding the code design I propose here, do you have any concerns
> that I should fix right away before submiting this as a patch? Please
> share your thoughts :)
I will comment on each patch separately :-).
> This patch series is divided as follows: Part 1 updates the xml-syscall
> interface to support the syscall group feature; Part 2 has the actual
> catchpoint code; Finally, Part 3 has the updated x86_64 xml, which
> defines the syscall groups for this architecture, and includes tests for
> this feature on x86_64.
Thanks for splitting the patch!
Cheers,
--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 0/3] Catch syscall group
2014-10-08 2:51 [RFC PATCH 0/3] Catch syscall group Gabriel Krisman Bertazi
` (3 preceding siblings ...)
2014-10-08 16:10 ` [RFC PATCH 0/3] Catch syscall group Sergio Durigan Junior
@ 2014-10-08 16:12 ` Doug Evans
4 siblings, 0 replies; 19+ messages in thread
From: Doug Evans @ 2014-10-08 16:12 UTC (permalink / raw)
To: Gabriel Krisman Bertazi; +Cc: gdb-patches
On Tue, Oct 7, 2014 at 10:51 PM, Gabriel Krisman Bertazi
<gabriel@krisman.be> wrote:
> Hello,
>
> This multi-part patch implements on top of the 'catch syscall' command
> the ability to catch a group of related syscalls using a single
> command.
>
> The idea is to be able to catch a group of syscalls with a single
> command, just like we can do with the "-e trace" option in strace. We
> separate the syscalls in groups according to their functionality and
> allow users to say:
>
> (gdb) catch syscall network
>
> This creates a catchpoint for every network related syscall, such as
> bind, accept, connect...
>
> (Please note that adding this feature to GDB was first suggested by Tom
> Tromey on PR 15879. :-)
> <https://sourceware.org/bugzilla/show_bug.cgi?id=15879>).
>
> Right now, I've created syscall groups only for x86_64 and sorted the
> syscalls among them by using the same groups that strace has.
>
> I am sending this as an RFC because I still have a few questions before
> proposing this as a patch:
>
> 1) Whether a feature like this would be acceptable on GDB?
I think so.
> 2) About the command to catch syscall groups: I think it is more
> practical to just say "catch syscall network", instead of "catch syscall
> group network" or something like that. What would be the GDB way to do
> that? (I implemented the former, but I'd be happy to rewrite
> this part of the patch.)
I dunno. I think I prefer "catch syscall-group ...".
> 3) I think it is nice to have a command to list the syscall groups
> available. Maybe by saying "catch syscall group" with no arguments.
> What do you think?
It's too bad "catch syscall" catches any syscall, then "catch syscall"
could list them all. :-)
[To catch any syscall I'd have been ok with "catch syscall all".
Probably too late though - we certainly can't change the meaning of
"catch syscall".]
Playing around I found "complete catch syscall ." is a workaround.
Other non-alnum characters work too. I'm not suggesting this as a
proper solution. :-)
And it's probably a bug we should fix. :-)
I think we do need a solution to this though. At least in the case of
syscalls themselves, there's too many to include in the output of
"help catch syscall".
> 4) What kind of documentation should be updated when proposing the
> patch? Do I have to update only the GDB manual or should I provide
> patches for other documentation as well?
doc/gdb.texinfo and NEWS
> 5) Regarding the code design I propose here, do you have any concerns
> that I should fix right away before submiting this as a patch? Please
> share your thoughts :)
Have to spend a bit more time on this.
I thought we'd get some high level details ironed out first (in an
attempt to save you some typing).
> This patch series is divided as follows: Part 1 updates the xml-syscall
> interface to support the syscall group feature; Part 2 has the actual
> catchpoint code; Finally, Part 3 has the updated x86_64 xml, which
> defines the syscall groups for this architecture, and includes tests for
> this feature on x86_64.
>
> This presents no regressions on Fedora 20 x86 and x86_64.
>
> Thanks!
>
> Gabriel Krisman Bertazi (3):
> Implemement support for groups of syscalls in the xml-syscall
> interface.
> Add support to catch groups of syscalls.
> Create syscall groups for x86_64.
>
> gdb/breakpoint.c | 73 +++++--
> gdb/syscalls/amd64-linux.xml | 362 +++++++++++++++----------------
> gdb/syscalls/gdb-syscalls.dtd | 1 +
> gdb/testsuite/gdb.base/catch-syscall.exp | 25 +++
> gdb/xml-syscall.c | 183 +++++++++++++++-
> gdb/xml-syscall.h | 12 +
> 6 files changed, 453 insertions(+), 203 deletions(-)
>
> --
> 1.9.3
>
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 1/3] Implemement support for groups of syscalls in the xml-syscall interface.
2014-10-08 2:51 ` [RFC PATCH 1/3] Implemement support for groups of syscalls in the xml-syscall interface Gabriel Krisman Bertazi
@ 2014-10-08 17:21 ` Sergio Durigan Junior
0 siblings, 0 replies; 19+ messages in thread
From: Sergio Durigan Junior @ 2014-10-08 17:21 UTC (permalink / raw)
To: Gabriel Krisman Bertazi; +Cc: gdb-patches
On Tuesday, October 07 2014, Gabriel Krisman Bertazi wrote:
> This implements support for groups of syscalls in the xml-syscall
> interface.
>
> It is done by maintaining a list of syscall_group_desc for each syscall
> group inside the syscalls_info structure. Inside each
> syscall_group_desc we have a vector of pointers to the syscalls that are
> part of that group.
>
> I also experimented with storing the group info inside each syscall_desc
> element, but that wasn't very practical when dealing with syscalls that
> are part of more than one group. :)
Thanks.
I think creating the syscall_desc list is the best approach in this case
indeed. I have other comments about the code, while I am at it.
> gdb/
>
> * syscalls/gdb-syscalls.dtd: Include group attribute to the
> syscall element.
> * xml-syscall.c (get_syscall_names_by_group): New.
> (get_syscall_group_names): New.
> (struct syscall_group_desc): New structure to store group data.
> (struct syscalls_info): Include field to store the group list.
> (sysinfo_free_syscall_group_desc): New.
> (free_syscalls_info): Free group list.
> (syscall_group_create_syscall_group_desc): New.
> (syscall_group_add_syscall): New.
> (syscall_create_syscall_desc): Add syscall to its groups.
> (syscall_start_syscall): Load group attribute.
> (syscall_group_get_group_by_name): New.
> (xml_list_of_syscalls): Add filter by group name.
> (xml_list_of_groups): New.
> (get_syscall_names): Call xml_list_of_syscalls with a NULL group
> filter string.
> * xml-syscall.h (get_syscall_names_by_group): Export function
> to retrieve a list of syscalls filtered by the group name.
> (get_syscall_group_names): Export function to retrieve the list of
> syscall groups.
Heh, you're being too descriptive in the ChangeLog :-). There is no
need to describe exactly what a function does, for example. So you
could write:
* xml-syscall.h (get_syscall_names_by_group): New prototype.
Anyway, this is just a comment to save you some time; I don't mind
having more information on the ChangeLog entry.
> ---
> gdb/syscalls/gdb-syscalls.dtd | 1 +
> gdb/xml-syscall.c | 183 ++++++++++++++++++++++++++++++++++++++++--
> gdb/xml-syscall.h | 12 +++
> 3 files changed, 190 insertions(+), 6 deletions(-)
>
> diff --git a/gdb/syscalls/gdb-syscalls.dtd b/gdb/syscalls/gdb-syscalls.dtd
> index 3ad3625..5255869 100644
> --- a/gdb/syscalls/gdb-syscalls.dtd
> +++ b/gdb/syscalls/gdb-syscalls.dtd
> @@ -10,5 +10,6 @@
>
> <!ELEMENT syscall EMPTY>
> <!ATTLIST syscall
> + groups CDATA #OPTIONAL
> name CDATA #REQUIRED
> number CDATA #REQUIRED>
Just a nitpicking from me, but I'd prefer if you put "groups" below
"number", obeying the "natural" order of the fields inside the tag.
> diff --git a/gdb/xml-syscall.c b/gdb/xml-syscall.c
> index 3824468..39d3f02 100644
> --- a/gdb/xml-syscall.c
> +++ b/gdb/xml-syscall.c
> @@ -76,6 +76,20 @@ get_syscall_names (void)
> return NULL;
> }
>
> +const char **
> +get_syscall_names_by_group (const char *group)
> +{
> + syscall_warn_user ();
> + return NULL;
> +}
> +
> +const char **
> +get_syscall_group_names (void)
> +{
> + syscall_warn_user ();
> + return NULL;
> +}
I know you are following the pattern you see in this file, and I truly
apologize because I wrote it, but I would love if you could put comments
on each new function you create in the file. I really intend to do a
revamp on this file "soon", but meanwhile it would be great if new
additions to it followed our best coding style :-).
> +
> #else /* ! HAVE_LIBEXPAT */
>
> /* Variable that will hold the last known data-directory. This is useful to
> @@ -95,12 +109,29 @@ typedef struct syscall_desc
> } *syscall_desc_p;
> DEF_VEC_P(syscall_desc_p);
>
> +/* Structure of a syscall group. */
> +typedef struct syscall_group_desc
> +{
> + /* The group name. */
> +
> + char *name;
> +
> + /* The syscalls that are part of the group. */
> +
> + VEC(syscall_desc_p) *syscalls;
> +} *syscall_group_desc_p;
> +DEF_VEC_P(syscall_group_desc_p);
> +
> /* Structure that represents syscalls information. */
> struct syscalls_info
> {
> /* The syscalls. */
>
> VEC(syscall_desc_p) *syscalls;
> +
> + /* The syscall groups. */
> +
> + VEC(syscall_group_desc_p) *groups;
> };
>
> /* Callback data for syscall information parsing. */
> @@ -134,17 +165,32 @@ sysinfo_free_syscalls_desc (struct syscall_desc *sd)
> }
>
> static void
> +sysinfo_free_syscall_group_desc (struct syscall_group_desc *sd)
> +{
> + VEC_free (syscall_desc_p, sd->syscalls);
> + xfree (sd->name);
> +}
> +
> +static void
> free_syscalls_info (void *arg)
> {
> struct syscalls_info *sysinfo = arg;
> struct syscall_desc *sysdesc;
> + struct syscall_group_desc *groupdesc;
> int i;
>
> for (i = 0;
> VEC_iterate (syscall_desc_p, sysinfo->syscalls, i, sysdesc);
> i++)
> sysinfo_free_syscalls_desc (sysdesc);
> +
> + for (i = 0;
> + VEC_iterate (syscall_group_desc_p, sysinfo->groups, i, groupdesc);
> + i++)
> + sysinfo_free_syscall_group_desc (groupdesc);
> +
> VEC_free (syscall_desc_p, sysinfo->syscalls);
> + VEC_free (syscall_group_desc_p, sysinfo->groups);
>
> xfree (sysinfo);
> }
> @@ -155,15 +201,59 @@ make_cleanup_free_syscalls_info (struct syscalls_info *sysinfo)
> return make_cleanup (free_syscalls_info, sysinfo);
> }
>
> +static struct syscall_group_desc *
> +syscall_group_create_syscall_group_desc (struct syscalls_info *sysinfo,
> + const char *group)
> +{
> + struct syscall_group_desc *groupdesc = XCNEW (struct syscall_group_desc);
> +
> + groupdesc->name = strdup (group);
Use xstrdup here.
> +
> + VEC_safe_push (syscall_group_desc_p, sysinfo->groups, groupdesc);
> +
> + return groupdesc;
> +}
> +
> +static void
> +syscall_group_add_syscall (struct syscalls_info *sysinfo,
> + struct syscall_desc *syscall,
> + const char *group)
> +{
> + struct syscall_group_desc *groupdesc;
> + int i;
> +
> + /* Search for an existing group. */
> + for (i = 0;
> + VEC_iterate (syscall_group_desc_p, sysinfo->groups, i, groupdesc);
> + i++)
> + if (strcmp (groupdesc->name, group) == 0)
> + break;
> +
> + if (groupdesc == NULL)
> + {
> + /* Create new group. */
> + groupdesc = syscall_group_create_syscall_group_desc (sysinfo, group);
> + }
> +
> + VEC_safe_push (syscall_desc_p, groupdesc->syscalls, syscall);
> +}
> +
> static void
> syscall_create_syscall_desc (struct syscalls_info *sysinfo,
> - const char *name, int number)
> + const char *name, int number,
> + char *groups)
> {
> struct syscall_desc *sysdesc = XCNEW (struct syscall_desc);
> + char *group;
>
> sysdesc->name = xstrdup (name);
> sysdesc->number = number;
>
> + /* Add syscall to its groups. */
> + if (groups != NULL)
> + for (group = strtok (groups, ","); group; group = strtok (NULL, ","))
> + syscall_group_add_syscall (sysinfo, sysdesc, group);
> +
> VEC_safe_push (syscall_desc_p, sysinfo->syscalls, sysdesc);
> }
>
> @@ -179,6 +269,7 @@ syscall_start_syscall (struct gdb_xml_parser *parser,
> /* syscall info. */
> char *name = NULL;
> int number = 0;
> + char *groups = NULL;
>
> len = VEC_length (gdb_xml_value_s, attributes);
>
> @@ -188,13 +279,15 @@ syscall_start_syscall (struct gdb_xml_parser *parser,
> name = attrs[i].value;
> else if (strcmp (attrs[i].name, "number") == 0)
> number = * (ULONGEST *) attrs[i].value;
> + else if (strcmp (attrs[i].name, "groups") == 0)
> + groups = attrs[i].value;
> else
> internal_error (__FILE__, __LINE__,
> _("Unknown attribute name '%s'."), attrs[i].name);
> }
>
> gdb_assert (name);
> - syscall_create_syscall_desc (data->sysinfo, name, number);
> + syscall_create_syscall_desc (data->sysinfo, name, number, groups);
> }
>
>
> @@ -202,6 +295,7 @@ syscall_start_syscall (struct gdb_xml_parser *parser,
> static const struct gdb_xml_attribute syscall_attr[] = {
> { "number", GDB_XML_AF_NONE, gdb_xml_parse_attr_ulongest, NULL },
> { "name", GDB_XML_AF_NONE, NULL, NULL },
> + { "groups", GDB_XML_AF_OPTIONAL, NULL, NULL },
> { NULL, GDB_XML_AF_NONE, NULL, NULL }
> };
>
> @@ -315,6 +409,26 @@ init_sysinfo (void)
> my_gdb_datadir = xstrdup (gdb_datadir);
> }
>
> +static struct syscall_group_desc *
> +syscall_group_get_group_by_name (const struct syscalls_info *sysinfo,
> + const char *group)
> +{
> + struct syscall_group_desc *groupdesc;
> + int i;
> +
> + if (sysinfo == NULL)
> + return NULL;
> +
> + /* Search for existing group. */
> + for (i = 0;
> + VEC_iterate (syscall_group_desc_p, sysinfo->groups, i, groupdesc);
> + i++)
> + if (strcmp (groupdesc->name, group) == 0)
> + return groupdesc;
> +
> + return NULL;
> +}
> +
> static int
> xml_get_syscall_number (const struct syscalls_info *sysinfo,
> const char *syscall_name)
> @@ -356,8 +470,10 @@ xml_get_syscall_name (const struct syscalls_info *sysinfo,
> }
>
> static const char **
> -xml_list_of_syscalls (const struct syscalls_info *sysinfo)
> +xml_list_of_syscalls (const struct syscalls_info *sysinfo,
> + const char *group_filter)
> {
> + VEC(syscall_desc_p) *syscall_list = NULL;
> struct syscall_desc *sysdesc;
> const char **names = NULL;
> int nsyscalls;
> @@ -366,11 +482,26 @@ xml_list_of_syscalls (const struct syscalls_info *sysinfo)
> if (sysinfo == NULL)
> return NULL;
>
> - nsyscalls = VEC_length (syscall_desc_p, sysinfo->syscalls);
> + if (group_filter == NULL)
> + {
> + /* We use the general list that includes every syscall. */
> + syscall_list = sysinfo->syscalls;
> + }
> + else
> + {
> + struct syscall_group_desc *groupdesc;
> +
> + groupdesc = syscall_group_get_group_by_name (sysinfo,
> + group_filter);
> + if (groupdesc != NULL)
> + syscall_list = groupdesc->syscalls;
> + }
This part is a bit complicated. For example, this last "if (groupdesc
!= NULL)" is telling me a bit of the design of the code. IMO, when
groupdesc is NULL it means that you could not find a group whose name is
"group_filter". In that case, you should return NULL to the caller,
since it asked for a group, and you could not find it. However, you are
returning an allocated char ** whose first element is NULL.
What this all means to me is that you are somewhat exposing more than
you should, so the callers of this function should implement some
mechanisms to determine whether the group exists, or whether the user
specified a syscall name (see my future comment on the breakpoint.c
diff). Anyway, this design is this way because you still haven't
implemented a way of explicitly specifying a syscall group to be caught.
> +
> + nsyscalls = VEC_length (syscall_desc_p, syscall_list);
> names = xmalloc ((nsyscalls + 1) * sizeof (char *));
>
> for (i = 0;
> - VEC_iterate (syscall_desc_p, sysinfo->syscalls, i, sysdesc);
> + VEC_iterate (syscall_desc_p, syscall_list, i, sysdesc);
> i++)
> names[i] = sysdesc->name;
>
> @@ -379,6 +510,30 @@ xml_list_of_syscalls (const struct syscalls_info *sysinfo)
> return names;
> }
>
> +static const char **
> +xml_list_of_groups (const struct syscalls_info *sysinfo)
> +{
> + struct syscall_group_desc *groupdesc;
> + const char **names = NULL;
> + int i;
> + int ngroups;
> +
> + if (sysinfo == NULL)
> + return NULL;
> +
> + ngroups = VEC_length (syscall_group_desc_p, sysinfo->groups);
> + names = xmalloc ((ngroups + 1) * sizeof (char *));
> +
> + for (i = 0;
> + VEC_iterate (syscall_group_desc_p, sysinfo->groups, i, groupdesc);
> + i++)
> + names[i] = groupdesc->name;
> +
> + names[i] = NULL;
> +
> + return names;
> +}
> +
> void
> set_xml_syscall_file_name (const char *name)
> {
> @@ -410,7 +565,23 @@ get_syscall_names (void)
> {
> init_sysinfo ();
>
> - return xml_list_of_syscalls (sysinfo);
> + return xml_list_of_syscalls (sysinfo, NULL);
> +}
> +
> +const char **
> +get_syscall_names_by_group (const char *group)
> +{
> + init_sysinfo ();
> +
> + return xml_list_of_syscalls (sysinfo, group);
> +}
> +
> +const char **
> +get_syscall_group_names (void)
> +{
> + init_sysinfo ();
> +
> + return xml_list_of_groups (sysinfo);
> }
>
> #endif /* ! HAVE_LIBEXPAT */
> diff --git a/gdb/xml-syscall.h b/gdb/xml-syscall.h
> index dff389d..903a758 100644
> --- a/gdb/xml-syscall.h
> +++ b/gdb/xml-syscall.h
> @@ -47,4 +47,16 @@ void get_syscall_by_name (const char *syscall_name, struct syscall *s);
>
> const char **get_syscall_names (void);
>
> +/* Function used to retrieve the list of syscalls of a given group in
> + the system. If group is NULL, return every syscall. The vector is
> + returned as an array of strings terminated by a NULL element.
> + Returns the list of syscalls of a group, or NULL otherwise. */
> +
> +const char **get_syscall_names_by_group (const char *group);
> +
> +/* Function used to retrieve the list of syscall groups in the system.
> + Returns an array of strings terminated by a NULL element. */
> +
> +const char **get_syscall_group_names (void);
> +
> #endif /* XML_SYSCALL_H */
> --
> 1.9.3
Other than the comment about group filtering, the patch looks good
enough to me.
--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 3/3] Create syscall groups for x86_64.
2014-10-08 2:52 ` [RFC PATCH 3/3] Create syscall groups for x86_64 Gabriel Krisman Bertazi
@ 2014-10-08 19:00 ` Sergio Durigan Junior
0 siblings, 0 replies; 19+ messages in thread
From: Sergio Durigan Junior @ 2014-10-08 19:00 UTC (permalink / raw)
To: Gabriel Krisman Bertazi; +Cc: gdb-patches
On Tuesday, October 07 2014, Gabriel Krisman Bertazi wrote:
> This commit introduces the following syscall groups for the x86_64
> architecture: memory, ipc, process, descriptor, signal and file.
>
> Please note that the sorting of the syscalls among these several groups
> follows the same structure used in strace.
Thanks for the patch.
One thing I am planning to do is to create some kind of semi-automatic
script to extract the syscall info from Linux headers. This
reorganization would make things harder in this area, so I propose that
you just include the group information to each syscall, without
modifying the current order.
> This also introduces tests for catching groups of syscalls on the x86_64
> architecture.
>
> gdb/syscalls/
>
> * amd64-linux.xml: Add 'groups' attribute to several syscalls on
> x86_64. Create groups memory, ipc, file, descriptor, process
> and signal.
gdb/syscalls doesn't have a ChangeLog file, so your ChangeLog entry will
have to be included in the gdb/ChangeLog file, and will have to refer to
syscalls/amd64-linux.xml.
>
> gdb/testsuite/
>
> * gdb.base/catch-syscall.exp (do_syscall_tests): Add call
> to test_catch_syscall_group.
> (test_catch_syscall_group): New.
> ---
> gdb/syscalls/amd64-linux.xml | 362 +++++++++++++++----------------
> gdb/testsuite/gdb.base/catch-syscall.exp | 25 +++
> 2 files changed, 206 insertions(+), 181 deletions(-)
>
> diff --git a/gdb/syscalls/amd64-linux.xml b/gdb/syscalls/amd64-linux.xml
> index 6a04218..974c5b5 100644
> --- a/gdb/syscalls/amd64-linux.xml
> +++ b/gdb/syscalls/amd64-linux.xml
> @@ -14,101 +14,101 @@
> The file mentioned above belongs to the Linux Kernel. -->
>
> <syscalls_info>
> - <syscall name="read" number="0"/>
> - <syscall name="write" number="1"/>
> - <syscall name="open" number="2"/>
> - <syscall name="close" number="3"/>
> - <syscall name="stat" number="4"/>
> - <syscall name="fstat" number="5"/>
> - <syscall name="lstat" number="6"/>
> - <syscall name="poll" number="7"/>
> - <syscall name="lseek" number="8"/>
> - <syscall name="mmap" number="9"/>
> - <syscall name="mprotect" number="10"/>
> - <syscall name="munmap" number="11"/>
> - <syscall name="brk" number="12"/>
> - <syscall name="rt_sigaction" number="13"/>
> - <syscall name="rt_sigprocmask" number="14"/>
> - <syscall name="rt_sigreturn" number="15"/>
> - <syscall name="ioctl" number="16"/>
> - <syscall name="pread64" number="17"/>
> - <syscall name="pwrite64" number="18"/>
> - <syscall name="readv" number="19"/>
> - <syscall name="writev" number="20"/>
> - <syscall name="access" number="21"/>
> - <syscall name="pipe" number="22"/>
> - <syscall name="select" number="23"/>
> + <syscall name="read" number="0" groups="descriptor"/>
> + <syscall name="write" number="1" groups="descriptor"/>
> + <syscall name="open" number="2" groups="descriptor,file"/>
> + <syscall name="close" number="3" groups="descriptor"/>
> + <syscall name="stat" number="4" groups="file"/>
> + <syscall name="fstat" number="5" groups="descriptor"/>
> + <syscall name="lstat" number="6" groups="file"/>
> + <syscall name="poll" number="7" groups="descriptor"/>
> + <syscall name="lseek" number="8" groups="descriptor"/>
> + <syscall name="mmap" number="9" groups="descriptor,memory"/>
> + <syscall name="mprotect" number="10" groups="memory"/>
> + <syscall name="munmap" number="11" groups="memory"/>
> + <syscall name="brk" number="12" groups="memory"/>
> + <syscall name="rt_sigaction" number="13" groups="signal"/>
> + <syscall name="rt_sigprocmask" number="14" groups="signal"/>
> + <syscall name="rt_sigreturn" number="15" groups="signal"/>
> + <syscall name="ioctl" number="16" groups="descriptor"/>
> + <syscall name="pread64" number="17" groups="descriptor"/>
> + <syscall name="pwrite64" number="18" groups="descriptor"/>
> + <syscall name="readv" number="19" groups="descriptor"/>
> + <syscall name="writev" number="20" groups="descriptor"/>
> + <syscall name="access" number="21" groups="file"/>
> + <syscall name="pipe" number="22" groups="descriptor"/>
> + <syscall name="select" number="23" groups="descriptor"/>
> <syscall name="sched_yield" number="24"/>
> - <syscall name="mremap" number="25"/>
> - <syscall name="msync" number="26"/>
> - <syscall name="mincore" number="27"/>
> - <syscall name="madvise" number="28"/>
> - <syscall name="shmget" number="29"/>
> - <syscall name="shmat" number="30"/>
> - <syscall name="shmctl" number="31"/>
> - <syscall name="dup" number="32"/>
> - <syscall name="dup2" number="33"/>
> - <syscall name="pause" number="34"/>
> + <syscall name="mremap" number="25" groups="memory"/>
> + <syscall name="msync" number="26" groups="memory"/>
> + <syscall name="mincore" number="27" groups="memory"/>
> + <syscall name="madvise" number="28" groups="memory"/>
> + <syscall name="shmget" number="29" groups="ipc"/>
> + <syscall name="shmat" number="30" groups="memory,ipc"/>
> + <syscall name="shmctl" number="31" groups="ipc"/>
> + <syscall name="dup" number="32" groups="descriptor"/>
> + <syscall name="dup2" number="33" groups="descriptor"/>
> + <syscall name="pause" number="34" groups="signal"/>
> <syscall name="nanosleep" number="35"/>
> <syscall name="getitimer" number="36"/>
> <syscall name="alarm" number="37"/>
> <syscall name="setitimer" number="38"/>
> <syscall name="getpid" number="39"/>
> - <syscall name="sendfile" number="40"/>
> - <syscall name="socket" number="41"/>
> - <syscall name="connect" number="42"/>
> - <syscall name="accept" number="43"/>
> - <syscall name="sendto" number="44"/>
> - <syscall name="recvfrom" number="45"/>
> - <syscall name="sendmsg" number="46"/>
> - <syscall name="recvmsg" number="47"/>
> - <syscall name="shutdown" number="48"/>
> - <syscall name="bind" number="49"/>
> - <syscall name="listen" number="50"/>
> - <syscall name="getsockname" number="51"/>
> - <syscall name="getpeername" number="52"/>
> - <syscall name="socketpair" number="53"/>
> - <syscall name="setsockopt" number="54"/>
> - <syscall name="getsockopt" number="55"/>
> - <syscall name="clone" number="56"/>
> - <syscall name="fork" number="57"/>
> - <syscall name="vfork" number="58"/>
> - <syscall name="execve" number="59"/>
> - <syscall name="exit" number="60"/>
> - <syscall name="wait4" number="61"/>
> - <syscall name="kill" number="62"/>
> + <syscall name="sendfile" number="40" groups="network,descriptor"/>
> + <syscall name="socket" number="41" groups="network"/>
> + <syscall name="connect" number="42" groups="network"/>
> + <syscall name="accept" number="43" groups="network"/>
> + <syscall name="sendto" number="44" groups="network"/>
> + <syscall name="recvfrom" number="45" groups="network"/>
> + <syscall name="sendmsg" number="46" groups="network"/>
> + <syscall name="recvmsg" number="47" groups="network"/>
> + <syscall name="shutdown" number="48" groups="network"/>
> + <syscall name="bind" number="49" groups="network"/>
> + <syscall name="listen" number="50" groups="network"/>
> + <syscall name="getsockname" number="51" groups="network"/>
> + <syscall name="getpeername" number="52" groups="network"/>
> + <syscall name="socketpair" number="53" groups="network"/>
> + <syscall name="setsockopt" number="54" groups="network"/>
> + <syscall name="getsockopt" number="55" groups="network"/>
> + <syscall name="clone" number="56" groups="process"/>
> + <syscall name="fork" number="57" groups="process"/>
> + <syscall name="vfork" number="58" groups="process"/>
> + <syscall name="execve" number="59" groups="process,file"/>
> + <syscall name="exit" number="60" groups="process"/>
> + <syscall name="wait4" number="61" groups="process"/>
> + <syscall name="kill" number="62" groups="signal"/>
> <syscall name="uname" number="63"/>
> - <syscall name="semget" number="64"/>
> - <syscall name="semop" number="65"/>
> - <syscall name="semctl" number="66"/>
> - <syscall name="shmdt" number="67"/>
> - <syscall name="msgget" number="68"/>
> - <syscall name="msgsnd" number="69"/>
> - <syscall name="msgrcv" number="70"/>
> - <syscall name="msgctl" number="71"/>
> - <syscall name="fcntl" number="72"/>
> - <syscall name="flock" number="73"/>
> - <syscall name="fsync" number="74"/>
> - <syscall name="fdatasync" number="75"/>
> - <syscall name="truncate" number="76"/>
> - <syscall name="ftruncate" number="77"/>
> - <syscall name="getdents" number="78"/>
> - <syscall name="getcwd" number="79"/>
> - <syscall name="chdir" number="80"/>
> - <syscall name="fchdir" number="81"/>
> - <syscall name="rename" number="82"/>
> - <syscall name="mkdir" number="83"/>
> - <syscall name="rmdir" number="84"/>
> - <syscall name="creat" number="85"/>
> - <syscall name="link" number="86"/>
> - <syscall name="unlink" number="87"/>
> - <syscall name="symlink" number="88"/>
> - <syscall name="readlink" number="89"/>
> - <syscall name="chmod" number="90"/>
> - <syscall name="fchmod" number="91"/>
> - <syscall name="chown" number="92"/>
> - <syscall name="fchown" number="93"/>
> - <syscall name="lchown" number="94"/>
> + <syscall name="semget" number="64" groups="ipc"/>
> + <syscall name="semop" number="65" groups="ipc"/>
> + <syscall name="semctl" number="66" groups="ipc"/>
> + <syscall name="shmdt" number="67" groups="memory,ipc"/>
> + <syscall name="msgget" number="68" groups="ipc"/>
> + <syscall name="msgsnd" number="69" groups="ipc"/>
> + <syscall name="msgrcv" number="70" groups="ipc"/>
> + <syscall name="msgctl" number="71" groups="ipc"/>
> + <syscall name="fcntl" number="72" groups="descriptor"/>
> + <syscall name="flock" number="73" groups="descriptor"/>
> + <syscall name="fsync" number="74" groups="descriptor"/>
> + <syscall name="fdatasync" number="75" groups="descriptor"/>
> + <syscall name="truncate" number="76" groups="file"/>
> + <syscall name="ftruncate" number="77" groups="descriptor"/>
> + <syscall name="getdents" number="78" groups="descriptor"/>
> + <syscall name="getcwd" number="79" groups="file"/>
> + <syscall name="chdir" number="80" groups="file"/>
> + <syscall name="fchdir" number="81" groups="descriptor"/>
> + <syscall name="rename" number="82" groups="file"/>
> + <syscall name="mkdir" number="83" groups="file"/>
> + <syscall name="rmdir" number="84" groups="file"/>
> + <syscall name="creat" number="85" groups="file,descriptor"/>
> + <syscall name="link" number="86" groups="file"/>
> + <syscall name="unlink" number="87" groups="file"/>
> + <syscall name="symlink" number="88" groups="file"/>
> + <syscall name="readlink" number="89" groups="file"/>
> + <syscall name="chmod" number="90" groups="file"/>
> + <syscall name="fchmod" number="91" groups="descriptor"/>
> + <syscall name="chown" number="92" groups="file"/>
> + <syscall name="fchown" number="93" groups="descriptor"/>
> + <syscall name="lchown" number="94" groups="file"/>
> <syscall name="umask" number="95"/>
> <syscall name="gettimeofday" number="96"/>
> <syscall name="getrlimit" number="97"/>
> @@ -141,18 +141,18 @@
> <syscall name="getsid" number="124"/>
> <syscall name="capget" number="125"/>
> <syscall name="capset" number="126"/>
> - <syscall name="rt_sigpending" number="127"/>
> - <syscall name="rt_sigtimedwait" number="128"/>
> - <syscall name="rt_sigqueueinfo" number="129"/>
> - <syscall name="rt_sigsuspend" number="130"/>
> - <syscall name="sigaltstack" number="131"/>
> - <syscall name="utime" number="132"/>
> - <syscall name="mknod" number="133"/>
> - <syscall name="uselib" number="134"/>
> + <syscall name="rt_sigpending" number="127" groups="signal"/>
> + <syscall name="rt_sigtimedwait" number="128" groups="signal"/>
> + <syscall name="rt_sigqueueinfo" number="129" groups="signal"/>
> + <syscall name="rt_sigsuspend" number="130" groups="signal"/>
> + <syscall name="sigaltstack" number="131" groups="signal"/>
> + <syscall name="utime" number="132" groups="file"/>
> + <syscall name="mknod" number="133" groups="file"/>
> + <syscall name="uselib" number="134" groups="file"/>
> <syscall name="personality" number="135"/>
> <syscall name="ustat" number="136"/>
> - <syscall name="statfs" number="137"/>
> - <syscall name="fstatfs" number="138"/>
> + <syscall name="statfs" number="137" groups="file"/>
> + <syscall name="fstatfs" number="138" groups="descriptor"/>
> <syscall name="sysfs" number="139"/>
> <syscall name="getpriority" number="140"/>
> <syscall name="setpriority" number="141"/>
> @@ -163,26 +163,26 @@
> <syscall name="sched_get_priority_max" number="146"/>
> <syscall name="sched_get_priority_min" number="147"/>
> <syscall name="sched_rr_get_interval" number="148"/>
> - <syscall name="mlock" number="149"/>
> - <syscall name="munlock" number="150"/>
> - <syscall name="mlockall" number="151"/>
> - <syscall name="munlockall" number="152"/>
> + <syscall name="mlock" number="149" groups="memory"/>
> + <syscall name="munlock" number="150" groups="memory"/>
> + <syscall name="mlockall" number="151" groups="memory"/>
> + <syscall name="munlockall" number="152" groups="memory"/>
> <syscall name="vhangup" number="153"/>
> <syscall name="modify_ldt" number="154"/>
> - <syscall name="pivot_root" number="155"/>
> + <syscall name="pivot_root" number="155" groups="file"/>
> <syscall name="_sysctl" number="156"/>
> <syscall name="prctl" number="157"/>
> - <syscall name="arch_prctl" number="158"/>
> + <syscall name="arch_prctl" number="158" groups="process"/>
> <syscall name="adjtimex" number="159"/>
> <syscall name="setrlimit" number="160"/>
> - <syscall name="chroot" number="161"/>
> + <syscall name="chroot" number="161" groups="file"/>
> <syscall name="sync" number="162"/>
> - <syscall name="acct" number="163"/>
> + <syscall name="acct" number="163" groups="file"/>
> <syscall name="settimeofday" number="164"/>
> - <syscall name="mount" number="165"/>
> - <syscall name="umount2" number="166"/>
> - <syscall name="swapon" number="167"/>
> - <syscall name="swapoff" number="168"/>
> + <syscall name="mount" number="165" groups="file"/>
> + <syscall name="umount2" number="166" groups="file"/>
> + <syscall name="swapon" number="167" groups="file"/>
> + <syscall name="swapoff" number="168" groups="file"/>
> <syscall name="reboot" number="169"/>
> <syscall name="sethostname" number="170"/>
> <syscall name="setdomainname" number="171"/>
> @@ -193,7 +193,7 @@
> <syscall name="delete_module" number="176"/>
> <syscall name="get_kernel_syms" number="177"/>
> <syscall name="query_module" number="178"/>
> - <syscall name="quotactl" number="179"/>
> + <syscall name="quotactl" number="179" groups="file"/>
> <syscall name="nfsservctl" number="180"/>
> <syscall name="getpmsg" number="181"/>
> <syscall name="putpmsg" number="182"/>
> @@ -201,20 +201,20 @@
> <syscall name="tuxcall" number="184"/>
> <syscall name="security" number="185"/>
> <syscall name="gettid" number="186"/>
> - <syscall name="readahead" number="187"/>
> - <syscall name="setxattr" number="188"/>
> - <syscall name="lsetxattr" number="189"/>
> - <syscall name="fsetxattr" number="190"/>
> - <syscall name="getxattr" number="191"/>
> - <syscall name="lgetxattr" number="192"/>
> - <syscall name="fgetxattr" number="193"/>
> - <syscall name="listxattr" number="194"/>
> - <syscall name="llistxattr" number="195"/>
> - <syscall name="flistxattr" number="196"/>
> - <syscall name="removexattr" number="197"/>
> - <syscall name="lremovexattr" number="198"/>
> - <syscall name="fremovexattr" number="199"/>
> - <syscall name="tkill" number="200"/>
> + <syscall name="readahead" number="187" groups="descriptor"/>
> + <syscall name="setxattr" number="188" groups="file"/>
> + <syscall name="lsetxattr" number="189" groups="file"/>
> + <syscall name="fsetxattr" number="190" groups="descriptor"/>
> + <syscall name="getxattr" number="191" groups="file"/>
> + <syscall name="lgetxattr" number="192" groups="file"/>
> + <syscall name="fgetxattr" number="193" groups="descriptor"/>
> + <syscall name="listxattr" number="194" groups="file"/>
> + <syscall name="llistxattr" number="195" groups="file"/>
> + <syscall name="flistxattr" number="196" groups="descriptor"/>
> + <syscall name="removexattr" number="197" groups="file"/>
> + <syscall name="lremovexattr" number="198" groups="file"/>
> + <syscall name="fremovexattr" number="199" groups="descriptor"/>
> + <syscall name="tkill" number="200" groups="signal"/>
> <syscall name="time" number="201"/>
> <syscall name="futex" number="202"/>
> <syscall name="sched_setaffinity" number="203"/>
> @@ -227,15 +227,15 @@
> <syscall name="io_cancel" number="210"/>
> <syscall name="get_thread_area" number="211"/>
> <syscall name="lookup_dcookie" number="212"/>
> - <syscall name="epoll_create" number="213"/>
> + <syscall name="epoll_create" number="213" groups="descriptor"/>
> <syscall name="epoll_ctl_old" number="214"/>
> <syscall name="epoll_wait_old" number="215"/>
> - <syscall name="remap_file_pages" number="216"/>
> - <syscall name="getdents64" number="217"/>
> + <syscall name="remap_file_pages" number="216" groups="memory"/>
> + <syscall name="getdents64" number="217" groups="descriptor"/>
> <syscall name="set_tid_address" number="218"/>
> <syscall name="restart_syscall" number="219"/>
> - <syscall name="semtimedop" number="220"/>
> - <syscall name="fadvise64" number="221"/>
> + <syscall name="semtimedop" number="220" groups="ipc"/>
> + <syscall name="fadvise64" number="221" groups="descriptor"/>
> <syscall name="timer_create" number="222"/>
> <syscall name="timer_settime" number="223"/>
> <syscall name="timer_gettime" number="224"/>
> @@ -245,15 +245,15 @@
> <syscall name="clock_gettime" number="228"/>
> <syscall name="clock_getres" number="229"/>
> <syscall name="clock_nanosleep" number="230"/>
> - <syscall name="exit_group" number="231"/>
> - <syscall name="epoll_wait" number="232"/>
> - <syscall name="epoll_ctl" number="233"/>
> - <syscall name="tgkill" number="234"/>
> - <syscall name="utimes" number="235"/>
> + <syscall name="exit_group" number="231" groups="process"/>
> + <syscall name="epoll_wait" number="232" groups="descriptor"/>
> + <syscall name="epoll_ctl" number="233" groups="descriptor"/>
> + <syscall name="tgkill" number="234" groups="signal"/>
> + <syscall name="utimes" number="235" groups="file"/>
> <syscall name="vserver" number="236"/>
> - <syscall name="mbind" number="237"/>
> - <syscall name="set_mempolicy" number="238"/>
> - <syscall name="get_mempolicy" number="239"/>
> + <syscall name="mbind" number="237" groups="memory"/>
> + <syscall name="set_mempolicy" number="238" groups="memory"/>
> + <syscall name="get_mempolicy" number="239" groups="memory"/>
> <syscall name="mq_open" number="240"/>
> <syscall name="mq_unlink" number="241"/>
> <syscall name="mq_timedsend" number="242"/>
> @@ -261,54 +261,54 @@
> <syscall name="mq_notify" number="244"/>
> <syscall name="mq_getsetattr" number="245"/>
> <syscall name="kexec_load" number="246"/>
> - <syscall name="waitid" number="247"/>
> + <syscall name="waitid" number="247" groups="process"/>
> <syscall name="add_key" number="248"/>
> <syscall name="request_key" number="249"/>
> <syscall name="keyctl" number="250"/>
> <syscall name="ioprio_set" number="251"/>
> <syscall name="ioprio_get" number="252"/>
> - <syscall name="inotify_init" number="253"/>
> - <syscall name="inotify_add_watch" number="254"/>
> - <syscall name="inotify_rm_watch" number="255"/>
> - <syscall name="migrate_pages" number="256"/>
> - <syscall name="openat" number="257"/>
> - <syscall name="mkdirat" number="258"/>
> - <syscall name="mknodat" number="259"/>
> - <syscall name="fchownat" number="260"/>
> - <syscall name="futimesat" number="261"/>
> - <syscall name="newfstatat" number="262"/>
> - <syscall name="unlinkat" number="263"/>
> - <syscall name="renameat" number="264"/>
> - <syscall name="linkat" number="265"/>
> - <syscall name="symlinkat" number="266"/>
> - <syscall name="readlinkat" number="267"/>
> - <syscall name="fchmodat" number="268"/>
> - <syscall name="faccessat" number="269"/>
> - <syscall name="pselect6" number="270"/>
> - <syscall name="ppoll" number="271"/>
> - <syscall name="unshare" number="272"/>
> + <syscall name="inotify_init" number="253" groups="descriptor"/>
> + <syscall name="inotify_add_watch" number="254" groups="descriptor"/>
> + <syscall name="inotify_rm_watch" number="255" groups="descriptor"/>
> + <syscall name="migrate_pages" number="256" groups="memory"/>
> + <syscall name="openat" number="257" groups="file,descriptor"/>
> + <syscall name="mkdirat" number="258" groups="file,descriptor"/>
> + <syscall name="mknodat" number="259" groups="file,descriptor"/>
> + <syscall name="fchownat" number="260" groups="file,descriptor"/>
> + <syscall name="futimesat" number="261" groups="file,descriptor"/>
> + <syscall name="newfstatat" number="262" groups="file,descriptor"/>
> + <syscall name="unlinkat" number="263" groups="file,descriptor"/>
> + <syscall name="renameat" number="264" groups="file,descriptor"/>
> + <syscall name="linkat" number="265" groups="file,descriptor"/>
> + <syscall name="symlinkat" number="266" groups="file,descriptor"/>
> + <syscall name="readlinkat" number="267" groups="file,descriptor"/>
> + <syscall name="fchmodat" number="268" groups="file,descriptor"/>
> + <syscall name="faccessat" number="269" groups="file,descriptor"/>
> + <syscall name="pselect6" number="270" groups="descriptor"/>
> + <syscall name="ppoll" number="271" groups="descriptor"/>
> + <syscall name="unshare" number="272" groups="process"/>
> <syscall name="set_robust_list" number="273"/>
> <syscall name="get_robust_list" number="274"/>
> - <syscall name="splice" number="275"/>
> - <syscall name="tee" number="276"/>
> - <syscall name="sync_file_range" number="277"/>
> - <syscall name="vmsplice" number="278"/>
> - <syscall name="move_pages" number="279"/>
> - <syscall name="utimensat" number="280"/>
> - <syscall name="epoll_pwait" number="281"/>
> - <syscall name="signalfd" number="282"/>
> - <syscall name="timerfd_create" number="283"/>
> - <syscall name="eventfd" number="284"/>
> - <syscall name="fallocate" number="285"/>
> - <syscall name="timerfd_settime" number="286"/>
> - <syscall name="timerfd_gettime" number="287"/>
> - <syscall name="accept4" number="288"/>
> - <syscall name="signalfd4" number="289"/>
> - <syscall name="eventfd2" number="290"/>
> - <syscall name="epoll_create1" number="291"/>
> - <syscall name="dup3" number="292"/>
> - <syscall name="pipe2" number="293"/>
> - <syscall name="inotify_init1" number="294"/>
> - <syscall name="preadv" number="295"/>
> - <syscall name="pwritev" number="296"/>
> + <syscall name="splice" number="275" groups="descriptor"/>
> + <syscall name="tee" number="276" groups="descriptor"/>
> + <syscall name="sync_file_range" number="277" groups="descriptor"/>
> + <syscall name="vmsplice" number="278" groups="descriptor"/>
> + <syscall name="move_pages" number="279" groups="memory"/>
> + <syscall name="utimensat" number="280" groups="file,descriptor"/>
> + <syscall name="epoll_pwait" number="281" groups="descriptor"/>
> + <syscall name="signalfd" number="282" groups="signal,descriptor"/>
> + <syscall name="timerfd_create" number="283" groups="descriptor"/>
> + <syscall name="eventfd" number="284" groups="descriptor"/>
> + <syscall name="fallocate" number="285" groups="descriptor"/>
> + <syscall name="timerfd_settime" number="286" groups="descriptor"/>
> + <syscall name="timerfd_gettime" number="287" groups="descriptor"/>
> + <syscall name="accept4" number="288" groups="network"/>
> + <syscall name="signalfd4" number="289" groups="signal,descriptor"/>
> + <syscall name="eventfd2" number="290" groups="descriptor"/>
> + <syscall name="epoll_create1" number="291" groups="descriptor"/>
> + <syscall name="dup3" number="292" groups="descriptor"/>
> + <syscall name="pipe2" number="293" groups="descriptor"/>
> + <syscall name="inotify_init1" number="294" groups="descriptor"/>
> + <syscall name="preadv" number="295" groups="descriptor"/>
> + <syscall name="pwritev" number="296" groups="descriptor"/>
> </syscalls_info>
> diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp
> index a70534c..93117cc 100644
> --- a/gdb/testsuite/gdb.base/catch-syscall.exp
> +++ b/gdb/testsuite/gdb.base/catch-syscall.exp
> @@ -275,6 +275,28 @@ proc test_catch_syscall_fail_nodatadir {} {
> }
> }
>
> +proc test_catch_syscall_group {} {
> + global decimal
> +
> + # Until we have syscall groups to test on other targets.
> + if { ![istarget "x86_64-*-linux*"] } then {
> + return
> + }
> + set sysnum "\\\[\[0-9\]+\\\]"
> +
> + gdb_test "catch syscall process" \
> + "Catchpoint $decimal \\(syscalls (\'(clone|fork|execve|exit)\' $sysnum)+.*" \
> + "set catchpoint on a group of syscalls"
> +
> + gdb_test "catch syscall process read" \
> + "Catchpoint $decimal \\(syscalls (\'(clone|fork|execve|exit)\' $sysnum)+.*read.*\\)" \
> + "set catchpoints on a group of syscalls and on a single syscall"
> +
> + gdb_test "complete catch syscall proc" \
> + "catch syscall process" \
> + "complete catch syscall group"
> +}
Maybe you could make a generic procedure that inserts a syscall group
catchpoint, and the checks to see if its members were mentioned? Just
an idea to make the testcase more automatic.
> +
> proc do_syscall_tests {} {
> # NOTE: We don't have to point gdb at the correct data-directory.
> # For the build tree that is handled by INTERNAL_GDBFLAGS.
> @@ -311,6 +333,9 @@ proc do_syscall_tests {} {
> # Testing the 'catch' syscall command during a restart of
> # the inferior.
> if [runto_main] then { test_catch_syscall_restarting_inferior }
> +
> + # Testing the 'catch' syscall command for a group of syscalls.
> + if [runto_main] then { test_catch_syscall_group }
> }
>
> proc test_catch_syscall_without_args_noxml {} {
> --
> 1.9.3
--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 2/3] Add support to catch groups of syscalls.
2014-10-08 2:51 ` [RFC PATCH 2/3] Add support to catch groups of syscalls Gabriel Krisman Bertazi
@ 2014-10-08 19:07 ` Sergio Durigan Junior
2014-10-08 19:46 ` Doug Evans
0 siblings, 1 reply; 19+ messages in thread
From: Sergio Durigan Junior @ 2014-10-08 19:07 UTC (permalink / raw)
To: Gabriel Krisman Bertazi; +Cc: gdb-patches
On Tuesday, October 07 2014, Gabriel Krisman Bertazi wrote:
> This implements the catchpoint side. While parsing 'catch syscall'
> arguments, we verify if the argument is a syscall group and expand it to
> a list of syscalls that are part of that group.
Thanks for the patch. Comments below.
> gdb/
>
> * breakpoint.c (catch_syscall_split_args): Verify if argument
> is a syscall group and expand it to a list of syscalls when
> creating catchpoints.
> (catch_syscall_completer): Include syscall groups to the list of
> word completion.
> ---
> gdb/breakpoint.c | 73 +++++++++++++++++++++++++++++++++++++++++++-------------
> 1 file changed, 57 insertions(+), 16 deletions(-)
>
> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
> index e2170b4..5243916 100644
> --- a/gdb/breakpoint.c
> +++ b/gdb/breakpoint.c
> @@ -12117,22 +12117,50 @@ catch_syscall_split_args (char *arg)
> /* Check if the user provided a syscall name or a number. */
> syscall_number = (int) strtol (cur_name, &endptr, 0);
> if (*endptr == '\0')
> - get_syscall_by_number (syscall_number, &s);
> + {
> + get_syscall_by_number (syscall_number, &s);
> +
> + /* Ok, it's valid. */
> + VEC_safe_push (int, result, s.number);
> + }
> else
> {
> - /* We have a name. Let's check if it's valid and convert it
> - to a number. */
> - get_syscall_by_name (cur_name, &s);
> -
> - if (s.number == UNKNOWN_SYSCALL)
> - /* Here we have to issue an error instead of a warning,
> - because GDB cannot do anything useful if there's no
> - syscall number to be caught. */
> + const char **syscall_list;
> +
> + /* If we have a syscall group, expand it to a list of
> + syscalls. */
> + syscall_list = get_syscall_names_by_group (cur_name);
> +
> + if (syscall_list == NULL)
> error (_("Unknown syscall name '%s'."), cur_name);
This part...
> - }
>
> - /* Ok, it's valid. */
> - VEC_safe_push (int, result, s.number);
> + if (syscall_list[0] == NULL)
> + {
> + /* If syscall_list is empty, cur_name is a syscall name
> + instead of a group. We push it into the group
> + list. */
> + syscall_list[0] = cur_name;
> + syscall_list[1] = NULL;
> + }
... and this part are the reasons I made the comment on the first patch
about leaving to much to the caller. For example, the caller has to
know that syscall_list == NULL and *syscall_list == NULL are different
things which mean entirely different things. However, *syscall_list ==
NULL should not happen in this interface, as I see it.
As I mentioned, you're doing this here because you have no way to know
whether the user is asking to catch a syscall name or a group of
syscalls. This would be solved with my early proposal, of implementing
the "-g" modifier on the catch syscall command. It would also make the
code simpler to follow here.
> +
> + for (i = 0; syscall_list[i]; i++)
> + {
> + get_syscall_by_name (syscall_list[i], &s);
> +
> + if (s.number == UNKNOWN_SYSCALL)
> + {
> + /* Here we have to issue an error instead of a warning,
> + because GDB cannot do anything useful if there's no
> + syscall number to be caught. */
> + error (_("Unknown syscall name '%s'."), syscall_list[i]);
> + }
> +
> + /* Ok, it's valid. */
> + VEC_safe_push (int, result, s.number);
> + }
> +
> + xfree (syscall_list);
> + }
> }
>
> discard_cleanups (cleanup);
> @@ -15615,11 +15643,24 @@ static VEC (char_ptr) *
> catch_syscall_completer (struct cmd_list_element *cmd,
> const char *text, const char *word)
> {
> - const char **list = get_syscall_names ();
> - VEC (char_ptr) *retlist
> - = (list == NULL) ? NULL : complete_on_enum (list, word, word);
> + VEC (char_ptr) *retlist;
> + const char **syscall_list = get_syscall_names ();
> + const char **group_list = get_syscall_group_names ();
> +
> + VEC (char_ptr) *sys_retlist
> + = (syscall_list == NULL) ? NULL : complete_on_enum (syscall_list,
> + word, word);
> +
> + VEC (char_ptr) *group_retlist
> + = (group_list == NULL) ? NULL : complete_on_enum (group_list, word, word);
No newlines between variables being declared.
> +
> + retlist = VEC_merge (char_ptr, sys_retlist, group_retlist);
> +
> + xfree (syscall_list);
> + xfree (group_list);
> + VEC_free (char_ptr, sys_retlist);
> + VEC_free (char_ptr, group_retlist);
>
> - xfree (list);
> return retlist;
> }
>
> --
> 1.9.3
--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 2/3] Add support to catch groups of syscalls.
2014-10-08 19:07 ` Sergio Durigan Junior
@ 2014-10-08 19:46 ` Doug Evans
2014-10-08 20:48 ` Sergio Durigan Junior
0 siblings, 1 reply; 19+ messages in thread
From: Doug Evans @ 2014-10-08 19:46 UTC (permalink / raw)
To: Sergio Durigan Junior; +Cc: Gabriel Krisman Bertazi, gdb-patches
On Wed, Oct 8, 2014 at 12:07 PM, Sergio Durigan Junior
<sergiodj@redhat.com> wrote:
> As I mentioned, you're doing this here because you have no way to know
> whether the user is asking to catch a syscall name or a group of
> syscalls. This would be solved with my early proposal, of implementing
> the "-g" modifier on the catch syscall command. It would also make the
> code simpler to follow here.
Yeah, let's agree on a syntax before we get through too many patch iterations.
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.
I also kinda dislike interpreting "-g" to mean all remaining arguments
(for a few reasons).
"catch syscall write -g network" feels clumsy if I can't also do
something like "catch syscall -g network -s write" or some such).
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.
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?
[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.]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 2/3] Add support to catch groups of syscalls.
2014-10-08 19:46 ` Doug Evans
@ 2014-10-08 20:48 ` Sergio Durigan Junior
2014-10-12 21:37 ` Gabriel Krisman Bertazi
0 siblings, 1 reply; 19+ messages in thread
From: Sergio Durigan Junior @ 2014-10-08 20:48 UTC (permalink / raw)
To: Doug Evans; +Cc: Gabriel Krisman Bertazi, gdb-patches
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/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 0/3] Catch syscall group
2014-10-08 16:10 ` [RFC PATCH 0/3] Catch syscall group Sergio Durigan Junior
@ 2014-10-12 21:12 ` Gabriel Krisman Bertazi
2014-10-12 22:55 ` Sergio Durigan Junior
0 siblings, 1 reply; 19+ messages in thread
From: Gabriel Krisman Bertazi @ 2014-10-12 21:12 UTC (permalink / raw)
To: Sergio Durigan Junior; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1421 bytes --]
Sergio Durigan Junior <sergiodj@redhat.com> writes:
> On Tuesday, October 07 2014, Gabriel Krisman Bertazi wrote:
>
>> Hello,
>>
>> This multi-part patch implements on top of the 'catch syscall' command
>> the ability to catch a group of related syscalls using a single
>> command.
>
Sergio and Doug,
Thank you both for your review.
>> (Please note that adding this feature to GDB was first suggested by Tom
>> Tromey on PR 15879. :-)
>> <https://sourceware.org/bugzilla/show_bug.cgi?id=15879>).
>
> It is good to mention the bug in the ChangeLog, even if you are not
> directly fixing it.
Ok.
> I will make comments in the patch itself, but it would be nice if you
> could do that for the other existing XML files as well. You didn't
> mention if you intend to do so or not.
>
> I know it will be kind of boring, but unfortunately those XML files are
> not being really maintained nowadays (a problem I intend to address soon
> with some patches and proposals), so if you don't touch those files now
> they will probably be forgotten for quite some time...
>
> However, this is just a request, so if you don't have the time to do
> that now I'd still vote for including this feature on GDB.
I intend to do so for other architectures, but forgot to mention in my
original message. Still, I won't be able to test on some platforms.
Thanks.
--
Gabriel Krisman Bertazi
[-- Attachment #2: Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 2/3] Add support to catch groups of syscalls.
2014-10-08 20:48 ` Sergio Durigan Junior
@ 2014-10-12 21:37 ` Gabriel Krisman Bertazi
2014-10-12 22:52 ` Sergio Durigan Junior
2014-10-13 16:49 ` Doug Evans
0 siblings, 2 replies; 19+ messages in thread
From: Gabriel Krisman Bertazi @ 2014-10-12 21:37 UTC (permalink / raw)
To: Sergio Durigan Junior; +Cc: Doug Evans, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 2597 bytes --]
Sergio Durigan Junior <sergiodj@redhat.com> writes:
> 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...
Doug and Sergio,
Thank you for your review and valuable suggestions.
The suggestion I feel more comfortable with is using -g for each syscall
group. I agree that syscall groups should be treated on a different
namespace than syscall names, which are the expected argument for a
command called "catch syscall".
>> 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?
I dislike the proposal of adding prefixes/suffixes to the group names
because I feel it might be harder to type, and also because it feels a
little unusual, if we consider the common way of providing arguments to
commands.
Using -g to specify syscall groups, as Sergio said, has also the
advantage of providing us with an intuitive command to list available
syscall groups, by saying "catch syscall -g" with no arguments.
So, my vote goes to using '-g' for each syscall group we want to
catch. Is that ok for you, guys?
I will still wait a few days to see if anyone has more suggestions
before sending the updated patch that fixes the syntax and the other
things you guys pointed out.
Thanks!
--
Gabriel Krisman Bertazi
[-- Attachment #2: Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 2/3] Add support to catch groups of syscalls.
2014-10-12 21:37 ` Gabriel Krisman Bertazi
@ 2014-10-12 22:52 ` Sergio Durigan Junior
2014-10-13 16:49 ` Doug Evans
1 sibling, 0 replies; 19+ messages in thread
From: Sergio Durigan Junior @ 2014-10-12 22:52 UTC (permalink / raw)
To: Gabriel Krisman Bertazi; +Cc: Doug Evans, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 956 bytes --]
On Sunday, October 12 2014, Gabriel Krisman Bertazi wrote:
> I dislike the proposal of adding prefixes/suffixes to the group names
> because I feel it might be harder to type, and also because it feels a
> little unusual, if we consider the common way of providing arguments to
> commands.
>
> Using -g to specify syscall groups, as Sergio said, has also the
> advantage of providing us with an intuitive command to list available
> syscall groups, by saying "catch syscall -g" with no arguments.
>
> So, my vote goes to using '-g' for each syscall group we want to
> catch. Is that ok for you, guys?
Yeah, this is still OK to me :-).
> I will still wait a few days to see if anyone has more suggestions
> before sending the updated patch that fixes the syntax and the other
> things you guys pointed out.
Good idea.
Thanks,
--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
[-- Attachment #2: Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 0/3] Catch syscall group
2014-10-12 21:12 ` Gabriel Krisman Bertazi
@ 2014-10-12 22:55 ` Sergio Durigan Junior
0 siblings, 0 replies; 19+ messages in thread
From: Sergio Durigan Junior @ 2014-10-12 22:55 UTC (permalink / raw)
To: Gabriel Krisman Bertazi; +Cc: gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1120 bytes --]
On Sunday, October 12 2014, Gabriel Krisman Bertazi wrote:
>> I will make comments in the patch itself, but it would be nice if you
>> could do that for the other existing XML files as well. You didn't
>> mention if you intend to do so or not.
>>
>> I know it will be kind of boring, but unfortunately those XML files are
>> not being really maintained nowadays (a problem I intend to address soon
>> with some patches and proposals), so if you don't touch those files now
>> they will probably be forgotten for quite some time...
>>
>> However, this is just a request, so if you don't have the time to do
>> that now I'd still vote for including this feature on GDB.
>
> I intend to do so for other architectures, but forgot to mention in my
> original message. Still, I won't be able to test on some platforms.
The logic will be implemented in the arch-independent part of the code,
so it is reasonable to test only x86* arches. But I can test on other
architectures if needed.
Cheers,
--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
[-- Attachment #2: Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 2/3] Add support to catch groups of syscalls.
2014-10-12 21:37 ` Gabriel Krisman Bertazi
2014-10-12 22:52 ` Sergio Durigan Junior
@ 2014-10-13 16:49 ` Doug Evans
2014-10-20 4:52 ` Gabriel Krisman Bertazi
1 sibling, 1 reply; 19+ messages in thread
From: Doug Evans @ 2014-10-13 16:49 UTC (permalink / raw)
To: Gabriel Krisman Bertazi; +Cc: Sergio Durigan Junior, gdb-patches
On Sun, Oct 12, 2014 at 2:36 PM, Gabriel Krisman Bertazi
<gabriel@krisman.be> wrote:
> Using -g to specify syscall groups, as Sergio said, has also the
> advantage of providing us with an intuitive command to list available
> syscall groups, by saying "catch syscall -g" with no arguments.
That can't work as "catch syscall" catches all syscalls, and it would
be confusing to have "catch syscall" catch all syscalls whereas "catch
syscall -g" just lists syscall groups.
> So, my vote goes to using '-g' for each syscall group we want to
> catch. Is that ok for you, guys?
Would you still allow "catch syscall open -g network"?
I'm not really comfortable with that (far more so than "catch syscall
open network-group").
If you want to require -g at the front, and thus disallow catching
both syscalls and syscall groups in the same command then that would
be fine with me.
Still need a solution for listing them. Arguably since we don't
provide a way to list syscalls (sigh, modulo the hack I showed, which
should be fixed so that it no longer works anyways :-)), providing a
way to list syscall groups is for a separate patch. Kudos if you
still want to provide a way to list syscalls and groups though.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 2/3] Add support to catch groups of syscalls.
2014-10-13 16:49 ` Doug Evans
@ 2014-10-20 4:52 ` Gabriel Krisman Bertazi
2014-10-20 19:39 ` Sergio Durigan Junior
0 siblings, 1 reply; 19+ messages in thread
From: Gabriel Krisman Bertazi @ 2014-10-20 4:52 UTC (permalink / raw)
To: Doug Evans; +Cc: Sergio Durigan Junior, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 2245 bytes --]
Doug Evans <dje@google.com> writes:
Sorry I took so long to answer your message. I got a lot of college
stuff to deal with right now... :(
> Would you still allow "catch syscall open -g network"?
Yes. As a matter of fact, I still don't see the problem of allowing
"catch syscall open -g network exit" to catch open and exit syscalls and
the network group on the same command, provided that -g refers only to
the next token. By the way, for the "-group" suffix you suggested,
would we also allow "catch syscall open network-group exit", right?
> I'm not really comfortable with that (far more so than "catch syscall
> open network-group").
> If you want to require -g at the front, and thus disallow catching
> both syscalls and syscall groups in the same command then that would
> be fine with me.
I really think we shouldn't disallow catching syscalls and syscalls
group on the same command, no matter which syntax we pick. GDB wiki
says that GDB should be more permissive about command's syntax, in a
sense that user shouldn't spend more time than needed to find out how a
command works. I think disallowing catching syscalls and groups on the
same command would reduce expressiveness in this case.
> Still need a solution for listing them. Arguably since we don't
> provide a way to list syscalls (sigh, modulo the hack I showed, which
> should be fixed so that it no longer works anyways :-)), providing a
> way to list syscall groups is for a separate patch. Kudos if you
> still want to provide a way to list syscalls and groups though.
So, definitively allowing "catch syscall -g" to list syscalls is not a
good idea. Sergio suggested off-list to use another option, maybe -lg
to list syscall groups. Then, a future patch could also extend catch
syscall to list all syscalls using a -l option or something like that.
Sergio, sorry if I got your suggestion wrong.
OTOH, I might be over-thinking this simple stuff :). I'm ok with the
namespace (suffix) syntax, but I think we should go with "g:" (or even
"group:network", if it's not too verbose) instead of "-group", to avoid
the issue pointed out by Sergio with the exit_group syscall.
Cheers,
--
Gabriel Krisman Bertazi
[-- Attachment #2: Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 2/3] Add support to catch groups of syscalls.
2014-10-20 4:52 ` Gabriel Krisman Bertazi
@ 2014-10-20 19:39 ` Sergio Durigan Junior
2014-10-27 19:20 ` Doug Evans
0 siblings, 1 reply; 19+ messages in thread
From: Sergio Durigan Junior @ 2014-10-20 19:39 UTC (permalink / raw)
To: Gabriel Krisman Bertazi; +Cc: Doug Evans, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 2502 bytes --]
On Monday, October 20 2014, Gabriel Krisman Bertazi wrote:
>> I'm not really comfortable with that (far more so than "catch syscall
>> open network-group").
>> If you want to require -g at the front, and thus disallow catching
>> both syscalls and syscall groups in the same command then that would
>> be fine with me.
>
> I really think we shouldn't disallow catching syscalls and syscalls
> group on the same command, no matter which syntax we pick. GDB wiki
> says that GDB should be more permissive about command's syntax, in a
> sense that user shouldn't spend more time than needed to find out how a
> command works. I think disallowing catching syscalls and groups on the
> same command would reduce expressiveness in this case.
I agree.
>> Still need a solution for listing them. Arguably since we don't
>> provide a way to list syscalls (sigh, modulo the hack I showed, which
>> should be fixed so that it no longer works anyways :-)), providing a
>> way to list syscall groups is for a separate patch. Kudos if you
>> still want to provide a way to list syscalls and groups though.
>
> So, definitively allowing "catch syscall -g" to list syscalls is not a
> good idea. Sergio suggested off-list to use another option, maybe -lg
> to list syscall groups. Then, a future patch could also extend catch
> syscall to list all syscalls using a -l option or something like that.
> Sergio, sorry if I got your suggestion wrong.
It is alright, I completely forgot I made that suggestion! Thanks for
bringing it to the table.
Anyway, yeah, I guess '-lg' (or -list-groups) should be OK.
> OTOH, I might be over-thinking this simple stuff :). I'm ok with the
> namespace (suffix) syntax, but I think we should go with "g:" (or even
> "group:network", if it's not too verbose) instead of "-group", to avoid
> the issue pointed out by Sergio with the exit_group syscall.
Yeah, maybe this is a bit over-thinking, but OTOH we are talking about
user interface, which cannot be changed easily after we make a release.
BTW, I like the idea of using the "g:" prefix, so I say "go for it" if
you think it is OK.
Sorry for not being able to comment more on the thread now, I am busy
with other things. However, I think you covered all the issues with
your message, so you should be good to go as long as Doug has no other
comments.
Cheers,
--
Sergio
GPG key ID: 0x65FC5E36
Please send encrypted e-mail if possible
http://sergiodj.net/
[-- Attachment #2: Type: application/pgp-signature, Size: 818 bytes --]
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [RFC PATCH 2/3] Add support to catch groups of syscalls.
2014-10-20 19:39 ` Sergio Durigan Junior
@ 2014-10-27 19:20 ` Doug Evans
0 siblings, 0 replies; 19+ messages in thread
From: Doug Evans @ 2014-10-27 19:20 UTC (permalink / raw)
To: Sergio Durigan Junior; +Cc: Gabriel Krisman Bertazi, gdb-patches
On Mon, Oct 20, 2014 at 12:39 PM, Sergio Durigan Junior
<sergiodj@redhat.com> wrote:
> On Monday, October 20 2014, Gabriel Krisman Bertazi wrote:
>
>>> I'm not really comfortable with that (far more so than "catch syscall
>>> open network-group").
>>> If you want to require -g at the front, and thus disallow catching
>>> both syscalls and syscall groups in the same command then that would
>>> be fine with me.
>>
>> I really think we shouldn't disallow catching syscalls and syscalls
>> group on the same command, no matter which syntax we pick. GDB wiki
>> says that GDB should be more permissive about command's syntax, in a
>> sense that user shouldn't spend more time than needed to find out how a
>> command works. I think disallowing catching syscalls and groups on the
>> same command would reduce expressiveness in this case.
>
> I agree.
>
>>> Still need a solution for listing them. Arguably since we don't
>>> provide a way to list syscalls (sigh, modulo the hack I showed, which
>>> should be fixed so that it no longer works anyways :-)), providing a
>>> way to list syscall groups is for a separate patch. Kudos if you
>>> still want to provide a way to list syscalls and groups though.
>>
>> So, definitively allowing "catch syscall -g" to list syscalls is not a
>> good idea. Sergio suggested off-list to use another option, maybe -lg
>> to list syscall groups. Then, a future patch could also extend catch
>> syscall to list all syscalls using a -l option or something like that.
>> Sergio, sorry if I got your suggestion wrong.
>
> It is alright, I completely forgot I made that suggestion! Thanks for
> bringing it to the table.
>
> Anyway, yeah, I guess '-lg' (or -list-groups) should be OK.
>
>> OTOH, I might be over-thinking this simple stuff :). I'm ok with the
>> namespace (suffix) syntax, but I think we should go with "g:" (or even
>> "group:network", if it's not too verbose) instead of "-group", to avoid
>> the issue pointed out by Sergio with the exit_group syscall.
>
> Yeah, maybe this is a bit over-thinking, but OTOH we are talking about
> user interface, which cannot be changed easily after we make a release.
>
> BTW, I like the idea of using the "g:" prefix, so I say "go for it" if
> you think it is OK.
>
> Sorry for not being able to comment more on the thread now, I am busy
> with other things. However, I think you covered all the issues with
> your message, so you should be good to go as long as Doug has no other
> comments.
I can live with "g:foo g:bar" more than "-g foo [-g?] bar", though I'm
willing to defer to a majority if it arises (depending on what the
majority decides on :-)).
I can also live with "catch syscall -l/-lg" though there are other
things where we want to provide the ability to list things (e.g.,
catch signal) and I would want consistency throughout. Another
thought is "catch list foo".
"g:" is pretty non-descript. "group:" is clearer.
OTOH, we do try to minimize typing where we can.
I'm hesitant to get too elaborate here and suggest supporting both.
OTOH, we can start with "g:" and add a "group:" alias later.
Anyone else have a preference?
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2014-10-27 19:20 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-10-08 2:51 [RFC PATCH 0/3] Catch syscall group Gabriel Krisman Bertazi
2014-10-08 2:51 ` [RFC PATCH 2/3] Add support to catch groups of syscalls Gabriel Krisman Bertazi
2014-10-08 19:07 ` Sergio Durigan Junior
2014-10-08 19:46 ` Doug Evans
2014-10-08 20:48 ` Sergio Durigan Junior
2014-10-12 21:37 ` Gabriel Krisman Bertazi
2014-10-12 22:52 ` Sergio Durigan Junior
2014-10-13 16:49 ` Doug Evans
2014-10-20 4:52 ` Gabriel Krisman Bertazi
2014-10-20 19:39 ` Sergio Durigan Junior
2014-10-27 19:20 ` Doug Evans
2014-10-08 2:51 ` [RFC PATCH 1/3] Implemement support for groups of syscalls in the xml-syscall interface Gabriel Krisman Bertazi
2014-10-08 17:21 ` Sergio Durigan Junior
2014-10-08 2:52 ` [RFC PATCH 3/3] Create syscall groups for x86_64 Gabriel Krisman Bertazi
2014-10-08 19:00 ` Sergio Durigan Junior
2014-10-08 16:10 ` [RFC PATCH 0/3] Catch syscall group Sergio Durigan Junior
2014-10-12 21:12 ` Gabriel Krisman Bertazi
2014-10-12 22:55 ` Sergio Durigan Junior
2014-10-08 16:12 ` Doug Evans
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox