Index: gdb/testsuite/gdb.base/debug-expr.exp |
diff --git a/gdb/testsuite/gdb.cp/destrprint.exp b/gdb/testsuite/gdb.base/debug-expr.exp |
similarity index 51% |
copy from gdb/testsuite/gdb.cp/destrprint.exp |
copy to gdb/testsuite/gdb.base/debug-expr.exp |
index 23d7e14662132eaf1dbd62a122b6bb12ff705862..958c40af48bf09e57f78e2455245e4df2b5d1ef3 100644 |
--- a/gdb/testsuite/gdb.cp/destrprint.exp |
+++ b/gdb/testsuite/gdb.base/debug-expr.exp |
@@ -1,4 +1,4 @@ |
-# Copyright 2011-2012 Free Software Foundation, Inc. |
+# Copyright 2012-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 |
@@ -13,30 +13,40 @@ |
# You should have received a copy of the GNU General Public License |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
-standard_testfile .cc |
+# Test "set debug expr 1" on c expressions. |
-if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug c++}]} { |
+standard_testfile .c |
+ |
+if {[prepare_for_testing $testfile.exp $testfile $srcfile {debug}]} { |
return -1 |
} |
if ![runto_main] { |
- untested destrprint |
+ fail "run to main" |
return -1 |
} |
-gdb_breakpoint [gdb_get_line_number "Break here"] |
-gdb_continue_to_breakpoint "Break here" |
+# Test whether the expression debug machinery accepts the expression. |
-gdb_test "up" "#1 .*~Derived.*" "go up to ~Derived" |
+proc test_debug_expr { cmd output } { |
+ global gdb_prompt |
-foreach setting {on off} { |
- gdb_test_no_output "set print object $setting" |
+ gdb_test_multiple $cmd "" { |
+ -re ".*Invalid expression.*\r\n$gdb_prompt $" { |
+ fail $cmd |
+ } |
+ -re ".*\[\r\n\]$output\r\n$gdb_prompt $" { |
+ pass $cmd |
+ } |
+ } |
+} |
- # Here we are in ~Derived. At this point, Derived has been |
- # destroyed, so *this looks like a Base. But, the static type of |
- # *this is still Derived, and printing it should show us all the |
- # fields, regardless of what "set print object" says. |
- gdb_test "print *this" \ |
- " = .*, z = 23." \ |
- "print *this with print object = $setting" |
+for { set i 0 } { $i < 4 } { incr i } { |
+ gdb_test_no_output "set variable array\[$i\] = $i" |
} |
+ |
+gdb_test_no_output "set debug expression 1" |
+ |
+# This caused gdb to segfault. |
+test_debug_expr "print /x {char\[4\]} array" \ |
+ "\[$\]$decimal = \\{0x0, 0x1, 0x2, 0x3\\}" |