Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: gdb/testsuite/gdb.trace/backtrace.exp

Issue 124383005: GDB 7.6.50 (Closed) Base URL: http://git.chromium.org/native_client/nacl-gdb.git@upstream
Patch Set: Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gdb/testsuite/gdb.trace/ax.exp ('k') | gdb/testsuite/gdb.trace/change-loc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gdb/testsuite/gdb.trace/backtrace.exp
diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trace/backtrace.exp
index 5093266bd0490d1de40e362263d7d26d115eae11..c3a7ec3d0d52127fe52d5900724bfc56c60c9a7d 100644
--- a/gdb/testsuite/gdb.trace/backtrace.exp
+++ b/gdb/testsuite/gdb.trace/backtrace.exp
@@ -1,4 +1,4 @@
-# Copyright 1998, 2007-2012 Free Software Foundation, Inc.
+# Copyright 1998-2013 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -15,27 +15,26 @@
# This file was written by Michael Snyder (msnyder@cygnus.com)
-load_lib "trace-support.exp";
+load_lib "trace-support.exp"
+standard_testfile actions.c
+set executable $testfile
+set expfile $testfile.exp
-gdb_exit
-gdb_start
+if [prepare_for_testing $expfile $executable $srcfile \
+ [list debug nowarnings]] {
+ untested "failed to prepare for trace tests"
+ return -1
+}
-standard_testfile actions.c
-if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
- executable {debug nowarnings}] != "" } {
- untested backtrace.exp
+if ![runto_main] {
+ fail "Can't run to main to check for trace support"
return -1
}
-gdb_load $binfile
-gdb_test "tstop" ".*" ""
-gdb_test "tfind none" ".*" ""
-runto_main
-gdb_reinitialize_dir $srcdir/$subdir
if { ![gdb_target_supports_trace] } then {
unsupported "Current target does not support trace"
- return 1;
+ return 1
}
@@ -57,10 +56,10 @@ set arg4 4
set arg5 5
set arg6 6
-set baseline [gdb_find_recursion_test_baseline $srcfile];
+set baseline [gdb_find_recursion_test_baseline $srcfile]
if { $baseline == -1 } {
fail "Could not find gdb_recursion_test function"
- return;
+ return
}
set return_me 0
@@ -105,7 +104,7 @@ all tests in this module will fail."
}
if { $return_me == 1 } then {
- return -1;
+ return -1
}
#
@@ -125,7 +124,7 @@ set tdp6 [gdb_gettpnum $testline6]
if { $tdp2 <= 0 || $tdp3 <= 0 || \
$tdp4 <= 0 || $tdp5 <= 0 || $tdp6 <= 0 } then {
fail "setting tracepoints failed"
- return;
+ return
}
#gdb_trace_setactions "setup TP to collect FP" \
@@ -156,14 +155,14 @@ gdb_trace_setactions "8.6: setup TP to collect stack mem cast expr" \
"$tdp6" \
"collect $fpreg, \(\*\(void \*\*\) \($spreg\)\) @ 64" "^$"
-gdb_test "tstart" ".*" ""
+gdb_test_no_output "tstart" ""
gdb_test "break end" ".*" ""
gdb_test "continue" \
"Continuing.*Breakpoint $decimal, end.*" \
"run trace experiment"
-gdb_test "tstop" ".*" ""
+gdb_test_no_output "tstop" ""
proc gdb_backtrace_tdp_1 { msg } {
global gdb_prompt
@@ -210,24 +209,57 @@ proc gdb_backtrace_tdp_3 { msg } {
}
}
-proc gdb_backtrace_tdp_4 { msg depth } {
+proc gdb_backtrace_tdp_4 { msg depth traceframe } {
global gdb_prompt
- # We are in a trace frame at which we collected all registers,
- # plus a sizeable hunk of stack memory. This should enable us to
- # display at least several stack frames worth of backtrace. We'll
- # assume that if we can't display at least "depth" levels (with
- # args), it counts as an error.
+ with_test_prefix "traceframe $traceframe" {
+ # We are in a trace frame at which we collected all registers,
+ # plus a sizeable hunk of stack memory. This should enable us to
+ # display at least several stack frames worth of backtrace. We'll
+ # assume that if we can't display at least "depth" levels (with
+ # args), it counts as an error.
+
+ gdb_test_multiple "backtrace" "$msg" {
+ -re "#$depth\[\t \].*gdb_recursion_test.*depth=\[0-9\]+.*q1=\[0-9\]+.*q2=\[0-9\]+.*q3=\[0-9\]+.*q4=\[0-9\]+.*q5=\[0-9\]+.*q6=\[0-9\]+.*$gdb_prompt $" {
+ pass "$msg"
+ }
+ -re "#$depth\[\t \].*gdb_recursion_test.*depth=.*$gdb_prompt $" {
+ fail "$msg (args missing from #$depth stack frame)"
+ }
+ -re "#\[0-9\]+\[\t \].*gdb_recursion_test.*depth=.*$gdb_prompt $" {
+ fail "$msg (fewer than $depth stack frames found)"
+ }
+ }
- gdb_test_multiple "backtrace" "$msg" {
- -re "#$depth\[\t \].*gdb_recursion_test.*depth=\[0-9\]+.*q1=\[0-9\]+.*q2=\[0-9\]+.*q3=\[0-9\]+.*q4=\[0-9\]+.*q5=\[0-9\]+.*q6=\[0-9\]+.*$gdb_prompt $" {
- pass "$msg"
+ 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)
+ }
}
- -re "#$depth\[\t \].*gdb_recursion_test.*depth=.*$gdb_prompt $" {
- fail "$msg (args missing from #$depth stack frame)"
+
+ 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)
+ }
}
- -re "#\[0-9\]+\[\t \].*gdb_recursion_test.*depth=.*$gdb_prompt $" {
- fail "$msg (fewer than $depth stack frames found)"
+
+ # 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"
}
}
}
@@ -259,7 +291,7 @@ gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 1, collect args and locals"
gdb_tfind_test "8.6: find frame 4" "4" "4"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp6:" ""
-gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0"
+gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0" 4
gdb_tfind_test "8.6: find frame 5" "5" "5"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
@@ -280,7 +312,7 @@ gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 2, collect args and locals"
gdb_tfind_test "8.6: find frame 9" "9" "9"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp6:" ""
-gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0"
+gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0" 9
gdb_tfind_test "8.6: find frame 10" "10" "10"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
@@ -301,7 +333,7 @@ gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 3, collect args and locals"
gdb_tfind_test "8.6: find frame 14" "14" "14"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp6:" ""
-gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0"
+gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0" 14
gdb_tfind_test "8.6: find frame 15" "15" "15"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
@@ -322,7 +354,7 @@ gdb_backtrace_tdp_3 "8.6: Backtrace, depth == 4, collect args and locals"
gdb_tfind_test "8.6: find frame 19" "19" "19"
gdb_test "printf \"TDP \%d:\\n\", \$tracepoint" \
"TDP $tdp6:" ""
-gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0"
+gdb_backtrace_tdp_4 "8.6: Backtrace, depth == 1, collect stack mem expr" "0" 19
gdb_test "printf \"x \%d x\\n\", depth == 3" \
"x 0 x" \
« no previous file with comments | « gdb/testsuite/gdb.trace/ax.exp ('k') | gdb/testsuite/gdb.trace/change-loc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698