summaryrefslogtreecommitdiff
path: root/gdb/symtab.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
commita4c4910bfa928b322e14ec4b1d924692034dd75f (patch)
treed4f7e670adbd262bfd27b392f994c66ff0f24c4a /gdb/symtab.c
parent8eb923c04760e86425b2dd86f6fd1c23b9404522 (diff)
downloadgdb-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/symtab.c')
-rw-r--r--gdb/symtab.c42
1 files changed, 33 insertions, 9 deletions
diff --git a/gdb/symtab.c b/gdb/symtab.c
index aa401ad034e..6422db43ee9 100644
--- a/gdb/symtab.c
+++ b/gdb/symtab.c
@@ -1222,17 +1222,41 @@ lookup_symbol_aux (const char *name, const char *linkage_name,
langdef = language_def (language);
- if (langdef->la_value_of_this != NULL
- && is_a_field_of_this != NULL)
+ if (langdef->la_name_of_this != NULL && is_a_field_of_this != NULL
+ && block != NULL)
{
- struct value *v = langdef->la_value_of_this (0);
-
- if (v && check_field (v, name))
+ struct symbol *sym = NULL;
+ /* 'this' is only defined in the function's block, so find the
+ enclosing function block. */
+ for (; block && !BLOCK_FUNCTION (block);
+ block = BLOCK_SUPERBLOCK (block));
+
+ if (block && !dict_empty (BLOCK_DICT (block)))
+ sym = lookup_block_symbol (block, langdef->la_name_of_this,
+ NULL, VAR_DOMAIN);
+ if (sym)
{
- *is_a_field_of_this = 1;
- if (symtab != NULL)
- *symtab = NULL;
- return NULL;
+ struct type *t = sym->type;
+
+ /* I'm not really sure that type of this can ever
+ be typedefed; just be safe. */
+ CHECK_TYPEDEF (t);
+ if (TYPE_CODE (t) == TYPE_CODE_PTR
+ || TYPE_CODE (t) == TYPE_CODE_REF)
+ t = TYPE_TARGET_TYPE (t);
+
+ if (TYPE_CODE (t) != TYPE_CODE_STRUCT
+ && TYPE_CODE (t) != TYPE_CODE_UNION)
+ error (_("Internal error: `%s' is not an aggregate"),
+ langdef->la_name_of_this);
+
+ if (check_field (t, name))
+ {
+ *is_a_field_of_this = 1;
+ if (symtab != NULL)
+ *symtab = NULL;
+ return NULL;
+ }
}
}