This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] gdb.trace/unavailable.exp: Use with_test_prefix.


This gets rid of the manual pf_prefix handling from
gdb.trace/unavailable.exp, one of the "needs indenting" ones.

Tested against gdbserver on x86_64 Fedora 16, and checked in.

2012-02-21  Pedro Alves  <palves@redhat.com>

	* gdb.trace/unavailable.exp (gdb_collect_globals_test): Use
	with_test_prefix.
---
 gdb/testsuite/gdb.trace/unavailable.exp |   68 ++++++++++++++-----------------
 1 files changed, 31 insertions(+), 37 deletions(-)

diff --git a/gdb/testsuite/gdb.trace/unavailable.exp b/gdb/testsuite/gdb.trace/unavailable.exp
index 9130b4b..be79b86 100644
--- a/gdb/testsuite/gdb.trace/unavailable.exp
+++ b/gdb/testsuite/gdb.trace/unavailable.exp
@@ -496,49 +496,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>}"
-
-    # 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>}"
-
-    # whole object available
-    gdb_test "print derived_whole" \
-	" = \\(Derived\\) {<Middle> = {<Base> = {x = 2}, _vptr.Middle = $hex, y = 3}, _vptr.Derived = $hex, z = 4}"
-
-    set pf_prefix $old_pf_prefix
+    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, 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}"
+    }
 
     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, 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, z = 4}"
+    }
 
     # An instance of a virtual class where we collected everything but
     # the vptr.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]