diff options
author | Peter Schauer <Peter.Schauer@mytum.de> | 1994-09-17 11:35:51 +0000 |
---|---|---|
committer | Peter Schauer <Peter.Schauer@mytum.de> | 1994-09-17 11:35:51 +0000 |
commit | 4c664b8d0ac4c98faac11fd247688fdeae5cea86 (patch) | |
tree | 084f33b21f5268846667a51462b2584ba9f5cf40 /gdb/cp-valprint.c | |
parent | b0ed204dbf2b8e321a06df31d2a5a8ca4fdf8611 (diff) | |
download | gdb-4c664b8d0ac4c98faac11fd247688fdeae5cea86.zip gdb-4c664b8d0ac4c98faac11fd247688fdeae5cea86.tar.gz gdb-4c664b8d0ac4c98faac11fd247688fdeae5cea86.tar.bz2 |
* cp-valprint.c (static_field_print): New variable, controls
printing of static members.
(_initialize_cp_valprint): New print set subcommand
"static-members". Turn on printing of static members by default.
(cp_print_value_fields): Print static members if necessary.
* solib.c: Remove inclusion of libelf.h and elf/mips.h.
(elf_locate_base): Use only standard BFD functions to collect
information about the .dynamic section. Check for DT_MIPS_RLD_MAP
tag only if it got defined via the inclusion of <link.h>.
* f-exp.y: Write block for OP_VAR_VALUE.
* f-valprint.c (info_common_command): Handle `info common'
without an argument correctly.
* c-typeprint.c (c_type_print_base): Handle template constructors.
* symtab.c (gdb_mangle_name): Handle template method mangling,
get rid of GCC_MANGLE_BUG code, which only applied to gcc-2.2.2.
Diffstat (limited to 'gdb/cp-valprint.c')
-rw-r--r-- | gdb/cp-valprint.c | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/gdb/cp-valprint.c b/gdb/cp-valprint.c index af8d767..594ed0f 100644 --- a/gdb/cp-valprint.c +++ b/gdb/cp-valprint.c @@ -31,6 +31,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ int vtblprint; /* Controls printing of vtbl's */ int objectprint; /* Controls looking up an object's derived type using what we find in its vtables. */ +static int static_field_print; /* Controls printing of static fields. */ struct obstack dont_print_obstack; static void @@ -240,8 +241,8 @@ cp_print_value_fields (type, valaddr, stream, format, recurse, pretty, for (i = n_baseclasses; i < len; i++) { - /* Check if static field */ - if (TYPE_FIELD_STATIC (type, i)) + /* If requested, skip printing of static fields. */ + if (!static_field_print && TYPE_FIELD_STATIC (type, i)) continue; if (fields_seen) fprintf_filtered (stream, ", "); @@ -273,6 +274,8 @@ cp_print_value_fields (type, valaddr, stream, format, recurse, pretty, fputs_filtered ("\"( ptr \"", stream); else fputs_filtered ("\"( nodef \"", stream); + if (TYPE_FIELD_STATIC (type, i)) + fputs_filtered ("static ", stream); fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i), language_cplus, DMGL_PARAMS | DMGL_ANSI); @@ -286,6 +289,8 @@ cp_print_value_fields (type, valaddr, stream, format, recurse, pretty, { annotate_field_begin (TYPE_FIELD_TYPE (type, i)); + if (TYPE_FIELD_STATIC (type, i)) + fputs_filtered ("static ", stream); fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i), language_cplus, DMGL_PARAMS | DMGL_ANSI); @@ -294,7 +299,7 @@ cp_print_value_fields (type, valaddr, stream, format, recurse, pretty, annotate_field_value (); } - if (TYPE_FIELD_PACKED (type, i)) + if (!TYPE_FIELD_STATIC (type, i) && TYPE_FIELD_PACKED (type, i)) { value_ptr v; @@ -319,6 +324,24 @@ cp_print_value_fields (type, valaddr, stream, format, recurse, pretty, { fputs_filtered ("<optimized out or zero length>", stream); } + else if (TYPE_FIELD_STATIC (type, i)) + { + value_ptr v; + char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, i); + struct symbol *sym = + lookup_symbol (phys_name, 0, VAR_NAMESPACE, 0, NULL); + if (sym == NULL) + fputs_filtered ("<optimized out>", stream); + else + { + v = value_at (TYPE_FIELD_TYPE (type, i), + (CORE_ADDR)SYMBOL_BLOCK_VALUE (sym)); + val_print (TYPE_FIELD_TYPE (type, i), + VALUE_CONTENTS_RAW (v), + VALUE_ADDRESS (v), + stream, format, 0, recurse + 1, pretty); + } + } else { val_print (TYPE_FIELD_TYPE (type, i), @@ -494,6 +517,15 @@ void _initialize_cp_valprint () { add_show_from_set + (add_set_cmd ("static-members", class_support, var_boolean, + (char *)&static_field_print, + "Set printing of C++ static members.", + &setprintlist), + &showprintlist); + /* Turn on printing of static fields. */ + static_field_print = 1; + + add_show_from_set (add_set_cmd ("vtbl", class_support, var_boolean, (char *)&vtblprint, "Set printing of C++ virtual function tables.", &setprintlist), |