[v2,4/4] Update documentation on catching a group of related syscalls.

Message ID 1416596731-2170-4-git-send-email-gabriel@krisman.be
State New, archived
Headers

Commit Message

Gabriel Krisman Bertazi Nov. 21, 2014, 7:05 p.m. UTC
  gdb/

	* breakpoint.c (_initialize_breakpoint): Update catch syscall
	command documentation.
	* NEWS: Include section about catching groups of syscalls.

gdb/doc/

	* gdb.texinfo (Set Catchpoints): Add 'group' argument to catch
	syscall.
---
 gdb/NEWS            |  5 +++++
 gdb/breakpoint.c    | 10 +++++-----
 gdb/doc/gdb.texinfo | 28 +++++++++++++++++++++++++++-
 3 files changed, 37 insertions(+), 6 deletions(-)
  

Comments

Eli Zaretskii Nov. 21, 2014, 7:48 p.m. UTC | #1
> From: Gabriel Krisman Bertazi <gabriel@krisman.be>
> Cc: Gabriel Krisman Bertazi <gabriel@krisman.be>
> Date: Fri, 21 Nov 2014 17:05:31 -0200
> 
> gdb/
> 
> 	* breakpoint.c (_initialize_breakpoint): Update catch syscall
> 	command documentation.
> 	* NEWS: Include section about catching groups of syscalls.
> 
> gdb/doc/
> 
> 	* gdb.texinfo (Set Catchpoints): Add 'group' argument to catch
> 	syscall.

OK for the documentation parts (didn't I approve them already?).

Thanks.
  
Gabriel Krisman Bertazi Nov. 26, 2014, 3:58 a.m. UTC | #2
Eli Zaretskii <eliz@gnu.org> writes:

> OK for the documentation parts (didn't I approve them already?).

Yeah. Sorry about that.

I had to fix some stuff on the other parts and mistakenly sent
everything again. :-)

Thanks!
  

Patch

diff --git a/gdb/NEWS b/gdb/NEWS
index d6a8b61..c901215 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -60,6 +60,11 @@  SGI Irix-6.x				mips-*-irix6*
 VAX running (4.2 - 4.3 Reno) BSD 	vax-*-bsd*
 VAX running Ultrix 			vax-*-ultrix*
 
+* The "catch syscall" command catches groups of related syscalls.
+
+  The "catch syscall" command now supports catching a group of related
+  syscalls using the 'group:' or 'g:' prefix.
+
 *** Changes in GDB 7.8
 
 * New command line options
diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
index 098e28d..c952d9a 100644
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -16660,11 +16660,11 @@  If REGEX is given, only stop for libraries matching the regular expression."),
 		     CATCH_PERMANENT,
 		     CATCH_TEMPORARY);
   add_catch_command ("syscall", _("\
-Catch system calls by their names and/or numbers.\n\
-Arguments say which system calls to catch.  If no arguments\n\
-are given, every system call will be caught.\n\
-Arguments, if given, should be one or more system call names\n\
-(if your system supports that), or system call numbers."),
+Catch system calls by their names, groups and/or numbers.\n\
+Arguments say which system calls to catch.  If no arguments are given,\n\
+every system call will be caught.  Arguments, if given, should be one\n\
+or more system call names (if your system supports that), system call\n\
+groups or system call numbers."),
 		     catch_syscall_command_1,
 		     catch_syscall_completer,
 		     CATCH_PERMANENT,
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index 15c2908..83d8d64 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -4254,7 +4254,7 @@  A call to @code{exec}.  This is currently only available for HP-UX
 and @sc{gnu}/Linux.
 
 @item syscall
-@itemx syscall @r{[}@var{name} @r{|} @var{number}@r{]} @dots{} 
+@itemx syscall @r{[}@var{name} @r{|} @var{number} @r{|} @r{group:}@var{groupname} @r{|} @r{g:}@var{groupname}@r{]} @dots{}
 @kindex catch syscall
 @cindex break on a system call.
 A call to or return from a system call, a.k.a.@: @dfn{syscall}.  A
@@ -4289,6 +4289,15 @@  may be useful if @value{GDBN}'s database does not have the complete
 list of syscalls on your system (e.g., because @value{GDBN} lags
 behind the OS upgrades).
 
+You may specify a group of related syscalls to be caught at once using
+the @code{group:} syntax (@code{g:} is a shorter equivalent.).  For
+instance, on some platforms @value{GDBN} allows you to catch all
+network related syscalls, by passing the argument @code{group:network}
+to @code{catch syscall}.  Note that not all syscall groups are
+available in every system.  You can use the command completion
+facilities (@pxref{Completion,, command completion}) to list the
+syscall groups available on your environment.
+
 The example below illustrates how this command works if you don't provide
 arguments to it:
 
@@ -4345,6 +4354,23 @@  Program exited normally.
 (@value{GDBP})
 @end smallexample
 
+Here is an example of catching a syscall group:
+
+@smallexample
+(@value{GDBP}) catch syscall group:process
+Catchpoint 1 (syscalls 'exit' [1] 'fork' [2] 'waitpid' [7]
+'execve' [11] 'wait4' [114] 'clone' [120] 'vfork' [190]
+'exit_group' [252] 'waitid' [284] 'unshare' [310])
+(@value{GDBP}) r
+Starting program: /tmp/catch-syscall
+
+Catchpoint 1 (call to syscall fork), 0x00007ffff7df4e27 in open64 ()
+   from /lib64/ld-linux-x86-64.so.2
+
+(@value{GDBP}) c
+Continuing.
+@end smallexample
+
 However, there can be situations when there is no corresponding name
 in XML file for that syscall number.  In this case, @value{GDBN} prints
 a warning message saying that it was not able to find the syscall name,