* c-exp.y (qualified_name): Replace explicit check for valid

destructor name with call to destructor_name_p.

	* c-lang.h, c-typeprint.c (cp_type_print_method_args):  Removed,
	no longer needed.

	* c-typeprint.c (c_type_print_varspec_prefix, c_type_print_base):
	Replace remaining fprintf_unfiltered calls with their filtered variant.
	(c_type_print_base):  Do not print return type for destructors from
	template classes.
	Replace cp_type_print_method_args with cplus_demangle call to get
	consistent type output for stubbed and unstubbed methods.

	* cp-valprint.c (cp_print_class_method):  Replace
	cp_type_print_method_args with cplus_demangle call to get consistent
	type output for stubbed and unstubbed methods.

	* gdbtypes.c, gdbtypes.h (get_destructor_fn_field):  New function
	to find the destructor field indices for a type.

	* gdbtypes.h (struct type):  Clarify comments for vptr_basetype
	and arg_types fields.
	(struct fn_field):  Remove args field, no longer used.

	* symtab.c (decode_line_1), valops.c (value_struct_elt,
	check_field_in):  Use get_destructor_fn_field to find the destructor
	field indices instead of assuming that the compiler passes the member
	function fields in a specific order.

	* symtab.c (find_methods):  Pass NULL instead of SYMBOL_BLOCK_VALUE
	to lookup_symbol.
	(list_symbol):  Replace cp_type_print_method_args with cplus_demangle
	call in zapped out code and explain why this code is zapped out.
This commit is contained in:
Peter Schauer 1996-12-14 09:17:22 +00:00
parent 93f8f531b0
commit a46d92a736
9 changed files with 186 additions and 156 deletions

View file

@ -1,3 +1,39 @@
Sat Dec 14 00:43:57 1996 Peter Schauer (pes@regent.e-technik.tu-muenchen.de)
* c-exp.y (qualified_name): Replace explicit check for valid
destructor name with call to destructor_name_p.
* c-lang.h, c-typeprint.c (cp_type_print_method_args): Removed,
no longer needed.
* c-typeprint.c (c_type_print_varspec_prefix, c_type_print_base):
Replace remaining fprintf_unfiltered calls with their filtered variant.
(c_type_print_base): Do not print return type for destructors from
template classes.
Replace cp_type_print_method_args with cplus_demangle call to get
consistent type output for stubbed and unstubbed methods.
* cp-valprint.c (cp_print_class_method): Replace
cp_type_print_method_args with cplus_demangle call to get consistent
type output for stubbed and unstubbed methods.
* gdbtypes.c, gdbtypes.h (get_destructor_fn_field): New function
to find the destructor field indices for a type.
* gdbtypes.h (struct type): Clarify comments for vptr_basetype
and arg_types fields.
(struct fn_field): Remove args field, no longer used.
* symtab.c (decode_line_1), valops.c (value_struct_elt,
check_field_in): Use get_destructor_fn_field to find the destructor
field indices instead of assuming that the compiler passes the member
function fields in a specific order.
* symtab.c (find_methods): Pass NULL instead of SYMBOL_BLOCK_VALUE
to lookup_symbol.
(list_symbol): Replace cp_type_print_method_args with cplus_demangle
call in zapped out code and explain why this code is zapped out.
Thu Dec 12 13:29:14 1996 Michael Meissner <meissner@tiktok.cygnus.com> Thu Dec 12 13:29:14 1996 Michael Meissner <meissner@tiktok.cygnus.com>
* config/powerpc/ppc{,le}-sim.mt (SIM): Add the simulator common * config/powerpc/ppc{,le}-sim.mt (SIM): Add the simulator common

View file

@ -1,5 +1,5 @@
/* YACC parser for C expressions, for GDB. /* YACC parser for C expressions, for GDB.
Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994 Copyright (C) 1986, 1989, 1990, 1991, 1993, 1994, 1996
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -604,15 +604,14 @@ qualified_name: typebase COLONCOLON name
error ("`%s' is not defined as an aggregate type.", error ("`%s' is not defined as an aggregate type.",
TYPE_NAME (type)); TYPE_NAME (type));
if (!STREQ (type_name_no_tag (type), $4.ptr))
error ("invalid destructor `%s::~%s'",
type_name_no_tag (type), $4.ptr);
tmp_token.ptr = (char*) alloca ($4.length + 2); tmp_token.ptr = (char*) alloca ($4.length + 2);
tmp_token.length = $4.length + 1; tmp_token.length = $4.length + 1;
tmp_token.ptr[0] = '~'; tmp_token.ptr[0] = '~';
memcpy (tmp_token.ptr+1, $4.ptr, $4.length); memcpy (tmp_token.ptr+1, $4.ptr, $4.length);
tmp_token.ptr[tmp_token.length] = 0; tmp_token.ptr[tmp_token.length] = 0;
/* Check for valid destructor name. */
destructor_name_p (tmp_token.ptr, type);
write_exp_elt_opcode (OP_SCOPE); write_exp_elt_opcode (OP_SCOPE);
write_exp_elt_type (type); write_exp_elt_type (type);
write_exp_string (tmp_token); write_exp_string (tmp_token);

View file

@ -1,5 +1,5 @@
/* C language support definitions for GDB, the GNU debugger. /* C language support definitions for GDB, the GNU debugger.
Copyright 1992 Free Software Foundation, Inc. Copyright 1992, 1996 Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -55,15 +55,8 @@ c_type_print_base PARAMS ((struct type *, GDB_FILE *, int, int));
extern void extern void
c_type_print_varspec_prefix PARAMS ((struct type *, GDB_FILE *, int, int)); c_type_print_varspec_prefix PARAMS ((struct type *, GDB_FILE *, int, int));
extern void
cp_type_print_method_args PARAMS ((struct type **, char *, char *, int,
GDB_FILE *));
/* These are in cp-valprint.c */ /* These are in cp-valprint.c */
extern void
cp_type_print_method_args PARAMS ((struct type **, char *, char *, int,
GDB_FILE *));
extern int vtblprint; /* Controls printing of vtbl's */ extern int vtblprint; /* Controls printing of vtbl's */
extern void extern void

View file

@ -144,42 +144,6 @@ c_print_type (type, varstring, stream, show, level)
c_type_print_varspec_suffix (type, stream, show, 0, demangled_args); c_type_print_varspec_suffix (type, stream, show, 0, demangled_args);
} }
/* Print the C++ method arguments ARGS to the file STREAM. */
void
cp_type_print_method_args (args, prefix, varstring, staticp, stream)
struct type **args;
char *prefix;
char *varstring;
int staticp;
GDB_FILE *stream;
{
int i;
fprintf_symbol_filtered (stream, prefix, language_cplus, DMGL_ANSI);
fprintf_symbol_filtered (stream, varstring, language_cplus, DMGL_ANSI);
fputs_filtered (" (", stream);
if (args && args[!staticp] && args[!staticp]->code != TYPE_CODE_VOID)
{
i = !staticp; /* skip the class variable */
while (1)
{
type_print (args[i++], "", stream, -1);
if (!args[i])
{
fprintf_filtered (stream, " ...");
break;
}
else if (args[i]->code != TYPE_CODE_VOID)
{
fprintf_filtered (stream, ", ");
}
else break;
}
}
fprintf_filtered (stream, ")");
}
/* If TYPE is a derived type, then print out derivation information. /* If TYPE is a derived type, then print out derivation information.
Print only the actual base classes of this type, not the base classes Print only the actual base classes of this type, not the base classes
@ -274,7 +238,7 @@ c_type_print_varspec_prefix (type, stream, show, passed_a_ptr)
case TYPE_CODE_METHOD: case TYPE_CODE_METHOD:
if (passed_a_ptr) if (passed_a_ptr)
fprintf_unfiltered (stream, "("); fprintf_filtered (stream, "(");
c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0); c_type_print_varspec_prefix (TYPE_TARGET_TYPE (type), stream, 0, 0);
if (passed_a_ptr) if (passed_a_ptr)
{ {
@ -658,11 +622,11 @@ c_type_print_base (type, stream, show, level)
{ {
char *physname = TYPE_FN_FIELD_PHYSNAME (f, j); char *physname = TYPE_FN_FIELD_PHYSNAME (f, j);
int is_full_physname_constructor = int is_full_physname_constructor =
((physname[0]=='_' && physname[1]=='_' && ((physname[0] == '_' && physname[1] == '_'
(isdigit(physname[2]) && strchr ("0123456789Qt", physname[2]))
|| physname[2]=='Q' || STREQN (physname, "__ct__", 6)
|| physname[2]=='t')) || DESTRUCTOR_PREFIX_P (physname)
|| (strncmp(physname, "__ct__", 6) == 0)); || STREQN (physname, "__dt__", 6));
QUIT; QUIT;
if (TYPE_FN_FIELD_PROTECTED (f, j)) if (TYPE_FN_FIELD_PROTECTED (f, j))
@ -699,7 +663,7 @@ c_type_print_base (type, stream, show, level)
if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0) if (TYPE_TARGET_TYPE (TYPE_FN_FIELD_TYPE (f, j)) == 0)
{ {
/* Keep GDB from crashing here. */ /* Keep GDB from crashing here. */
fprintf_unfiltered (stream, "<undefined type> %s;\n", fprintf_filtered (stream, "<undefined type> %s;\n",
TYPE_FN_FIELD_PHYSNAME (f, j)); TYPE_FN_FIELD_PHYSNAME (f, j));
break; break;
} }
@ -710,41 +674,35 @@ c_type_print_base (type, stream, show, level)
fputs_filtered (" ", stream); fputs_filtered (" ", stream);
} }
if (TYPE_FN_FIELD_STUB (f, j)) if (TYPE_FN_FIELD_STUB (f, j))
/* Build something we can demangle. */
mangled_name = gdb_mangle_name (type, i, j);
else
mangled_name = TYPE_FN_FIELD_PHYSNAME (f, j);
demangled_name =
cplus_demangle (mangled_name,
DMGL_ANSI | DMGL_PARAMS);
if (demangled_name == NULL)
fprintf_filtered (stream, "<badly mangled name '%s'>",
mangled_name);
else
{ {
/* Build something we can demangle. */ char *demangled_no_class =
mangled_name = gdb_mangle_name (type, i, j); strchr (demangled_name, ':');
demangled_name =
cplus_demangle (mangled_name, if (demangled_no_class == NULL)
DMGL_ANSI | DMGL_PARAMS); demangled_no_class = demangled_name;
if (demangled_name == NULL)
fprintf_filtered (stream, "<badly mangled name %s>",
mangled_name);
else else
{ {
char *demangled_no_class = if (*++demangled_no_class == ':')
strchr (demangled_name, ':'); ++demangled_no_class;
if (demangled_no_class == NULL)
demangled_no_class = demangled_name;
else
{
if (*++demangled_no_class == ':')
++demangled_no_class;
}
fputs_filtered (demangled_no_class, stream);
free (demangled_name);
} }
free (mangled_name); fputs_filtered (demangled_no_class, stream);
free (demangled_name);
} }
else if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_'
&& is_cplus_marker (TYPE_FN_FIELD_PHYSNAME (f, j)[1])) if (TYPE_FN_FIELD_STUB (f, j))
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j) + 1, free (mangled_name);
"~", method_name, 0, stream);
else
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j), "",
method_name,
TYPE_FN_FIELD_STATIC_P (f, j),
stream);
fprintf_filtered (stream, ";\n"); fprintf_filtered (stream, ";\n");
} }

View file

@ -87,6 +87,8 @@ cp_print_class_method (valaddr, type, stream)
QUIT; QUIT;
if (TYPE_FN_FIELD_VOFFSET (f, j) == offset) if (TYPE_FN_FIELD_VOFFSET (f, j) == offset)
{ {
if (TYPE_FN_FIELD_STUB (f, j))
check_stub_method (domain, i, j);
kind = "virtual "; kind = "virtual ";
goto common; goto common;
} }
@ -121,21 +123,19 @@ cp_print_class_method (valaddr, type, stream)
common: common:
if (i < len) if (i < len)
{ {
char *demangled_name;
fprintf_filtered (stream, "&"); fprintf_filtered (stream, "&");
c_type_print_varspec_prefix (TYPE_FN_FIELD_TYPE (f, j), stream, 0, 0); fprintf_filtered (stream, kind);
fprintf_unfiltered (stream, kind); demangled_name = cplus_demangle (TYPE_FN_FIELD_PHYSNAME (f, j),
if (TYPE_FN_FIELD_PHYSNAME (f, j)[0] == '_' DMGL_ANSI | DMGL_PARAMS);
&& is_cplus_marker (TYPE_FN_FIELD_PHYSNAME (f, j)[1])) if (demangled_name == NULL)
{ fprintf_filtered (stream, "<badly mangled name %s>",
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j) + 1, "~", TYPE_FN_FIELD_PHYSNAME (f, j));
TYPE_FN_FIELDLIST_NAME (domain, i),
0, stream);
}
else else
{ {
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (f, j), "", fputs_filtered (demangled_name, stream);
TYPE_FN_FIELDLIST_NAME (domain, i), free (demangled_name);
0, stream);
} }
} }
else else

View file

@ -1,5 +1,5 @@
/* Support routines for manipulating internal types for GDB. /* Support routines for manipulating internal types for GDB.
Copyright (C) 1992, 1993, 1994, 1995 Free Software Foundation, Inc. Copyright (C) 1992, 1993, 1994, 1995, 1996 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules. Contributed by Cygnus Support, using pieces from other GDB modules.
This file is part of GDB. This file is part of GDB.
@ -879,6 +879,35 @@ fill_in_vptr_fieldno (type)
} }
} }
/* Find the method and field indices for the destructor in class type T.
Return 1 if the destructor was found, otherwise, return 0. */
int
get_destructor_fn_field (t, method_indexp, field_indexp)
struct type *t;
int *method_indexp;
int *field_indexp;
{
int i;
for (i = 0; i < TYPE_NFN_FIELDS (t); i++)
{
int j;
struct fn_field *f = TYPE_FN_FIELDLIST1 (t, i);
for (j = 0; j < TYPE_FN_FIELDLIST_LENGTH (t, i); j++)
{
if (DESTRUCTOR_PREFIX_P (TYPE_FN_FIELD_PHYSNAME (f, j)))
{
*method_indexp = i;
*field_indexp = j;
return 1;
}
}
}
return 0;
}
/* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989. /* Added by Bryan Boreham, Kewill, Sun Sep 17 18:07:17 1989.
If this is a stubbed struct (i.e. declared as struct foo *), see if If this is a stubbed struct (i.e. declared as struct foo *), see if

View file

@ -1,5 +1,5 @@
/* Internal type definitions for GDB. /* Internal type definitions for GDB.
Copyright (C) 1992, 1993, 1994 Free Software Foundation, Inc. Copyright (C) 1992, 1993, 1994, 1996 Free Software Foundation, Inc.
Contributed by Cygnus Support, using pieces from other GDB modules. Contributed by Cygnus Support, using pieces from other GDB modules.
This file is part of GDB. This file is part of GDB.
@ -303,11 +303,14 @@ struct type
} *fields; } *fields;
/* For types with virtual functions, VPTR_BASETYPE is the base class which /* For types with virtual functions (TYPE_CODE_STRUCT), VPTR_BASETYPE
defined the virtual function table pointer. is the base class which defined the virtual function table pointer.
For types that are pointer to member types, VPTR_BASETYPE For types that are pointer to member types (TYPE_CODE_MEMBER),
is the type that this pointer is a member of. VPTR_BASETYPE is the type that this pointer is a member of.
For method types (TYPE_CODE_METHOD), VPTR_BASETYPE is the aggregate
type that contains the method.
Unused otherwise. */ Unused otherwise. */
@ -327,7 +330,11 @@ struct type
union type_specific union type_specific
{ {
/* ARG_TYPES is for TYPE_CODE_METHOD and TYPE_CODE_FUNC. */ /* ARG_TYPES is for TYPE_CODE_METHOD.
Contains the type of each argument, ending with a void type
after the last argument for normal member functions or a NULL
pointer after the last argument for functions with variable
arguments. */
struct type **arg_types; struct type **arg_types;
@ -433,17 +440,10 @@ struct cplus_struct_type
char *physname; char *physname;
/* The return value of the method */ /* The type of the method. */
struct type *type; struct type *type;
/* The argument list. Only valid if is_stub is clear. Contains
the type of each argument, including `this', and ending with
a NULL pointer after the last argument. Should not contain
a `this' pointer for static member functions. */
struct type **args;
/* For virtual functions. /* For virtual functions.
First baseclass that defines this virtual function. */ First baseclass that defines this virtual function. */
@ -775,6 +775,8 @@ lookup_fundamental_type PARAMS ((struct objfile *, int));
extern void extern void
fill_in_vptr_fieldno PARAMS ((struct type *)); fill_in_vptr_fieldno PARAMS ((struct type *));
extern int get_destructor_fn_field PARAMS ((struct type *, int *, int *));
extern int get_discrete_bounds PARAMS ((struct type*, LONGEST*, LONGEST*)); extern int get_discrete_bounds PARAMS ((struct type*, LONGEST*, LONGEST*));
#if MAINTENANCE_CMDS #if MAINTENANCE_CMDS

View file

@ -1,5 +1,5 @@
/* Symbol table lookup for the GNU debugger, GDB. /* Symbol table lookup for the GNU debugger, GDB.
Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995 Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -77,7 +77,7 @@ list_symbols PARAMS ((char *, int, int, int));
static void static void
output_source_filename PARAMS ((char *, int *)); output_source_filename PARAMS ((char *, int *));
static char * char *
operator_chars PARAMS ((char *, char **)); operator_chars PARAMS ((char *, char **));
static int find_line_common PARAMS ((struct linetable *, int, int *)); static int find_line_common PARAMS ((struct linetable *, int, int *));
@ -1551,7 +1551,7 @@ find_function_start_sal (sym, funfirstline)
some legitimate operator text, return a pointer to the some legitimate operator text, return a pointer to the
beginning of the substring of the operator text. beginning of the substring of the operator text.
Otherwise, return "". */ Otherwise, return "". */
static char * char *
operator_chars (p, end) operator_chars (p, end)
char *p; char *p;
char **end; char **end;
@ -1717,19 +1717,12 @@ find_methods (t, name, sym_arr)
if (DESTRUCTOR_PREFIX_P (phys_name)) if (DESTRUCTOR_PREFIX_P (phys_name))
continue; continue;
/* FIXME: Why are we looking this up in the
SYMBOL_BLOCK_VALUE (sym_class)? It is intended as a hook
for nested types? If so, it should probably hook to the
type, not the symbol. mipsread.c is the only symbol
reader which sets the SYMBOL_BLOCK_VALUE for types, and
this is not documented in symtab.h. -26Aug93. */
sym_arr[i1] = lookup_symbol (phys_name, sym_arr[i1] = lookup_symbol (phys_name,
SYMBOL_BLOCK_VALUE (sym_class), NULL, VAR_NAMESPACE,
VAR_NAMESPACE,
(int *) NULL, (int *) NULL,
(struct symtab **) NULL); (struct symtab **) NULL);
if (sym_arr[i1]) i1++; if (sym_arr[i1])
i1++;
else else
{ {
fputs_filtered("(Cannot find method ", gdb_stdout); fputs_filtered("(Cannot find method ", gdb_stdout);
@ -2029,25 +2022,22 @@ decode_line_1 (argptr, funfirstline, default_symtab, default_line, canonical)
sym_arr = (struct symbol **) alloca(total_number_of_methods (t) sym_arr = (struct symbol **) alloca(total_number_of_methods (t)
* sizeof(struct symbol *)); * sizeof(struct symbol *));
/* Cfront objects don't have fieldlists. */ if (destructor_name_p (copy, t))
if (destructor_name_p (copy, t) && TYPE_FN_FIELDLISTS (t) != NULL)
{ {
/* destructors are a special case. */ /* Destructors are a special case. */
struct fn_field *f = TYPE_FN_FIELDLIST1 (t, 0); int m_index, f_index;
int len = TYPE_FN_FIELDLIST_LENGTH (t, 0) - 1;
/* gcc 1.x puts destructor in last field, if (get_destructor_fn_field (t, &m_index, &f_index))
gcc 2.x puts destructor in first field. */
char *phys_name = TYPE_FN_FIELD_PHYSNAME (f, len);
if (!DESTRUCTOR_PREFIX_P (phys_name))
{ {
phys_name = TYPE_FN_FIELD_PHYSNAME (f, 0); struct fn_field *f = TYPE_FN_FIELDLIST1 (t, m_index);
if (!DESTRUCTOR_PREFIX_P (phys_name))
phys_name = ""; sym_arr[i1] =
lookup_symbol (TYPE_FN_FIELD_PHYSNAME (f, f_index),
NULL, VAR_NAMESPACE, (int *) NULL,
(struct symtab **)NULL);
if (sym_arr[i1])
i1++;
} }
sym_arr[i1] =
lookup_symbol (phys_name, SYMBOL_BLOCK_VALUE (sym_class),
VAR_NAMESPACE, 0, (struct symtab **)NULL);
if (sym_arr[i1]) i1++;
} }
else else
i1 = find_methods (t, copy, sym_arr); i1 = find_methods (t, copy, sym_arr);
@ -2848,15 +2838,26 @@ list_symbols (regexp, class, bpt, from_tty)
} }
else else
{ {
# if 0 /* FIXME, why is this zapped out? */ # if 0
char buf[1024]; /* Tiemann says: "info methods was never implemented." */
char *demangled_name;
c_type_print_base (TYPE_FN_FIELD_TYPE(t, i), c_type_print_base (TYPE_FN_FIELD_TYPE(t, i),
gdb_stdout, 0, 0); gdb_stdout, 0, 0);
c_type_print_varspec_prefix (TYPE_FN_FIELD_TYPE(t, i), c_type_print_varspec_prefix (TYPE_FN_FIELD_TYPE(t, i),
gdb_stdout, 0); gdb_stdout, 0);
sprintf (buf, " %s::", type_name_no_tag (t)); if (TYPE_FN_FIELD_STUB (t, i))
cp_type_print_method_args (TYPE_FN_FIELD_ARGS (t, i), check_stub_method (TYPE_DOMAIN_TYPE (type), j, i);
buf, name, gdb_stdout); demangled_name =
cplus_demangle (TYPE_FN_FIELD_PHYSNAME (t, i),
DMGL_ANSI | DMGL_PARAMS);
if (demangled_name == NULL)
fprintf_filtered (stream, "<badly mangled name %s>",
TYPE_FN_FIELD_PHYSNAME (t, i));
else
{
fputs_filtered (demangled_name, stream);
free (demangled_name);
}
# endif # endif
} }
} }

View file

@ -1,5 +1,5 @@
/* Perform non-arithmetic operations on values, for GDB. /* Perform non-arithmetic operations on values, for GDB.
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995 Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996
Free Software Foundation, Inc. Free Software Foundation, Inc.
This file is part of GDB. This file is part of GDB.
@ -1648,7 +1648,7 @@ search_struct_field (name, arg1, offset, type, looking_for_baseclass)
error ("Internal error: could not find physical static variable named %s", error ("Internal error: could not find physical static variable named %s",
phys_name); phys_name);
v = value_at (TYPE_FIELD_TYPE (type, i), v = value_at (TYPE_FIELD_TYPE (type, i),
(CORE_ADDR)SYMBOL_BLOCK_VALUE (sym)); SYMBOL_VALUE_ADDRESS (sym));
} }
else else
v = value_primitive_field (arg1, offset, i, type); v = value_primitive_field (arg1, offset, i, type);
@ -1922,11 +1922,19 @@ value_struct_elt (argp, args, name, static_memfuncp, err)
{ {
if (!args[1]) if (!args[1])
{ {
/* destructors are a special case. */ /* Destructors are a special case. */
v = value_fn_field (NULL, TYPE_FN_FIELDLIST1 (t, 0), int m_index, f_index;
TYPE_FN_FIELDLIST_LENGTH (t, 0), 0, 0);
if (!v) error("could not find destructor function named %s.", name); v = NULL;
else return v; if (get_destructor_fn_field (t, &m_index, &f_index))
{
v = value_fn_field (NULL, TYPE_FN_FIELDLIST1 (t, m_index),
f_index, NULL, 0);
}
if (v == NULL)
error ("could not find destructor function named %s.", name);
else
return v;
} }
else else
{ {
@ -2005,7 +2013,11 @@ check_field_in (type, name)
/* Destructors are a special case. */ /* Destructors are a special case. */
if (destructor_name_p (name, type)) if (destructor_name_p (name, type))
return 1; {
int m_index, f_index;
return get_destructor_fn_field (type, &m_index, &f_index);
}
for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i) for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; --i)
{ {
@ -2092,7 +2104,7 @@ value_struct_elt_for_reference (domain, offset, curtype, name, intype)
error ("Internal error: could not find physical static variable named %s", error ("Internal error: could not find physical static variable named %s",
phys_name); phys_name);
return value_at (SYMBOL_TYPE (sym), return value_at (SYMBOL_TYPE (sym),
(CORE_ADDR)SYMBOL_BLOCK_VALUE (sym)); SYMBOL_VALUE_ADDRESS (sym));
} }
if (TYPE_FIELD_PACKED (t, i)) if (TYPE_FIELD_PACKED (t, i))
error ("pointers to bitfield members not allowed"); error ("pointers to bitfield members not allowed");