From b04fd3bec955560e00fb0cf6b75e36187a207113 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Marcin=20Ko=C5=9Bcielnicki?= Date: Thu, 7 Jan 2016 16:48:02 +0100 Subject: [PATCH] gdb: Add tracepoint support for powerpc. 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 | 5 +++++ gdb/gdbserver/linux-ppc-low.c | 8 +++++++- gdb/testsuite/ChangeLog | 8 ++++++++ gdb/testsuite/gdb.trace/ftrace.exp | 2 ++ gdb/testsuite/gdb.trace/mi-trace-unavailable.exp | 2 ++ gdb/testsuite/gdb.trace/pending.exp | 3 ++- gdb/testsuite/gdb.trace/trace-common.h | 2 +- gdb/testsuite/lib/trace-support.exp | 4 ++++ 8 files changed, 31 insertions(+), 3 deletions(-) diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 11e1c4f..dda87b0 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,8 @@ +2016-03-09 Marcin Kościelnicki + + * linux-ppc-low.c (ppc_supports_tracepoints): New function. + (struct linux_target_ops): Wire in the above. + 2016-03-03 Yao Qi * linux-low.c: Update comments to start_step_over. diff --git a/gdb/gdbserver/linux-ppc-low.c b/gdb/gdbserver/linux-ppc-low.c index 61a1693..49d27ee 100644 --- a/gdb/gdbserver/linux-ppc-low.c +++ b/gdb/gdbserver/linux-ppc-low.c @@ -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 */ diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 6704253..644a6f1 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,5 +1,13 @@ 2016-03-09 Marcin Kościelnicki + * 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 + * 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. diff --git a/gdb/testsuite/gdb.trace/ftrace.exp b/gdb/testsuite/gdb.trace/ftrace.exp index a1d4771..349f4e2 100644 --- a/gdb/testsuite/gdb.trace/ftrace.exp +++ b/gdb/testsuite/gdb.trace/ftrace.exp @@ -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 "" } diff --git a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp index 82c6101..4228c97 100644 --- a/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp +++ b/gdb/testsuite/gdb.trace/mi-trace-unavailable.exp @@ -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. diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp index 3ef752f..43f4c60 100644 --- a/gdb/testsuite/gdb.trace/pending.exp +++ b/gdb/testsuite/gdb.trace/pending.exp @@ -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" }} diff --git a/gdb/testsuite/gdb.trace/trace-common.h b/gdb/testsuite/gdb.trace/trace-common.h index eceb182..fa99fd9 100644 --- a/gdb/testsuite/gdb.trace/trace-common.h +++ b/gdb/testsuite/gdb.trace/trace-common.h @@ -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" \ diff --git a/gdb/testsuite/lib/trace-support.exp b/gdb/testsuite/lib/trace-support.exp index f593c43..372a595 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 "powerpc*-*-*"] { + set fpreg "r31" + set spreg "r1" + set pcreg "pc" } else { set fpreg "fp" set spreg "sp" -- 2.7.4