diff options
author | David Carlton <carlton@bactrian.org> | 2002-10-25 23:50:01 +0000 |
---|---|---|
committer | David Carlton <carlton@bactrian.org> | 2002-10-25 23:50:01 +0000 |
commit | 43cbe67fd8e6426975833937615c19910376cf3f (patch) | |
tree | efa9f55148ce89881899ca4d5e51dc6eda3ade28 /gdb/valops.c | |
parent | 449bdf205b34287c861493260e1ba3d94d1162f1 (diff) | |
download | gdb-43cbe67fd8e6426975833937615c19910376cf3f.tar.gz |
2002-10-25 David Carlton <carlton@math.stanford.edu>
* symtab.c (lookup_symbol_aux_block): New function.
(lookup_symbol_aux_local): Call lookup_symbol_aux_block.
(lookup_symbol_aux): Ditto.
* Merge from mainline; tag is carlton_dictionary-20021025-merge.
2002-10-25 David Carlton <carlton@math.stanford.edu>
* cp-support.c: Add comment to demangled name pitfalls.
* symtab.c (lookup_transparent_type): Add FIXME comment at
beginning.
2002-10-23 David Carlton <carlton@math.stanford.edu>
* symtab.c: Delete cplusplus_hint.
Delete prototype for find_template_name_end.
* dwarf2read.c (scan_partial_symbols): Add in a gdb_assert from a
later version of my namespace_minimal patch.
2002-10-25 David Carlton <carlton@math.stanford.edu>
* gdb.c++/namespace.exp: Change all of the setup_xfail tests that
I added into setup_kfails.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 36 |
1 files changed, 24 insertions, 12 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index 2c051bed3cd..91b97b4a237 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -3308,18 +3308,17 @@ value_full_object (struct value *argp, struct type *rtype, int xfull, int xtop, -/* C++: return the value of the class instance variable, if one exists. +/* Return the value of the local variable, if one exists. Flag COMPLAIN signals an error if the request is made in an inappropriate context. */ struct value * -value_of_this (int complain) +value_of_local (const char *name, int complain) { struct symbol *func, *sym; struct block *b; int i; - static const char funny_this[] = "this"; - struct value *this; + struct value * ret; if (selected_frame == 0) { @@ -3333,7 +3332,7 @@ value_of_this (int complain) if (!func) { if (complain) - error ("no `this' in nameless context"); + error ("no `%s' in nameless context", name); else return 0; } @@ -3342,26 +3341,39 @@ value_of_this (int complain) if (dict_empty (BLOCK_DICT (b))) { if (complain) - error ("no args, no `this'"); + error ("no args, no `%s'", name); else return 0; } /* Calling lookup_block_symbol is necessary to get the LOC_REGISTER symbol instead of the LOC_ARG one (if both exist). */ - sym = lookup_block_symbol (b, funny_this, NULL, VAR_NAMESPACE); + sym = lookup_block_symbol (b, name, NULL, VAR_NAMESPACE); if (sym == NULL) { if (complain) - error ("current stack frame not in method"); + error ("current stack frame does not contain a variable named `%s'", name); else return NULL; } - this = read_var_value (sym, selected_frame); - if (this == 0 && complain) - error ("`this' argument at unknown address"); - return this; + ret = read_var_value (sym, selected_frame); + if (ret == 0 && complain) + error ("`%s' argument unreadable", name); + return ret; +} + +/* C++/Objective-C: return the value of the class instance variable, + if one exists. Flag COMPLAIN signals an error if the request is + made in an inappropriate context. */ + +struct value * +value_of_this (int complain) +{ + if (current_language->la_language == language_objc) + return value_of_local ("self", complain); + else + return value_of_local ("this", complain); } /* Create a slice (sub-string, sub-array) of ARRAY, that is LENGTH elements |