aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarcin Kościelnicki <koriakin@0x04.net>2015-11-10 09:52:29 +0100
committerMarcin Kościelnicki <koriakin@0x04.net>2015-11-10 20:05:49 +0100
commit6e7675a70f5a375159f94354fb6f38519303a73d (patch)
treedc2be4cddf5ff77dcf9817f29555a0de4ad58fd9
parent6b21c2bf57ecb18d7df949391ffc178f00b85630 (diff)
downloadgdb-6e7675a70f5a375159f94354fb6f38519303a73d.zip
gdb-6e7675a70f5a375159f94354fb6f38519303a73d.tar.gz
gdb-6e7675a70f5a375159f94354fb6f38519303a73d.tar.bz2
gdb/testsuite/gdb.trace: Deduplicate pcreg/spreg/fpreg.
These variables were used in many gdb.trace tests. Keep them in one place, to reduce work needed for new targets. gdb/testsuite/ChangeLog: * 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.
-rw-r--r--gdb/testsuite/ChangeLog19
-rw-r--r--gdb/testsuite/gdb.trace/backtrace.exp16
-rw-r--r--gdb/testsuite/gdb.trace/change-loc.exp8
-rw-r--r--gdb/testsuite/gdb.trace/collection.exp18
-rw-r--r--gdb/testsuite/gdb.trace/entry-values.exp10
-rw-r--r--gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp14
-rw-r--r--gdb/testsuite/gdb.trace/pending.exp8
-rw-r--r--gdb/testsuite/gdb.trace/report.exp18
-rw-r--r--gdb/testsuite/gdb.trace/trace-break.exp16
-rw-r--r--gdb/testsuite/gdb.trace/trace-condition.exp12
-rw-r--r--gdb/testsuite/gdb.trace/unavailable.exp18
-rw-r--r--gdb/testsuite/gdb.trace/while-dyn.exp12
-rw-r--r--gdb/testsuite/lib/trace-support.exp23
13 files changed, 47 insertions, 145 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog
index dfc9b77..0f04109 100644
--- a/gdb/testsuite/ChangeLog
+++ b/gdb/testsuite/ChangeLog
@@ -1,3 +1,22 @@
+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.
diff --git a/gdb/testsuite/gdb.trace/backtrace.exp b/gdb/testsuite/gdb.trace/backtrace.exp
index f69089b..c172029 100644
--- a/gdb/testsuite/gdb.trace/backtrace.exp
+++ b/gdb/testsuite/gdb.trace/backtrace.exp
@@ -140,23 +140,9 @@ gdb_trace_setactions "8.6: setup TP to collect regs, args, and locals" \
"$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" ""
diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index a417ef9..97c604e 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -58,14 +58,6 @@ if { ![gdb_target_supports_trace] } then {
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.
diff --git a/gdb/testsuite/gdb.trace/collection.exp b/gdb/testsuite/gdb.trace/collection.exp
index 69ad6ee..987fb6f 100644
--- a/gdb/testsuite/gdb.trace/collection.exp
+++ b/gdb/testsuite/gdb.trace/collection.exp
@@ -36,24 +36,6 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug nowarnings}]} {
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
#
diff --git a/gdb/testsuite/gdb.trace/entry-values.exp b/gdb/testsuite/gdb.trace/entry-values.exp
index 0cf5615..07aaa22 100644
--- a/gdb/testsuite/gdb.trace/entry-values.exp
+++ b/gdb/testsuite/gdb.trace/entry-values.exp
@@ -214,20 +214,12 @@ if ![gdb_target_supports_trace] {
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"
diff --git a/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp b/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
index a7bed0b..932a548 100644
--- a/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
+++ b/gdb/testsuite/gdb.trace/mi-trace-frame-collected.exp
@@ -51,20 +51,6 @@ mi_gdb_test "-break-insert -a gdb_recursion_test" \
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"
diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp
index 9938c5a..75e954a 100644
--- a/gdb/testsuite/gdb.trace/pending.exp
+++ b/gdb/testsuite/gdb.trace/pending.exp
@@ -421,6 +421,7 @@ proc pending_tracepoint_with_action_resolved { trace_type } \
global srcfile
global lib_sl1
global gdb_prompt
+ global pcreg
# Start with a fresh gdb.
clean_restart $executable
@@ -436,13 +437,6 @@ proc pending_tracepoint_with_action_resolved { trace_type } \
}
}
- 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" "^$"
diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp
index b3e9000..53ea943 100644
--- a/gdb/testsuite/gdb.trace/report.exp
+++ b/gdb/testsuite/gdb.trace/report.exp
@@ -150,24 +150,6 @@ gdb_trace_setactions "9.x: setup TP to collect locals" \
"$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" "^$"
diff --git a/gdb/testsuite/gdb.trace/trace-break.exp b/gdb/testsuite/gdb.trace/trace-break.exp
index 1f57601..4329f3a 100644
--- a/gdb/testsuite/gdb.trace/trace-break.exp
+++ b/gdb/testsuite/gdb.trace/trace-break.exp
@@ -37,22 +37,6 @@ if ![gdb_target_supports_trace] {
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 } \
diff --git a/gdb/testsuite/gdb.trace/trace-condition.exp b/gdb/testsuite/gdb.trace/trace-condition.exp
index aec0401..15efb68 100644
--- a/gdb/testsuite/gdb.trace/trace-condition.exp
+++ b/gdb/testsuite/gdb.trace/trace-condition.exp
@@ -21,16 +21,6 @@ set expfile $testfile.exp
# 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"
@@ -139,7 +129,7 @@ proc 18955_i386_failure { trace_command } {
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
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 910c1dd..5f70fc5 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -26,24 +26,6 @@ if {[prepare_for_testing $testfile.exp $testfile $srcfile \
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
#
diff --git a/gdb/testsuite/gdb.trace/while-dyn.exp b/gdb/testsuite/gdb.trace/while-dyn.exp
index fe4535e..765edfe 100644
--- a/gdb/testsuite/gdb.trace/while-dyn.exp
+++ b/gdb/testsuite/gdb.trace/while-dyn.exp
@@ -43,16 +43,6 @@ if { ![gdb_target_supports_trace] } then {
# 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
@@ -74,7 +64,7 @@ proc test_while_stepping { while_stepping } {
gdb_trace_setactions "5.12: define $while_stepping <stepcount>" \
"" \
- "collect $fpreg" "^$" \
+ "collect \$$fpreg" "^$" \
"$while_stepping 5" "^$" \
"collect p" "^$" \
"end" "^$" \
diff --git a/gdb/testsuite/lib/trace-support.exp b/gdb/testsuite/lib/trace-support.exp
index 0af73b4..4ec8cac 100644
--- a/gdb/testsuite/lib/trace-support.exp
+++ b/gdb/testsuite/lib/trace-support.exp
@@ -20,6 +20,29 @@
#
+# 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.
# Allows tests to abort early if not running on a trace-aware target.