Index: gdb/testsuite/gdb.trace/unavailable.exp |
diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp |
index 5d82d4c8649a057e93fae9fc8ebad6a492e0ad8a..1fb75ebb3a00da939799450a690ab7a7d348438b 100644 |
--- a/gdb/testsuite/gdb.trace/unavailable.exp |
+++ b/gdb/testsuite/gdb.trace/unavailable.exp |
@@ -15,14 +15,11 @@ |
load_lib "trace-support.exp" |
-set testfile "unavailable" |
-set srcfile ${testfile}.cc |
+standard_testfile unavailable.cc |
set executable $testfile |
-set binfile $objdir/$subdir/$executable |
-if { [gdb_compile "$srcdir/$subdir/$srcfile" $binfile \ |
- executable {debug nowarnings c++}] != "" } { |
- untested unavailable.exp |
+if {[prepare_for_testing $testfile.exp $testfile $srcfile \ |
+ {debug nowarnings c++}]} { |
return -1 |
} |
@@ -136,13 +133,9 @@ proc test_maybe_regvar_display { var } { |
# Test procs |
# |
-proc gdb_collect_args_test {} { |
+proc gdb_collect_args_test {} { with_test_prefix "unavailable arguments" { |
global cr |
global gdb_prompt |
- global pf_prefix |
- |
- set old_pf_prefix $pf_prefix |
- set pf_prefix "$pf_prefix unavailable arguments:" |
prepare_for_trace_test |
@@ -205,17 +198,11 @@ proc gdb_collect_args_test {} { |
gdb_test "tfind none" \ |
"#0 end .*" \ |
"cease trace debugging" |
+}} |
- set pf_prefix $old_pf_prefix |
-} |
- |
-proc gdb_collect_locals_test { func msg } { |
+proc gdb_collect_locals_test { func msg } { with_test_prefix "unavailable locals: $msg" { |
global cr |
global gdb_prompt |
- global pf_prefix |
- |
- set old_pf_prefix $pf_prefix |
- set pf_prefix "$pf_prefix unavailable locals: $msg:" |
prepare_for_trace_test |
@@ -262,18 +249,12 @@ proc gdb_collect_locals_test { func msg } { |
gdb_test "tfind none" \ |
"#0 end .*" \ |
"cease trace debugging" |
+}} |
- set pf_prefix $old_pf_prefix |
-} |
- |
-proc gdb_unavailable_registers_test { } { |
+proc gdb_unavailable_registers_test { } { with_test_prefix "unavailable registers" { |
global gdb_prompt |
global spreg |
global pcreg |
- global pf_prefix |
- |
- set old_pf_prefix $pf_prefix |
- set pf_prefix "$pf_prefix unavailable registers:" |
prepare_for_trace_test |
@@ -319,19 +300,46 @@ proc gdb_unavailable_registers_test { } { |
"info registers \$$spreg reports not available" |
gdb_test "tfind none" "#0 end .*" "cease trace debugging" |
+}} |
+ |
+proc gdb_unavailable_floats { } { |
+ global gdb_prompt |
+ |
+ with_test_prefix "unavailable floats" { |
+ prepare_for_trace_test |
+ |
+ # We'll simply re-use the globals_test_function for this test |
+ gdb_test "trace globals_test_func" \ |
+ "Tracepoint \[0-9\]+ at .*" \ |
+ "set tracepoint" |
- set pf_prefix $old_pf_prefix |
+ # Collect nothing. |
+ |
+ # Begin the test. |
+ run_trace_experiment globals_test_func |
+ |
+ # Necessarily target specific. |
+ if {[istarget "x86_64-*-*"] || [istarget i?86-*]} { |
+ send_gdb "info float\n" |
+ gdb_expect_list "info float" ".*$gdb_prompt $" { |
+ "Status Word: <unavailable>" |
+ "Control Word: <unavailable>" |
+ "Tag Word: <unavailable>" |
+ "Instruction Pointer: <unavailable>:<unavailable>" |
+ "Operand Pointer: <unavailable>:<unavailable>" |
+ "Opcode: <unavailable>" |
+ } |
+ } |
+ |
+ gdb_test "tfind none" "#0 end .*" "cease trace debugging" |
+ } |
} |
-proc gdb_collect_globals_test { } { |
+proc gdb_collect_globals_test { } { with_test_prefix "collect globals" { |
global ws |
global cr |
global gdb_prompt |
global hex |
- global pf_prefix |
- |
- set old_pf_prefix $pf_prefix |
- set pf_prefix "$pf_prefix collect globals:" |
prepare_for_trace_test |
@@ -464,7 +472,7 @@ proc gdb_collect_globals_test { } { |
"non collected const string is still printable" |
gdb_test "print g_string_p" \ |
- " = $hex \"hello world\"" \ |
+ " = $hex <g_const_string> \"hello world\"" \ |
"printing constant string through collected pointer" |
gdb_test "print g_string_unavail" \ |
@@ -518,48 +526,43 @@ proc gdb_collect_globals_test { } { |
gdb_test_no_output "set print object on" |
- set old_pf_prefix_2 $pf_prefix |
- set pf_prefix "$pf_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>}" |
+ 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>" |
- # vtable pointer available, but nothing else |
- gdb_test "print derived_partial" \ |
- " = \\(Derived\\) {<Middle> = {<Base> = <unavailable>, _vptr.Middle = <unavailable>, y = <unavailable>}, _vptr.Derived = $hex, z = <unavailable>}" |
+ # no vtable pointer available |
+ gdb_test "print derived_unavail" \ |
+ " = {<Middle> = <unavailable>, _vptr.Derived = <unavailable>, z = <unavailable>}" |
- # whole object available |
- gdb_test "print derived_whole" \ |
- " = \\(Derived\\) {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex, z = 4}" |
+ # 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>}" |
- set pf_prefix $old_pf_prefix_2 |
+ # 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" |
- set pf_prefix "$pf_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>}" |
+ with_test_prefix "print object off" { |
+ gdb_test "print virtualp" " = \\(Virtual \\*\\) <unavailable>" |
- # vtable pointer available, but nothing else |
- gdb_test "print derived_partial" \ |
- " = {<Middle> = {<Base> = <unavailable>, _vptr.Middle = <unavailable>, y = <unavailable>}, _vptr.Derived = $hex, z = <unavailable>}" |
+ # no vtable pointer available |
+ gdb_test "print derived_unavail" \ |
+ " = {<Middle> = <unavailable>, _vptr.Derived = <unavailable>, z = <unavailable>}" |
- # whole object available |
- gdb_test "print derived_whole" \ |
- " = {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex, z = 4}" |
+ # 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>}" |
- set pf_prefix $old_pf_prefix_2 |
+ # 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. |
@@ -569,13 +572,12 @@ proc gdb_collect_globals_test { } { |
gdb_test "tfind none" \ |
"#0 end .*" \ |
"cease trace debugging" |
- |
- set pf_prefix $old_pf_prefix |
-} |
+}} |
proc gdb_trace_collection_test {} { |
gdb_collect_globals_test |
gdb_unavailable_registers_test |
+ gdb_unavailable_floats |
gdb_collect_args_test |
gdb_collect_locals_test local_test_func "auto locals" |
@@ -583,13 +585,10 @@ proc gdb_trace_collection_test {} { |
gdb_collect_locals_test statlocal_test_func "static locals" |
} |
-clean_restart $executable |
runto_main |
-# We generously give ourselves one "pass" if we successfully |
-# detect that this test cannot be run on this target! |
if { ![gdb_target_supports_trace] } then { |
- pass "Current target does not support trace" |
+ unsupported "Current target does not support trace" |
return 1; |
} |