aboutsummaryrefslogtreecommitdiff
path: root/gdb/printcmd.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/printcmd.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/printcmd.c')
-rw-r--r--gdb/printcmd.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/gdb/printcmd.c b/gdb/printcmd.c
index 523fad2..3c2d28c 100644
--- a/gdb/printcmd.c
+++ b/gdb/printcmd.c
@@ -568,9 +568,10 @@ set_next_address (struct gdbarch *gdbarch, CORE_ADDR addr)
DO_DEMANGLE controls whether to print a symbol in its native "raw" form,
or to interpret it as a possible C++ name and convert it back to source
form. However note that DO_DEMANGLE can be overridden by the specific
- settings of the demangle and asm_demangle variables. */
+ settings of the demangle and asm_demangle variables. Returns
+ non-zero if anything was printed; zero otherwise. */
-void
+int
print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
struct ui_file *stream,
int do_demangle, char *leadin)
@@ -589,7 +590,7 @@ print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
&filename, &line, &unmapped))
{
do_cleanups (cleanup_chain);
- return;
+ return 0;
}
fputs_filtered (leadin, stream);
@@ -616,6 +617,7 @@ print_address_symbolic (struct gdbarch *gdbarch, CORE_ADDR addr,
fputs_filtered (">", stream);
do_cleanups (cleanup_chain);
+ return 1;
}
/* Given an address ADDR return all the elements needed to print the
@@ -683,6 +685,13 @@ build_address_symbolic (struct gdbarch *gdbarch,
name_temp = SYMBOL_LINKAGE_NAME (symbol);
}
+ if (msymbol != NULL
+ && MSYMBOL_SIZE (msymbol) == 0
+ && MSYMBOL_TYPE (msymbol) != mst_text
+ && MSYMBOL_TYPE (msymbol) != mst_text_gnu_ifunc
+ && MSYMBOL_TYPE (msymbol) != mst_file_text)
+ msymbol = NULL;
+
if (msymbol != NULL)
{
if (SYMBOL_VALUE_ADDRESS (msymbol) > name_location || symbol == NULL)
@@ -763,10 +772,9 @@ pc_prefix (CORE_ADDR addr)
/* Print address ADDR symbolically on STREAM. Parameter DEMANGLE
controls whether to print the symbolic name "raw" or demangled.
- Global setting "addressprint" controls whether to print hex address
- or not. */
+ Return non-zero if anything was printed; zero otherwise. */
-void
+int
print_address_demangle (const struct value_print_options *opts,
struct gdbarch *gdbarch, CORE_ADDR addr,
struct ui_file *stream, int do_demangle)
@@ -778,8 +786,9 @@ print_address_demangle (const struct value_print_options *opts,
}
else
{
- print_address_symbolic (gdbarch, addr, stream, do_demangle, "");
+ return print_address_symbolic (gdbarch, addr, stream, do_demangle, "");
}
+ return 1;
}