gdbserver/s390: Switch on tracepoint support.
authorMarcin Kościelnicki <koriakin@0x04.net>
Mon, 9 Nov 2015 13:52:13 +0000 (14:52 +0100)
committerMarcin Kościelnicki <koriakin@0x04.net>
Tue, 29 Mar 2016 21:08:05 +0000 (23:08 +0200)
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.

gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-s390-low.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.trace/ftrace.exp
gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
gdb/testsuite/gdb.trace/trace-common.h
gdb/testsuite/lib/trace-support.exp

index a63d7fb4d608c9beee172e31a597cabfcd83e87c..a7a8d2b38f2be6622c4694430f020cc05aaf2489 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-29  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-18  Yao Qi  <yao.qi@linaro.org>
 
        * linux-low.c (lwp_signal_can_be_delivered): New function.
index 7304febf7e677e59d7673a54b0a0b133592230ef..2bcfa7ad575b9ed83d83d7d5c7513b5718aab6a6 100644 (file)
@@ -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 */
index e99e661de8a052ccb64fc37de4d70e8b155cf873..76af26951e87587aa404753060d83edbc0947640 100644 (file)
@@ -1,3 +1,12 @@
+2016-03-29  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-29  Yao Qi  <yao.qi@linaro.org>
 
        * gdb.arch/arm-neon.exp: Pass debug to prepare_for_testing.
index 349f4e2d6662c5da56f095e365883b919df244be..4736f0f5fc650163a71de3b83e3d34892b0b177e 100644 (file)
@@ -244,6 +244,11 @@ if [is_amd64_regs_target] {
     set arg0exp "\$x0"
 } elseif [istarget "powerpc*-*-*"] {
     set arg0exp "\$r3"
+} 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 ""
 }
index 0daaa257d800ce77c8dee1f3fa22eb12d8d87421..a69c329a54ed34a13beab13fc4e5f53de937b2a7 100644 (file)
@@ -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" \
index 4228c9720882e0d5065393d86f3f5a35af2210f3..a49cd17c7cb45148e71a2b99a1e3707018160a51 100644 (file)
@@ -130,30 +130,39 @@ 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 "powerpc*-*-*"] {
            set pcnum 64
+           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"
        }
index fa99fd90fbffa54a482b14f1bdb667b77d31de33..60cf9e82489d8b4da55d4ad0874906b29ca51b58 100644 (file)
@@ -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"
index 372a595f27bbf7fc2345337b551ccb75818eef8d..b307f3fd5ba8549665e97f06906baf7d72eaee7c 100644 (file)
@@ -40,6 +40,10 @@ if [is_amd64_regs_target] {
     set fpreg "r31"
     set spreg "r1"
     set pcreg "pc"
+} elseif { [istarget "s390*-*-*"] } {
+    set fpreg "r11"
+    set spreg "r15"
+    set pcreg "pc"
 } else {
     set fpreg "fp"
     set spreg "sp"