Fix segfault with 'set print object on' + 'whatis <struct>' & co
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.base / whatis.exp
index dd6aeb02f91c67e41cc811dac5664d5ad98009f0..509183e2ea4c3b64dcfdb4205ed2b07f72d41265 100644 (file)
@@ -282,14 +282,31 @@ gdb_test "whatis v_double_pointer" \
 
 
 # test whatis command with structure types
+
+# First with a type argument, with both "set print object" set to "on"
+# and "off", ending with "off" for the following tests.
+foreach_with_prefix print_object {"on" "off"} {
+    gdb_test_no_output "set print object $print_object"
+
+    gdb_test "whatis struct t_struct" \
+       "type = struct t_struct" \
+       "whatis named structure using type name"
+
+    gdb_test "whatis struct t_struct *" \
+       "type = struct t_struct \\*" \
+       "whatis named structure using type name and pointer"
+
+    gdb_test "whatis struct t_struct &" \
+       "type = struct t_struct &" \
+       "whatis named structure using type name and reference"
+}
+
+# Now with an expression argument.
+
 gdb_test "whatis v_struct1" \
     "type = struct t_struct" \
     "whatis named structure"
 
-gdb_test "whatis struct t_struct" \
-    "type = struct t_struct" \
-    "whatis named structure using type name"
-
 gdb_test "whatis v_struct2" \
     "type = struct \{\.\.\.\}" \
     "whatis unnamed structure"
This page took 0.025514 seconds and 4 git commands to generate.