Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Marcin Kościelnicki" <koriakin@0x04.net>
To: gdb-patches@sourceware.org
Cc: "Marcin Kościelnicki" <koriakin@0x04.net>
Subject: [PATCH v3] gdbserver/s390: Switch on tracepoint support.
Date: Fri, 04 Mar 2016 10:39:00 -0000	[thread overview]
Message-ID: <1457087959-3032-1-git-send-email-koriakin@0x04.net> (raw)
In-Reply-To: <1456126708-23285-1-git-send-email-koriakin@0x04.net>

Also adds s390 support to gdb.trace testsuite.

gdb/gdbserver/ChangeLog:

	* linux-s390-low.c (s390_supports_tracepoints): New function.
	(struct linux_target_ops): Fill supports_tracepoints hook.

gdb/testsuite/ChangeLog:

	* gdb.trace/ftrace.exp: Set arg0exp for s390.
	* gdb.trace/mi-trace-frame-collected.exp: Expect 4 registers on s390.
	* gdb.trace/mi-trace-unavailable.exp: Set pcnum for s390, add gpr0num
	variable for GPR 0 instead of assuming it is register 0.
	* gdb.trace/trace-common.h: Add s390 fast tracepoint placeholder.
	* lib/trace-support.exp: Add s390 registers.
---
Since I'm abandoning my main gdb.trace cleanup patch, here's a new version
that includes the necessary s390 test changes on top of current master.

 gdb/gdbserver/ChangeLog                              |  5 +++++
 gdb/gdbserver/linux-s390-low.c                       | 10 +++++++++-
 gdb/testsuite/ChangeLog                              |  9 +++++++++
 gdb/testsuite/gdb.trace/ftrace.exp                   |  5 +++++
 gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp | 15 ++++++++++++++-
 gdb/testsuite/gdb.trace/mi-trace-unavailable.exp     | 18 +++++++++++++-----
 gdb/testsuite/gdb.trace/trace-common.h               |  8 ++++++++
 gdb/testsuite/lib/trace-support.exp                  |  4 ++++
 8 files changed, 67 insertions(+), 7 deletions(-)

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 11e1c4f..489a044 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,8 @@
+2016-03-04  Marcin Kościelnicki  <koriakin@0x04.net>
+
+	* linux-s390-low.c (s390_supports_tracepoints): New function.
+	(struct linux_target_ops): Fill supports_tracepoints hook.
+
 2016-03-03  Yao Qi  <yao.qi@linaro.org>
 
 	* linux-low.c: Update comments to start_step_over.
diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c
index 7304feb..2bcfa7a 100644
--- a/gdb/gdbserver/linux-s390-low.c
+++ b/gdb/gdbserver/linux-s390-low.c
@@ -745,6 +745,14 @@ s390_regs_info (void)
   return &regs_info;
 }
 
+/* The "supports_tracepoints" linux_target_ops method.  */
+
+static int
+s390_supports_tracepoints (void)
+{
+  return 1;
+}
+
 struct linux_target_ops the_low_target = {
   s390_arch_setup,
   s390_regs_info,
@@ -771,7 +779,7 @@ struct linux_target_ops the_low_target = {
   NULL, /* new_fork */
   NULL, /* prepare_to_resume */
   NULL, /* process_qsupported */
-  NULL, /* supports_tracepoints */
+  s390_supports_tracepoints,
   NULL, /* get_thread_area */
   NULL, /* install_fast_tracepoint_jump_pad */
   NULL, /* emit_ops */
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index 1811103..29a3fd0 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,12 @@
+2016-03-04  Marcin Kościelnicki  <koriakin@0x04.net>
+
+	* gdb.trace/ftrace.exp: Set arg0exp for s390.
+	* gdb.trace/mi-trace-frame-collected.exp: Expect 4 registers on s390.
+	* gdb.trace/mi-trace-unavailable.exp: Set pcnum for s390, add gpr0num
+	variable for GPR 0 instead of assuming it is register 0.
+	* gdb.trace/trace-common.h: Add s390 fast tracepoint placeholder.
+	* lib/trace-support.exp: Add s390 registers.
+
 2016-03-03  Doug Evans  <dje@google.com>
 
 	* gdb.base/skip.exp: Use with_test_prefix.
diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp
index a1d4771..b3c1223 100644
--- a/gdb/testsuite/gdb.trace/ftrace.exp
+++ b/gdb/testsuite/gdb.trace/ftrace.exp
@@ -242,6 +242,11 @@ if [is_amd64_regs_target] {
     set arg0exp "*(int *) (\$ebp + 8)"
 } elseif { [istarget "aarch64*-*-*"] } {
     set arg0exp "\$x0"
+} elseif { [istarget "s390x-*-*"] } {
+    set arg0exp "\$r2"
+} elseif { [istarget "s390-*-*"] } {
+    # On targets with 64-bit GPRs, avoid the high part.
+    set arg0exp "(\$r2 & 0xffffffff)"
 } else {
     set arg0exp ""
 }
diff --git a/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp b/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
index 0daaa25..a69c329 100644
--- a/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
+++ b/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
@@ -91,10 +91,23 @@ proc test_trace_frame_collected { data_source } {
 	    ".*\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"0\",frame=\{.*" \
 	    "-trace-find frame-number 0"
 
+	set reg_pattern "\{number=\"$decimal\",value=\"$hex\"\}"
+
 	# Test MI command '-trace-frame-collected' dumps only
 	# collected registers.
+	if { [istarget "s390*-*-*"] } {
+	    # Only PC is collected, but on s390 PC is a pseudo-register -
+	    # collecting it also collects the underlying PSWA register.
+	    if { "$data_source" != "tfile" } {
+		set reg_pattern "$reg_pattern,$reg_pattern"
+	    } else {
+		# For tfile, PSWM and CC are also guessed.
+		set reg_pattern "$reg_pattern,$reg_pattern,$reg_pattern,$reg_pattern"
+	    }
+	}
+
 	mi_gdb_test "-trace-frame-collected" \
-	    "\\^done,explicit-variables=\\\[\{name=\"gdb_char_test\",value=\".*\"\}\\\],computed-expressions=\\\[\\\],registers=\\\[\{number=\"$decimal\",value=\"$hex\"\}\\\],tvars=\\\[\\\],memory=\\\[\{address=\"$hex\",length=\"1\"\}\\\]"\
+	    "\\^done,explicit-variables=\\\[\{name=\"gdb_char_test\",value=\".*\"\}\\\],computed-expressions=\\\[\\\],registers=\\\[$reg_pattern\\\],tvars=\\\[\\\],memory=\\\[\{address=\"$hex\",length=\"1\"\}\\\]"\
 	    "-trace-frame-collected (register)"
 
 	mi_gdb_test "-trace-find frame-number 1" \
diff --git a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
index 82c6101..4ab67fe 100644
--- a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
+++ b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
@@ -130,28 +130,36 @@ proc test_trace_unavailable { data_source } {
 	    ".*\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"1\",frame=\{.*" \
 	    "-trace-find frame-number 1"
 
-	set pcnum 0
+	set pcnum -1
+	set gpr0num -1
 	if [is_amd64_regs_target] {
 	    set pcnum 16
+	    set gpr0num 0
 	} elseif [is_x86_like_target] {
 	    set pcnum 8
+	    set gpr0num 0
 	} elseif [is_aarch64_target] {
 	    set pcnum 32
+	    set gpr0num 0
+	} elseif { [istarget "s390*-*-*"] } {
+	    # Strictly speaking, this is PSWA, not PC.
+	    set pcnum 1
+	    set gpr0num 2
 	} else {
 	    # Other ports support tracepoint should define the number
 	    # of its own pc register.
 	}
 
-	if { $pcnum != 0 } {
+	if { $pcnum != -1 } {
 	    global hex
 	    # Test that register 0 and PC are displayed, and register
 	    # 0 is unavailable.
-	    mi_gdb_test "-data-list-register-values x 0 ${pcnum}" \
-		".*\\^done,register-values=\\\[\{number=\"0\",value=\"<unavailable>\"\},\{number=\"${pcnum}\",value=\"${hex}\"\}\\\]" \
+	    mi_gdb_test "-data-list-register-values x ${gpr0num} ${pcnum}" \
+		".*\\^done,register-values=\\\[\{number=\"${gpr0num}\",value=\"<unavailable>\"\},\{number=\"${pcnum}\",value=\"${hex}\"\}\\\]" \
 		"-data-list-register-values x"
 
 	    # Test that only available register PC is displayed.
-	    mi_gdb_test "-data-list-register-values --skip-unavailable x 0 ${pcnum}" \
+	    mi_gdb_test "-data-list-register-values --skip-unavailable x ${gpr0num} ${pcnum}" \
 		".*\\^done,register-values=\\\[\{number=\"${pcnum}\",value=\"${hex}\"\}\\\]" \
 		"-data-list-register-values --skip-unavailable x"
 	}
diff --git a/gdb/testsuite/gdb.trace/trace-common.h b/gdb/testsuite/gdb.trace/trace-common.h
index eceb182..a330024 100644
--- a/gdb/testsuite/gdb.trace/trace-common.h
+++ b/gdb/testsuite/gdb.trace/trace-common.h
@@ -48,6 +48,14 @@ x86_trace_dummy ()
        "    nop\n" \
        )
 
+#elif (defined __s390__)
+
+#define FAST_TRACEPOINT_LABEL(name) \
+  asm ("    .global " SYMBOL(name) "\n" \
+       SYMBOL(name) ":\n" \
+       "    mvc 0(8, %r15), 0(%r15)\n" \
+       )
+
 #else
 
 #error "unsupported architecture for trace tests"
diff --git a/gdb/testsuite/lib/trace-support.exp b/gdb/testsuite/lib/trace-support.exp
index f593c43..878f9e2 100644
--- a/gdb/testsuite/lib/trace-support.exp
+++ b/gdb/testsuite/lib/trace-support.exp
@@ -36,6 +36,10 @@ if [is_amd64_regs_target] {
     set fpreg "x29"
     set spreg "sp"
     set pcreg "pc"
+} elseif { [istarget "s390*-*-*"] } {
+    set fpreg "r11"
+    set spreg "r15"
+    set pcreg "pc"
 } else {
     set fpreg "fp"
     set spreg "sp"
-- 
2.7.1


  reply	other threads:[~2016-03-04 10:39 UTC|newest]

Thread overview: 89+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-24 12:12 [PATCH 0/8] gdb/s390: Add regular and fast " Marcin Kościelnicki
2016-01-24 12:12 ` [PATCH 4/8] gdb/s390: Fill gen_return_address hook Marcin Kościelnicki
2016-02-07 14:02   ` Marcin Kościelnicki
2016-02-25 19:23     ` Marcin Kościelnicki
2016-03-04 10:42       ` Marcin Kościelnicki
2016-03-11 11:20     ` Andreas Arnez
2016-03-11 11:35       ` Marcin Kościelnicki
2016-03-11 12:18         ` Andreas Arnez
2016-03-11 12:26           ` Marcin Kościelnicki
2016-03-11 15:31             ` Andreas Arnez
2016-03-11 15:44               ` Pedro Alves
2016-03-11 16:45                 ` Andreas Arnez
2016-03-11 17:02                   ` Pedro Alves
2016-03-11 18:17                     ` Eli Zaretskii
2016-03-11 18:37                       ` Pedro Alves
2016-03-11 19:34                         ` Eli Zaretskii
2016-03-15 11:11                           ` Pedro Alves
2016-03-15 11:23                             ` Andreas Arnez
2016-03-15 11:30                               ` Pedro Alves
2016-03-11 18:07                   ` Eli Zaretskii
2016-03-13  9:53               ` Marcin Kościelnicki
2016-03-14 10:07                 ` Andreas Arnez
2016-01-24 12:12 ` [PATCH 5/8] gdbserver/s390: Switch on tracepoint support Marcin Kościelnicki
2016-02-07 14:04   ` Marcin Kościelnicki
2016-02-22  7:38     ` [PATCH] " Marcin Kościelnicki
2016-03-04 10:39       ` Marcin Kościelnicki [this message]
2016-03-15 18:41         ` [PATCH v4] " Marcin Kościelnicki
2016-03-22  9:16           ` Marcin Kościelnicki
2016-03-23 15:25           ` Andreas Arnez
2016-03-24  1:15             ` Marcin Kościelnicki
2016-03-29 18:31               ` Ulrich Weigand
2016-03-29 21:40                 ` Marcin Kościelnicki
2016-03-29 21:40             ` [PATCH obv] gdb/NEWS: Add mention of s390*-linux tracepoints Marcin Kościelnicki
2016-03-30  2:49               ` Eli Zaretskii
2016-01-24 12:12 ` [PATCH 3/8] gdb/s390: Fill pseudo register agent expression hooks Marcin Kościelnicki
2016-02-07 14:01   ` Marcin Kościelnicki
2016-02-25 19:23     ` Marcin Kościelnicki
2016-03-04 10:42       ` Marcin Kościelnicki
2016-03-11  2:20         ` Marcin Kościelnicki
2016-03-11  9:58     ` Andreas Arnez
2016-03-11 10:04       ` Marcin Kościelnicki
2016-01-24 12:12 ` [PATCH 1/8] gdb: Add write_guessed_tracepoint_pc hook to gdbarch Marcin Kościelnicki
2016-01-26 14:58   ` Andreas Arnez
2016-02-07 13:59     ` [PATCH 1/8] gdb: Add supply_pseudo_pc " Marcin Kościelnicki
2016-02-16 18:28       ` Ulrich Weigand
2016-02-16 21:32         ` Marcin Kościelnicki
2016-02-18 10:35         ` [PATCH 1/2] gdb: Add guess_tracepoint_registers " Marcin Kościelnicki
2016-02-18 10:35           ` [PATCH 2/2] gdb/s390: Fill guess_tracepoint_registers hook Marcin Kościelnicki
2016-02-18 16:03             ` Ulrich Weigand
2016-02-18 16:36               ` [PATCH] " Marcin Kościelnicki
2016-02-18 16:48                 ` Ulrich Weigand
2016-02-18 16:58                   ` Marcin Kościelnicki
2016-02-18 11:38           ` [PATCH 1/2] gdb: Add guess_tracepoint_registers hook to gdbarch Luis Machado
2016-02-18 11:39             ` Marcin Kościelnicki
2016-02-18 11:45             ` [PATCH] " Marcin Kościelnicki
2016-02-18 15:40               ` Ulrich Weigand
2016-02-18 15:41                 ` Marcin Kościelnicki
2016-02-18 15:58                   ` Ulrich Weigand
2016-02-18 16:01                     ` Marcin Kościelnicki
2016-02-18 16:06                       ` Ulrich Weigand
2016-02-18 16:11                         ` Marcin Kościelnicki
2016-02-18 16:13                           ` Ulrich Weigand
2016-02-18 16:22                             ` Marcin Kościelnicki
2016-01-24 12:12 ` [PATCH 2/8] gdb/s390: Fill write_guessed_tracepoint_pc hook Marcin Kościelnicki
2016-01-26 18:12   ` Andreas Arnez
2016-01-26 19:26     ` Marcin Kościelnicki
2016-01-29 18:57       ` Andreas Arnez
2016-02-07 14:00         ` [PATCH 2/8] gdb/s390: Fill supply_pseudo_pc hook Marcin Kościelnicki
2016-01-24 12:12 ` [PATCH 7/8] gdb.trace: Bump tspeed.exp timeout to 600 seconds Marcin Kościelnicki
2016-01-26 18:17   ` Andreas Arnez
2016-01-29  9:53     ` [PATCH] " Marcin Kościelnicki
2016-02-12 11:20       ` Yao Qi
2016-02-18 18:54       ` Marcin Kościelnicki
2016-01-24 12:12 ` [PATCH 8/8] gdbserver/s390: Add support for compiled agent expressions Marcin Kościelnicki
2016-03-04 10:41   ` [PATCH v2] " Marcin Kościelnicki
2016-03-14 16:19     ` Andreas Arnez
2016-01-24 12:13 ` [PATCH 6/8] gdbserver/s390: Add fast tracepoint support Marcin Kościelnicki
2016-01-25 14:34   ` Antoine Tremblay
2016-02-19 13:41     ` Marcin Kościelnicki
2016-02-19 14:41       ` Antoine Tremblay
2016-03-04 10:40         ` [PATCH v2] " Marcin Kościelnicki
2016-03-14 16:19           ` Andreas Arnez
2016-03-14 16:25             ` Marcin Kościelnicki
2016-01-25 13:27 ` [PATCH 0/8] gdb/s390: Add regular and " Antoine Tremblay
2016-01-25 13:56 ` Pedro Alves
2016-01-25 14:28   ` Marcin Kościelnicki
2016-01-25 15:57     ` Pedro Alves
2016-01-25 16:03       ` Marcin Kościelnicki
2016-02-12 11:04 ` Marcin Kościelnicki

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=1457087959-3032-1-git-send-email-koriakin@0x04.net \
    --to=koriakin@0x04.net \
    --cc=gdb-patches@sourceware.org \
    /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