]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.trace/unavailable.exp
Update years in copyright notice for the GDB files.
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.trace / unavailable.exp
index 9130b4b74be9b99f8c77b70fc3db8e92bb2cc9e5..b776dd33b153ea9f4c99f627e9ea6f928b1076d7 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright 1998, 2005, 2007-2012 Free Software Foundation, Inc.
+# Copyright 1998-2013 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 
 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
 }
 
@@ -305,6 +302,39 @@ proc gdb_unavailable_registers_test { } { with_test_prefix "unavailable register
     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"
+
+       # 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 { } { with_test_prefix "collect globals" {
     global ws
     global cr
@@ -442,7 +472,7 @@ proc gdb_collect_globals_test { } { with_test_prefix "collect globals" {
        "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" \
@@ -496,49 +526,43 @@ proc gdb_collect_globals_test { } { with_test_prefix "collect globals" {
 
     gdb_test_no_output "set print object on"
 
-    global pf_prefix
-    set old_pf_prefix $pf_prefix
-    append 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
+       # 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"
 
-    append pf_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, 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, z = 4}"
-
-    set pf_prefix $old_pf_prefix
+       # 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.
@@ -553,6 +577,7 @@ proc gdb_collect_globals_test { } { with_test_prefix "collect globals" {
 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"
@@ -560,7 +585,6 @@ proc gdb_trace_collection_test {} {
     gdb_collect_locals_test statlocal_test_func "static locals"
 }
 
-clean_restart $executable
 runto_main
 
 if { ![gdb_target_supports_trace] } then {