aboutsummaryrefslogtreecommitdiff
path: root/gdb/valprint.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2012-05-18 15:31:42 +0000
committerTom Tromey <tromey@redhat.com>2012-05-18 15:31:42 +0000
commit9cb709b6ba0111234528d4ead138d5b54fed6095 (patch)
treea7f5ace4300361d3c46c18e28cf185fc50e8db98 /gdb/valprint.c
parentb012acddd87cb89dc4b357adf458511232c58bfe (diff)
downloadgdb-9cb709b6ba0111234528d4ead138d5b54fed6095.zip
gdb-9cb709b6ba0111234528d4ead138d5b54fed6095.tar.gz
gdb-9cb709b6ba0111234528d4ead138d5b54fed6095.tar.bz2
PR exp/13907:
* valprint.h (struct value_print_options) <symbol_print>: New field. * valprint.c (user_print_options): Add default for symbol_print. (show_symbol_print): New function. (generic_val_print): Respect symbol_print. (_initialize_valprint): Add "print symbol" setting. * f-valprint.c (f_val_print): Respect symbol_print. * c-valprint.c (c_val_print): Respect symbol_print. * NEWS: Update. * printcmd.c (print_address_symbolic): Return int. Ignore some zero-size symbols. (print_address_demangle): Return int. * defs.h: (print_address_symbolic): Return int. * value.h (print_address_demangle): Return int. doc * gdb.texinfo (Print Settings): Document 'set print symbol'. testsuite * gdb.mi/mi-var-cmd.exp: Update. * gdb.objc/basicclass.exp (do_objc_tests): Update. * gdb.cp/virtbase.exp: Update. * gdb.cp/classes.exp (test_static_members): Update. * gdb.cp/casts.exp: Update. * gdb.base/pointers.exp: Update. * gdb.base/funcargs.exp (pointer_args): Update. (structs_by_reference): Update. * gdb.base/find.exp: Update. * gdb.base/call-strs.exp: Send "set print symbol off". * gdb.base/call-ar-st.exp: Update. * gdb.ada/fun_addr.exp: Update. * gdb.base/printcmds.exp (test_print_symbol): New proc. Call it. (test_print_repeats_10, test_print_strings) (test_print_char_arrays): Update.
Diffstat (limited to 'gdb/valprint.c')
-rw-r--r--gdb/valprint.c25
1 files changed, 23 insertions, 2 deletions
diff --git a/gdb/valprint.c b/gdb/valprint.c
index 6742fc1..1384396 100644
--- a/gdb/valprint.c
+++ b/gdb/valprint.c
@@ -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);
+}
+
/* A helper function for val_print. When printing in "summary" mode,
@@ -388,7 +399,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 +2613,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."), _("\