aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.trace
diff options
context:
space:
mode:
authorYao Qi <yao@codesourcery.com>2013-03-15 01:41:29 +0000
committerYao Qi <yao@codesourcery.com>2013-03-15 01:41:29 +0000
commit0a251e08fa4e7130f05462ecc9f60e6683cdefca (patch)
treec79ccfc1f502d7e7d48c54b67720381603201b98 /gdb/testsuite/gdb.trace
parent2c415c0f382fd6361d9d702ebdd71cd6d6a06d19 (diff)
downloadgdb-0a251e08fa4e7130f05462ecc9f60e6683cdefca.zip
gdb-0a251e08fa4e7130f05462ecc9f60e6683cdefca.tar.gz
gdb-0a251e08fa4e7130f05462ecc9f60e6683cdefca.tar.bz2
gdb/testsuite/
* gdb.threads/non-ldr-exc-1.exp (do_test): Fix the indent of using with_test_prefix. * gdb.threads/non-ldr-exc-2.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-3.exp (do_test): Likewise. * gdb.threads/non-ldr-exc-4.exp (do_test): Likewise. * gdb.threads/watchpoint-fork.exp (test): Likewise. * gdb.base/break-interp.exp (test_core): Likewise. (test_attach_gdb): Likewise. * gdb.base/catch-load.exp (one_catch_load_test): Likewise. * gdb.base/disp-step-syscall.exp (disp_step_cross_syscall): Likewise. * gdb.base/jit-so.exp (one_jit_test): Likewise. * gdb.base/jit.exp (one_jit_test): Likewise. * gdb.base/sepdebug.exp (test_different_dir): Likewise. * gdb.dwarf2/dw2-dir-file-name.exp (test): Likewise. * gdb.dwarf2/dw2-noloc.exp (file_symbols): Likewise. * gdb.mi/mi-breakpoint-changed.exp (test_pending_resolved): Likewise. * gdb.mi/mi-cmd-param-changed.exp (test_command_param_changed): Likewise. * gdb.mi/mi-watch.exp test_watchpoint_all): Likewise. * gdb.mi/pr11022.exp (test_memory_changed_observer): Likewise. * gdb.trace/change-loc.exp (tracepoint_change_loc_1): Likewise. (tracepoint_change_loc_2): Likewise. * gdb.trace/disconnected-tracing.exp (disconnected_tracing): Likewise. (disconnected_tfind): Likewise. * gdb.trace/mi-traceframe-changed.exp (test_tfind_tfile): Likewise. (test_tfind_remote): Likewise. * gdb.trace/mi-tracepoint-changed.exp (test_reconnect): Likewise. (test_pending_resolved): Likewise. * gdb.trace/mi-tsv-changed.exp (test_create_delete_modify_tsv): Likewise. (test_upload_tsv): Likewise. * gdb.trace/pending.exp (pending_tracepoint_resolved): Likewise. (pending_tracepoint_works): Likewise. * gdb.trace/report.exp (use_collected_data): Likewise. * gdb.trace/status-stop.exp (test_tstart_tstop_tstart): Likewise. (test_tstart_tstart, test_buffer_full_tstart): Likewise. * gdb.trace/strace.exp (strace_info_marker): Likewise. (strace_trace_on_same_addr): Likewise. (strace_trace_on_diff_addr): Likewise. * gdb.trace/unavailable.exp (gdb_collect_args_test): Likewise. (gdb_collect_locals_test): Likewise. (gdb_unavailable_registers_test): Likewise. (gdb_collect_globals_test): Likewise.
Diffstat (limited to 'gdb/testsuite/gdb.trace')
-rw-r--r--gdb/testsuite/gdb.trace/change-loc.exp338
-rw-r--r--gdb/testsuite/gdb.trace/disconnected-tracing.exp176
-rw-r--r--gdb/testsuite/gdb.trace/mi-traceframe-changed.exp118
-rw-r--r--gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp325
-rw-r--r--gdb/testsuite/gdb.trace/mi-tsv-changed.exp336
-rw-r--r--gdb/testsuite/gdb.trace/pending.exp162
-rw-r--r--gdb/testsuite/gdb.trace/report.exp367
-rw-r--r--gdb/testsuite/gdb.trace/status-stop.exp113
-rw-r--r--gdb/testsuite/gdb.trace/strace.exp380
-rw-r--r--gdb/testsuite/gdb.trace/unavailable.exp654
10 files changed, 1522 insertions, 1447 deletions
diff --git a/gdb/testsuite/gdb.trace/change-loc.exp b/gdb/testsuite/gdb.trace/change-loc.exp
index b02cf27..3a79b10 100644
--- a/gdb/testsuite/gdb.trace/change-loc.exp
+++ b/gdb/testsuite/gdb.trace/change-loc.exp
@@ -69,208 +69,218 @@ if [is_amd64_regs_target] {
# Set tracepoint during tracing experiment.
-proc tracepoint_change_loc_1 { trace_type } { with_test_prefix "1 $trace_type" {
- global testfile
- global srcfile
- global pcreg
- global gdb_prompt
-
- clean_restart ${testfile}
- if ![runto_main] {
- fail "Can't run to main"
- return -1
- }
- gdb_test_no_output "delete break 1"
-
- # Set a tracepoint we'll never meet. Just to avoid the complain after
- # type `tstart' later.
- gdb_test "next" ".*"
- gdb_test "trace main" "Tracepoint \[0-9\] at.* file .*$srcfile, line.*" \
- "set tracepoint on main"
-
- gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \
- "breakpoint on marker"
-
- gdb_test_no_output "tstart"
-
- gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \
- "continue to marker 1"
- # Set a tracepoint during tracing.
- set test "set tracepoint on set_tracepoint"
- gdb_test_multiple "${trace_type} set_tracepoint" $test {
- -re "Target returns error code .* too far .*$gdb_prompt $" {
- if [string equal $trace_type "ftrace"] {
- # The target was unable to install the fast tracepoint
- # (e.g., jump pad too far from tracepoint).
- pass "$test (too far)"
- } else {
- fail $test
- }
+proc tracepoint_change_loc_1 { trace_type } {
+ with_test_prefix "1 $trace_type" {
+ global testfile
+ global srcfile
+ global pcreg
+ global gdb_prompt
+
+ clean_restart ${testfile}
+ if ![runto_main] {
+ fail "Can't run to main"
+ return -1
}
- -re "\r\n$gdb_prompt $" {
- pass $test
+ gdb_test_no_output "delete break 1"
+
+ # Set a tracepoint we'll never meet. Just to avoid the
+ # complain after type `tstart' later.
+ gdb_test "next" ".*"
+ gdb_test "trace main" \
+ "Tracepoint \[0-9\] at.* file .*$srcfile, line.*" \
+ "set tracepoint on main"
+
+ gdb_test "break marker" \
+ "Breakpoint.*at.* file .*$srcfile, line.*" \
+ "breakpoint on marker"
+
+ gdb_test_no_output "tstart"
+
+ gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \
+ "continue to marker 1"
+ # Set a tracepoint during tracing.
+ set test "set tracepoint on set_tracepoint"
+ gdb_test_multiple "${trace_type} set_tracepoint" $test {
+ -re "Target returns error code .* too far .*$gdb_prompt $" {
+ if [string equal $trace_type "ftrace"] {
+ # The target was unable to install the fast tracepoint
+ # (e.g., jump pad too far from tracepoint).
+ pass "$test (too far)"
+ } else {
+ fail $test
+ }
+ }
+ -re "\r\n$gdb_prompt $" {
+ pass $test
+ }
}
- }
- gdb_trace_setactions "set action for tracepoint" "" \
- "collect \$$pcreg" "^$"
+ gdb_trace_setactions "set action for tracepoint" "" \
+ "collect \$$pcreg" "^$"
- # tracepoint has two locations after shlib change-loc-1 is loaded.
- gdb_test "info trace" \
- "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ # tracepoint has two locations after shlib change-loc-1 is loaded.
+ gdb_test "info trace" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.*4\.2.* in func4.*" \
- "tracepoint with two locations"
-
- set test "continue to marker 2"
- gdb_test_multiple "continue" $test {
- -re "Target returns error code .* too far .*$gdb_prompt $" {
- if [string equal $trace_type "ftrace"] {
- # Expected if the target was unable to install the
- # fast tracepoint (e.g., jump pad too far from
- # tracepoint).
- pass "$test (too far)"
- # Skip the rest of the tests.
- return
- } else {
- fail "continue to marker 2"
- fail $test
- }
-
- }
- -re ".*Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
- pass "continue to marker 2"
- }
- }
+ "tracepoint with two locations"
+
+ set test "continue to marker 2"
+ gdb_test_multiple "continue" $test {
+ -re "Target returns error code .* too far .*$gdb_prompt $" {
+ if [string equal $trace_type "ftrace"] {
+ # Expected if the target was unable to install the
+ # fast tracepoint (e.g., jump pad too far from
+ # tracepoint).
+ pass "$test (too far)"
+ # Skip the rest of the tests.
+ return
+ } else {
+ fail "continue to marker 2"
+ fail $test
+ }
- # tracepoint has three locations after shlib change-loc-2 is loaded.
- gdb_test "info trace" \
- "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ }
+ -re ".*Breakpoint.*marker.*at.*$srcfile.*$gdb_prompt $" {
+ pass "continue to marker 2"
+ }
+ }
+
+ # tracepoint has three locations after shlib change-loc-2 is
+ # loaded.
+ gdb_test "info trace" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*4\.1.* in func4.*4\.2.* in func4.*4\.3.* in func4 .*" \
- "tracepoint with three locations"
+ "tracepoint with three locations"
- gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \
- "continue to marker 3"
+ gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \
+ "continue to marker 3"
- # shlib is unloaded, there are still three locations, but one is pending.
- gdb_test "info trace" \
- "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ # shlib is unloaded, there are still three locations, but one
+ # is pending.
+ gdb_test "info trace" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*
4\.1.* in func4.*\tinstalled on target\r\n(4\.2.* in func4.*\tinstalled on target\r\n4\.3.* \<PENDING\>\[\t \]+set_tracepoint|4\.2.* \<PENDING\>\[\t \]+set_tracepoint.*4\.3.* in func4.*\tinstalled on target).*" \
- "tracepoint with two locations (unload)"
+ "tracepoint with two locations (unload)"
- gdb_test_no_output "tstop"
+ gdb_test_no_output "tstop"
- gdb_test "tfind" "Found trace frame 0, tracepoint 4.*" "tfind frame 0"
- gdb_test "tfind" "Target failed to find requested trace frame\\..*"
-}}
+ gdb_test "tfind" "Found trace frame 0, tracepoint 4.*" \
+ "tfind frame 0"
+ gdb_test "tfind" \
+ "Target failed to find requested trace frame\\..*"
+ }
+}
# Set pending tracepoint.
-proc tracepoint_change_loc_2 { trace_type } { with_test_prefix "2 $trace_type" {
- global srcdir
- global srcfile
- global subdir
- global pcreg
- global binfile
- global gdb_prompt
-
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
-
- gdb_test_multiple "${trace_type} set_tracepoint" "set pending tracepoint" {
- -re ".*Make \(|fast \)tracepoint pending.*y or \\\[n\\\]. $" {
- gdb_test "y" "\(Fast t|T\)racepoint.*set_tracepoint.*pending." "set pending tracepoint"
+proc tracepoint_change_loc_2 { trace_type } {
+ with_test_prefix "2 $trace_type" {
+ global srcdir
+ global srcfile
+ global subdir
+ global pcreg
+ global binfile
+ global gdb_prompt
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+
+ gdb_test_multiple "${trace_type} set_tracepoint" "set pending tracepoint" {
+ -re ".*Make \(|fast \)tracepoint pending.*y or \\\[n\\\]. $" {
+ gdb_test "y" "\(Fast t|T\)racepoint.*set_tracepoint.*pending." "set pending tracepoint"
+ }
}
- }
- gdb_trace_setactions "set action for tracepoint" "" \
- "collect \$$pcreg" "^$"
+ gdb_trace_setactions "set action for tracepoint" "" \
+ "collect \$$pcreg" "^$"
- # tracepoint has no location information now. Make sure nothing
- # else is displayed.
- gdb_test "info trace" \
- "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ # tracepoint has no location information now. Make sure nothing
+ # else is displayed.
+ gdb_test "info trace" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*PENDING.*set_tracepoint\r\n\[\t \]+collect \\$$pcreg\r" \
- "single pending tracepoint info (without symbols)"
+ "single pending tracepoint info (without symbols)"
- gdb_load ${binfile}
- # tracepoint has one location after executable is loaded.
- gdb_test "info trace" \
- "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ gdb_load ${binfile}
+ # tracepoint has one location after executable is loaded.
+ gdb_test "info trace" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*func4.*" \
- "tracepoint with one location"
+ "tracepoint with one location"
- set main_bp 0
- gdb_test_multiple "break main" "set breakpoint on main" {
- -re "Breakpoint (\[0-9\]*) at .*, line.*$gdb_prompt $" {
- set main_bp $expect_out(1,string)
+ set main_bp 0
+ gdb_test_multiple "break main" "set breakpoint on main" {
+ -re "Breakpoint (\[0-9\]*) at .*, line.*$gdb_prompt $" {
+ set main_bp $expect_out(1,string)
+ }
}
- }
- gdb_run_cmd
+ gdb_run_cmd
- gdb_test "" \
- ".*Breakpoint.*main.*at.*$srcfile.*" \
- "run to main"
- gdb_test_no_output "delete break $main_bp"
+ gdb_test "" \
+ ".*Breakpoint.*main.*at.*$srcfile.*" \
+ "run to main"
+ gdb_test_no_output "delete break $main_bp"
- # tracepoint has two locations after shlib change-loc-1 is loaded.
- gdb_test "info trace" \
- "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ # tracepoint has two locations after shlib change-loc-1 is loaded.
+ gdb_test "info trace" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*1\.1.* in func4.*1\.2.* in func4.*" \
- "tracepoint with two locations"
-
- gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \
- "breakpoint on marker"
-
- # tracepoint with two locations will be downloaded and installed.
- set test "tstart"
- gdb_test_multiple "tstart" $test {
- -re "^tstart\r\n$gdb_prompt $" {
- pass "tstart"
- }
- -re "Target returns error code .* too far .*$gdb_prompt $" {
- if [string equal $trace_type "ftrace"] {
- # The target was unable to install the fast tracepoint
- # (e.g., jump pad too far from tracepoint).
- pass "$test (too far)"
- # Skip the rest of the tests.
- return
- } else {
- fail $test
- }
+ "tracepoint with two locations"
+
+ gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \
+ "breakpoint on marker"
+
+ # tracepoint with two locations will be downloaded and installed.
+ set test "tstart"
+ gdb_test_multiple "tstart" $test {
+ -re "^tstart\r\n$gdb_prompt $" {
+ pass "tstart"
+ }
+ -re "Target returns error code .* too far .*$gdb_prompt $" {
+ if [string equal $trace_type "ftrace"] {
+ # The target was unable to install the fast tracepoint
+ # (e.g., jump pad too far from tracepoint).
+ pass "$test (too far)"
+ # Skip the rest of the tests.
+ return
+ } else {
+ fail $test
+ }
+ }
}
- }
- gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \
- "continue to marker 1"
+ gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \
+ "continue to marker 1"
- gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \
- "continue to marker 2"
+ gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \
+ "continue to marker 2"
- # tracepoint has three locations after shlib change-loc-2 is loaded.
- gdb_test "info trace" \
- "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ # tracepoint has three locations after shlib change-loc-2 is loaded.
+ gdb_test "info trace" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*1\.1.* in func4.*1\.2.* in func4.*1\.3.* in func4 .*" \
- "tracepoint with three locations"
+ "tracepoint with three locations"
- gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \
- "continue to marker 3"
+ gdb_test "continue" ".*Breakpoint.*marker.*at.*$srcfile.*" \
+ "continue to marker 3"
- # shlib is unloaded, there are still three locations, but one is pending.
- gdb_test "info trace" \
- "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ # shlib is unloaded, there are still three locations, but one is pending.
+ gdb_test "info trace" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+\(|fast \)tracepoint\[ \]+keep y.*\<MULTIPLE\>.*
1\.1.* in func4.*\tinstalled on target\r\n(1\.2.* in func4.*\tinstalled on target\r\n1\.3.* \<PENDING\>\[\t \]+set_tracepoint|1\.2.* \<PENDING\>\[\t \]+set_tracepoint\r\n1\.3.* in func4.*\tinstalled on target).*" \
- "tracepoint with two locations (unload)"
+ "tracepoint with two locations (unload)"
- gdb_test_no_output "tstop"
+ gdb_test_no_output "tstop"
- gdb_test "tfind" "Found trace frame 0, tracepoint 1.*" "tfind frame 0"
- gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" "tfind frame 1"
- gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" "tfind frame 2"
- gdb_test "tfind" "Target failed to find requested trace frame\\..*"
-}}
+ gdb_test "tfind" "Found trace frame 0, tracepoint 1.*" "tfind frame 0"
+ gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" "tfind frame 1"
+ gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" "tfind frame 2"
+ gdb_test "tfind" "Target failed to find requested trace frame\\..*"
+ }
+}
tracepoint_change_loc_1 "trace"
tracepoint_change_loc_2 "trace"
diff --git a/gdb/testsuite/gdb.trace/disconnected-tracing.exp b/gdb/testsuite/gdb.trace/disconnected-tracing.exp
index bec016e..03d7d09 100644
--- a/gdb/testsuite/gdb.trace/disconnected-tracing.exp
+++ b/gdb/testsuite/gdb.trace/disconnected-tracing.exp
@@ -45,101 +45,105 @@ if ![gdb_target_supports_trace] {
# Disconnect in tracing.
-proc disconnected_tracing { } { with_test_prefix "trace" {
- global executable
- global decimal
- global srcfile
-
- # Start with a fresh gdb.
- clean_restart ${executable}
- if ![runto_main] {
- fail "Can't run to main"
- return -1
- }
-
- gdb_test_no_output "set confirm off"
- gdb_test_no_output "set disconnected-tracing on"
- gdb_test "trace start" ".*"
- gdb_trace_setactions "collect on tracepoint 2" "2" \
- "collect foo" "^$"
- gdb_test "break end" "Breakpoint ${decimal} at .*"
-
- gdb_test_no_output "tstart"
-
- gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
- gdb_test_no_output "tstop"
-
- gdb_test "info tracepoints" ".*in start at.*" \
- "first info tracepoints"
-
- gdb_test "disconnect" "Ending remote debugging\\." "first disconnect"
- if { [gdb_reconnect] == 0 } {
- pass "first reconnect after unload"
- } else {
- fail "first reconnect after unload"
- return 0
- }
- gdb_test "info tracepoints" ".*in start at.*" \
- "second info tracepoints"
-
- delete_breakpoints
- gdb_test "info tracepoints" ".*No tracepoints..*" \
- "third info tracepoints"
-
- gdb_test "disconnect" "Ending remote debugging\\." "second disconnect"
- if { [gdb_reconnect] == 0 } {
- pass "second reconnect after unload"
- } else {
- fail "second reconnect after unload"
- return 0
- }
- gdb_test "tstatus"
- gdb_test "info tracepoints" \
- "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+proc disconnected_tracing { } {
+ with_test_prefix "trace" {
+ global executable
+ global decimal
+ global srcfile
+
+ # Start with a fresh gdb.
+ clean_restart ${executable}
+ if ![runto_main] {
+ fail "Can't run to main"
+ return -1
+ }
+
+ gdb_test_no_output "set confirm off"
+ gdb_test_no_output "set disconnected-tracing on"
+ gdb_test "trace start" ".*"
+ gdb_trace_setactions "collect on tracepoint 2" "2" \
+ "collect foo" "^$"
+ gdb_test "break end" "Breakpoint ${decimal} at .*"
+
+ gdb_test_no_output "tstart"
+
+ gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
+ gdb_test_no_output "tstop"
+
+ gdb_test "info tracepoints" ".*in start at.*" \
+ "first info tracepoints"
+
+ gdb_test "disconnect" "Ending remote debugging\\." "first disconnect"
+ if { [gdb_reconnect] == 0 } {
+ pass "first reconnect after unload"
+ } else {
+ fail "first reconnect after unload"
+ return 0
+ }
+ gdb_test "info tracepoints" ".*in start at.*" \
+ "second info tracepoints"
+
+ delete_breakpoints
+ gdb_test "info tracepoints" ".*No tracepoints..*" \
+ "third info tracepoints"
+
+ gdb_test "disconnect" "Ending remote debugging\\." "second disconnect"
+ if { [gdb_reconnect] == 0 } {
+ pass "second reconnect after unload"
+ } else {
+ fail "second reconnect after unload"
+ return 0
+ }
+ gdb_test "tstatus"
+ gdb_test "info tracepoints" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+tracepoint keep y.* in start at .*$srcfile:\[0-9\]+.
\[\t \]+tracepoint already hit 1 time.
\[\t \]+trace buffer usage ${decimal} bytes.
\[\t \]+collect foo.*" \
- "fourth info tracepoints"
-}}
+ "fourth info tracepoints"
+ }
+}
disconnected_tracing
# Disconnected in tfind
-proc disconnected_tfind { } { with_test_prefix "tfind" {
- global executable
- global decimal
-
- # Start with a fresh gdb.
- clean_restart ${executable}
- if ![runto_main] {
- fail "Can't run to main"
- return -1
+proc disconnected_tfind { } {
+ with_test_prefix "tfind" {
+ global executable
+ global decimal
+
+ # Start with a fresh gdb.
+ clean_restart ${executable}
+ if ![runto_main] {
+ fail "Can't run to main"
+ return -1
+ }
+
+ gdb_test_no_output "set confirm off"
+ gdb_test_no_output "set disconnected-tracing on"
+ gdb_test "trace start" ".*"
+ gdb_test_no_output "tstart"
+
+ gdb_test "break end" "Breakpoint ${decimal} at .*"
+ gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
+ gdb_test_no_output "tstop"
+
+ gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
+ gdb_test "p \$trace_frame" ".*\\\$${decimal} = 0.*" \
+ "p \$trace_frame before disconnected"
+ gdb_test "p \$tracepoint" ".*\\\$${decimal} = 2.*" \
+ "p \$tracepoint before disconnected"
+
+ gdb_test "disconnect" "Ending remote debugging\\." "first disconnect"
+
+ gdb_test "p \$trace_frame" ".*\\\$${decimal} = -1.*"
+ gdb_test "p \$tracepoint" ".*\\\$${decimal} = -1.*"
+ gdb_test "p \$trace_line" ".*\\\$${decimal} = -1.*"
+ gdb_test "p \$trace_file" ".*\\\$${decimal} = void.*"
+ gdb_test "p \$trace_func" ".*\\\$${decimal} = void.*"
}
-
- gdb_test_no_output "set confirm off"
- gdb_test_no_output "set disconnected-tracing on"
- gdb_test "trace start" ".*"
- gdb_test_no_output "tstart"
-
- gdb_test "break end" "Breakpoint ${decimal} at .*"
- gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*"
- gdb_test_no_output "tstop"
-
- gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
- gdb_test "p \$trace_frame" ".*\\\$${decimal} = 0.*" \
- "p \$trace_frame before disconnected"
- gdb_test "p \$tracepoint" ".*\\\$${decimal} = 2.*" \
- "p \$tracepoint before disconnected"
-
- gdb_test "disconnect" "Ending remote debugging\\." "first disconnect"
-
- gdb_test "p \$trace_frame" ".*\\\$${decimal} = -1.*"
- gdb_test "p \$tracepoint" ".*\\\$${decimal} = -1.*"
- gdb_test "p \$trace_line" ".*\\\$${decimal} = -1.*"
- gdb_test "p \$trace_file" ".*\\\$${decimal} = void.*"
- gdb_test "p \$trace_func" ".*\\\$${decimal} = void.*"
-}}
+}
disconnected_tfind
diff --git a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
index 42dbe19..7849a7e 100644
--- a/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-traceframe-changed.exp
@@ -34,39 +34,41 @@ remote_exec target "$binfile"
# Copy tracefile from target to host.
remote_download host [remote_upload target basic.tf] basic.tf
-proc test_tfind_tfile { } { with_test_prefix "tfile" {
- global binfile
- global decimal
-
- if [mi_gdb_start] {
- return
+proc test_tfind_tfile { } {
+ with_test_prefix "tfile" {
+ global binfile
+ global decimal
+
+ if [mi_gdb_start] {
+ return
+ }
+ mi_gdb_load ${binfile}
+
+ mi_gdb_test "-target-select tfile basic.tf" \
+ ".*=breakpoint-created,bkpt=\{number=\"${decimal}\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"write_basic_trace_file\".*\\^connected" \
+ "select trace file"
+
+ mi_gdb_test "tfind 0" \
+ ".*=traceframe-changed,num=\"0\",tracepoint=\"${decimal}\".*\\^done" \
+ "tfind 0"
+
+ # No MI notification is sent because traceframe is not changed.
+ mi_gdb_test "tfind 0" \
+ "\\&\"tfind 0\\\\n\"\r\n\~\"Found.*\\^done" \
+ "tfind 0 again"
+
+ mi_gdb_test "tfind end" \
+ ".*=traceframe-changed,end.*\\^done" \
+ "tfind end"
+
+ # No MI notification is send because request is from MI command.
+ mi_gdb_test "-trace-find frame-number 0" \
+ "-trace-find frame-number 0\r\n\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"0\",frame=\{.*" \
+ "-trace-find frame-number 0"
+
+ mi_gdb_exit
}
- mi_gdb_load ${binfile}
-
- mi_gdb_test "-target-select tfile basic.tf" \
- ".*=breakpoint-created,bkpt=\{number=\"${decimal}\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",.*,func=\"write_basic_trace_file\".*\\^connected" \
- "select trace file"
-
- mi_gdb_test "tfind 0" \
- ".*=traceframe-changed,num=\"0\",tracepoint=\"${decimal}\".*\\^done" \
- "tfind 0"
-
- # No MI notification is sent because traceframe is not changed.
- mi_gdb_test "tfind 0" \
- "\\&\"tfind 0\\\\n\"\r\n\~\"Found.*\\^done" \
- "tfind 0 again"
-
- mi_gdb_test "tfind end" \
- ".*=traceframe-changed,end.*\\^done" \
- "tfind end"
-
- # No MI notification is send because request is from MI command.
- mi_gdb_test "-trace-find frame-number 0" \
- "-trace-find frame-number 0\r\n\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"0\",frame=\{.*" \
- "-trace-find frame-number 0"
-
- mi_gdb_exit
-}}
+}
test_tfind_tfile
@@ -99,38 +101,40 @@ if ![gdb_target_supports_trace] {
gdb_exit
-proc test_tfind_remote { } { with_test_prefix "remote" {
- global decimal
+proc test_tfind_remote { } {
+ with_test_prefix "remote" {
+ global decimal
- if [mi_gdb_start] {
- return
- }
- mi_run_to_main
+ if [mi_gdb_start] {
+ return
+ }
+ mi_run_to_main
- mi_gdb_test "-break-insert end" "\\^done.*" "break end"
- mi_gdb_test "-break-insert -a func2" "\\^done.*" "break func2"
- mi_gdb_test "-trace-start" "=breakpoint-modified,bkpt={.*installed=\"y\".*}.*\\^done.*" \
- "trace start"
+ mi_gdb_test "-break-insert end" "\\^done.*" "break end"
+ mi_gdb_test "-break-insert -a func2" "\\^done.*" "break func2"
+ mi_gdb_test "-trace-start" "=breakpoint-modified,bkpt={.*installed=\"y\".*}.*\\^done.*" \
+ "trace start"
- mi_execute_to "exec-continue" "breakpoint-hit" end "" ".*" ".*" \
- { "" "disp=\"keep\"" } \
- "continue to end"
- mi_gdb_test "-trace-stop" "\\^done.*" "trace stop"
+ mi_execute_to "exec-continue" "breakpoint-hit" end "" ".*" ".*" \
+ { "" "disp=\"keep\"" } \
+ "continue to end"
+ mi_gdb_test "-trace-stop" "\\^done.*" "trace stop"
- mi_gdb_test "tfind 0" \
- ".*=traceframe-changed,num=\"0\",tracepoint=\"${decimal}\".*\\^done" \
- "tfind 0"
+ mi_gdb_test "tfind 0" \
+ ".*=traceframe-changed,num=\"0\",tracepoint=\"${decimal}\".*\\^done" \
+ "tfind 0"
- mi_gdb_test "tfind" \
- ".*=traceframe-changed,num=\"1\",tracepoint=\"${decimal}\".*\\^done" \
- "tfind"
+ mi_gdb_test "tfind" \
+ ".*=traceframe-changed,num=\"1\",tracepoint=\"${decimal}\".*\\^done" \
+ "tfind"
- mi_gdb_test "tfind end" \
- ".*=traceframe-changed,end.*\\^done" \
- "tfind end"
+ mi_gdb_test "tfind end" \
+ ".*=traceframe-changed,end.*\\^done" \
+ "tfind end"
- mi_gdb_exit
-}}
+ mi_gdb_exit
+ }
+}
test_tfind_remote
diff --git a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
index c706979..d0a7a1e 100644
--- a/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-tracepoint-changed.exp
@@ -49,192 +49,195 @@ set MIFLAGS "-i=mi"
# remote stub can be uploaded to GDB, and GDB emits MI notification if
# new tracepoints are created.
-proc test_reconnect { } { with_test_prefix "reconnect" {
+proc test_reconnect { } {
+ with_test_prefix "reconnect" {
- global gdbserver_reconnect_p
- global gdb_prompt
- global executable
- global lib_sl1 lib_sl2
+ global gdbserver_reconnect_p
+ global gdb_prompt
+ global executable
+ global lib_sl1 lib_sl2
- set gdbserver_reconnect_p 1
- if { [info proc gdb_reconnect] == "" } {
- return 0
- }
+ set gdbserver_reconnect_p 1
+ if { [info proc gdb_reconnect] == "" } {
+ return 0
+ }
- clean_restart $executable
- gdb_load_shlibs $lib_sl1
- gdb_load_shlibs $lib_sl2
- if ![runto_main] then {
- fail "Can't run to main"
- return 0
- }
- # Create tracepoints on marker and main, and leave them in the
- # remote stub.
- gdb_test "trace marker" "Tracepoint.*at.* file .*" \
- "tracepoint on marker"
- gdb_test "trace main" "Tracepoint.*at.* file .*" \
- "tracepoint on main"
- gdb_test_no_output "tstart" "start trace experiment"
-
- set test "disconnect"
- gdb_test_multiple "disconnect" $test {
- -re "Trace is running but will stop on detach; detach anyway\\? \\(y or n\\) $" {
- pass $test
-
- set test "disconnected"
- gdb_test_multiple "y" $test {
- -re "$gdb_prompt $" {
- pass "$test"
+ clean_restart $executable
+ gdb_load_shlibs $lib_sl1
+ gdb_load_shlibs $lib_sl2
+ if ![runto_main] then {
+ fail "Can't run to main"
+ return 0
+ }
+ # Create tracepoints on marker and main, and leave them in the
+ # remote stub.
+ gdb_test "trace marker" "Tracepoint.*at.* file .*" \
+ "tracepoint on marker"
+ gdb_test "trace main" "Tracepoint.*at.* file .*" \
+ "tracepoint on main"
+ gdb_test_no_output "tstart" "start trace experiment"
+
+ set test "disconnect"
+ gdb_test_multiple "disconnect" $test {
+ -re "Trace is running but will stop on detach; detach anyway\\? \\(y or n\\) $" {
+ pass $test
+
+ set test "disconnected"
+ gdb_test_multiple "y" $test {
+ -re "$gdb_prompt $" {
+ pass "$test"
+ }
}
}
}
- }
-
- gdb_exit
- if [mi_gdb_start] {
- return
- }
+ gdb_exit
- global srcdir
- global subdir
- global binfile
-
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_load ${binfile}
-
- global gdbserver_protocol
- global gdbserver_gdbport
-
- # Create tracepoints on marker and pendfunc2.
- mi_gdb_test "-break-insert -a -f pendfunc2" \
- {.*\^done,bkpt=.*addr=\"<PENDING>\".*} \
- "insert tracepoint on pendfunc2"
- mi_gdb_test "-break-insert -a marker" {.*\^done,bkpt=.*\".*} \
- "insert tracepoint on marker"
-
- # Connect to the remote stub again, and make sure GDB merges the
- # tracepoints of both sides correctly.
- send_gdb "47-target-select $gdbserver_protocol $gdbserver_gdbport\n"
-
- global mi_gdb_prompt
- set test "tracepoint created"
- gdb_expect {
- -re "=breakpoint-created,bkpt=\{number=\"1\",type=\"tracepoint\"" {
- # Tracepoint 1 in GDB, which has already existed before
- # connecting, should have been merged with a tracepoint on
- # the target, so we shouldn't see a =breakpoint-created
- # notification for it.
- fail "$test: 1"
- exp_continue
- }
- -re "=breakpoint-created,bkpt=\{number=\"2\",type=\"tracepoint\"" {
- # Similar to above.
- fail "$test: 2"
- exp_continue
+ if [mi_gdb_start] {
+ return
}
- -re "=breakpoint-created,bkpt=\{number=\"3\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",\[^\n\]+,func=\"main\"\[^\n\]+,installed=\"y\"" {
- # A tracepoint on main was defined in the stub, not in GDB,
- # so we should see a =breakpoint-created notification.
- pass $test
+
+ global srcdir
+ global subdir
+ global binfile
+
+ mi_gdb_reinitialize_dir $srcdir/$subdir
+ mi_gdb_load ${binfile}
+
+ global gdbserver_protocol
+ global gdbserver_gdbport
+
+ # Create tracepoints on marker and pendfunc2.
+ mi_gdb_test "-break-insert -a -f pendfunc2" \
+ {.*\^done,bkpt=.*addr=\"<PENDING>\".*} \
+ "insert tracepoint on pendfunc2"
+ mi_gdb_test "-break-insert -a marker" {.*\^done,bkpt=.*\".*} \
+ "insert tracepoint on marker"
+
+ # Connect to the remote stub again, and make sure GDB merges the
+ # tracepoints of both sides correctly.
+ send_gdb "47-target-select $gdbserver_protocol $gdbserver_gdbport\n"
+
+ global mi_gdb_prompt
+ set test "tracepoint created"
+ gdb_expect {
+ -re "=breakpoint-created,bkpt=\{number=\"1\",type=\"tracepoint\"" {
+ # Tracepoint 1 in GDB, which has already existed before
+ # connecting, should have been merged with a tracepoint on
+ # the target, so we shouldn't see a =breakpoint-created
+ # notification for it.
+ fail "$test: 1"
+ exp_continue
+ }
+ -re "=breakpoint-created,bkpt=\{number=\"2\",type=\"tracepoint\"" {
+ # Similar to above.
+ fail "$test: 2"
+ exp_continue
+ }
+ -re "=breakpoint-created,bkpt=\{number=\"3\",type=\"tracepoint\",disp=\"keep\",enabled=\"y\",\[^\n\]+,func=\"main\"\[^\n\]+,installed=\"y\"" {
+ # A tracepoint on main was defined in the stub, not in GDB,
+ # so we should see a =breakpoint-created notification.
+ pass $test
+ }
}
- }
- # Tracepoint on marker is defined. After the sync, we know that
- # the tracepoint is in remote stub. Mark it 'installed'.
- set test "tracepoint on marker is installed"
- gdb_expect {
- -re "=breakpoint-modified,bkpt=\{number=\"2\".*,func=\"marker\".*installed=\"y\".*${mi_gdb_prompt}$" {
- pass "$test"
+ # Tracepoint on marker is defined. After the sync, we know that
+ # the tracepoint is in remote stub. Mark it 'installed'.
+ set test "tracepoint on marker is installed"
+ gdb_expect {
+ -re "=breakpoint-modified,bkpt=\{number=\"2\".*,func=\"marker\".*installed=\"y\".*${mi_gdb_prompt}$" {
+ pass "$test"
+ }
}
- }
- # Check that tracepoint 1 is still pending.
- mi_gdb_test "-break-info 1" \
- {.*\^done,BreakpointTable=.*addr=\"<PENDING>\".*} \
- "break-info 1"
-
- set gdbserver_reconnect_p 0
-}}
+ # Check that tracepoint 1 is still pending.
+ mi_gdb_test "-break-info 1" \
+ {.*\^done,BreakpointTable=.*addr=\"<PENDING>\".*} \
+ "break-info 1"
+ set gdbserver_reconnect_p 0
+ }
+}
# Test 'breakpoint-modified' notification is emited when pending tracepoints are
# resolved.
-proc test_pending_resolved { } { with_test_prefix "pending resolved" {
- global decimal hex
- global executable
- global srcdir
- global subdir
- global binfile
- global lib_sl1 lib_sl2
- global mi_gdb_prompt
-
- gdb_exit
- if [mi_gdb_start] {
- continue
- }
+proc test_pending_resolved { } {
+ with_test_prefix "pending resolved" {
+ global decimal hex
+ global executable
+ global srcdir
+ global subdir
+ global binfile
+ global lib_sl1 lib_sl2
+ global mi_gdb_prompt
+
+ gdb_exit
+ if [mi_gdb_start] {
+ continue
+ }
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_load ${binfile}
- mi_load_shlibs $lib_sl1 $lib_sl2
-
- # Create a pending tracepoint on pendfunc2
- mi_gdb_test "-break-insert -a -f pendfunc2" \
- {.*\^done,bkpt=.*addr=\"<PENDING>\".*} \
- "insert breakpoint on pendfunc2"
- # Insert breakpoint on marker
- mi_gdb_test "-break-insert marker" {.*\^done,bkpt=.*} \
- "insert breakpoint on marker"
-
- mi_run_cmd
- mi_expect_stop "breakpoint-hit" "marker" ""\
- ".*" ".*" {"" "disp=\"keep\""} \
- "continue to marker breakpoint"
- mi_gdb_test "-trace-start" {\^done} "trace start"
-
- mi_send_resuming_command "exec-continue" "continuing execution to marker 1"
-
- # It is expected to get two "=breakpoint-modified" notifications.
- # Pending tracepoint is resolved.
- set test "tracepoint on pendfunc2 resolved"
- gdb_expect {
- -re "=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\".*installed=\"n\"" {
- pass "$test"
+ mi_gdb_reinitialize_dir $srcdir/$subdir
+ mi_gdb_load ${binfile}
+ mi_load_shlibs $lib_sl1 $lib_sl2
+
+ # Create a pending tracepoint on pendfunc2
+ mi_gdb_test "-break-insert -a -f pendfunc2" \
+ {.*\^done,bkpt=.*addr=\"<PENDING>\".*} \
+ "insert breakpoint on pendfunc2"
+ # Insert breakpoint on marker
+ mi_gdb_test "-break-insert marker" {.*\^done,bkpt=.*} \
+ "insert breakpoint on marker"
+
+ mi_run_cmd
+ mi_expect_stop "breakpoint-hit" "marker" ""\
+ ".*" ".*" {"" "disp=\"keep\""} \
+ "continue to marker breakpoint"
+ mi_gdb_test "-trace-start" {\^done} "trace start"
+
+ mi_send_resuming_command "exec-continue" "continuing execution to marker 1"
+
+ # It is expected to get two "=breakpoint-modified" notifications.
+ # Pending tracepoint is resolved.
+ set test "tracepoint on pendfunc2 resolved"
+ gdb_expect {
+ -re "=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\".*installed=\"n\"" {
+ pass "$test"
+ }
}
- }
- # Resolved tracepoint is installed.
- set test "tracepoint on pendfunc2 installed"
- gdb_expect {
- -re "=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\".*installed=\"y\"" {
- pass "$test"
+ # Resolved tracepoint is installed.
+ set test "tracepoint on pendfunc2 installed"
+ gdb_expect {
+ -re "=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*.*times=\"0\".*installed=\"y\"" {
+ pass "$test"
+ }
}
- }
- mi_expect_stop "breakpoint-hit" "marker" ".*" ".*" ".*" \
- {"" "disp=\"keep\""} "continue to marker"
+ mi_expect_stop "breakpoint-hit" "marker" ".*" ".*" ".*" \
+ {"" "disp=\"keep\""} "continue to marker"
- mi_gdb_test "-trace-stop" {\^done,.*} "trace stop"
- mi_gdb_test "-trace-find frame-number 0" \
- "-trace-find frame-number 0\r\n\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"0\",frame=\{.*" \
- "-trace-find frame-number 0"
- mi_gdb_test "-trace-find none" {\^done,found="0"} "back to live inferior"
+ mi_gdb_test "-trace-stop" {\^done,.*} "trace stop"
+ mi_gdb_test "-trace-find frame-number 0" \
+ "-trace-find frame-number 0\r\n\\^done,found=\"1\",tracepoint=\"${decimal}\",traceframe=\"0\",frame=\{.*" \
+ "-trace-find frame-number 0"
+ mi_gdb_test "-trace-find none" {\^done,found="0"} "back to live inferior"
- mi_send_resuming_command "exec-continue" "continuing to exit"
- set test "tracepoint on pendfunc2 becomes pending again"
- gdb_expect {
- -re ".*=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*addr=\"<PENDING>\",.*times=\"0\"" {
- pass "$test"
- }
- -re ".*${mi_gdb_prompt}$" {
- fail $test
- }
- timeout {
- fail "$test (timeout)"
+ mi_send_resuming_command "exec-continue" "continuing to exit"
+ set test "tracepoint on pendfunc2 becomes pending again"
+ gdb_expect {
+ -re ".*=breakpoint-modified,bkpt=\{number=\"1\",type=\"tracepoint\".*addr=\"<PENDING>\",.*times=\"0\"" {
+ pass "$test"
+ }
+ -re ".*${mi_gdb_prompt}$" {
+ fail $test
+ }
+ timeout {
+ fail "$test (timeout)"
+ }
}
- }
- mi_expect_stop "exited-normally" "" "" "" "" "" ""
-}}
+ mi_expect_stop "exited-normally" "" "" "" "" "" ""
+ }
+}
# Test target supports tracepoints or not.
diff --git a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
index a8ed9fc..4ca46e1 100644
--- a/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
+++ b/gdb/testsuite/gdb.trace/mi-tsv-changed.exp
@@ -25,202 +25,206 @@ if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \
# Test notifications on creating, deleting and modifying TSV.
-proc test_create_delete_modify_tsv { } {with_test_prefix "create delete modify" {
- global binfile
- global decimal
- global testfile
- global srcdir subdir
- global mi_gdb_prompt
-
- if [mi_gdb_start] {
- return
- }
- mi_gdb_load ${binfile}
-
- mi_gdb_test "tvariable \$tvar1" \
- ".*=tsv-created,name=\"tvar1\",initial=\"0\"\\\\n.*\\^done" \
- "tvariable \$tvar1"
- mi_gdb_test "tvariable \$tvar1 = 1" \
- ".*=tsv-modified,name=\"tvar1\",initial=\"1\".*\\^done" \
- "tvariable \$tvar1 modified"
- # No "=tsv-modified" notification is emitted, because the initial
- # value is not changed.
- mi_gdb_test "tvariable \$tvar1 = 1" \
- ".*\\\$tvar1 = 1\\\\n\"\r\n~\"Trace state .*\\\\n.*\\^done" \
- "tvariable \$tvar1 modified without notification"
- mi_gdb_test "tvariable \$tvar2 = 45" \
- ".*=tsv-created,name=\"tvar2\",initial=\"45\"\\\\n.*\\^done" \
- "tvariable \$tvar2"
-
- mi_gdb_test "delete tvariable \$tvar2" \
- ".*=tsv-deleted,name=\"tvar2\"\\\\n.*\\^done" \
- "delete tvariable \$tvar2"
-
- mi_gdb_test "delete tvariable" \
- ".*=tsv-deleted\\\\n.*\\^done" \
- "delete all tvariables"
-
- # Test target supports tracepoints or not.
- clean_restart $testfile
-
- if ![runto_main] {
- fail "Can't run to main to check for trace support"
- return -1
- }
-
- if ![gdb_target_supports_trace] {
- unsupported "Current target does not support trace"
- return -1
- }
- gdb_exit
- if [mi_gdb_start] {
- continue
- }
+proc test_create_delete_modify_tsv { } {
+ with_test_prefix "create delete modify" {
+ global binfile
+ global decimal
+ global testfile
+ global srcdir subdir
+ global mi_gdb_prompt
+
+ if [mi_gdb_start] {
+ return
+ }
+ mi_gdb_load ${binfile}
+
+ mi_gdb_test "tvariable \$tvar1" \
+ ".*=tsv-created,name=\"tvar1\",initial=\"0\"\\\\n.*\\^done" \
+ "tvariable \$tvar1"
+ mi_gdb_test "tvariable \$tvar1 = 1" \
+ ".*=tsv-modified,name=\"tvar1\",initial=\"1\".*\\^done" \
+ "tvariable \$tvar1 modified"
+ # No "=tsv-modified" notification is emitted, because the initial
+ # value is not changed.
+ mi_gdb_test "tvariable \$tvar1 = 1" \
+ ".*\\\$tvar1 = 1\\\\n\"\r\n~\"Trace state .*\\\\n.*\\^done" \
+ "tvariable \$tvar1 modified without notification"
+ mi_gdb_test "tvariable \$tvar2 = 45" \
+ ".*=tsv-created,name=\"tvar2\",initial=\"45\"\\\\n.*\\^done" \
+ "tvariable \$tvar2"
+
+ mi_gdb_test "delete tvariable \$tvar2" \
+ ".*=tsv-deleted,name=\"tvar2\"\\\\n.*\\^done" \
+ "delete tvariable \$tvar2"
+
+ mi_gdb_test "delete tvariable" \
+ ".*=tsv-deleted\\\\n.*\\^done" \
+ "delete all tvariables"
+
+ # Test target supports tracepoints or not.
+ clean_restart $testfile
+
+ if ![runto_main] {
+ fail "Can't run to main to check for trace support"
+ return -1
+ }
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_load ${binfile}
-
- mi_gdb_test "tvariable \$tvar3 = 3" \
- ".*=tsv-created,name=\"tvar3\",initial=\"3\".*\\^done" \
- "tvariable \$tvar3 modified"
- mi_gdb_test "-break-insert -a gdb_c_test" \
- {.*\^done,bkpt=.*} \
- "insert tracepoint on gdb_c_test"
- # Define an action that increases $tvar3
- send_gdb "actions\n"
- gdb_expect {
- -re "End with" {
+ if ![gdb_target_supports_trace] {
+ unsupported "Current target does not support trace"
+ return -1
}
- }
- send_gdb "collect \$tvar3 += 3\nend\n"
- set test "define actions"
- gdb_expect {
- -re ".*${mi_gdb_prompt}$" {
- pass $test
+ gdb_exit
+ if [mi_gdb_start] {
+ continue
}
- timeout {
- fail "$test (timeout)"
+
+ mi_gdb_reinitialize_dir $srcdir/$subdir
+ mi_gdb_load ${binfile}
+
+ mi_gdb_test "tvariable \$tvar3 = 3" \
+ ".*=tsv-created,name=\"tvar3\",initial=\"3\".*\\^done" \
+ "tvariable \$tvar3 modified"
+ mi_gdb_test "-break-insert -a gdb_c_test" \
+ {.*\^done,bkpt=.*} \
+ "insert tracepoint on gdb_c_test"
+ # Define an action that increases $tvar3
+ send_gdb "actions\n"
+ gdb_expect {
+ -re "End with" {
+ }
}
- }
+ send_gdb "collect \$tvar3 += 3\nend\n"
+ set test "define actions"
+ gdb_expect {
+ -re ".*${mi_gdb_prompt}$" {
+ pass $test
+ }
+ timeout {
+ fail "$test (timeout)"
+ }
+ }
+
+ mi_gdb_test "-break-insert begin" \
+ {.*\^done,bkpt=.*} \
+ "insert tracepoint on begin"
+ mi_gdb_test "-break-insert end" \
+ {.*\^done,bkpt=.*} \
+ "insert tracepoint on end"
+ mi_run_cmd
+
+ mi_expect_stop "breakpoint-hit" "begin" ""\
+ ".*" ".*" {"" "disp=\"keep\""} \
+ "continue to begin breakpoint"
+ mi_gdb_test "-trace-start" {.*\^done} "trace start"
+ mi_send_resuming_command "exec-continue" "continuing to end"
+ mi_gdb_test "-trace-stop" {.*} "trace stop"
+ # Force GDB to get the current value of trace state variable.
+ mi_gdb_test "-trace-list-variables" ".*" "list trace variables"
+ mi_gdb_test "tvariable \$tvar3 = 2" \
+ ".*=tsv-modified,name=\"tvar3\",initial=\"2\",current=\"6\".*\\^done" \
+ "tvariable \$tvar3 modified"
- mi_gdb_test "-break-insert begin" \
- {.*\^done,bkpt=.*} \
- "insert tracepoint on begin"
- mi_gdb_test "-break-insert end" \
- {.*\^done,bkpt=.*} \
- "insert tracepoint on end"
- mi_run_cmd
-
- mi_expect_stop "breakpoint-hit" "begin" ""\
- ".*" ".*" {"" "disp=\"keep\""} \
- "continue to begin breakpoint"
- mi_gdb_test "-trace-start" {.*\^done} "trace start"
- mi_send_resuming_command "exec-continue" "continuing to end"
- mi_gdb_test "-trace-stop" {.*} "trace stop"
- # Force GDB to get the current value of trace state variable.
- mi_gdb_test "-trace-list-variables" ".*" "list trace variables"
- mi_gdb_test "tvariable \$tvar3 = 2" \
- ".*=tsv-modified,name=\"tvar3\",initial=\"2\",current=\"6\".*\\^done" \
- "tvariable \$tvar3 modified"
-
-}}
+ }
+}
# Test when GDB connects to a disconnected stub, existing TSVs in
# remote stub can be uploaded to GDB, and GDB emits MI notification
# for new uploaded TSVs.
-proc test_upload_tsv { } { with_test_prefix "upload" {
+proc test_upload_tsv { } {
+ with_test_prefix "upload" {
- global gdbserver_reconnect_p
- global gdb_prompt
- global testfile
- global decimal
+ global gdbserver_reconnect_p
+ global gdb_prompt
+ global testfile
+ global decimal
- set gdbserver_reconnect_p 1
- if { [info proc gdb_reconnect] == "" } {
- return 0
- }
+ set gdbserver_reconnect_p 1
+ if { [info proc gdb_reconnect] == "" } {
+ return 0
+ }
- clean_restart $testfile
- if ![runto_main] then {
- fail "Can't run to main"
- return 0
- }
+ clean_restart $testfile
+ if ![runto_main] then {
+ fail "Can't run to main"
+ return 0
+ }
- gdb_test "tvariable \$tvar1" \
- "Trace state variable \\\$tvar1 created, with initial value 0." \
- "Create a trace state variable"
-
- gdb_test "tvariable \$tvar2 = 45" \
- "Trace state variable \\\$tvar2 created, with initial value 45." \
- "Create a trace state variable with initial value"
- # Define a tracepoint otherwise tracing cannot be started.
- gdb_test "trace main" "Tracepoint $decimal at .*"
- gdb_test_no_output "tstart" "start trace experiment"
-
- set test "disconnect"
- gdb_test_multiple "disconnect" $test {
- -re "Trace is running but will stop on detach; detach anyway\\? \\(y or n\\) $" {
- pass $test
-
- set test "disconnected"
- gdb_test_multiple "y" $test {
- -re "$gdb_prompt $" {
- pass "$test"
+ gdb_test "tvariable \$tvar1" \
+ "Trace state variable \\\$tvar1 created, with initial value 0." \
+ "Create a trace state variable"
+
+ gdb_test "tvariable \$tvar2 = 45" \
+ "Trace state variable \\\$tvar2 created, with initial value 45." \
+ "Create a trace state variable with initial value"
+ # Define a tracepoint otherwise tracing cannot be started.
+ gdb_test "trace main" "Tracepoint $decimal at .*"
+ gdb_test_no_output "tstart" "start trace experiment"
+
+ set test "disconnect"
+ gdb_test_multiple "disconnect" $test {
+ -re "Trace is running but will stop on detach; detach anyway\\? \\(y or n\\) $" {
+ pass $test
+
+ set test "disconnected"
+ gdb_test_multiple "y" $test {
+ -re "$gdb_prompt $" {
+ pass "$test"
+ }
}
}
}
- }
- gdb_exit
+ gdb_exit
- if [mi_gdb_start] {
- return
- }
+ if [mi_gdb_start] {
+ return
+ }
- global srcdir
- global subdir
- global binfile
+ global srcdir
+ global subdir
+ global binfile
- mi_gdb_reinitialize_dir $srcdir/$subdir
- mi_gdb_load ${binfile}
+ mi_gdb_reinitialize_dir $srcdir/$subdir
+ mi_gdb_load ${binfile}
- global gdbserver_protocol
- global gdbserver_gdbport
+ global gdbserver_protocol
+ global gdbserver_gdbport
- send_gdb "47-target-select $gdbserver_protocol $gdbserver_gdbport\n"
+ send_gdb "47-target-select $gdbserver_protocol $gdbserver_gdbport\n"
- global mi_gdb_prompt
- set tsv1_created 0
- set tsv2_created 0
- gdb_expect {
- -re "=tsv-created,name=\"tvar1\",initial=\"0\"" {
- set tsv1_created 1
- exp_continue
- }
- -re "=tsv-created,name=\"tvar2\",initial=\"45\"" {
- set tsv2_created 1
- exp_continue
+ global mi_gdb_prompt
+ set tsv1_created 0
+ set tsv2_created 0
+ gdb_expect {
+ -re "=tsv-created,name=\"tvar1\",initial=\"0\"" {
+ set tsv1_created 1
+ exp_continue
+ }
+ -re "=tsv-created,name=\"tvar2\",initial=\"45\"" {
+ set tsv2_created 1
+ exp_continue
+ }
+ -re ".*${mi_gdb_prompt}" {
+
+ }
}
- -re ".*${mi_gdb_prompt}" {
+ if $tsv1_created {
+ pass "tsv1 created"
+ } else {
+ fail "tsv1 created"
+ }
+ if $tsv2_created {
+ pass "tsv2 created"
+ } else {
+ fail "tsv2 created"
}
- }
- if $tsv1_created {
- pass "tsv1 created"
- } else {
- fail "tsv1 created"
- }
- if $tsv2_created {
- pass "tsv2 created"
- } else {
- fail "tsv2 created"
+ set gdbserver_reconnect_p 0
}
-
- set gdbserver_reconnect_p 0
-}}
+}
test_create_delete_modify_tsv
diff --git a/gdb/testsuite/gdb.trace/pending.exp b/gdb/testsuite/gdb.trace/pending.exp
index c70600a..0308e13 100644
--- a/gdb/testsuite/gdb.trace/pending.exp
+++ b/gdb/testsuite/gdb.trace/pending.exp
@@ -58,107 +58,117 @@ if ![gdb_target_supports_trace] {
# Verify pending tracepoint is resolved to running to main.
-proc pending_tracepoint_resolved { trace_type } { with_test_prefix "$trace_type resolved" {
- global srcdir
- global subdir
- global binfile
- global srcfile
- global lib_sl1
-
- # Start with a fresh gdb.
- gdb_exit
- gdb_start
- gdb_reinitialize_dir $srcdir/$subdir
-
- gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" {
- -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" {
- gdb_test "y" "\(Fast t|T\)racepoint.*set_point1.*pending." \
- "set pending tracepoint (without symbols)"
+proc pending_tracepoint_resolved { trace_type } {
+ with_test_prefix "$trace_type resolved" {
+ global srcdir
+ global subdir
+ global binfile
+ global srcfile
+ global lib_sl1
+
+ # Start with a fresh gdb.
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+
+ gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" {
+ -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" {
+ gdb_test "y" "\(Fast t|T\)racepoint.*set_point1.*pending." \
+ "set pending tracepoint (without symbols)"
+ }
}
- }
- gdb_test "info trace" \
- "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ gdb_test "info trace" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*PENDING.*set_point1.*" \
- "single pending tracepoint info (without symbols)"
+ "single pending tracepoint info (without symbols)"
- gdb_load ${binfile}
+ gdb_load ${binfile}
- gdb_test "break main" "Breakpoint.*at.* file .*$srcfile, line.*" \
- "breakpoint function"
+ gdb_test "break main" "Breakpoint.*at.* file .*$srcfile, line.*" \
+ "breakpoint function"
- gdb_run_cmd
- gdb_test "" "Breakpoint 2, main.*"
+ gdb_run_cmd
+ gdb_test "" "Breakpoint 2, main.*"
- # Run to main which should resolve a pending tracepoint
- gdb_test "info trace" \
- "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ # Run to main which should resolve a pending tracepoint
+ gdb_test "info trace" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*pendfunc.*" \
- "single tracepoint info"
-}}
+ "single tracepoint info"
+ }
+}
# Verify pending tracepoint is resolved and works as expected.
-proc pending_tracepoint_works { trace_type } { with_test_prefix "$trace_type works" {
- global executable
- global srcfile
- global lib_sl1
- global gdb_prompt
+proc pending_tracepoint_works { trace_type } {
+ with_test_prefix "$trace_type works" {
+ global executable
+ global srcfile
+ global lib_sl1
+ global gdb_prompt
- # Restart with a fresh gdb.
- clean_restart $executable
+ # Restart with a fresh gdb.
+ clean_restart $executable
- # Test setting and querying pending tracepoints
+ # Test setting and querying pending tracepoints
- gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" {
- -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" {
- gdb_test "y" "\(Fast t|T\)racepoint.*set_point1.*pending." "set pending tracepoint"
+ gdb_test_multiple "$trace_type set_point1" "set pending tracepoint" {
+ -re ".*Make \(fast |\)tracepoint pending.*y or \\\[n\\\]. $" {
+ gdb_test "y" \
+ "\(Fast t|T\)racepoint.*set_point1.*pending." \
+ "set pending tracepoint"
+ }
}
- }
- gdb_test "info trace" \
- "Num Type\[ \]+Disp Enb Address\[ \]+What.*
+ gdb_test "info trace" \
+ "Num Type\[ \]+Disp Enb Address\[ \]+What.*
\[0-9\]+\[\t \]+\(fast |\)tracepoint\[ \]+keep y.*PENDING.*set_point1.*" \
- "single pending tracepoint info"
+ "single pending tracepoint info"
- # Run to main which should resolve a pending tracepoint
- gdb_test "break main" "Breakpoint.*at.* file .*$srcfile, line.*" \
- "breakpoint function"
- gdb_run_cmd
- gdb_test "" "Breakpoint 2, main.*"
+ # Run to main which should resolve a pending tracepoint
+ gdb_test "break main" "Breakpoint.*at.* file .*$srcfile, line.*" \
+ "breakpoint function"
+ gdb_run_cmd
+ gdb_test "" "Breakpoint 2, main.*"
- gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \
- "breakpoint on marker"
+ gdb_test "break marker" "Breakpoint.*at.* file .*$srcfile, line.*" \
+ "breakpoint on marker"
- set test "start trace experiment"
- gdb_test_multiple "tstart" $test {
- -re "^tstart\r\n$gdb_prompt $" {
- pass $test
- }
- -re "Target returns error code .* too far .*$gdb_prompt $" {
- if [string equal $trace_type "ftrace"] {
- # The target was unable to install the fast tracepoint
- # (e.g., jump pad too far from tracepoint).
- pass "$test (too far)"
- # Skip the rest of the tests.
- return
- } else {
- fail $test
+ set test "start trace experiment"
+ gdb_test_multiple "tstart" $test {
+ -re "^tstart\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re "Target returns error code .* too far .*$gdb_prompt $" {
+ if [string equal $trace_type "ftrace"] {
+ # The target was unable to install the fast tracepoint
+ # (e.g., jump pad too far from tracepoint).
+ pass "$test (too far)"
+ # Skip the rest of the tests.
+ return
+ } else {
+ fail $test
+ }
}
- }
- }
+ }
- gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*" \
- "continue to marker"
+ gdb_test "continue" "Continuing.\r\n\r\nBreakpoint.*marker.*at.*$srcfile.*" \
+ "continue to marker"
- gdb_test "tstop" "\[\r\n\]+" "stop trace experiment"
+ gdb_test "tstop" "\[\r\n\]+" "stop trace experiment"
- gdb_test "tfind start" "#0 .*" "tfind test frame 0"
- gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" "tfind test frame 1"
- gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" "tfind test frame 2"
- gdb_test "tfind" "Target failed to find requested trace frame..*" "tfind test frame"
-}}
+ gdb_test "tfind start" "#0 .*" "tfind test frame 0"
+ gdb_test "tfind" "Found trace frame 1, tracepoint 1.*" \
+ "tfind test frame 1"
+ gdb_test "tfind" "Found trace frame 2, tracepoint 1.*" \
+ "tfind test frame 2"
+ gdb_test "tfind" \
+ "Target failed to find requested trace frame..*" \
+ "tfind test frame"
+ }
+}
# Verify pending tracepoint is resolved during trace.
diff --git a/gdb/testsuite/gdb.trace/report.exp b/gdb/testsuite/gdb.trace/report.exp
index 527b470..25680c7 100644
--- a/gdb/testsuite/gdb.trace/report.exp
+++ b/gdb/testsuite/gdb.trace/report.exp
@@ -192,212 +192,213 @@ gdb_test "help tdump" "Print everything collected at the current.*" \
# Check the collected trace data from different sources, such as live
# inferior and tfile.
-proc use_collected_data { data_source } { with_test_prefix "${data_source}" {
- global tdp1 tdp2 tdp3 tdp4 tdp5 tdp6
- global testline1 testline2 testline3 testline4 testline5 testline6
- global pcreg fpreg spreg
- global srcfile srcdir subdir
- global arg1 arg3
- global decimal hex gdb_prompt
- #
- # 9.1 test the tdump command
- #
-
- set timeout 60
-
- gdb_tfind_test "9.1: find frame for TP $tdp1" "tracepoint $tdp1" \
- "\$tracepoint" "$tdp1"
-
- # Nothing was collected at tdp1, so this tdump should be empty.
- gdb_test "tdump" \
- "Data collected at tracepoint $tdp1, trace frame $decimal:" \
- "9.1: tdump, nothing collected"
-
- gdb_tfind_test "9.1: find frame for TP $tdp2" "tracepoint $tdp2" \
- "\$tracepoint" "$tdp2"
-
- # regs were collected at tdp2.
- # How to match for the output of "info registers" on an unknown architecture?
- # For now, assume that most architectures have a register called "pc".
-
- gdb_test "tdump" \
- "\[\r\n\]$pcreg .*" \
- "9.1: tdump, regs collected"
-
- gdb_tfind_test "9.1: find frame for TP $tdp3" "tracepoint $tdp3" \
- "\$tracepoint" "$tdp3"
-
- # args were collected at tdp3
- gdb_test "tdump" \
- "depth = 3.*q1 = 2.*q2 = 2.*q3 = 3.*q4 = 4.*q5 = 5.*q6 = 6" \
- "9.1: tdump, args collected"
-
- gdb_tfind_test "9.1: find frame for TP $tdp4" "tracepoint $tdp4" \
- "\$tracepoint" "$tdp4"
-
- # locals were collected at tdp4
- gdb_test "tdump" \
- "q = 1" \
- "9.1: tdump, locals collected"
-
- gdb_tfind_test "9.1: find frame for TP $tdp5" "tracepoint $tdp5" \
- "\$tracepoint" "$tdp5"
-
- # stack was collected at tdp5, plus the frame pointer
- gdb_test "tdump" \
- ".$fpreg = .*$spreg @ 64 = .*" \
- "9.1: tdump, memrange collected"
-
- gdb_tfind_test "9.1: find frame for TP $tdp6" "tracepoint $tdp6" \
- "\$tracepoint" "$tdp6"
-
- # globals were collected at tdp6
- gdb_test "tdump" \
- "gdb_char_test = 1.*gdb_short_test = 2.*gdb_long_test = 3" \
- "9.1: tdump, global variables collected"
-
- # 9.2 test tdump with arguments
- # [no go, tdump doesn't have any arguments]
-
- set linecount1 0
- set linecount2 0
- set linecount3 0
- set linecount4 0
- set linecount5 0
- set linecount6 0
-
- gdb_tfind_test "11.x, 12.1: find start frame" "start" "0"
-
- #
- # 11.x test built-in trace variables $trace_frame, $trace_line etc.
- #
-
- gdb_test "printf \"x %d x\\n\", \$trace_frame" "x 0 x" \
- "11.1: test \$trace_frame"
-
- gdb_test "printf \"x %d x\\n\", \$tracepoint" "x $tdp1 x" \
- "11.2: test \$tracepoint"
-
- gdb_test "printf \"x %d x\\n\", \$trace_line" "x $testline1 x" \
- "11.3: test \$trace_line"
-
- gdb_test_multiple "print \$trace_file" "11.4: test \$trace_file" {
- -re "\\$\[0-9\]+ = \"$srcfile\"\[\r\n\]+$gdb_prompt $" {
- pass "11.4: test \$trace_file"
- }
- -re "\\$\[0-9\]+ = \"$srcdir/$subdir/$srcfile\"\[\r\n\]+$gdb_prompt $" {
- pass "11.4: test \$trace_file"
+proc use_collected_data { data_source } {
+ with_test_prefix "${data_source}" {
+ global tdp1 tdp2 tdp3 tdp4 tdp5 tdp6
+ global testline1 testline2 testline3 testline4 testline5 testline6
+ global pcreg fpreg spreg
+ global srcfile srcdir subdir
+ global arg1 arg3
+ global decimal hex gdb_prompt
+ #
+ # 9.1 test the tdump command
+ #
+
+ set timeout 60
+
+ gdb_tfind_test "9.1: find frame for TP $tdp1" "tracepoint $tdp1" \
+ "\$tracepoint" "$tdp1"
+
+ # Nothing was collected at tdp1, so this tdump should be empty.
+ gdb_test "tdump" \
+ "Data collected at tracepoint $tdp1, trace frame $decimal:" \
+ "9.1: tdump, nothing collected"
+
+ gdb_tfind_test "9.1: find frame for TP $tdp2" "tracepoint $tdp2" \
+ "\$tracepoint" "$tdp2"
+
+ # regs were collected at tdp2.
+ # How to match for the output of "info registers" on an unknown architecture?
+ # For now, assume that most architectures have a register called "pc".
+
+ gdb_test "tdump" \
+ "\[\r\n\]$pcreg .*" \
+ "9.1: tdump, regs collected"
+
+ gdb_tfind_test "9.1: find frame for TP $tdp3" "tracepoint $tdp3" \
+ "\$tracepoint" "$tdp3"
+
+ # args were collected at tdp3
+ gdb_test "tdump" \
+ "depth = 3.*q1 = 2.*q2 = 2.*q3 = 3.*q4 = 4.*q5 = 5.*q6 = 6" \
+ "9.1: tdump, args collected"
+
+ gdb_tfind_test "9.1: find frame for TP $tdp4" "tracepoint $tdp4" \
+ "\$tracepoint" "$tdp4"
+
+ # locals were collected at tdp4
+ gdb_test "tdump" \
+ "q = 1" \
+ "9.1: tdump, locals collected"
+
+ gdb_tfind_test "9.1: find frame for TP $tdp5" "tracepoint $tdp5" \
+ "\$tracepoint" "$tdp5"
+
+ # stack was collected at tdp5, plus the frame pointer
+ gdb_test "tdump" \
+ ".$fpreg = .*$spreg @ 64 = .*" \
+ "9.1: tdump, memrange collected"
+
+ gdb_tfind_test "9.1: find frame for TP $tdp6" "tracepoint $tdp6" \
+ "\$tracepoint" "$tdp6"
+
+ # globals were collected at tdp6
+ gdb_test "tdump" \
+ "gdb_char_test = 1.*gdb_short_test = 2.*gdb_long_test = 3" \
+ "9.1: tdump, global variables collected"
+
+ # 9.2 test tdump with arguments
+ # [no go, tdump doesn't have any arguments]
+
+ set linecount1 0
+ set linecount2 0
+ set linecount3 0
+ set linecount4 0
+ set linecount5 0
+ set linecount6 0
+
+ gdb_tfind_test "11.x, 12.1: find start frame" "start" "0"
+
+ #
+ # 11.x test built-in trace variables $trace_frame, $trace_line etc.
+ #
+
+ gdb_test "printf \"x %d x\\n\", \$trace_frame" "x 0 x" \
+ "11.1: test \$trace_frame"
+
+ gdb_test "printf \"x %d x\\n\", \$tracepoint" "x $tdp1 x" \
+ "11.2: test \$tracepoint"
+
+ gdb_test "printf \"x %d x\\n\", \$trace_line" "x $testline1 x" \
+ "11.3: test \$trace_line"
+
+ gdb_test_multiple "print \$trace_file" "11.4: test \$trace_file" {
+ -re "\\$\[0-9\]+ = \"$srcfile\"\[\r\n\]+$gdb_prompt $" {
+ pass "11.4: test \$trace_file"
+ }
+ -re "\\$\[0-9\]+ = \"$srcdir/$subdir/$srcfile\"\[\r\n\]+$gdb_prompt $" {
+ pass "11.4: test \$trace_file"
+ }
}
- }
- #gdb_test "print \$trace_file" "\"$srcdir/$subdir/$srcfile\"" \
- # "11.4: test \$trace_file"
+ #gdb_test "print \$trace_file" "\"$srcdir/$subdir/$srcfile\"" \
+ # "11.4: test \$trace_file"
- #
- # 12.x test report generation using arbitrary GDB commands, loops etc.
- #
+ #
+ # 12.x test report generation using arbitrary GDB commands, loops etc.
+ #
- gdb_test_multiple "while \$trace_frame != -1\n output \$trace_file\n printf \", line \%d \(tracepoint #\%d\)\\n\", \$trace_line, \$tracepoint\n tfind\n end" "12.1: trace report #1" {
- -re "> end\r\n" {
- exp_continue
- }
- -re "^Found trace frame \[0-9\]+, tracepoint \[0-9\]+\r\n" {
- exp_continue
- }
- -re "^\[^\r\n\]* line $testline1 .tracepoint .$tdp1\\)\r\n" {
- set linecount1 [expr $linecount1 + 1]
- exp_continue
- }
- -re "^\[^\r\n\]* line $testline2 .tracepoint .$tdp2\\)\r\n" {
- set linecount2 [expr $linecount2 + 1]
- exp_continue
- }
- -re "^\[^\r\n\]* line $testline3 .tracepoint .$tdp3\\)\r\n" {
- set linecount3 [expr $linecount3 + 1]
- exp_continue
- }
- -re "^\[^\r\n\]* line $testline4 .tracepoint .$tdp4\\)\r\n" {
- set linecount4 [expr $linecount4 + 1]
- exp_continue
- }
- -re "^\[^\r\n\]* line $testline5 .tracepoint .$tdp5\\)\r\n" {
- set linecount5 [expr $linecount5 + 1]
- exp_continue
- }
- -re "^\[^\r\n\]* line $testline6 .tracepoint .$tdp6\\)\r\n" {
- set linecount6 [expr $linecount6 + 1]
- exp_continue
- }
- -re "^No trace frame found\r\n$gdb_prompt $" {
- if { ($linecount1 < 4) || ($linecount2 < 4) || ($linecount3 < 4) || ($linecount4 < 4) || ($linecount5 < 4) || ($linecount6 < 4) } {
- fail "12.1: trace report #1"
- } else {
- pass "12.1: trace report #1"
+ gdb_test_multiple "while \$trace_frame != -1\n output \$trace_file\n printf \", line \%d \(tracepoint #\%d\)\\n\", \$trace_line, \$tracepoint\n tfind\n end" "12.1: trace report #1" {
+ -re "> end\r\n" {
+ exp_continue
+ }
+ -re "^Found trace frame \[0-9\]+, tracepoint \[0-9\]+\r\n" {
+ exp_continue
+ }
+ -re "^\[^\r\n\]* line $testline1 .tracepoint .$tdp1\\)\r\n" {
+ set linecount1 [expr $linecount1 + 1]
+ exp_continue
+ }
+ -re "^\[^\r\n\]* line $testline2 .tracepoint .$tdp2\\)\r\n" {
+ set linecount2 [expr $linecount2 + 1]
+ exp_continue
+ }
+ -re "^\[^\r\n\]* line $testline3 .tracepoint .$tdp3\\)\r\n" {
+ set linecount3 [expr $linecount3 + 1]
+ exp_continue
+ }
+ -re "^\[^\r\n\]* line $testline4 .tracepoint .$tdp4\\)\r\n" {
+ set linecount4 [expr $linecount4 + 1]
+ exp_continue
+ }
+ -re "^\[^\r\n\]* line $testline5 .tracepoint .$tdp5\\)\r\n" {
+ set linecount5 [expr $linecount5 + 1]
+ exp_continue
+ }
+ -re "^\[^\r\n\]* line $testline6 .tracepoint .$tdp6\\)\r\n" {
+ set linecount6 [expr $linecount6 + 1]
+ exp_continue
+ }
+ -re "^No trace frame found\r\n$gdb_prompt $" {
+ if { ($linecount1 < 4) || ($linecount2 < 4) || ($linecount3 < 4) || ($linecount4 < 4) || ($linecount5 < 4) || ($linecount6 < 4) } {
+ fail "12.1: trace report #1"
+ } else {
+ pass "12.1: trace report #1"
+ }
}
}
- }
- gdb_tfind_test "12.2: tfind end, selects no frame" "end" "-1"
- gdb_tfind_test "12.2: find first TDP #2 frame" "tracepoint $tdp2" \
- "\$tracepoint" "$tdp2"
+ gdb_tfind_test "12.2: tfind end, selects no frame" "end" "-1"
+ gdb_tfind_test "12.2: find first TDP #2 frame" "tracepoint $tdp2" \
+ "\$tracepoint" "$tdp2"
- set linecount2 0
+ set linecount2 0
- gdb_test_multiple "while \$trace_frame != -1\n printf \"tracepoint #\%d, FP 0x\%08x, SP 0x\%08x, PC 0x%08x\\n\", \$tracepoint, \$fp, \$sp, \$pc\n tfind tracepoint\n end" "12.2: trace report #2" {
- -re "tracepoint #$tdp2, FP $hex, SP $hex, PC $hex" {
- set linecount2 [expr $linecount2 + 1]
- exp_continue
- }
- -re ".*$gdb_prompt $" {
- if { ($linecount2 < 4) } {
- fail "12.2: trace report #2"
- } else {
- pass "12.2: trace report #2"
+ gdb_test_multiple "while \$trace_frame != -1\n printf \"tracepoint #\%d, FP 0x\%08x, SP 0x\%08x, PC 0x%08x\\n\", \$tracepoint, \$fp, \$sp, \$pc\n tfind tracepoint\n end" "12.2: trace report #2" {
+ -re "tracepoint #$tdp2, FP $hex, SP $hex, PC $hex" {
+ set linecount2 [expr $linecount2 + 1]
+ exp_continue
+ }
+ -re ".*$gdb_prompt $" {
+ if { ($linecount2 < 4) } {
+ fail "12.2: trace report #2"
+ } else {
+ pass "12.2: trace report #2"
+ }
}
}
- }
- gdb_tfind_test "12.3: tfind end, selects no frame" "end" "-1"
- gdb_tfind_test "12.3: find first TDP #3 frame" "tracepoint $tdp3" \
- "\$tracepoint" "$tdp3"
+ gdb_tfind_test "12.3: tfind end, selects no frame" "end" "-1"
+ gdb_tfind_test "12.3: find first TDP #3 frame" "tracepoint $tdp3" \
+ "\$tracepoint" "$tdp3"
- set linecount3 0
+ set linecount3 0
- gdb_test_multiple "while \$trace_frame != -1\n printf \"TDP #\%d, frame \%d: depth = \%d, q1 = \%d\\n\", \$tracepoint, \$trace_frame, depth, q1\n tfind tracepoint\n end" "12.3: trace report #3" {
- -re "TDP #$tdp3, frame $decimal: depth = $decimal, q1 = $decimal" {
- set linecount3 [expr $linecount3 + 1]
- exp_continue
- }
- -re ".*$gdb_prompt $" {
- if { ($linecount3 < 4) } {
- fail "12.3: trace report #3"
- } else {
- pass "12.3: trace report #3"
+ gdb_test_multiple "while \$trace_frame != -1\n printf \"TDP #\%d, frame \%d: depth = \%d, q1 = \%d\\n\", \$tracepoint, \$trace_frame, depth, q1\n tfind tracepoint\n end" "12.3: trace report #3" {
+ -re "TDP #$tdp3, frame $decimal: depth = $decimal, q1 = $decimal" {
+ set linecount3 [expr $linecount3 + 1]
+ exp_continue
+ }
+ -re ".*$gdb_prompt $" {
+ if { ($linecount3 < 4) } {
+ fail "12.3: trace report #3"
+ } else {
+ pass "12.3: trace report #3"
+ }
}
}
- }
- gdb_tfind_test "12.4: tfind end, selects no frame" "end" "-1"
- gdb_tfind_test "12.4: find first TDP #6 frame" "tracepoint $tdp6" \
- "\$tracepoint" "$tdp6"
+ gdb_tfind_test "12.4: tfind end, selects no frame" "end" "-1"
+ gdb_tfind_test "12.4: find first TDP #6 frame" "tracepoint $tdp6" \
+ "\$tracepoint" "$tdp6"
- set linecount6 0
+ set linecount6 0
- gdb_test_multiple "while \$trace_frame != -1\n printf \"TDP #\%d, frame %d: char_test = \%d, long_test = \%d\\n\", \$tracepoint, \$trace_frame, gdb_char_test, gdb_long_test\n tfind tracepoint\n end" "12.4: trace report #4" {
- -re "TDP #$tdp6, frame $decimal: char_test = $arg1, long_test = $arg3" {
- set linecount6 [expr $linecount6 + 1]
- exp_continue
- }
- -re ".*$gdb_prompt $" {
- if { ($linecount6 < 4) } {
- fail "12.4: trace report #4"
- } else {
- pass "12.4: trace report #4"
+ gdb_test_multiple "while \$trace_frame != -1\n printf \"TDP #\%d, frame %d: char_test = \%d, long_test = \%d\\n\", \$tracepoint, \$trace_frame, gdb_char_test, gdb_long_test\n tfind tracepoint\n end" "12.4: trace report #4" {
+ -re "TDP #$tdp6, frame $decimal: char_test = $arg1, long_test = $arg3" {
+ set linecount6 [expr $linecount6 + 1]
+ exp_continue
+ }
+ -re ".*$gdb_prompt $" {
+ if { ($linecount6 < 4) } {
+ fail "12.4: trace report #4"
+ } else {
+ pass "12.4: trace report #4"
+ }
}
}
}
}
-}
use_collected_data "live"
diff --git a/gdb/testsuite/gdb.trace/status-stop.exp b/gdb/testsuite/gdb.trace/status-stop.exp
index 044e18f..bca03d2 100644
--- a/gdb/testsuite/gdb.trace/status-stop.exp
+++ b/gdb/testsuite/gdb.trace/status-stop.exp
@@ -37,72 +37,81 @@ if ![gdb_target_supports_trace] {
# Verify that the sequence of commands "tstart tstop tstart" works well.
-proc test_tstart_tstop_tstart { } { with_test_prefix "tstart_tstop_tstart" {
- global executable
- global hex
-
- # Start with a fresh gdb.
- clean_restart ${executable}
- if ![runto_main] {
- fail "Can't run to main"
- return -1
- }
-
- gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
- gdb_test_no_output "tstart"
-
- gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
- gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
+proc test_tstart_tstop_tstart { } {
+ with_test_prefix "tstart_tstop_tstart" {
+ global executable
+ global hex
- gdb_test_no_output "tstop"
+ # Start with a fresh gdb.
+ clean_restart ${executable}
+ if ![runto_main] {
+ fail "Can't run to main"
+ return -1
+ }
- gdb_test_no_output "tstart"
-}}
+ gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
+ gdb_test_no_output "tstart"
-# Verify the sequence of commands "tstart tstart" works well.
+ gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+ gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
+ "continue to end"
-proc test_tstart_tstart { } { with_test_prefix "tstart_tstart" {
- global executable
- global hex
+ gdb_test_no_output "tstop"
- # Start with a fresh gdb.
- clean_restart ${executable}
- if ![runto_main] {
- fail "Can't run to main"
- return -1
+ gdb_test_no_output "tstart"
}
+}
- gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
- gdb_test_no_output "tstart"
+# Verify the sequence of commands "tstart tstart" works well.
- gdb_test "tstart" "" "tstart again" "A trace is running already. Start a new run\\? \\(y or n\\) " "y"
-}}
+proc test_tstart_tstart { } {
+ with_test_prefix "tstart_tstart" {
+ global executable
+ global hex
-# Verify that trace stops clearly when trace buffer is full.
+ # Start with a fresh gdb.
+ clean_restart ${executable}
+ if ![runto_main] {
+ fail "Can't run to main"
+ return -1
+ }
-proc test_buffer_full_tstart { } { with_test_prefix "buffer_full_tstart" {
- global executable
- global hex
+ gdb_test "trace func1" "Tracepoint \[0-9\] at $hex: file.*"
+ gdb_test_no_output "tstart"
- # Start with a fresh gdb.
- clean_restart ${executable}
- if ![runto_main] {
- fail "Can't run to main"
- return -1
+ gdb_test "tstart" "" "tstart again" \
+ "A trace is running already. Start a new run\\? \\(y or n\\) " \
+ "y"
}
+}
- gdb_test "trace func2" "Tracepoint \[0-9\] at $hex: file.*"
- gdb_trace_setactions "collect buf: define actions" \
- "" \
- "collect buf" "^$"
-
- gdb_test_no_output "tstart"
- gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
- gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
+# Verify that trace stops clearly when trace buffer is full.
- gdb_test "tstatus" ".*buffer was full.*"
- gdb_test_no_output "tstart"
-}}
+proc test_buffer_full_tstart { } {
+ with_test_prefix "buffer_full_tstart" {
+ global executable
+ global hex
+
+ # Start with a fresh gdb.
+ clean_restart ${executable}
+ if ![runto_main] {
+ fail "Can't run to main"
+ return -1
+ }
+
+ gdb_test "trace func2" "Tracepoint \[0-9\] at $hex: file.*"
+ gdb_trace_setactions "collect buf: define actions" \
+ "" \
+ "collect buf" "^$"
+
+ gdb_test_no_output "tstart"
+ gdb_test "break end" "Breakpoint \[0-9\] at $hex: file.*"
+ gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
+
+ gdb_test "tstatus" ".*buffer was full.*"
+ gdb_test_no_output "tstart"
+ }
+}
test_tstart_tstop_tstart
diff --git a/gdb/testsuite/gdb.trace/strace.exp b/gdb/testsuite/gdb.trace/strace.exp
index b330ee9..3f3eb4e 100644
--- a/gdb/testsuite/gdb.trace/strace.exp
+++ b/gdb/testsuite/gdb.trace/strace.exp
@@ -126,223 +126,245 @@ proc strace_remove_socket { action } {
}
}}
-proc strace_info_marker { } { with_test_prefix "info_marker" {
- global executable
- global gdb_prompt
- global libipa
-
- # Restart with a fresh gdb.
- clean_restart $executable
- gdb_load_shlibs $libipa
- if ![runto_main] {
- fail "Can't run to main"
- return -1
- }
+proc strace_info_marker { } {
+ with_test_prefix "info_marker" {
+ global executable
+ global gdb_prompt
+ global libipa
+
+ # Restart with a fresh gdb.
+ clean_restart $executable
+ gdb_load_shlibs $libipa
+ if ![runto_main] {
+ fail "Can't run to main"
+ return -1
+ }
- # List the markers in program. They should be disabled.
- gdb_test "info static-tracepoint-markers" \
- ".*ust/bar\[\t \]+n\[\t \]+.*ust/bar2\[\t \]+n\[\t \]+.*"
+ # List the markers in program. They should be disabled.
+ gdb_test "info static-tracepoint-markers" \
+ ".*ust/bar\[\t \]+n\[\t \]+.*ust/bar2\[\t \]+n\[\t \]+.*"
- # List all the thread. It is expected to get three threads without
- # any errors.
- gdb_test_multiple "info threads 3 2 1" "info threads" {
- -re "3\[ \t\]+Thread .*2\[ \t\]+Thread .*1\[ \t\]+Thread .*${gdb_prompt} $" {
- pass "info threads"
+ # List all the thread. It is expected to get three threads without
+ # any errors.
+ gdb_test_multiple "info threads 3 2 1" "info threads" {
+ -re "3\[ \t\]+Thread .*2\[ \t\]+Thread .*1\[ \t\]+Thread .*${gdb_prompt} $" {
+ pass "info threads"
+ }
}
- }
- # GDB detaches inferior so that the socket file can be removed.
- gdb_test_multiple "detach" "detach" {
- -re "Detaching .*, process .*${gdb_prompt} $" {
- pass "detach"
+ # GDB detaches inferior so that the socket file can be removed.
+ gdb_test_multiple "detach" "detach" {
+ -re "Detaching .*, process .*${gdb_prompt} $" {
+ pass "detach"
+ }
}
}
-}}
-
-proc strace_probe_marker { } { with_test_prefix "probe_marker" {
- global executable
- global expect_out
- global gdb_prompt
- global hex
- global libipa
+}
- # Restart with a fresh gdb.
- clean_restart $executable
- gdb_load_shlibs $libipa
- if ![runto_main] {
- fail "Can't run to main"
- return -1
- }
+proc strace_probe_marker { } {
+ with_test_prefix "probe_marker" {
+ global executable
+ global expect_out
+ global gdb_prompt
+ global hex
+ global libipa
+
+ # Restart with a fresh gdb.
+ clean_restart $executable
+ gdb_load_shlibs $libipa
+ if ![runto_main] {
+ fail "Can't run to main"
+ return -1
+ }
- gdb_test "strace -m ust/bar" "Static tracepoint \[0-9\]+ at ${hex}: file.*"
- gdb_test "strace -m ust/bar2" "Static tracepoint \[0-9\]+ at ${hex}: file.*"
- # Two trace markers should be enabled.
- gdb_test "info static-tracepoint-markers" \
- "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+y\[\t \]+$hex.*"
+ gdb_test "strace -m ust/bar" \
+ "Static tracepoint \[0-9\]+ at ${hex}: file.*"
+ gdb_test "strace -m ust/bar2" \
+ "Static tracepoint \[0-9\]+ at ${hex}: file.*"
+ # Two trace markers should be enabled.
+ gdb_test "info static-tracepoint-markers" \
+ "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+y\[\t \]+$hex.*"
- gdb_test "break end" "Breakpoint \[0-9\]+ at.*"
+ gdb_test "break end" "Breakpoint \[0-9\]+ at.*"
- gdb_test_no_output "tstart"
- gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
- gdb_test_no_output "tstop"
+ gdb_test_no_output "tstart"
+ gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
+ "continue to end"
+ gdb_test_no_output "tstop"
- gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
- gdb_test "tfind" "Found trace frame 1, tracepoint .*" "tfind frame 1"
- gdb_test "tfind" "Target failed to find requested trace frame\\..*"
-}}
+ gdb_test "tfind" "Found trace frame 0, tracepoint .*" \
+ "tfind frame 0"
+ gdb_test "tfind" "Found trace frame 1, tracepoint .*" \
+ "tfind frame 1"
+ gdb_test "tfind" \
+ "Target failed to find requested trace frame\\..*"
+ }
+}
proc strace_trace_on_same_addr { type } {
-with_test_prefix "trace_same_addr $type" {
- global executable
- global expect_out
- global gdb_prompt
- global hex
- global libipa
-
- # Restart with a fresh gdb.
- clean_restart $executable
- gdb_load_shlibs $libipa
- if ![runto_main] {
- fail "Can't run to main"
- return -1
- }
+ with_test_prefix "trace_same_addr $type" {
+ global executable
+ global expect_out
+ global gdb_prompt
+ global hex
+ global libipa
+
+ # Restart with a fresh gdb.
+ clean_restart $executable
+ gdb_load_shlibs $libipa
+ if ![runto_main] {
+ fail "Can't run to main"
+ return -1
+ }
- set marker_bar_addr ""
- set marker_bar2_addr ""
+ set marker_bar_addr ""
+ set marker_bar2_addr ""
- # List the markers in program. They should be disabled.
- gdb_test_multiple "info static-tracepoint-markers" "info static-tracepoint-markers 1" {
- -re ".*ust/bar\[\t \]+n.*${gdb_prompt} $" {
- set ignore ""
+ # List the markers in program. They should be disabled.
+ gdb_test_multiple "info static-tracepoint-markers" "info static-tracepoint-markers 1" {
+ -re ".*ust/bar\[\t \]+n.*${gdb_prompt} $" {
+ set ignore ""
- regexp "ust/bar\[\t \]+n\[\t \]+($hex) .*ust/bar2\[\t \]+n\[\t \]+($hex) " \
- "$expect_out(0,string)" ignore marker_bar_addr marker_bar2_addr
+ regexp "ust/bar\[\t \]+n\[\t \]+($hex) .*ust/bar2\[\t \]+n\[\t \]+($hex) " \
+ "$expect_out(0,string)" ignore marker_bar_addr marker_bar2_addr
- pass "info static-tracepoint-markers 1"
- }
- -re ".*${gdb_prompt} $" {
- fail "info static-tracepoint-markers 1"
+ pass "info static-tracepoint-markers 1"
+ }
+ -re ".*${gdb_prompt} $" {
+ fail "info static-tracepoint-markers 1"
+ }
}
- }
-
- gdb_test "strace -m ust/bar" "Static tracepoint \[0-9\]+ at ${hex}: file.*"
- gdb_test "strace -m ust/bar2" "Static tracepoint \[0-9\]+ at ${hex}: file.*"
- # Two trace markers should be enabled.
- gdb_test "info static-tracepoint-markers" \
- "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+y\[\t \]+$hex.*" \
- "info static-tracepoint-markers 2"
- # Set breapoints or tracepoints.
- set test "${type} on marker bar"
- gdb_test_multiple "${type} *${marker_bar_addr}" $test {
- -re "\(Fast trace|Trace|Break\)point \[0-9\]+ at ${hex}: file.*\r\n$gdb_prompt $" {
- pass $test
- }
- -re ".*\r\n$gdb_prompt $" {
- if [string equal $type "ftrace"] {
- # The instruction may be not long enough to set a fast
- # tracepoint. Skip the rest of this test.
- return -1
- } else {
- fail $test
+ gdb_test "strace -m ust/bar" "Static tracepoint \[0-9\]+ at ${hex}: file.*"
+ gdb_test "strace -m ust/bar2" "Static tracepoint \[0-9\]+ at ${hex}: file.*"
+ # Two trace markers should be enabled.
+ gdb_test "info static-tracepoint-markers" \
+ "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+y\[\t \]+$hex.*" \
+ "info static-tracepoint-markers 2"
+
+ # Set breapoints or tracepoints.
+ set test "${type} on marker bar"
+ gdb_test_multiple "${type} *${marker_bar_addr}" $test {
+ -re "\(Fast trace|Trace|Break\)point \[0-9\]+ at ${hex}: file.*\r\n$gdb_prompt $" {
+ pass $test
+ }
+ -re ".*\r\n$gdb_prompt $" {
+ if [string equal $type "ftrace"] {
+ # The instruction may be not long enough to set a fast
+ # tracepoint. Skip the rest of this test.
+ return -1
+ } else {
+ fail $test
+ }
}
}
- }
- set test "${type} on marker bar2"
- gdb_test_multiple "${type} *${marker_bar2_addr}" $test {
- -re "\(Fast trace|Trace|Break\)point \[0-9\]+ at ${hex}: file.*" {
- pass $test
- }
- -re ".*\r\n$gdb_prompt $" {
- if [string equal $type "ftrace"] {
- # The instruction may be not long enough to set a fast
- # tracepoint. Skip the rest of this test.
- return -1
- } else {
- fail $test
+ set test "${type} on marker bar2"
+ gdb_test_multiple "${type} *${marker_bar2_addr}" $test {
+ -re "\(Fast trace|Trace|Break\)point \[0-9\]+ at ${hex}: file.*" {
+ pass $test
+ }
+ -re ".*\r\n$gdb_prompt $" {
+ if [string equal $type "ftrace"] {
+ # The instruction may be not long enough to set a fast
+ # tracepoint. Skip the rest of this test.
+ return -1
+ } else {
+ fail $test
+ }
}
}
- }
-
- gdb_test "break end" "Breakpoint \[0-9\]+ at.*"
- if [string equal $type "break"] {
- gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
- "continue to bar"
- gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
- "continue to bar2"
- gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
- "continue to end"
- } else {
-
- gdb_test_no_output "tstart"
- gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
- "continue to end"
- gdb_test_no_output "tstop"
-
- gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
- gdb_test "tfind" "Found trace frame 1, tracepoint .*" "tfind frame 1"
- gdb_test "tfind" "Found trace frame 2, tracepoint .*" "tfind frame 2"
- gdb_test "tfind" "Found trace frame 3, tracepoint .*" "tfind frame 3"
- gdb_test "tfind" "Target failed to find requested trace frame\\..*"
+ gdb_test "break end" "Breakpoint \[0-9\]+ at.*"
+
+ if [string equal $type "break"] {
+ gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
+ "continue to bar"
+ gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
+ "continue to bar2"
+ gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
+ "continue to end"
+ } else {
+
+ gdb_test_no_output "tstart"
+ gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
+ "continue to end"
+ gdb_test_no_output "tstop"
+
+ gdb_test "tfind" "Found trace frame 0, tracepoint .*" \
+ "tfind frame 0"
+ gdb_test "tfind" "Found trace frame 1, tracepoint .*" \
+ "tfind frame 1"
+ gdb_test "tfind" "Found trace frame 2, tracepoint .*" \
+ "tfind frame 2"
+ gdb_test "tfind" "Found trace frame 3, tracepoint .*" \
+ "tfind frame 3"
+ gdb_test "tfind" \
+ "Target failed to find requested trace frame\\..*"
+ }
}
-}}
-
-proc strace_trace_on_diff_addr { } { with_test_prefix "trace_diff_addr" {
-
- global executable
- global expect_out
- global gdb_prompt
- global hex
- global libipa
+}
- # Restart with a fresh gdb.
- clean_restart $executable
- gdb_load_shlibs $libipa
- if ![runto_main] {
- fail "Can't run to main"
- return -1
- }
+proc strace_trace_on_diff_addr { } {
+ with_test_prefix "trace_diff_addr" {
+
+ global executable
+ global expect_out
+ global gdb_prompt
+ global hex
+ global libipa
+
+ # Restart with a fresh gdb.
+ clean_restart $executable
+ gdb_load_shlibs $libipa
+ if ![runto_main] {
+ fail "Can't run to main"
+ return -1
+ }
- set marker_bar_addr ""
- set marker_bar2_addr ""
+ set marker_bar_addr ""
+ set marker_bar2_addr ""
- # List the markers in program. They should be disabled.
- gdb_test_multiple "info static-tracepoint-markers" "info static-tracepoint-markers 1" {
- -re ".*ust/bar\[\t \]+n.*${gdb_prompt} $" {
- set ignore ""
+ # List the markers in program. They should be disabled.
+ gdb_test_multiple "info static-tracepoint-markers" "info static-tracepoint-markers 1" {
+ -re ".*ust/bar\[\t \]+n.*${gdb_prompt} $" {
+ set ignore ""
- regexp "ust/bar\[\t \]+n\[\t \]+($hex) .*ust/bar2\[\t \]+n\[\t \]+($hex) " \
- "$expect_out(0,string)" ignore marker_bar_addr marker_bar2_addr
+ regexp "ust/bar\[\t \]+n\[\t \]+($hex) .*ust/bar2\[\t \]+n\[\t \]+($hex) " \
+ "$expect_out(0,string)" ignore marker_bar_addr marker_bar2_addr
- pass "info static-tracepoint-markers 1"
- }
- -re ".*${gdb_prompt} $" {
- fail "info static-tracepoint-markers 1"
+ pass "info static-tracepoint-markers 1"
+ }
+ -re ".*${gdb_prompt} $" {
+ fail "info static-tracepoint-markers 1"
+ }
}
- }
- gdb_test "strace -m ust/bar" "Static tracepoint \[0-9\]+ at ${hex}: file.*"
+ gdb_test "strace -m ust/bar" "Static tracepoint \[0-9\]+ at ${hex}: file.*"
- gdb_test "info static-tracepoint-markers" \
- "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+n\[\t \]+$hex.*" \
- "info static-tracepoint-markers 2"
+ gdb_test "info static-tracepoint-markers" \
+ "ust/bar\[\t \]+y\[\t \]+$hex .*ust/bar2\[\t \]+n\[\t \]+$hex.*" \
+ "info static-tracepoint-markers 2"
- # Set common tracepoint.
- gdb_test "trace *${marker_bar2_addr}" \
- "Tracepoint \[0-9\]+ at ${hex}: file.*"
+ # Set common tracepoint.
+ gdb_test "trace *${marker_bar2_addr}" \
+ "Tracepoint \[0-9\]+ at ${hex}: file.*"
- gdb_test "break end" "Breakpoint \[0-9\]+ at.*"
+ gdb_test "break end" "Breakpoint \[0-9\]+ at.*"
- gdb_test_no_output "tstart"
- gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" "continue to end"
- gdb_test_no_output "tstop"
+ gdb_test_no_output "tstart"
+ gdb_test "continue" "Continuing\\.\[ \r\n\]+Breakpoint.*" \
+ "continue to end"
+ gdb_test_no_output "tstop"
- gdb_test "tfind" "Found trace frame 0, tracepoint .*" "tfind frame 0"
- gdb_test "tfind" "Found trace frame 1, tracepoint .*" "tfind frame 1"
- gdb_test "tfind" "Target failed to find requested trace frame\\..*"
-}}
+ gdb_test "tfind" "Found trace frame 0, tracepoint .*" \
+ "tfind frame 0"
+ gdb_test "tfind" "Found trace frame 1, tracepoint .*" \
+ "tfind frame 1"
+ gdb_test "tfind" \
+ "Target failed to find requested trace frame\\..*"
+ }
+}
# Run it on x86/x86_64 linux.
if { [istarget "x86_64-*-linux*"] || [istarget "i\[34567\]86-*-linux*"] } {
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 005aa62..8e2e105 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -133,174 +133,180 @@ proc test_maybe_regvar_display { var } {
# Test procs
#
-proc gdb_collect_args_test {} { with_test_prefix "unavailable arguments" {
- global cr
- global gdb_prompt
+proc gdb_collect_args_test {} {
+ with_test_prefix "unavailable arguments" {
+ global cr
+ global gdb_prompt
- prepare_for_trace_test
+ prepare_for_trace_test
- gdb_test "trace args_test_func" \
- "Tracepoint \[0-9\]+ at .*" \
- "set tracepoint"
+ gdb_test "trace args_test_func" \
+ "Tracepoint \[0-9\]+ at .*" \
+ "set tracepoint"
- # Begin the test.
- run_trace_experiment args_test_func
+ # Begin the test.
+ run_trace_experiment args_test_func
- # Test printing the variables, and also their addresses. We
- # haven't collected any stack, so there's no way GDB can figure
- # out the latter.
+ # Test printing the variables, and also their addresses. We
+ # haven't collected any stack, so there's no way GDB can figure
+ # out the latter.
- gdb_test "print argc" " = <unavailable>"
- gdb_test "print &argc" \
- "Can't take address of \"argc\" which isn't an lvalue\."
+ gdb_test "print argc" " = <unavailable>"
+ gdb_test "print &argc" \
+ "Can't take address of \"argc\" which isn't an lvalue\."
- gdb_test "print argi" " = <unavailable>"
- gdb_test "print &argi" \
- "Can't take address of \"argi\" which isn't an lvalue\."
+ gdb_test "print argi" " = <unavailable>"
+ gdb_test "print &argi" \
+ "Can't take address of \"argi\" which isn't an lvalue\."
- gdb_test "print argf" " = <unavailable>"
- gdb_test "print &argf" \
- "Can't take address of \"argf\" which isn't an lvalue\."
+ gdb_test "print argf" " = <unavailable>"
+ gdb_test "print &argf" \
+ "Can't take address of \"argf\" which isn't an lvalue\."
- gdb_test "print argd" " = <unavailable>"
- gdb_test "print &argd" \
- "Can't take address of \"argd\" which isn't an lvalue\."
+ gdb_test "print argd" " = <unavailable>"
+ gdb_test "print &argd" \
+ "Can't take address of \"argd\" which isn't an lvalue\."
- # struct arg as one of several args (near end of list)
+ # struct arg as one of several args (near end of list)
- gdb_test "print argstruct" \
- " = \{memberc = <unavailable>, memberi = <unavailable>, memberf = <unavailable>, memberd = <unavailable>\}"
+ gdb_test "print argstruct" \
+ " = \{memberc = <unavailable>, memberi = <unavailable>, memberf = <unavailable>, memberd = <unavailable>\}"
- gdb_test "print argstruct.memberc" " = <unavailable>"
- gdb_test "print argstruct.memberi" " = <unavailable>"
- gdb_test "print argstruct.memberf" " = <unavailable>"
- gdb_test "print argstruct.memberd" " = <unavailable>"
+ gdb_test "print argstruct.memberc" " = <unavailable>"
+ gdb_test "print argstruct.memberi" " = <unavailable>"
+ gdb_test "print argstruct.memberf" " = <unavailable>"
+ gdb_test "print argstruct.memberd" " = <unavailable>"
- gdb_test "print argarray" " = \\(int \\*\\) <unavailable>"
+ gdb_test "print argarray" " = \\(int \\*\\) <unavailable>"
- gdb_test "print &argarray" \
- "Can't take address of \"argarray\" which isn't an lvalue\."
+ gdb_test "print &argarray" \
+ "Can't take address of \"argarray\" which isn't an lvalue\."
- gdb_test "print argarray\[0\]" "value is not available"
+ gdb_test "print argarray\[0\]" "value is not available"
- # Test "info args"
- set r ""
- set r "${r}argc = <unavailable>${cr}"
- set r "${r}argi = <unavailable>${cr}"
- set r "${r}argf = <unavailable>${cr}"
- set r "${r}argd = <unavailable>${cr}"
- set r "${r}argstruct = {memberc = <unavailable>, memberi = <unavailable>, memberf = <unavailable>, memberd = <unavailable>}${cr}"
- set r "${r}argarray = <unavailable>${cr}"
- gdb_test "info args" "$r" "info args"
+ # Test "info args"
+ set r ""
+ set r "${r}argc = <unavailable>${cr}"
+ set r "${r}argi = <unavailable>${cr}"
+ set r "${r}argf = <unavailable>${cr}"
+ set r "${r}argd = <unavailable>${cr}"
+ set r "${r}argstruct = {memberc = <unavailable>, memberi = <unavailable>, memberf = <unavailable>, memberd = <unavailable>}${cr}"
+ set r "${r}argarray = <unavailable>${cr}"
+ gdb_test "info args" "$r" "info args"
- test_maybe_regvar_display "argc"
+ test_maybe_regvar_display "argc"
- gdb_test "tfind none" \
- "#0 end .*" \
- "cease trace debugging"
-}}
+ gdb_test "tfind none" \
+ "#0 end .*" \
+ "cease trace debugging"
+ }
+}
-proc gdb_collect_locals_test { func msg } { with_test_prefix "unavailable locals: $msg" {
- global cr
- global gdb_prompt
+proc gdb_collect_locals_test { func msg } {
+ with_test_prefix "unavailable locals: $msg" {
+ global cr
+ global gdb_prompt
- prepare_for_trace_test
+ prepare_for_trace_test
- set testline [gdb_get_line_number "set $func tracepoint here"]
+ set testline [gdb_get_line_number "set $func tracepoint here"]
- gdb_test "trace $testline" \
+ gdb_test "trace $testline" \
"Tracepoint \[0-9\]+ at .*" \
"set tracepoint"
- # Begin the test.
- run_trace_experiment $func
-
- gdb_test "print locc" " = <unavailable>"
- gdb_test "print loci" " = <unavailable>"
- gdb_test "print locf" " = <unavailable>"
- gdb_test "print locd" " = <unavailable>"
-
- gdb_test "print locst.memberc" " = <unavailable>"
- gdb_test "print locst.memberi" " = <unavailable>"
- gdb_test "print locst.memberf" " = <unavailable>"
- gdb_test "print locst.memberd" " = <unavailable>"
-
- gdb_test "print locar\[0\]" " = <unavailable>"
- gdb_test "print locar\[1\]" " = <unavailable>"
- gdb_test "print locar\[2\]" " = <unavailable>"
- gdb_test "print locar\[3\]" " = <unavailable>"
-
- # Test "info locals"
- set r ""
- set r "${r}locf = <unavailable>${cr}"
- set r "${r}locd = <unavailable>${cr}"
- set r "${r}locst = {memberc = <unavailable>, memberi = <unavailable>, memberf = <unavailable>, memberd = <unavailable>}${cr}"
- set r "${r}locar = {<unavailable>, <unavailable>, <unavailable>, <unavailable>}${cr}"
- set r "${r}i = <unavailable>${cr}"
- if { $func == "local_test_func" } {
- set r "${r}locdefst = {<No data fields>}${cr}"
- }
- set r "${r}locc = <unavailable>${cr}"
- set r "${r}loci = <unavailable>${cr}"
- gdb_test "info locals" "$r" "info locals"
+ # Begin the test.
+ run_trace_experiment $func
+
+ gdb_test "print locc" " = <unavailable>"
+ gdb_test "print loci" " = <unavailable>"
+ gdb_test "print locf" " = <unavailable>"
+ gdb_test "print locd" " = <unavailable>"
+
+ gdb_test "print locst.memberc" " = <unavailable>"
+ gdb_test "print locst.memberi" " = <unavailable>"
+ gdb_test "print locst.memberf" " = <unavailable>"
+ gdb_test "print locst.memberd" " = <unavailable>"
+
+ gdb_test "print locar\[0\]" " = <unavailable>"
+ gdb_test "print locar\[1\]" " = <unavailable>"
+ gdb_test "print locar\[2\]" " = <unavailable>"
+ gdb_test "print locar\[3\]" " = <unavailable>"
+
+ # Test "info locals"
+ set r ""
+ set r "${r}locf = <unavailable>${cr}"
+ set r "${r}locd = <unavailable>${cr}"
+ set r "${r}locst = {memberc = <unavailable>, memberi = <unavailable>, memberf = <unavailable>, memberd = <unavailable>}${cr}"
+ set r "${r}locar = {<unavailable>, <unavailable>, <unavailable>, <unavailable>}${cr}"
+ set r "${r}i = <unavailable>${cr}"
+ if { $func == "local_test_func" } {
+ set r "${r}locdefst = {<No data fields>}${cr}"
+ }
+ set r "${r}locc = <unavailable>${cr}"
+ set r "${r}loci = <unavailable>${cr}"
+ gdb_test "info locals" "$r" "info locals"
- test_maybe_regvar_display "loci"
+ test_maybe_regvar_display "loci"
- gdb_test "tfind none" \
- "#0 end .*" \
- "cease trace debugging"
-}}
+ gdb_test "tfind none" \
+ "#0 end .*" \
+ "cease trace debugging"
+ }
+}
-proc gdb_unavailable_registers_test { } { with_test_prefix "unavailable registers" {
- global gdb_prompt
- global spreg
- global pcreg
+proc gdb_unavailable_registers_test { } {
+ with_test_prefix "unavailable registers" {
+ global gdb_prompt
+ global spreg
+ global pcreg
- prepare_for_trace_test
+ prepare_for_trace_test
- # We'll simply re-use the globals_test_function for this test
- gdb_test "trace globals_test_func" \
+ # We'll simply re-use the globals_test_function for this test
+ gdb_test "trace globals_test_func" \
"Tracepoint \[0-9\]+ at .*" \
"set tracepoint"
- # Collect nothing.
-
- # Begin the test.
- run_trace_experiment globals_test_func
-
- # On some archs, the $sp/$pc are a real raw registers. On others,
- # like x86, they're user registers. Test both variants.
- test_register_unavailable "\$$spreg"
- test_register_unavailable "\$sp"
-
- # Test reading uncollected pseudo-registers. The set of which
- # depends on target.
- if [is_amd64_regs_target] {
- # Check the raw register first.
- test_register_unavailable "\$rax"
- test_register_unavailable "\$eax"
- test_register_unavailable "\$ax"
- } elseif [is_x86_like_target] {
- # Check the raw register first.
- test_register_unavailable "\$eax"
- test_register_unavailable "\$ax"
- }
+ # Collect nothing.
+
+ # Begin the test.
+ run_trace_experiment globals_test_func
- # GDBserver always provides the PC value of regular tracepoint
- # hits, since it's the same as the tracepoint's address.
- test_register "\$$pcreg"
- test_register "\$pc"
+ # On some archs, the $sp/$pc are a real raw registers. On others,
+ # like x86, they're user registers. Test both variants.
+ test_register_unavailable "\$$spreg"
+ test_register_unavailable "\$sp"
+
+ # Test reading uncollected pseudo-registers. The set of which
+ # depends on target.
+ if [is_amd64_regs_target] {
+ # Check the raw register first.
+ test_register_unavailable "\$rax"
+ test_register_unavailable "\$eax"
+ test_register_unavailable "\$ax"
+ } elseif [is_x86_like_target] {
+ # Check the raw register first.
+ test_register_unavailable "\$eax"
+ test_register_unavailable "\$ax"
+ }
- gdb_test "info registers" \
- "\\*value not available\\*.*\\*value not available\\*" \
- "info registers, multiple registers not available"
+ # GDBserver always provides the PC value of regular tracepoint
+ # hits, since it's the same as the tracepoint's address.
+ test_register "\$$pcreg"
+ test_register "\$pc"
- gdb_test "info registers \$$spreg" \
- "\\*value not available\\*" \
- "info registers \$$spreg reports not available"
+ gdb_test "info registers" \
+ "\\*value not available\\*.*\\*value not available\\*" \
+ "info registers, multiple registers not available"
- gdb_test "tfind none" "#0 end .*" "cease trace debugging"
-}}
+ gdb_test "info registers \$$spreg" \
+ "\\*value not available\\*" \
+ "info registers \$$spreg reports not available"
+
+ gdb_test "tfind none" "#0 end .*" "cease trace debugging"
+ }
+}
proc gdb_unavailable_floats { } {
global gdb_prompt
@@ -335,244 +341,246 @@ proc gdb_unavailable_floats { } {
}
}
-proc gdb_collect_globals_test { } { with_test_prefix "collect globals" {
- global ws
- global cr
- global gdb_prompt
- global hex
+proc gdb_collect_globals_test { } {
+ with_test_prefix "collect globals" {
+ global ws
+ global cr
+ global gdb_prompt
+ global hex
- prepare_for_trace_test
+ prepare_for_trace_test
- set testline [gdb_get_line_number "set globals_test_func tracepoint here"]
+ set testline [gdb_get_line_number "set globals_test_func tracepoint here"]
- gdb_test "trace $testline" \
+ gdb_test "trace $testline" \
"Tracepoint \[0-9\]+ at .*" \
"set tracepoint"
- # We collect the initial sizeof(pointer) bytes of derived_partial
- # in an attempt of collecting the vptr. Not portable, but should
- # work everywhere we need to care.
- gdb_trace_setactions "define actions" \
- "" \
- "collect struct_b.struct_a.array\[2\]" "^$" \
- "collect struct_b.struct_a.array\[100\]" "^$" \
- \
- "collect a" "^$" \
- "collect c" "^$" \
- \
- "collect tarray\[0\].a" "^$" \
- "collect tarray\[1\].a" "^$" \
- "collect tarray\[3\].a" "^$" \
- "collect tarray\[3\].b" "^$" \
- "collect tarray\[4\].b" "^$" \
- "collect tarray\[5\].b" "^$" \
- \
- "collect g_string_p" "^$" \
- "collect g_string_partial\[1\]" "^$" \
- "collect g_string_partial\[2\]" "^$" \
- \
- "collect g_structref_p" "^$" \
- \
- "collect *((char *)&derived_partial)@sizeof\(void *\)" "^$" \
- "collect derived_whole" "^$" \
- \
- "collect virtual_partial.z" "^$"
-
- # Begin the test.
- run_trace_experiment globals_test_func
-
- gdb_test "print globalc" " = <unavailable>"
- gdb_test "print globali" " = <unavailable>"
- gdb_test "print globalf" " = <unavailable>"
- gdb_test "print globald" " = <unavailable>"
-
- gdb_test "print globalstruct.memberc" " = <unavailable>"
- gdb_test "print globalstruct.memberi" " = <unavailable>"
- gdb_test "print globalstruct.memberf" " = <unavailable>"
- gdb_test "print globalstruct.memberd" " = <unavailable>"
-
- gdb_test "print globalstruct" \
+ # We collect the initial sizeof(pointer) bytes of derived_partial
+ # in an attempt of collecting the vptr. Not portable, but should
+ # work everywhere we need to care.
+ gdb_trace_setactions "define actions" \
+ "" \
+ "collect struct_b.struct_a.array\[2\]" "^$" \
+ "collect struct_b.struct_a.array\[100\]" "^$" \
+ \
+ "collect a" "^$" \
+ "collect c" "^$" \
+ \
+ "collect tarray\[0\].a" "^$" \
+ "collect tarray\[1\].a" "^$" \
+ "collect tarray\[3\].a" "^$" \
+ "collect tarray\[3\].b" "^$" \
+ "collect tarray\[4\].b" "^$" \
+ "collect tarray\[5\].b" "^$" \
+ \
+ "collect g_string_p" "^$" \
+ "collect g_string_partial\[1\]" "^$" \
+ "collect g_string_partial\[2\]" "^$" \
+ \
+ "collect g_structref_p" "^$" \
+ \
+ "collect *((char *)&derived_partial)@sizeof\(void *\)" "^$" \
+ "collect derived_whole" "^$" \
+ \
+ "collect virtual_partial.z" "^$"
+
+ # Begin the test.
+ run_trace_experiment globals_test_func
+
+ gdb_test "print globalc" " = <unavailable>"
+ gdb_test "print globali" " = <unavailable>"
+ gdb_test "print globalf" " = <unavailable>"
+ gdb_test "print globald" " = <unavailable>"
+
+ gdb_test "print globalstruct.memberc" " = <unavailable>"
+ gdb_test "print globalstruct.memberi" " = <unavailable>"
+ gdb_test "print globalstruct.memberf" " = <unavailable>"
+ gdb_test "print globalstruct.memberd" " = <unavailable>"
+
+ gdb_test "print globalstruct" \
" = {memberc = <unavailable>, memberi = <unavailable>, memberf = <unavailable>, memberd = <unavailable>}"
- gdb_test "print globalp == &globalstruct" \
+ gdb_test "print globalp == &globalstruct" \
"value is not available" \
"can't compare using non collected global pointer"
- gdb_test "print globalarr\[1\]" " = <unavailable>"
- gdb_test "print globalarr\[2\]" " = <unavailable>"
- gdb_test "print globalarr\[3\]" " = <unavailable>"
+ gdb_test "print globalarr\[1\]" " = <unavailable>"
+ gdb_test "print globalarr\[2\]" " = <unavailable>"
+ gdb_test "print globalarr\[3\]" " = <unavailable>"
- gdb_test "print struct_b" \
- " = {d = <unavailable>, ef = <unavailable>, struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable>, <unavailable>, -1431655766, <unavailable> <repeats 97 times>, -1431655766, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}, s = <unavailable>, static static_struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>, bitfield = <unavailable>}, string = <unavailable>}"
+ gdb_test "print struct_b" \
+ " = {d = <unavailable>, ef = <unavailable>, struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable>, <unavailable>, -1431655766, <unavailable> <repeats 97 times>, -1431655766, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}, s = <unavailable>, static static_struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>, bitfield = <unavailable>}, string = <unavailable>}"
- gdb_test "print /x struct_b" \
- " = {d = <unavailable>, ef = <unavailable>, struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable>, <unavailable>, 0xaaaaaaaa, <unavailable> <repeats 97 times>, 0xaaaaaaaa, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}, s = <unavailable>, static static_struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>, bitfield = <unavailable>}, string = <unavailable>}"
+ gdb_test "print /x struct_b" \
+ " = {d = <unavailable>, ef = <unavailable>, struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable>, <unavailable>, 0xaaaaaaaa, <unavailable> <repeats 97 times>, 0xaaaaaaaa, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}, s = <unavailable>, static static_struct_a = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>, bitfield = <unavailable>}, string = <unavailable>}"
- gdb_test "print /x struct_b.struct_a" \
- " = {a = <unavailable>, b = <unavailable>, array = {<unavailable>, <unavailable>, 0xaaaaaaaa, <unavailable> <repeats 97 times>, 0xaaaaaaaa, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}"
+ gdb_test "print /x struct_b.struct_a" \
+ " = {a = <unavailable>, b = <unavailable>, array = {<unavailable>, <unavailable>, 0xaaaaaaaa, <unavailable> <repeats 97 times>, 0xaaaaaaaa, <unavailable> <repeats 9899 times>}, ptr = <unavailable>, bitfield = <unavailable>}"
- gdb_test "print /x struct_b.struct_a.array" \
- " = {<unavailable>, <unavailable>, 0xaaaaaaaa, <unavailable> <repeats 97 times>, 0xaaaaaaaa, <unavailable> <repeats 9899 times>}"
+ gdb_test "print /x struct_b.struct_a.array" \
+ " = {<unavailable>, <unavailable>, 0xaaaaaaaa, <unavailable> <repeats 97 times>, 0xaaaaaaaa, <unavailable> <repeats 9899 times>}"
- gdb_test "print /x struct_b.struct_a.array\[0\]" " = <unavailable>"
+ gdb_test "print /x struct_b.struct_a.array\[0\]" " = <unavailable>"
- gdb_test "print /x struct_b.struct_a.array\[2\]" " = 0xaaaaaaaa"
+ gdb_test "print /x struct_b.struct_a.array\[2\]" " = 0xaaaaaaaa"
- # Check the target doesn't overcollect. GDB used to merge memory
- # ranges to collect if they were close enough (collecting the hole
- # as well), but does not do that anymore. It's plausible that a
- # target may do this on its end, but as of this writing, no known
- # target does it.
- gdb_test "print {a, b, c}" \
- " = \\{1, <unavailable>, 3\\}" \
- "No overcollect of almost but not quite adjacent memory ranges"
+ # Check the target doesn't overcollect. GDB used to merge memory
+ # ranges to collect if they were close enough (collecting the hole
+ # as well), but does not do that anymore. It's plausible that a
+ # target may do this on its end, but as of this writing, no known
+ # target does it.
+ gdb_test "print {a, b, c}" \
+ " = \\{1, <unavailable>, 3\\}" \
+ "No overcollect of almost but not quite adjacent memory ranges"
- # Check <unavailable> isn't confused with 0 in array element repetitions
+ # Check <unavailable> isn't confused with 0 in array element repetitions
- gdb_test_no_output "set print repeat 1"
+ gdb_test_no_output "set print repeat 1"
- gdb_test "print /x tarray" \
- " = \{\{a = 0x0, b = <unavailable>\} <repeats 2 times>, \{a = <unavailable>, b = <unavailable>\}, \{a = 0x0, b = 0x0\}, \{a = <unavailable>, b = 0x0\} <repeats 2 times>, \{a = <unavailable>, b = <unavailable>\} <repeats 2 times>\}" \
- "<unavailable> is not the same as 0 in array element repetitions"
+ gdb_test "print /x tarray" \
+ " = \{\{a = 0x0, b = <unavailable>\} <repeats 2 times>, \{a = <unavailable>, b = <unavailable>\}, \{a = 0x0, b = 0x0\}, \{a = <unavailable>, b = 0x0\} <repeats 2 times>, \{a = <unavailable>, b = <unavailable>\} <repeats 2 times>\}" \
+ "<unavailable> is not the same as 0 in array element repetitions"
- gdb_test_no_output "set print repeat 10"
+ gdb_test_no_output "set print repeat 10"
- # Check that value repeat handles unavailable-ness.
- gdb_test "print *tarray@3" " = \\{\\{a = 0, b = <unavailable>\\}, \\{a = 0, b = <unavailable>\\}, \\{a = <unavailable>, b = <unavailable>\\}\\}"
+ # Check that value repeat handles unavailable-ness.
+ gdb_test "print *tarray@3" " = \\{\\{a = 0, b = <unavailable>\\}, \\{a = 0, b = <unavailable>\\}, \\{a = <unavailable>, b = <unavailable>\\}\\}"
- # Static fields
+ # Static fields
- gdb_test "print struct_b.static_struct_a" \
- " = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>, bitfield = <unavailable>}"
+ gdb_test "print struct_b.static_struct_a" \
+ " = {a = <unavailable>, b = <unavailable>, array = {<unavailable> <repeats 10000 times>}, ptr = <unavailable>, bitfield = <unavailable>}"
- # Bitfields
+ # Bitfields
- gdb_test "print struct_b.struct_a.bitfield" " = <unavailable>"
+ gdb_test "print struct_b.struct_a.bitfield" " = <unavailable>"
- # References
+ # References
- gdb_test "print g_int" " = <unavailable>"
+ gdb_test "print g_int" " = <unavailable>"
- gdb_test "print g_ref" \
- "\\(int &\\) @$hex: <unavailable>" \
- "global reference shows address but not value"
+ gdb_test "print g_ref" \
+ "\\(int &\\) @$hex: <unavailable>" \
+ "global reference shows address but not value"
- gdb_test "print *&g_ref" \
- "\\$\[0-9\]+ = <unavailable>$cr" \
- "referenced integer was not collected (taking address of reference)"
+ gdb_test "print *&g_ref" \
+ "\\$\[0-9\]+ = <unavailable>$cr" \
+ "referenced integer was not collected (taking address of reference)"
- gdb_test "print *g_structref_p" \
- " = {d = <unavailable>, ref = <unavailable>}"
+ gdb_test "print *g_structref_p" \
+ " = {d = <unavailable>, ref = <unavailable>}"
- # Strings
+ # Strings
- # Const string is always available, even when not collected.
- gdb_test "print g_const_string" \
- " = \"hello world\"$cr" \
- "non collected const string is still printable"
+ # Const string is always available, even when not collected.
+ gdb_test "print g_const_string" \
+ " = \"hello world\"$cr" \
+ "non collected const string is still printable"
- gdb_test "print g_string_p" \
- " = $hex <g_const_string> \"hello world\"" \
- "printing constant string through collected pointer"
+ gdb_test "print g_string_p" \
+ " = $hex <g_const_string> \"hello world\"" \
+ "printing constant string through collected pointer"
- gdb_test "print g_string_unavail" \
- " = \{<unavailable> <repeats 12 times>\}" \
- "printing non collected string"
+ gdb_test "print g_string_unavail" \
+ " = \{<unavailable> <repeats 12 times>\}" \
+ "printing non collected string"
- # Incomplete strings print as an array.
- gdb_test "print g_string_partial" \
- "\\$\[0-9\]+ = \{<unavailable>, 101 'e', 108 'l', <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>\}" \
- "printing partially collected string"
+ # Incomplete strings print as an array.
+ gdb_test "print g_string_partial" \
+ "\\$\[0-9\]+ = \{<unavailable>, 101 'e', 108 'l', <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>, <unavailable>\}" \
+ "printing partially collected string"
- # It is important for this test that the last examined value is
- # <unavailable>, to exercise the case of the $__ convenience
- # variable being set to <unavailable> without error.
- set msg "examining partially collected object"
- gdb_test_multiple "x /10x &struct_b" "$msg" {
- -re "$hex <struct_b>:${ws}<unavailable>${ws}<unavailable>${ws}<unavailable>${ws}<unavailable>$cr$hex <struct_b\\+16>:${ws}<unavailable>${ws}<unavailable>${ws}0xaaaaaaaa${ws}<unavailable>$cr$hex <struct_b\\+32>:${ws}<unavailable>${ws}<unavailable>$cr$gdb_prompt $" {
- pass "$msg"
- }
- -re "value is not available" {
- fail "$msg"
+ # It is important for this test that the last examined value is
+ # <unavailable>, to exercise the case of the $__ convenience
+ # variable being set to <unavailable> without error.
+ set msg "examining partially collected object"
+ gdb_test_multiple "x /10x &struct_b" "$msg" {
+ -re "$hex <struct_b>:${ws}<unavailable>${ws}<unavailable>${ws}<unavailable>${ws}<unavailable>$cr$hex <struct_b\\+16>:${ws}<unavailable>${ws}<unavailable>${ws}0xaaaaaaaa${ws}<unavailable>$cr$hex <struct_b\\+32>:${ws}<unavailable>${ws}<unavailable>$cr$gdb_prompt $" {
+ pass "$msg"
+ }
+ -re "value is not available" {
+ fail "$msg"
+ }
}
- }
- gdb_test "p \$__" " = <unavailable>" "last examined value was <unavailable>"
-
- # This tests that building the array does not require accessing
- # g_int's contents.
- gdb_test "print { 1, g_int, 3 }" \
- " = \\{1, <unavailable>, 3\\}" \
- "build array from unavailable value"
-
- # Note, depends on previous test.
- gdb_test "print \$\[1\]" \
- " = <unavailable>" \
- "subscript a non-memory rvalue array, accessing an unvailable element"
-
- # Access a field of a non-lazy value, making sure the
- # unavailable-ness is propagated. History values are easy
- # non-lazy values, so use those. The first test just sets up for
- # the second.
- gdb_test "print g_smallstruct" " = \\{member = <unavailable>\\}"
- gdb_test "print \$.member" " = <unavailable>"
-
- # Cast to baseclass, checking the unavailable-ness is propagated.
- gdb_test "print (small_struct) g_smallstruct_b" " = \\{member = <unavailable>\\}"
-
- # Same cast, but starting from a non-lazy, value.
- gdb_test "print g_smallstruct_b" " = \\{<small_struct> = \\{member = <unavailable>\\}, <No data fields>\\}"
- gdb_test "print (small_struct) \$" " = \\{member = <unavailable>\\}"
-
- gdb_test_no_output "set print object on"
-
- with_test_prefix "print object on" {
- # With print object on, printing a pointer may need to fetch
- # the pointed-to object, to check its run-time type. Make
- # sure that fails gracefully and transparently when the
- # pointer itself is unavailable.
- gdb_test "print virtualp" " = \\(Virtual \\*\\) <unavailable>"
-
- # no vtable pointer available
- gdb_test "print derived_unavail" \
- " = {<Middle> = <unavailable>, _vptr.Derived = <unavailable>, z = <unavailable>}"
-
- # vtable pointer available, but nothing else
- gdb_test "print derived_partial" \
- " = \\(Derived\\) {<Middle> = {<Base> = <unavailable>, _vptr.Middle = <unavailable>, y = <unavailable>}, _vptr.Derived = $hex <vtable for Derived.*>, z = <unavailable>}"
-
- # whole object available
- gdb_test "print derived_whole" \
- " = \\(Derived\\) {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex <vtable for Derived.*>, z = 4}"
- }
+ gdb_test "p \$__" " = <unavailable>" "last examined value was <unavailable>"
+
+ # This tests that building the array does not require accessing
+ # g_int's contents.
+ gdb_test "print { 1, g_int, 3 }" \
+ " = \\{1, <unavailable>, 3\\}" \
+ "build array from unavailable value"
+
+ # Note, depends on previous test.
+ gdb_test "print \$\[1\]" \
+ " = <unavailable>" \
+ "subscript a non-memory rvalue array, accessing an unvailable element"
+
+ # Access a field of a non-lazy value, making sure the
+ # unavailable-ness is propagated. History values are easy
+ # non-lazy values, so use those. The first test just sets up for
+ # the second.
+ gdb_test "print g_smallstruct" " = \\{member = <unavailable>\\}"
+ gdb_test "print \$.member" " = <unavailable>"
+
+ # Cast to baseclass, checking the unavailable-ness is propagated.
+ gdb_test "print (small_struct) g_smallstruct_b" " = \\{member = <unavailable>\\}"
+
+ # Same cast, but starting from a non-lazy, value.
+ gdb_test "print g_smallstruct_b" " = \\{<small_struct> = \\{member = <unavailable>\\}, <No data fields>\\}"
+ gdb_test "print (small_struct) \$" " = \\{member = <unavailable>\\}"
+
+ gdb_test_no_output "set print object on"
+
+ with_test_prefix "print object on" {
+ # With print object on, printing a pointer may need to fetch
+ # the pointed-to object, to check its run-time type. Make
+ # sure that fails gracefully and transparently when the
+ # pointer itself is unavailable.
+ gdb_test "print virtualp" " = \\(Virtual \\*\\) <unavailable>"
+
+ # no vtable pointer available
+ gdb_test "print derived_unavail" \
+ " = {<Middle> = <unavailable>, _vptr.Derived = <unavailable>, z = <unavailable>}"
+
+ # vtable pointer available, but nothing else
+ gdb_test "print derived_partial" \
+ " = \\(Derived\\) {<Middle> = {<Base> = <unavailable>, _vptr.Middle = <unavailable>, y = <unavailable>}, _vptr.Derived = $hex <vtable for Derived.*>, z = <unavailable>}"
+
+ # whole object available
+ gdb_test "print derived_whole" \
+ " = \\(Derived\\) {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex <vtable for Derived.*>, z = 4}"
+ }
- gdb_test_no_output "set print object off"
+ gdb_test_no_output "set print object off"
- with_test_prefix "print object off" {
- gdb_test "print virtualp" " = \\(Virtual \\*\\) <unavailable>"
+ with_test_prefix "print object off" {
+ gdb_test "print virtualp" " = \\(Virtual \\*\\) <unavailable>"
- # no vtable pointer available
- gdb_test "print derived_unavail" \
- " = {<Middle> = <unavailable>, _vptr.Derived = <unavailable>, z = <unavailable>}"
+ # no vtable pointer available
+ gdb_test "print derived_unavail" \
+ " = {<Middle> = <unavailable>, _vptr.Derived = <unavailable>, z = <unavailable>}"
- # vtable pointer available, but nothing else
- gdb_test "print derived_partial" \
- " = {<Middle> = {<Base> = <unavailable>, _vptr.Middle = <unavailable>, y = <unavailable>}, _vptr.Derived = $hex <vtable for Derived.*>, z = <unavailable>}"
+ # vtable pointer available, but nothing else
+ gdb_test "print derived_partial" \
+ " = {<Middle> = {<Base> = <unavailable>, _vptr.Middle = <unavailable>, y = <unavailable>}, _vptr.Derived = $hex <vtable for Derived.*>, z = <unavailable>}"
- # whole object available
- gdb_test "print derived_whole" \
- " = {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex <vtable for Derived.*>, z = 4}"
- }
+ # whole object available
+ gdb_test "print derived_whole" \
+ " = {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex <vtable for Derived.*>, z = 4}"
+ }
- # An instance of a virtual class where we collected everything but
- # the vptr.
- gdb_test "print virtual_partial" \
- " = {_vptr.Virtual = <unavailable>, z = 0}"
+ # An instance of a virtual class where we collected everything but
+ # the vptr.
+ gdb_test "print virtual_partial" \
+ " = {_vptr.Virtual = <unavailable>, z = 0}"
- gdb_test "tfind none" \
- "#0 end .*" \
- "cease trace debugging"
-}}
+ gdb_test "tfind none" \
+ "#0 end .*" \
+ "cease trace debugging"
+ }
+}
proc gdb_trace_collection_test {} {
gdb_collect_globals_test