[v4,5/5] Update documentation on catching a group of related syscalls.

Message ID 1431304069-19647-6-git-send-email-gabriel@krisman.be
State New, archived
Headers

Commit Message

Gabriel Krisman Bertazi May 11, 2015, 12:27 a.m. UTC
  gdb/

	* break-catch-syscall.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/break-catch-syscall.c | 10 +++++-----
 gdb/doc/gdb.texinfo       | 28 +++++++++++++++++++++++++++-
 3 files changed, 37 insertions(+), 6 deletions(-)
  

Comments

Gabriel Krisman Bertazi May 11, 2015, 12:40 a.m. UTC | #1
Gabriel Krisman Bertazi <gabriel@krisman.be> writes:

> gdb/
>
> 	* break-catch-syscall.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.

Oops,

Sorry, I sent the documentation patch again.  Please, ignore this one,
Eli already approved it twice. :)
  
Pedro Alves May 13, 2015, 10:29 a.m. UTC | #2
On 05/11/2015 01:40 AM, Gabriel Krisman Bertazi wrote:
> Gabriel Krisman Bertazi <gabriel@krisman.be> writes:
> 
>> gdb/
>>
>> 	* break-catch-syscall.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.
> 
> Oops,
> 
> Sorry, I sent the documentation patch again.  Please, ignore this one,
> Eli already approved it twice. :)

Generally, personally, in such cases, I prefer that an already approved patch
is included in the series.  That is, it makes it easier for people to review
the whole series on its own.  Don't assume that people still have context
on previous discussions and patches in their heads.  For example, I didn't
really follow v1 and v2 closely (was OOO when most of the discussions
happened, I think), and when I saw v3 I had to go hunt for the
documentation patch.  You can just mention in the patch intro that it is
already approved.

Thanks,
Pedro Alves
  
Eli Zaretskii May 13, 2015, 4:40 p.m. UTC | #3
> Date: Wed, 13 May 2015 11:29:56 +0100
> From: Pedro Alves <palves@redhat.com>
> CC: gdb-patches@sourceware.org, dje@google.com
> 
> > Sorry, I sent the documentation patch again.  Please, ignore this one,
> > Eli already approved it twice. :)
> 
> Generally, personally, in such cases, I prefer that an already approved patch
> is included in the series.

I don't mind, but please do tell that it was already approved.

Thanks.
  

Patch

diff --git a/gdb/NEWS b/gdb/NEWS
index 6ad68ac..a6b5e44 100644
--- a/gdb/NEWS
+++ b/gdb/NEWS
@@ -138,6 +138,11 @@  qXfer:exec-file:read
 HP/PA running HP-UX           hppa*-*-hpux*
 Itanium running HP-UX         ia64-*-hpux*
 
+* 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.9
 
 * GDB now supports hardware watchpoints on x86 GNU Hurd.
diff --git a/gdb/break-catch-syscall.c b/gdb/break-catch-syscall.c
index 686daf1..e65bd0a 100644
--- a/gdb/break-catch-syscall.c
+++ b/gdb/break-catch-syscall.c
@@ -723,11 +723,11 @@  _initialize_break_catch_syscall (void)
 					   catch_syscall_inferior_data_cleanup);
 
   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 9e2787d..e2be1d3 100644
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -4282,7 +4282,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
@@ -4317,6 +4317,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:
 
@@ -4373,6 +4382,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,