+2015-11-10 Marcin Kościelnicki <koriakin@0x04.net>
+
+ * gdb.trace/backtrace.exp: Use global fpreg/spreg definition, add $
+ in front.
+ * gdb.trace/change-loc.exp: Use global pcreg definition.
+ * gdb.trace/collection.exp: Use global pcreg/fpreg/spreg definition.
+ * gdb.trace/entry-values.exp: Use global spreg definition, add $
+ in front.
+ * gdb.trace/mi-trace-frame-collected.exp: Use global pcreg definition.
+ * gdb.trace/pending.exp: Likewise.
+ * gdb.trace/report.exp: Use global pcreg/fpreg/spreg definition.
+ * gdb.trace/trace-break.exp: Likewise.
+ * gdb.trace/trace-condition.exp: Use global pcreg definition, add $
+ in front.
+ * gdb.trace/unavailable.exp: Use global pcreg/fpreg/spreg definition.
+ * gdb.trace/while-dyn.exp: Use global fpreg definition, add $
+ in front.
+ * lib/trace-support.exp: Define fpreg, spreg, pcreg variables.
+
2015-11-09 Joel Brobecker <brobecker@adacore.com>
* gdb.ada/fin_fun_out: New testcase.
"$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"
-} elseif [is_aarch64_target] {
- set fpreg "\$x29"
- set spreg "\$sp"
-} else {
- set fpreg "\$fp"
- set spreg "\$sp"
-}
-
gdb_trace_setactions "8.6: setup TP to collect stack mem cast expr" \
"$tdp6" \
- "collect $fpreg, \(\*\(void \*\*\) \($spreg\)\) @ 64" "^$"
+ "collect \$$fpreg, \(\*\(void \*\*\) \(\$$spreg\)\) @ 64" "^$"
gdb_test_no_output "tstart" ""
return -1
}
-if [is_amd64_regs_target] {
- set pcreg "rip"
-} elseif [is_x86_like_target] {
- set pcreg "eip"
-} else {
- set pcreg "pc"
-}
-
# Set tracepoint during tracing experiment.
set ws "\[\r\n\t \]+"
set cr "\[\r\n\]+"
-if [is_amd64_regs_target] {
- set fpreg "rbp"
- set spreg "rsp"
- set pcreg "rip"
-} elseif [is_x86_like_target] {
- set fpreg "ebp"
- set spreg "esp"
- set pcreg "eip"
-} elseif [is_aarch64_target] {
- set fpreg "x29"
- set spreg "sp"
- set pcreg "pc"
-} else {
- set fpreg "fp"
- set spreg "sp"
- set pcreg "pc"
-}
-
#
# Utility procs
#
gdb_test "trace foo" "Tracepoint $decimal at .*"
-if [is_amd64_regs_target] {
- set spreg "\$rsp"
-} elseif [is_x86_like_target] {
- set spreg "\$esp"
-} else {
- set spreg "\$sp"
-}
-
# Collect arguments i and j. Collect 'global1' which is entry value
# of argument i. Don't collect 'global2' to test the entry value of
# argument j.
gdb_trace_setactions "set action for tracepoint 1" "" \
- "collect i, j, global1, \(\*\(void \*\*\) \($spreg\)\) @ 64" "^$"
+ "collect i, j, global1, \(\*\(void \*\*\) \(\$$spreg\)\) @ 64" "^$"
gdb_test_no_output "tstart"
mi_gdb_test "-trace-define-variable \$tsv 1" {.*\^done} \
"-trace-define-variable"
-set pcreg ""
-if [is_amd64_regs_target] {
- set pcreg "rip"
-} elseif [is_x86_like_target] {
- set pcreg "eip"
-} elseif [is_aarch64_target] {
- set pcreg "pc"
-} else {
- # Other ports that support tracepoints should set the name of pc
- # register here.
- fail "set the name of pc register"
- return -1
-}
-
mi_gdb_test "-break-commands 3 \"collect gdb_char_test\" \"collect gdb_union1_test\" \"collect gdb_struct1_test.l\" \"collect gdb_arr_test\[0\]\" \"collect $${pcreg}\" \"teval \$tsv += 1\" \"collect \$tsv\" \"end\" " \
{\^done} "set action"
global srcfile
global lib_sl1
global gdb_prompt
+ global pcreg
# Start with a fresh gdb.
clean_restart $executable
}
}
- set pcreg "pc"
- if [is_amd64_regs_target] {
- set pcreg "rip"
- } elseif [is_x86_like_target] {
- set pcreg "eip"
- }
-
gdb_trace_setactions "set action for pending tracepoint" "" \
"collect \$$pcreg" "^$"
"$tdp4" \
"collect \$locs" "^$"
-if [is_amd64_regs_target] {
- set fpreg "rbp"
- set spreg "rsp"
- set pcreg "rip"
-} elseif [is_x86_like_target] {
- set fpreg "ebp"
- set spreg "esp"
- set pcreg "eip"
-} elseif [is_aarch64_target] {
- set fpreg "x29"
- set spreg "sp"
- set pcreg "pc"
-} else {
- set fpreg "fp"
- set spreg "sp"
- set pcreg "pc"
-}
-
gdb_trace_setactions "9.x: setup TP to collect stack memory" \
"$tdp5" \
"collect \$$fpreg, \*\(void \*\*\) \$$spreg @ 64" "^$"
return -1
}
-set fpreg "fp"
-set spreg "sp"
-set pcreg "pc"
-
-if [is_amd64_regs_target] {
- set fpreg "rbp"
- set spreg "rsp"
- set pcreg "rip"
-} elseif [is_x86_like_target] {
- set fpreg "ebp"
- set spreg "esp"
- set pcreg "eip"
-} elseif [is_aarch64_target] {
- set fpreg "x29"
-}
-
# Set breakpoint and tracepoint at the same address.
proc break_trace_same_addr_1 { trace_type option } \
# Some targets have leading underscores on assembly symbols.
set additional_flags [gdb_target_symbol_prefix_flags]
-if [is_amd64_regs_target] {
- set pcreg "\$rip"
-} elseif [is_x86_like_target] {
- set pcreg "\$eip"
-} elseif [is_aarch64_target] {
- set pcreg "\$pc"
-} else {
- set pcreg "\$pc"
-}
-
if [prepare_for_testing $expfile $executable $srcfile \
[list debug $additional_flags]] {
untested "failed to prepare for trace tests"
foreach trace_command { "trace" "ftrace" } {
# This condition is always true as the PC should be set to the tracepoint
# address when hit.
- test_tracepoints $trace_command "$pcreg == *set_point" 10
+ test_tracepoints $trace_command "\$$pcreg == *set_point" 10
# Can we read local variables?
test_tracepoints $trace_command "anarg == 100 || anarg == 200" 2 18955_x86_64_failure
set ws "\[\r\n\t \]+"
set cr "\[\r\n\]+"
-if [is_amd64_regs_target] {
- set fpreg "rbp"
- set spreg "rsp"
- set pcreg "rip"
-} elseif [is_x86_like_target] {
- set fpreg "ebp"
- set spreg "esp"
- set pcreg "eip"
-} elseif [is_aarch64_target] {
- set fpreg "x29"
- set spreg "sp"
- set pcreg "pc"
-} else {
- set fpreg "fp"
- set spreg "sp"
- set pcreg "pc"
-}
-
#
# Utility procs
#
# test while-stepping dynamically (live target)
#
-if [is_amd64_regs_target] {
- set fpreg "\$rbp"
-} elseif [is_x86_like_target] {
- set fpreg "\$ebp"
-} elseif [is_aarch64_target] {
- set fpreg "\$x29"
-} else {
- set fpreg "\$fp"
-}
-
proc test_while_stepping { while_stepping } {
global fpreg
global decimal
gdb_trace_setactions "5.12: define $while_stepping <stepcount>" \
"" \
- "collect $fpreg" "^$" \
+ "collect \$$fpreg" "^$" \
"$while_stepping 5" "^$" \
"collect p" "^$" \
"end" "^$" \
#
+#
+# Program counter / stack pointer / frame pointer for supported targets.
+# Used in many tests, kept here to avoid duplication.
+#
+
+if [is_amd64_regs_target] {
+ set fpreg "rbp"
+ set spreg "rsp"
+ set pcreg "rip"
+} elseif [is_x86_like_target] {
+ set fpreg "ebp"
+ set spreg "esp"
+ set pcreg "eip"
+} elseif [is_aarch64_target] {
+ set fpreg "x29"
+ set spreg "sp"
+ set pcreg "pc"
+} else {
+ set fpreg "fp"
+ set spreg "sp"
+ set pcreg "pc"
+}
+
#
# Procedure: gdb_target_supports_trace
# Returns true if GDB is connected to a target that supports tracing.