[PATCH] gdbserver/s390: Switch on tracepoint support.

Marcin Kościelnicki
2016-02-22T07:38:34Z

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/mi-trace-frame-collected.exp: Expect 4 registers on s390.
* gdb.trace/trace-common.h: Add s390 fast tracepoint placeholder.
---
Updated. This version depends on
https://sourceware.org/ml/gdb-patches/2016-02/msg00627.html .

gdb/gdbserver/ChangeLog | 5 +++++
gdb/gdbserver/linux-s390-low.c | 10 +++++++++-
gdb/testsuite/ChangeLog | 10 +++++-----
gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp | 16 +++++++++++++---
gdb/testsuite/gdb.trace/trace-common.h | 8 ++++++++
5 files changed, 40 insertions(+), 9 deletions(-)

diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 326c769..6132bbf 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,10 @@
2016-02-17 Marcin KoÅ›cielnicki <koriakin@0x04.net>

+ * linux-s390-low.c (s390_supports_tracepoints): New function.
+ (struct linux_target_ops): Fill supports_tracepoints hook.
+
+2016-02-07 Marcin KoÅ›cielnicki <koriakin@0x04.net>
+
* linux-s390-low.c (s390_supports_z_point_type): New function.
(struct linux_target_ops): Wire s390_supports_z_point_type in.

diff --git a/gdb/gdbserver/linux-s390-low.c b/gdb/gdbserver/linux-s390-low.c
index 533e384..c85c331 100644
--- a/gdb/gdbserver/linux-s390-low.c
+++ b/gdb/gdbserver/linux-s390-low.c
@@ -690,6 +690,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,
@@ -716,7 +724,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 8d695ec..27b2548 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2016-02-22 Marcin KoÅ›cielnicki <koriakin@0x04.net>
+
+ * gdb.trace/mi-trace-frame-collected.exp: Expect 4 registers on s390.
+ * gdb.trace/trace-common.h: Add s390 fast tracepoint placeholder.
+
2016-02-19 Marcin KoÅ›cielnicki <koriakin@0x04.net>

* gdb.trace/ftrace.exp: Remove unnecessary target check.
@@ -312,11 +317,6 @@
(foreach_with_prefix): Likewise.
* lib/gdb.exp (foreach_with_prefix): New procedure.

-2016-01-25 Marcin KoÅ›cielnicki <koriakin@0x04.net>
-
- * gdb.trace/backtrace.exp: Bump stack collection fudge factor.
- * gdb.trace/entry-values.exp: Bump stack collection fudge factor.
-
2016-01-23 Marcin KoÅ›cielnicki <koriakin@0x04.net>

* gdb.trace/unavailable-dwarf-piece.exp: Fix bitfield handling on big
diff --git a/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp b/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
index 0daaa25..1f0baaa 100644
--- a/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
+++ b/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
@@ -91,11 +91,21 @@ 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.
- 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\"\}\\\]"\
- "-trace-frame-collected (register)"
+ if { [istarget "s390*-*-*"] } {
+ # Only PC is collected, but on s390 PC is a pseudo-register -
+ # collecting it also collects the underlying PSWA register.
+ mi_gdb_test "-trace-frame-collected" \
+ "\\^done,explicit-variables=\\\[\{name=\"gdb_char_test\",value=\".*\"\}\\\],computed-expressions=\\\[\\\],registers=\\\[$reg_pattern,$reg_pattern,$reg_pattern,$reg_pattern\\\],tvars=\\\[\\\],memory=\\\[\{address=\"$hex\",length=\"1\"\}\\\]"\
+ "-trace-frame-collected (register)"
+ } else {
+ mi_gdb_test "-trace-frame-collected" \
+ "\\^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" \
".*\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"1\",frame=\{.*" \
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"
--
2.7.1