diff options
author | Vladimir Prus <vladimir@codesourcery.com> | 2008-04-06 08:56:37 +0000 |
---|---|---|
committer | Vladimir Prus <vladimir@codesourcery.com> | 2008-04-06 08:56:37 +0000 |
commit | a4c4910bfa928b322e14ec4b1d924692034dd75f (patch) | |
tree | d4f7e670adbd262bfd27b392f994c66ff0f24c4a /gdb/valops.c | |
parent | 8eb923c04760e86425b2dd86f6fd1c23b9404522 (diff) | |
download | gdb-a4c4910bfa928b322e14ec4b1d924692034dd75f.tar.gz |
Fix breakpoint condition that use member variables.
* valops.c (check_field): Remove.
(check_field_in): Rename to check_field.
(value_of_this): Use la_name_of_this.
* value.h (check_field): Adjust prototype.
* language.h (la_value_of_this): Rename to la_name_of_this.
* language.c (unknown_language_defn): Specify "this" for
name_of_this.
(auto_language_defn): Likewise.
(local_language_defn): Likewise.
* ada-lang.c (ada_language_defn): Adjust comment.
* c-lang.c (c_language_defn): Adjust comment.
(cplus_language_defn): Specify "this" for name_of_this.
(asm_language_defn): Adjust comment.
(minimal_language_defn): Adjust comment.
* f-lang.c (f_language_defn): Specify NULL for name_of_this.
* jv-lang.c (java_language_defn): Specify "this" for name_of_this.
* m2-lang.c (m2_language_defn): Specify "this" for name_of_this.
* objc-lang.c (objc_language_defn): Specify "self" for
name_of_this.
* p-lang.c (pascal_language_defn): Specify "this" for
name_of_this.
* scm-lang.c (scm_language_defn): Specify NULL for name_of_this.
* symtab.c (lookup_symbol_aux): Lookup "this" in the
proper scope, and check for field in type of "this", without
trying to create a value.
Diffstat (limited to 'gdb/valops.c')
-rw-r--r-- | gdb/valops.c | 49 |
1 files changed, 7 insertions, 42 deletions
diff --git a/gdb/valops.c b/gdb/valops.c index 882e3a5f6b8..b11a088bbcc 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -80,8 +80,6 @@ static enum oload_classification classify_oload_match (struct badness_vector *, int, int); -static int check_field_in (struct type *, const char *); - static struct value *value_struct_elt_for_reference (struct type *, int, struct type *, char *, @@ -2338,12 +2336,12 @@ destructor_name_p (const char *name, const struct type *type) return 0; } -/* Helper function for check_field: Given TYPE, a structure/union, +/* Given TYPE, a structure/union, return 1 if the component named NAME from the ultimate target structure/union is defined, otherwise, return 0. */ -static int -check_field_in (struct type *type, const char *name) +int +check_field (struct type *type, const char *name) { int i; @@ -2372,44 +2370,12 @@ check_field_in (struct type *type, const char *name) } for (i = TYPE_N_BASECLASSES (type) - 1; i >= 0; i--) - if (check_field_in (TYPE_BASECLASS (type, i), name)) + if (check_field (TYPE_BASECLASS (type, i), name)) return 1; return 0; } - -/* C++: Given ARG1, a value of type (pointer to a)* structure/union, - return 1 if the component named NAME from the ultimate target - structure/union is defined, otherwise, return 0. */ - -int -check_field (struct value *arg1, const char *name) -{ - struct type *t; - - arg1 = coerce_array (arg1); - - t = value_type (arg1); - - /* Follow pointers until we get to a non-pointer. */ - - for (;;) - { - CHECK_TYPEDEF (t); - if (TYPE_CODE (t) != TYPE_CODE_PTR - && TYPE_CODE (t) != TYPE_CODE_REF) - break; - t = TYPE_TARGET_TYPE (t); - } - - if (TYPE_CODE (t) != TYPE_CODE_STRUCT - && TYPE_CODE (t) != TYPE_CODE_UNION) - error (_("Internal error: `this' is not an aggregate")); - - return check_field_in (t, name); -} - /* C++: Given an aggregate type CURTYPE, and a member name NAME, return the appropriate member (or the address of the member, if WANT_ADDRESS). This function is used to resolve user expressions @@ -2815,10 +2781,9 @@ value_of_local (const char *name, int complain) 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); + if (!current_language->la_name_of_this) + return 0; + return value_of_local (current_language->la_name_of_this, complain); } /* Create a slice (sub-string, sub-array) of ARRAY, that is LENGTH |