gdb: Add tracepoint support for powerpc.
authorMarcin Kościelnicki <koriakin@0x04.net>
Thu, 7 Jan 2016 15:48:02 +0000 (16:48 +0100)
committerMarcin Kościelnicki <koriakin@0x04.net>
Wed, 9 Mar 2016 17:47:46 +0000 (18:47 +0100)
gdb/gdbserver/ChangeLog:

* linux-ppc-low.c (ppc_supports_tracepoints): New function.
(struct linux_target_ops): Wire in the above.

gdb/testsuite/ChangeLog:

* gdb.trace/ftrace.exp: Set arg0exp for ppc.
* gdb.trace/mi-trace-unavailable.exp: Set pcnum for ppc.
* gdb.trace/pending.exp: Accept leading dot before function name.
* gdb.trace/trace-common.h: Add fast tracepoint dummy insn for ppc.
* lib/trace-support.exp: Set registers for ppc.

gdb/gdbserver/ChangeLog
gdb/gdbserver/linux-ppc-low.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.trace/ftrace.exp
gdb/testsuite/gdb.trace/mi-trace-unavailable.exp
gdb/testsuite/gdb.trace/pending.exp
gdb/testsuite/gdb.trace/trace-common.h
gdb/testsuite/lib/trace-support.exp

index 11e1c4f..dda87b0 100644 (file)
@@ -1,3 +1,8 @@
+2016-03-09  Marcin Kościelnicki  <koriakin@0x04.net>
+
+       * linux-ppc-low.c (ppc_supports_tracepoints): New function.
+       (struct linux_target_ops): Wire in the above.
+
 2016-03-03  Yao Qi  <yao.qi@linaro.org>
 
        * linux-low.c: Update comments to start_step_over.
index 61a1693..49d27ee 100644 (file)
@@ -756,6 +756,12 @@ ppc_arch_setup (void)
   current_process ()->tdesc = tdesc;
 }
 
+static int
+ppc_supports_tracepoints (void)
+{
+  return 1;
+}
+
 struct linux_target_ops the_low_target = {
   ppc_arch_setup,
   ppc_regs_info,
@@ -782,7 +788,7 @@ struct linux_target_ops the_low_target = {
   NULL, /* new_fork */
   NULL, /* prepare_to_resume */
   NULL, /* process_qsupported */
-  NULL, /* supports_tracepoints */
+  ppc_supports_tracepoints,
   NULL, /* get_thread_area */
   NULL, /* install_fast_tracepoint_jump_pad */
   NULL, /* emit_ops */
index 6704253..644a6f1 100644 (file)
@@ -1,5 +1,13 @@
 2016-03-09  Marcin Kościelnicki  <koriakin@0x04.net>
 
+       * gdb.trace/ftrace.exp: Set arg0exp for ppc.
+       * gdb.trace/mi-trace-unavailable.exp: Set pcnum for ppc.
+       * gdb.trace/pending.exp: Accept leading dot before function name.
+       * gdb.trace/trace-common.h: Add fast tracepoint dummy insn for ppc.
+       * lib/trace-support.exp: Set registers for ppc.
+
+2016-03-09  Marcin Kościelnicki  <koriakin@0x04.net>
+
        * gdb.trace/entry-values.exp: Link ${binfile}1.o to ${binfile}1 and
        use it for disassembly; accept .main in addition to main in backtrace.
 
index a1d4771..349f4e2 100644 (file)
@@ -242,6 +242,8 @@ if [is_amd64_regs_target] {
     set arg0exp "*(int *) (\$ebp + 8)"
 } elseif { [istarget "aarch64*-*-*"] } {
     set arg0exp "\$x0"
+} elseif [istarget "powerpc*-*-*"] {
+    set arg0exp "\$r3"
 } else {
     set arg0exp ""
 }
index 82c6101..4228c97 100644 (file)
@@ -137,6 +137,8 @@ proc test_trace_unavailable { data_source } {
            set pcnum 8
        } elseif [is_aarch64_target] {
            set pcnum 32
+       } elseif [istarget "powerpc*-*-*"] {
+           set pcnum 64
        } else {
            # Other ports support tracepoint should define the number
            # of its own pc register.
index 3ef752f..43f4c60 100644 (file)
@@ -307,7 +307,8 @@ proc pending_tracepoint_installed_during_trace { trace_type } \
 \[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc2.*" \
        "tracepoint is resolved"
 
-    gdb_test "tfind start" "#0  $hex in pendfunc2 .*" "tfind test frame 0"
+    # powerpc64 shows "in .pendfunc2" here.
+    gdb_test "tfind start" "#0  $hex in .?pendfunc2 .*" "tfind test frame 0"
     gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind test frame"
 }}
 
index eceb182..fa99fd9 100644 (file)
@@ -40,7 +40,7 @@ x86_trace_dummy ()
        "    call " SYMBOL(x86_trace_dummy) "\n" \
        )
 
-#elif (defined __aarch64__)
+#elif (defined __aarch64__) || (defined __powerpc__)
 
 #define FAST_TRACEPOINT_LABEL(name) \
   asm ("    .global " SYMBOL(name) "\n" \
index f593c43..372a595 100644 (file)
@@ -36,6 +36,10 @@ if [is_amd64_regs_target] {
     set fpreg "x29"
     set spreg "sp"
     set pcreg "pc"
+} elseif [istarget "powerpc*-*-*"] {
+    set fpreg "r31"
+    set spreg "r1"
+    set pcreg "pc"
 } else {
     set fpreg "fp"
     set spreg "sp"