diff options
author | Gabriel Krisman Bertazi <gabriel@krisman.be> | 2016-07-23 18:38:24 -0300 |
---|---|---|
committer | Gabriel Krisman Bertazi <gabriel@krisman.be> | 2016-07-23 18:38:24 -0300 |
commit | e34879080d8935792ef3942efa5f25b4c3169b5a (patch) | |
tree | daab863d91a6bb66ab2c10f1f4ef50b52dab66ea /gdb/testsuite/gdb.base/catch-syscall.exp | |
parent | 49ecef2a7da2ee9df4ae675f99b70518fbf1bb23 (diff) | |
download | binutils-gdb-e34879080d8935792ef3942efa5f25b4c3169b5a.tar.gz |
Implement catch syscall group
Implement support to add catchpoints for a group of related syscalls
using the syntax:
(gdb) catch syscall group:<group>
or
(gdb) catch syscall g:<group>
Several groups are predefined in the xml files for all architectures
supported by GDB over Linux. They are based on the groups defined by
strace.
gdb/
* xml-syscall.c (get_syscalls_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_syscalls_by_group): New.
(xml_list_of_groups): New.
* xml-syscall.h (get_syscalls_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.
* break-catch-syscall.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): Add word completion for system call
groups.
* configure.ac: Include dependency for xsltproc when building
in maintainer-mode.
* break-catch-syscall.c (_initialize_breakpoint): Update catch
syscall command documentation.
* NEWS: Include section about catching groups of syscalls.
* configure: Regenerate.
* data-directory/Makefile.in: Generate syscall xml when building
in maintainer mode.
* syscalls/gdb-syscalls.dtd: Include group attribute to the
syscall element.
* syscalls/apply-defaults.xsl: New.
* syscalls/linux-defaults.xml.in: New.
* syscalls/aarch64-linux.xml: Rename to aarch64-linux.xml.in.
* syscalls/amd64-linux.xml: Rename to amd64-linux.xml.in.
* syscalls/arm-linux.xml: Rename to arm-linux.xml.in.
* syscalls/bfin-linux.xml: Rename to bfin-linux.xml.in.
* syscalls/i386-linux.xml: Rename to i386-linux.xml.in.
* syscalls/mips-n32-linux.xml: Rename to mips-n32-linux.xml.in.
* syscalls/mips-n64-linux.xml: Rename to mips-n64-linux.xml.in.
* syscalls/mips-o32-linux.xml: Rename to mips-o32-linux.xml.in.
* syscalls/ppc-linux.xml: Rename to ppc-linux.xml.in.
* syscalls/ppc64-linux.xml: Rename to ppc64-linux.xml.in.
* syscalls/s390-linux.xml: Rename to s390-linux.xml.in.
* syscalls/s390x-linux.xml: Rename to s390x-linux.xml.in.
* syscalls/sparc-linux.xml: Rename to sparc-linux.xml.in.
* syscalls/sparc64-linux.xml: Rename to sparc64-linux.xml.in.
* syscalls/aarch64-linux.xml: Regenerate.
* syscalls/amd64-linux.xml: Regenerate.
* syscalls/arm-linux.xml: Regenerate.
* syscalls/i386-linux.xml: Regenerate.
* syscalls/mips-n32-linux.xml: Regenerate.
* syscalls/mips-n64-linux.xml: Regenerate.
* syscalls/mips-o32-linux.xml: Regenerate.
* syscalls/ppc-linux.xml: Regenerate.
* syscalls/ppc64-linux.xml: Regenerate.
* syscalls/s390-linux.xml: Regenerate.
* syscalls/s390x-linux.xml: Regenerate.
* syscalls/sparc-linux.xml: Regenerate.
* syscalls/sparc64-linux.xml: Regenerate.
gdb/testsuite/
* gdb.base/catch-syscall.exp (do_syscall_tests): Add call
to test_catch_syscall_group.
(test_catch_syscall_group): New.
gdb/doc/
* gdb.texinfo (Set Catchpoints): Add 'group' argument to catch
syscall.
Diffstat (limited to 'gdb/testsuite/gdb.base/catch-syscall.exp')
-rw-r--r-- | gdb/testsuite/gdb.base/catch-syscall.exp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp index f3ab6cbfbb8..a739c46d02d 100644 --- a/gdb/testsuite/gdb.base/catch-syscall.exp +++ b/gdb/testsuite/gdb.base/catch-syscall.exp @@ -385,6 +385,42 @@ proc test_catch_syscall_fail_nodatadir {} { } } +proc test_catch_syscall_group {} { + global decimal + + set sysnum "\\\[${decimal}\\\]" + + gdb_test "catch syscall g:process" \ + "Catchpoint $decimal \\(syscalls (\'(clone|fork|execve|exit)\' $sysnum)+.*" \ + "set catchpoint on a group of syscalls" + + gdb_test "catch syscall group: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 "catch syscall group:" \ + "Unknown syscall group ''\." \ + "set catchpoints on an invalid group" + + gdb_test "catch syscall g:junk" \ + "Unknown syscall group 'junk'\." \ + "set catchpoints on an unknown group." + + gdb_test "complete catch syscall g:proc" \ + "catch syscall g:process" \ + "complete catch syscall group with 'g:' prefix" + + gdb_test "complete catch syscall group:proc" \ + "catch syscall group:process" \ + "complete catch syscall group with 'group:' prefix" + + gdb_test_sequence "complete catch syscall g" \ + "complete catch syscall group suggests 'group:' prefix" { + "group:descriptor" "group:file" "group:ipc" "group:memory" + "group:network" "group:process" "group:signal" + } +} + 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. @@ -435,6 +471,9 @@ proc do_syscall_tests {} { # Testing if the 'catch syscall' command works when switching to # different architectures on-the-fly (PR gdb/10737). if [runto_main] then { test_catch_syscall_multi_arch } + + # 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 {} { |