gdb: Make python display_hint None handling defined behaviour
[deliverable/binutils-gdb.git] / gdb / testsuite / gdb.python / py-prettyprint.exp
index 335908279c9ed90630943a2f78b8fb097d57df32..82e7e6503168a683b1758f905e00ce72852613b3 100644 (file)
@@ -109,7 +109,12 @@ proc run_lang_tests {exefile lang} {
     gdb_test_no_output "set python print-stack full"
     gdb_test "print hint_error" "Exception: hint failed\r\nhint_error_val"
 
-    gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}"
+    gdb_test "print c" " = container \"container\" with 2 elements = {$nl *.0. = 23,$nl *.1. = 72$nl}" \
+       "print c, pretty printing on, default display hint"
+
+    gdb_test_no_output "set variable c.is_map_p=1"
+    gdb_test "print c" " = container \"container\" with 2 elements = \{$nl  \\\[23\\\] = 72$nl\}" \
+       "print c, pretty printing on, display hint is now map"
 
     gdb_test "print nstype" " = {$nl *.0. = 7,$nl *.1. = 42$nl}"
 
@@ -117,6 +122,14 @@ proc run_lang_tests {exefile lang} {
     gdb_test "print nstype" " = {.0. = 7, .1. = 42}" \
        "print nstype on one line"
 
+    # Now we have pretty printing turned off, try printing 'c' again.
+    gdb_test "print c" " = container \"container\" with 2 elements = \{\\\[23\\\] = 72\}" \
+       "print c, pretty printing off, display hint is now map"
+
+    gdb_test_no_output "set variable c.is_map_p=0"
+    gdb_test "print c" " = container \"container\" with 2 elements = \{\\\[0\\\] = 23, \\\[1\\\] = 72\}" \
+       "print c, pretty printing off, default display hint"
+
     # Check that GDB doesn't lose typedefs when looking for a printer.
     gdb_test "print an_int" " = -1"
     gdb_test "print (int) an_int" " = -1"
This page took 0.023666 seconds and 4 git commands to generate.