From patchwork Fri Nov 21 19:05:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gabriel Krisman Bertazi X-Patchwork-Id: 3845 Received: (qmail 23549 invoked by alias); 21 Nov 2014 19:06:00 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 23537 invoked by uid 89); 21 Nov 2014 19:05:59 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL, BAYES_00, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.2 X-HELO: layla.krisman.be Received: from layla.krisman.be (HELO layla.krisman.be) (176.31.208.35) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-SHA encrypted) ESMTPS; Fri, 21 Nov 2014 19:05:54 +0000 Received: from [127.0.0.1] (localhost [127.0.0.1]) with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (envelope-from ) id 1XrtQe-0002wr-7c; Fri, 21 Nov 2014 19:59:37 +0100 From: Gabriel Krisman Bertazi To: gdb-patches@sourceware.org Cc: Gabriel Krisman Bertazi Subject: [PATCH v2 3/4] Create syscall groups for x86_64. Date: Fri, 21 Nov 2014 17:05:30 -0200 Message-Id: <1416596731-2170-3-git-send-email-gabriel@krisman.be> In-Reply-To: <1416596731-2170-1-git-send-email-gabriel@krisman.be> References: <1416596731-2170-1-git-send-email-gabriel@krisman.be> In-Reply-To: <1414956944-8856-1-git-send-email-gabriel@krisman.be> References: <1414956944-8856-1-git-send-email-gabriel@krisman.be> X-IsSubscribed: yes 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(-) 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. --> - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -141,18 +141,18 @@ - - - - - - - - + + + + + + + + - - + + @@ -163,26 +163,26 @@ - - - - + + + + - + - + - + - + - - - - + + + + @@ -193,7 +193,7 @@ - + @@ -201,20 +201,20 @@ - - - - - - - - - - - - - - + + + + + + + + + + + + + + @@ -227,15 +227,15 @@ - + - - + + - - + + @@ -245,15 +245,15 @@ - - - - - + + + + + - - - + + + @@ -261,54 +261,54 @@ - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + 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 {} {