From: Yao Qi Date: Wed, 31 Jul 2013 00:44:42 +0000 (+0000) Subject: gdb/ X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=de74e63a5651500a398a4166405c1bfe4a4fe2fd;p=binutils-gdb.git gdb/ * tracepoint.c (trace_dump_command): Select the current frame. gdb/testsuite/ * gdb.trace/backtrace.exp (gdb_backtrace_tdp_4): Test command 'tdump' on stack frame 0 and 1 respectively. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index b9641a09860..129b23ec53f 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2013-07-31 Pedro Alves + Yao Qi + + * tracepoint.c (trace_dump_command): Select the current frame. + 2013-07-30 Doug Evans * dwarf2read.c (process_queue): Add type signature to debug output. diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 12460df1fa2..41d41f730c1 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-07-31 Yao Qi + + * gdb.trace/backtrace.exp (gdb_backtrace_tdp_4): Test command + 'tdump' on stack frame 0 and 1 respectively. + 2013-07-31 Yao Qi PR gdb/13443 diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trace/backtrace.exp index e40428f8ecc..c3a7ec3d0d5 100644 --- a/gdb/testsuite/gdb.trace/backtrace.exp +++ b/gdb/testsuite/gdb.trace/backtrace.exp @@ -230,6 +230,37 @@ proc gdb_backtrace_tdp_4 { msg depth traceframe } { fail "$msg (fewer than $depth stack frames found)" } } + + set output_string0 "" + # Match the output of command 'tdump' and save it in + # $output_string0. + set test "tdump on frame 0" + gdb_test_multiple "tdump" $test { + -re "tdump\[\r\n\]+(.*)\[\r\n\]+$gdb_prompt $" { + set output_string0 $expect_out(1,string) + } + } + + gdb_test "up" ".*" "" + + # Test that command 'tdump' still works properly when the + # selected frame is not the current frame, and save the output + # in $output_string1. + set test "tdump on frame 1" + set output_string1 "" + gdb_test_multiple "tdump" $test { + -re "tdump\[\r\n\]+(.*)\[\r\n\]+$gdb_prompt $" { + set output_string1 $expect_out(1,string) + } + } + + # Output of 'tdump' on frame 0 and frame 1 should be + # identical. + if ![string compare $output_string0 $output_string1] { + pass "tdump output" + } else { + fail "tdump output" + } } } diff --git a/gdb/tracepoint.c b/gdb/tracepoint.c index 8b70bd3eaf3..ce61fb7b2f6 100644 --- a/gdb/tracepoint.c +++ b/gdb/tracepoint.c @@ -3065,6 +3065,12 @@ trace_dump_command (char *args, int from_tty) tracepoint_number, traceframe_number); old_chain = make_cleanup (null_cleanup, NULL); + + /* This command only makes sense for the current frame, not the + selected frame. */ + make_cleanup_restore_current_thread (); + select_frame (get_current_frame ()); + actions = all_tracepoint_actions_and_cleanup (loc->owner); trace_dump_actions (actions, 0, stepping_frame, from_tty);