aboutsummaryrefslogtreecommitdiff
path: root/gdb/valops.c
diff options
context:
space:
mode:
authorVladimir Prus <vladimir@codesourcery.com>2008-04-06 08:56:37 +0000
committerVladimir Prus <vladimir@codesourcery.com>2008-04-06 08:56:37 +0000
commit2b2d9e11a0bd5355936c876a8d14a06d78d4b39e (patch)
tree96d07737397754779f0b1b68d79a1f6efc8fc08a /gdb/valops.c
parent2344873715652bf0296adce9f7f686e914fdd36e (diff)
downloadgdb-2b2d9e11a0bd5355936c876a8d14a06d78d4b39e.zip
gdb-2b2d9e11a0bd5355936c876a8d14a06d78d4b39e.tar.gz
gdb-2b2d9e11a0bd5355936c876a8d14a06d78d4b39e.tar.bz2
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.c49
1 files changed, 7 insertions, 42 deletions
diff --git a/gdb/valops.c b/gdb/valops.c
index 882e3a5..b11a088 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