aboutsummaryrefslogtreecommitdiff
path: root/gdb/values.c
diff options
context:
space:
mode:
authorPer Bothner <per@bothner.com>1992-03-19 00:05:35 +0000
committerPer Bothner <per@bothner.com>1992-03-19 00:05:35 +0000
commit2cd999854048fb4e3cd5c8762f40427221eb4112 (patch)
treeb8aaa853ebd7808b9d39ae4a06dcd4d37c18ae5d /gdb/values.c
parentc976b3499ce3335b2e49a71d5a478035bbe507bd (diff)
downloadgdb-2cd999854048fb4e3cd5c8762f40427221eb4112.zip
gdb-2cd999854048fb4e3cd5c8762f40427221eb4112.tar.gz
gdb-2cd999854048fb4e3cd5c8762f40427221eb4112.tar.bz2
Some improvements to g++ debugging.
* symtab.c (list_symbols): demangle before pattern matching. * symtab.c: Other fixes to improve handing of operators. * valprint.c (type_print_base): Fix test for constructor. * values.c (value_static_field): Allow evaluation of CLASS::METHOD, returning a function pointer.
Diffstat (limited to 'gdb/values.c')
-rw-r--r--gdb/values.c29
1 files changed, 20 insertions, 9 deletions
diff --git a/gdb/values.c b/gdb/values.c
index 34875ca..bb5fa68 100644
--- a/gdb/values.c
+++ b/gdb/values.c
@@ -1124,6 +1124,8 @@ value_static_field (type, fieldname, fieldno)
if (fieldno < 0)
{
+ char **physnames;
+ struct symbol **sym_arr;
/* Look for static field. */
int i;
for (i = TYPE_NFIELDS (type) - 1; i >= TYPE_N_BASECLASSES (type); i--)
@@ -1144,14 +1146,24 @@ value_static_field (type, fieldname, fieldno)
return v;
}
- if (destructor_name_p (fieldname, type))
- error ("Cannot get value of destructor");
-
- for (i = TYPE_NFN_FIELDS (type) - 1; i >= 0; i--)
+ sym_arr = (struct symbol **)
+ alloca(TYPE_NFN_FIELDS_TOTAL (type) * sizeof(struct symbol*));
+ physnames = (char **)
+ alloca (TYPE_NFN_FIELDS_TOTAL (type) * sizeof(char*));
+ /* Note: This does duplicate work, since find_methods does a
+ recursive search *and* so does value_static_field. FIXME */
+ i = find_methods (type, fieldname, physnames, sym_arr);
+ if (i > 1)
+ error ("Cannot get value of overloaded method \"%s\"", fieldname);
+ else if (i)
{
- if (! strcmp (TYPE_FN_FIELDLIST_NAME (type, i), fieldname))
- error ("Cannot get value of method \"%s\"", fieldname);
- }
+ struct symbol *sym = sym_arr[0];
+ value val = read_var_value (sym, (FRAME) 0);
+ if (val == 0)
+ error ("Address of method \"%s\" is unknown (possibly inlined).",
+ fieldname);
+ return val;
+ }
error("there is no field named %s", fieldname);
}
@@ -1161,8 +1173,7 @@ value_static_field (type, fieldname, fieldno)
if (! sym) error ("Internal error: could not find physical static variable named %s", phys_name);
type = TYPE_FIELD_TYPE (type, fieldno);
- v = value_at (type, (CORE_ADDR)SYMBOL_BLOCK_VALUE (sym));
- return v;
+ return value_at (type, (CORE_ADDR)SYMBOL_BLOCK_VALUE (sym));
}
/* Compute the address of the baseclass which is