diff mbox

[v2,3/4] Create syscall groups for x86_64.

Message ID 1416596731-2170-3-git-send-email-gabriel@krisman.be
State New
Headers show

Commit Message

Gabriel Krisman Bertazi Nov. 21, 2014, 7:05 p.m. UTC
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 |  33 +++
 2 files changed, 214 insertions(+), 181 deletions(-)

Comments

Doug Evans Jan. 15, 2015, 8:27 a.m. UTC | #1
Gabriel Krisman Bertazi <gabriel@krisman.be> writes:
> 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.

Some of these are a bit weird, but if this is identical to what strace
has done, then let's leave it at that.

Just some nits inline.
Ok with those changes, as well as review comments of others.
[I'm not sure offhand if Sergio commented on this one.]

Thanks!

>
> 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 |  33 +++
>  2 files changed, 214 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 ed87d61..c061414 100644
> --- a/gdb/testsuite/gdb.base/catch-syscall.exp
> +++ b/gdb/testsuite/gdb.base/catch-syscall.exp
> @@ -275,6 +275,36 @@ 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 "\\\[${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 g:process read" \

s/g:process/group:process/
[so that we test both g: and group: as args to catch]

> +	"Catchpoint $decimal \\(syscalls (\'(clone|fork|execve|exit)\' $sysnum)+.*read.*\\)" \
> +	"set catchpoints on a group of syscalls and on a single syscall"

Add a test that "g:" and "group:" without a group name and with a bad
group name are handled correctly.  To simplify things, I'd be ok with
"g:" and "group:junk" or some such.

> +
> +    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 "complete catch syscall g" \
> +	".*group:process.*" \
> +	"complete catch syscall group suggests 'group:' prefix"
> +}
> +
>  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.
> @@ -315,6 +345,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 {} {
diff mbox

Patch

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 ed87d61..c061414 100644
--- a/gdb/testsuite/gdb.base/catch-syscall.exp
+++ b/gdb/testsuite/gdb.base/catch-syscall.exp
@@ -275,6 +275,36 @@  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 "\\\[${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 g: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 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 "complete catch syscall g" \
+	".*group:process.*" \
+	"complete catch syscall group suggests 'group:' prefix"
+}
+
 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.
@@ -315,6 +345,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 {} {