-# Copyright (C) 1998 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
-# the Free Software Foundation; either version 2 of the License, or
+# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
-#
+#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
-#
+#
# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-
-# Please email any bugs, comments, and/or additions to this file to:
-# bug-gdb@prep.ai.mit.edu
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
# This file was written by Michael Snyder (msnyder@cygnus.com)
load_lib "trace-support.exp";
-if $tracelevel then {
- strace $tracelevel
-}
-
-set prms_id 0
-set bug_id 0
gdb_exit
gdb_start
-if [istarget "m68k-*-elf"] then {
- load_lib "emc-support.exp";
- set srcfile gdb_c_test.c
- set binfile [board_info target d490_binfile];
- gdb_test "set remotetimeout 6" "" ""
- set timeout 500
- gdb_target_monitor "$binfile"
- # Give a TSTOP and ignore errors, to make sure any previous trace is off
- gdb_test "tstop" "" ""
- gdb_test "tfind none" "" ""
- send_gdb "compare-sections CS\n"
- gdb_expect {
- -re "MIS-MATCHED.*$gdb_prompt $" {
- gdb_suppress_entire_file "Symbol file does not match target!
- all tests in this module will fail.";
- }
- -re ".*$gdb_prompt $" { }
- }
-} else {
- set testfile "actions"
- set srcfile ${testfile}.c
- set binfile $objdir/$subdir/$testfile
- if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
- executable {debug additional_flags="-gdwarf"}] != "" } {
- gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
- }
- gdb_load $binfile
- gdb_test "tstop" "" ""
- gdb_test "tfind none" "" ""
- runto_main
+standard_testfile actions.c
+if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
+ executable {debug nowarnings}] != "" } {
+ untested backtrace.exp
+ return -1
}
+gdb_load $binfile
+gdb_test "tstop" ".*" ""
+gdb_test "tfind none" ".*" ""
+runto_main
gdb_reinitialize_dir $srcdir/$subdir
-# We generously give ourselves one "pass" if we successfully
-# detect that this test cannot be run on this target!
if { ![gdb_target_supports_trace] } then {
- pass "Current target does not supporst trace"
+ unsupported "Current target does not support trace"
return 1;
}
return;
}
-send_gdb "list $baseline, +12\n"
-gdb_expect {
+set return_me 0
+
+gdb_test_multiple "list $baseline, +12" "all tests in this module will fail" {
-re "\[\r\n\](\[0-9\]+).*gdbtestline 1 " {
set testline1 $expect_out(1,string)
exp_continue
}
-re ".*$gdb_prompt $" {
if { ($testline1 == 0) || ($testline2 == 0) || ($testline3 == 0) || ($testline4 == 0) || ($testline5 == 0) || ($testline6 == 0) } {
- gdb_suppress_entire_file "failed to locate test source lines:
+ untested backtrace.exp
+ set return_me 1
all tests in this module will fail."
}
}
default {
- gdb_suppress_entire_file "failed to locate test source lines (def):
+ untested backtrace.exp
+ set return_me 1
all tests in this module will fail."
- }
+ }
+}
+
+if { $return_me == 1 } then {
+ return -1;
}
#
"$tdp4" \
"collect \$regs, \$args, \$locs" "^$"
+if [is_amd64_regs_target] {
+ set fpreg "\$rbp"
+ set spreg "\$rsp"
+} elseif [is_x86_like_target] {
+ set fpreg "\$ebp"
+ set spreg "\$esp"
+} else {
+ set fpreg "\$fp"
+ set spreg "\$sp"
+}
+
gdb_trace_setactions "8.6: setup TP to collect stack mem cast expr" \
- "$tdp6" \
- "collect \$fp, \(\*\(void \*\*\) \(\$sp\)\) @ 64" "^$"
+ "$tdp6" \
+ "collect $fpreg, \(\*\(void \*\*\) \($spreg\)\) @ 64" "^$"
-gdb_test "tstart" "" ""
+gdb_test "tstart" ".*" ""
-if [istarget "m68k-*-elf"] then {
- gdb_emclaptop_command "85,$arg1,$arg2,$arg3,$arg4,$arg5,$arg6"
- sleep 5
-} else {
- gdb_test "break end" "" ""
- gdb_test "continue" \
- "Continuing.*Breakpoint $decimal, end.*" \
- "run trace experiment"
-}
+gdb_test "break end" ".*" ""
+gdb_test "continue" \
+ "Continuing.*Breakpoint $decimal, end.*" \
+ "run trace experiment"
-gdb_test "tstop" "" ""
+gdb_test "tstop" ".*" ""
proc gdb_backtrace_tdp_1 { msg } {
global gdb_prompt
# to be able to display the function's arguments or locals, and we
# do not expect to be able to identify the caller of this function.
- send_gdb "backtrace\n"
- gdb_expect {
- -re "#0\[\t \]+gdb_recursion_test.*depth=.*$gdb_prompt $" {
- pass "$msg"
- }
- -re ".*$gdb_prompt $" {
- fail "$msg"
- }
- timeout { fail "$msg (timeout)" }
- }
+ gdb_test "backtrace" \
+ "#0\[\t \]+gdb_recursion_test.*depth=.*" \
+ "$msg"
}
proc gdb_backtrace_tdp_2 { msg } {
# passed in registers (which isn't the case for m68k), and we
# don't expect to be able to identify the caller's stack frame.
- send_gdb "backtrace\n"
- gdb_expect {
- -re "#0\[\t \]+gdb_recursion_test.*depth=.*$gdb_prompt $" {
- pass "$msg"
- }
- -re ".*$gdb_prompt $" {
- fail "$msg"
- }
- timeout { fail "$msg (timeout)" }
- }
+ gdb_test "backtrace" \
+ "#0\[\t \]+gdb_recursion_test.*depth=.*" \
+ "$msg"
}
proc gdb_backtrace_tdp_3 { msg } {
# arguments and all locals. This means that the display of
# stack frame #0 should be complete (including argument values).
- send_gdb "backtrace\n"
- gdb_expect {
+ gdb_test_multiple "backtrace" "$msg" {
-re "#0\[\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 "#0\[\t \]+gdb_recursion_test.*depth=Cannot access.*$gdb_prompt $" {
fail "$msg (failed to collect arguments)"
}
- -re ".*$gdb_prompt $" {
- fail "$msg"
- }
- timeout { fail "$msg (timeout)" }
}
}
# assume that if we can't display at least "depth" levels (with
# args), it counts as an error.
- send_gdb "backtrace\n"
- gdb_expect {
+ 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 "#\[0-9\]+\[\t \].*gdb_recursion_test.*depth=.*$gdb_prompt $" {
fail "$msg (fewer than $depth stack frames found)"
}
- -re ".*$gdb_prompt $" {
- fail "$msg"
- }
- timeout { fail "$msg (timeout)" }
}
}
"1.13: trace in recursion: depth not equal to 3"
# Finished!
-gdb_test "tfind none" "" ""
+gdb_test "tfind none" ".*" ""