From patchwork Thu Nov 13 00:18:07 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergio Durigan Junior X-Patchwork-Id: 3686 Received: (qmail 9496 invoked by alias); 13 Nov 2014 00:18:20 -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 9374 invoked by uid 89); 13 Nov 2014 00:18:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Thu, 13 Nov 2014 00:18:17 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAD0IDRC030420 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Nov 2014 19:18:14 -0500 Received: from psique.yyz.redhat.com (dhcp-10-15-16-169.yyz.redhat.com [10.15.16.169]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAD0IBQh005720; Wed, 12 Nov 2014 19:18:13 -0500 From: Sergio Durigan Junior To: GDB Patches Cc: Pedro Alves , Gabriel Krisman Bertazi , Sergio Durigan Junior Subject: [PATCH 3/3] Testcase Date: Wed, 12 Nov 2014 19:18:07 -0500 Message-Id: <1415837887-28888-4-git-send-email-sergiodj@redhat.com> In-Reply-To: <1415837887-28888-1-git-send-email-sergiodj@redhat.com> References: <1415837887-28888-1-git-send-email-sergiodj@redhat.com> X-IsSubscribed: yes This patch implements the testcase for this fix. The test is very simple: we just have to verify if the syscall number for each architecture has different meanings. I chose to test i386 and x86_64 here, but it could be any other architecture supported by the "catch syscall" command. gdb/testsuite/ 2014-11-12 Sergio Durigan Junior PR breakpoints/10737 * gdb.base/catch-syscall.exp (do_syscall_tests): Call test_catch_syscall_multi_target. (test_catch_syscall_multi_target): New function. --- gdb/testsuite/gdb.base/catch-syscall.exp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/gdb/testsuite/gdb.base/catch-syscall.exp b/gdb/testsuite/gdb.base/catch-syscall.exp index a70534c..cec1d07 100644 --- a/gdb/testsuite/gdb.base/catch-syscall.exp +++ b/gdb/testsuite/gdb.base/catch-syscall.exp @@ -311,6 +311,10 @@ proc do_syscall_tests {} { # Testing the 'catch' syscall command during a restart of # the inferior. if [runto_main] then { test_catch_syscall_restarting_inferior } + + # 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_target } } proc test_catch_syscall_without_args_noxml {} { @@ -372,6 +376,32 @@ proc test_catch_syscall_with_wrong_args_noxml {} { } } +proc test_catch_syscall_multi_target {} { + global decimal binfile + + with_test_prefix "multiple targets" { + clean_restart $binfile + + gdb_test "set architecture i386" \ + "The target architecture is assumed to be i386" \ + "set arch to i386" + + gdb_test "catch syscall 1" \ + "Catchpoint $decimal \\(syscall .exit. \\\[1\\\]\\)" \ + "insert catch syscall on syscall 1 -- exit on i386" + + gdb_test "set architecture i386:x86-64" \ + "The target architecture is assumed to be i386:x86-64" \ + "set arch to x86_64" + + gdb_test "catch syscall 1" \ + "Catchpoint $decimal \\(syscall .write. \\\[1\\\]\\)" \ + "insert catch syscall on syscall 1 -- exit on i386" + + clean_restart $binfile + } +} + proc do_syscall_tests_without_xml {} { # Make sure GDB doesn't load the syscalls xml from the system data # directory.