* 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.
This commit is contained in:
Peter Schauer 1994-09-17 11:35:51 +00:00
parent b0ed204dbf
commit 4c664b8d0a
5 changed files with 72 additions and 6 deletions

View file

@ -1,3 +1,24 @@
Sat Sep 17 02:26:58 1994 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* 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.
Fri Sep 16 16:06:08 1994 Per Bothner (bothner@kalessin.cygnus.com)
* gdbtypes.h (TYPE_INDEX_TYPE): New macro.

View file

@ -35,6 +35,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <string.h>
#include <errno.h>
#include <ctype.h>
static void
c_type_print_args PARAMS ((struct type *, GDB_FILE *));
@ -641,6 +642,14 @@ c_type_print_base (type, stream, show, level)
int is_constructor = name && STREQ(method_name, name);
for (j = 0; j < len2; j++)
{
char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
int is_full_physname_constructor =
((physname[0]=='_' && physname[1]=='_' &&
(isdigit(physname[2])
|| physname[2]=='Q'
|| physname[2]=='t'))
|| (strncmp(physname, "__ct__", 6) == 0));
QUIT;
if (TYPE_FN_FIELD_PROTECTED (f, j))
{
@ -680,7 +689,7 @@ c_type_print_base (type, stream, show, level)
TYPE_FN_FIELD_PHYSNAME (f, j));
break;
}
else if (!is_constructor)
else if (!is_constructor && !is_full_physname_constructor)
{
type_print (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)),
"", stream, 0);

View file

@ -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),
@ -493,6 +516,15 @@ cp_print_class_member (valaddr, domain, stream, prefix)
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.",

View file

@ -477,6 +477,10 @@ variable: name_not_typename
innermost_block = block_found;
}
write_exp_elt_opcode (OP_VAR_VALUE);
/* We want to use the selected frame, not
another more inner frame which happens to
be in the same block. */
write_exp_elt_block (NULL);
write_exp_elt_sym (sym);
write_exp_elt_opcode (OP_VAR_VALUE);
break;

View file

@ -786,10 +786,10 @@ info_common_command (comname, from_tty)
funname = SYMBOL_NAME (msymbol);
}
/* If comnname is NULL, we assume the user wishes to see the
/* If comname is NULL, we assume the user wishes to see the
which COMMON blocks are visible here and then return */
if (strlen (comname) == 0)
if (comname == 0)
{
list_all_visible_commons (funname);
return;