Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Yao Qi <yao@codesourcery.com>
To: Pedro Alves <palves@redhat.com>
Cc: <gdb-patches@sourceware.org>
Subject: Re: [PATCH 3/3] Select the current frame in command tdump.
Date: Wed, 31 Jul 2013 00:47:00 -0000	[thread overview]
Message-ID: <51F85E71.3060301@codesourcery.com> (raw)
In-Reply-To: <51F7C00D.5010009@redhat.com>

On 07/30/2013 09:30 PM, Pedro Alves wrote:
> "still works".
> 
> Suggest:
> 
> 	Test that the 'tdump' command still works

Fixed.  Patch 1/3 and 2/3 are committed.  Patch 3/3 is committed too
with the typo fix in comment.

-- 
Yao (齐尧)

gdb:

2013-07-31  Pedro Alves  <pedro@codesourcery.com>
	    Yao Qi  <yao@codesourcery.com>

	* tracepoint.c (trace_dump_command): Select the current frame.

gdb/testsuite:

2013-07-31  Yao Qi  <yao@codesourcery.com>

	* gdb.trace/backtrace.exp (gdb_backtrace_tdp_4): Test command
	'tdump' on stack frame 0 and 1 respectively.
---
 gdb/testsuite/gdb.trace/backtrace.exp |   31 +++++++++++++++++++++++++++++++
 gdb/tracepoint.c                      |    6 ++++++
 2 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trace/backtrace.exp
index e40428f..c3a7ec3 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 8b70bd3..ce61fb7 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);
-- 
1.7.7.6


  reply	other threads:[~2013-07-31  0:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-27 14:02 [PATCH 0/3] " Yao Qi
2013-06-27 14:02 ` [PATCH 1/3] Tweak gdb.trace/backtrace.exp Yao Qi
2013-07-29 15:44   ` Pedro Alves
2013-06-27 14:02 ` [PATCH 2/3] Make test result of gdb.trace/backtrace.exp unique Yao Qi
2013-07-29 15:44   ` Pedro Alves
2013-06-27 14:22 ` [PATCH 3/3] Select the current frame in command tdump Yao Qi
2013-07-29 15:44   ` Pedro Alves
2013-07-30 13:23     ` Yao Qi
2013-07-30 13:31       ` Pedro Alves
2013-07-31  0:47         ` Yao Qi [this message]
2013-07-22  1:13 ` [PATCH 0/3] " Yao Qi
2013-07-29  9:31   ` [ping 2]: " Yao Qi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51F85E71.3060301@codesourcery.com \
    --to=yao@codesourcery.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox