2002-08-19 David Carlton <carlton@math.stanford.edu>
* valops.c (search_struct_field): Change error message to treat return value of 0 from value_static_field as meaning that field is optimized out. (value_struct_elt_for_reference): Ditto. * values.c (value_static_field): Treat an unresolved location the same as a nonexistent symbol. Fix PR gdb/635.
This commit is contained in:
parent
2a73a662d6
commit
2c2738a0e0
3 changed files with 29 additions and 7 deletions
|
@ -1,5 +1,11 @@
|
|||
2002-08-19 David Carlton <carlton@math.stanford.edu>
|
||||
|
||||
* valops.c (search_struct_field): Change error message to treat
|
||||
return value of 0 from value_static_field as meaning that field is
|
||||
optimized out.
|
||||
(value_struct_elt_for_reference): Ditto.
|
||||
* values.c (value_static_field): Treat an unresolved location the
|
||||
same as a nonexistent symbol. Fix PR gdb/635.
|
||||
* gnu-v2-abi.c (gnuv2_value_rtti_type): Eliminate test for being
|
||||
enclosed. Fix PR gdb/574.
|
||||
* MAINTAINERS: Add self to Write After Approval list.
|
||||
|
|
17
gdb/valops.c
17
gdb/valops.c
|
@ -2054,11 +2054,18 @@ search_struct_field (char *name, struct value *arg1, int offset,
|
|||
{
|
||||
struct value *v;
|
||||
if (TYPE_FIELD_STATIC (type, i))
|
||||
v = value_static_field (type, i);
|
||||
{
|
||||
v = value_static_field (type, i);
|
||||
if (v == 0)
|
||||
error ("field %s is nonexistent or has been optimised out",
|
||||
name);
|
||||
}
|
||||
else
|
||||
v = value_primitive_field (arg1, offset, i, type);
|
||||
if (v == 0)
|
||||
error ("there is no field named %s", name);
|
||||
{
|
||||
v = value_primitive_field (arg1, offset, i, type);
|
||||
if (v == 0)
|
||||
error ("there is no field named %s", name);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -3043,7 +3050,7 @@ value_struct_elt_for_reference (struct type *domain, int offset,
|
|||
{
|
||||
v = value_static_field (t, i);
|
||||
if (v == NULL)
|
||||
error ("Internal error: could not find static variable %s",
|
||||
error ("static field %s has been optimized out",
|
||||
name);
|
||||
return v;
|
||||
}
|
||||
|
|
13
gdb/values.c
13
gdb/values.c
|
@ -793,7 +793,9 @@ unpack_pointer (struct type *type, char *valaddr)
|
|||
}
|
||||
|
||||
|
||||
/* Get the value of the FIELDN'th field (which must be static) of TYPE. */
|
||||
/* Get the value of the FIELDN'th field (which must be static) of
|
||||
TYPE. Return NULL if the field doesn't exist or has been
|
||||
optimized out. */
|
||||
|
||||
struct value *
|
||||
value_static_field (struct type *type, int fieldno)
|
||||
|
@ -809,7 +811,14 @@ value_static_field (struct type *type, int fieldno)
|
|||
{
|
||||
char *phys_name = TYPE_FIELD_STATIC_PHYSNAME (type, fieldno);
|
||||
struct symbol *sym = lookup_symbol (phys_name, 0, VAR_NAMESPACE, 0, NULL);
|
||||
if (sym == NULL)
|
||||
/* In some cases (involving uninitalized, unreferenced static
|
||||
const integral members), g++ -gdwarf-2 can emit debugging
|
||||
information giving rise to symbols whose SYMBOL_CLASS is
|
||||
LOC_UNRESOLVED. In that case, do a minimal symbol lookup.
|
||||
If it returns a useful value, then the symbol was defined
|
||||
elsewhere, so we use that information. Otherwise, return
|
||||
NULL. */
|
||||
if (sym == NULL || SYMBOL_CLASS (sym) == LOC_UNRESOLVED)
|
||||
{
|
||||
/* With some compilers, e.g. HP aCC, static data members are reported
|
||||
as non-debuggable symbols */
|
||||
|
|
Loading…
Reference in a new issue