Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sergio Durigan Junior <sergiodj@redhat.com>
To: GDB Patches <gdb-patches@sourceware.org>
Cc: Pedro Alves <palves@redhat.com>,
	       Gabriel Krisman Bertazi <gabriel@krisman.be>,
	       Sergio Durigan Junior <sergiodj@redhat.com>
Subject: [PATCH 3/3] Testcase
Date: Thu, 13 Nov 2014 00:18:00 -0000	[thread overview]
Message-ID: <1415837887-28888-4-git-send-email-sergiodj@redhat.com> (raw)
In-Reply-To: <1415837887-28888-1-git-send-email-sergiodj@redhat.com>

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  <sergiodj@redhat.com>

	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.
-- 
1.9.3


  parent reply	other threads:[~2014-11-13  0:18 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-13  0:18 [PATCH] Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global Sergio Durigan Junior
2014-11-13  0:18 ` [PATCH 1/3] Making syscall information be per-arch, " Sergio Durigan Junior
2014-11-14 15:53   ` Pedro Alves
2014-11-14 23:17     ` Sergio Durigan Junior
2014-11-13  0:18 ` Sergio Durigan Junior [this message]
2014-11-14 15:54   ` [PATCH 3/3] Testcase Pedro Alves
2014-11-18  3:30     ` Sergio Durigan Junior
2014-11-18 15:13       ` Pedro Alves
2014-11-18 20:20         ` Sergio Durigan Junior
2014-11-19  9:23           ` PowerPC: "set architecture" -> "Architecture not recognized" ? (was: Re: [PATCH 3/3] Testcase) Pedro Alves
2014-11-19 18:46             ` PowerPC: "set architecture" -> "Architecture not recognized" ? Sergio Durigan Junior
2014-11-20 10:48               ` Pedro Alves
2014-11-20 17:20                 ` Sergio Durigan Junior
2014-11-13  0:18 ` [PATCH 2/3] Adjust calls for setting "catch syscall" information Sergio Durigan Junior
2014-11-14 15:53   ` Pedro Alves
2014-11-14 23:18     ` Sergio Durigan Junior
2014-11-20 17:34 ` [PATCH] Partial fix for PR breakpoints/10737: Make syscall info be per-arch instead of global Sergio Durigan Junior

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1415837887-28888-4-git-send-email-sergiodj@redhat.com \
    --to=sergiodj@redhat.com \
    --cc=gabriel@krisman.be \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox