* gdb.dwarf2/dup-psym.exp: Use prepare_for_testing_full.
[deliverable/binutils-gdb.git] / gdb / valprint.c
index 6742fc16ecae4483ab8cf191c0db61d337df92e5..fc5942da77887069a9a1e19192245711df5c8755 100644 (file)
@@ -85,7 +85,8 @@ struct value_print_options user_print_options =
   1,                           /* static_field_print */
   1,                           /* pascal_static_field_print */
   0,                           /* raw */
-  0                            /* summary */
+  0,                           /* summary */
+  1                            /* symbol_print */
 };
 
 /* Initialize *OPTS to be a copy of the user print options.  */
@@ -219,6 +220,16 @@ show_addressprint (struct ui_file *file, int from_tty,
 {
   fprintf_filtered (file, _("Printing of addresses is %s.\n"), value);
 }
+
+static void
+show_symbol_print (struct ui_file *file, int from_tty,
+                  struct cmd_list_element *c, const char *value)
+{
+  fprintf_filtered (file,
+                   _("Printing of symbols when printing pointers is %s.\n"),
+                   value);
+}
+
 \f
 
 /* A helper function for val_print.  When printing in "summary" mode,
@@ -329,7 +340,6 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
   unsigned len;
   struct type *elttype, *unresolved_elttype;
   struct type *unresolved_type = type;
-  unsigned eltlen;
   LONGEST val;
   CORE_ADDR addr;
 
@@ -388,7 +398,9 @@ generic_val_print (struct type *type, const gdb_byte *valaddr,
              return;
            }
 
-         if (options->addressprint)
+         if (options->symbol_print)
+           print_address_demangle (options, gdbarch, addr, stream, demangle);
+         else if (options->addressprint)
            fputs_filtered (paddress (gdbarch, addr), stream);
        }
       break;
@@ -2600,6 +2612,14 @@ Show printing of addresses."), NULL,
                           show_addressprint,
                           &setprintlist, &showprintlist);
 
+  add_setshow_boolean_cmd ("symbol", class_support,
+                          &user_print_options.symbol_print, _("\
+Set printing of symbol names when printing pointers."), _("\
+Show printing of symbol names when printing pointers."),
+                          NULL, NULL,
+                          show_symbol_print,
+                          &setprintlist, &showprintlist);
+
   add_setshow_zuinteger_cmd ("input-radix", class_support, &input_radix_1,
                             _("\
 Set default input radix for entering numbers."), _("\
This page took 0.025161 seconds and 4 git commands to generate.