aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKeith Seitz <keiths@redhat.com>2009-11-11 23:34:11 +0000
committerKeith Seitz <keiths@redhat.com>2009-11-11 23:34:11 +0000
commit1e5a1abc158e35ce44f0e3b1eb1319569c0520f3 (patch)
treefedb2405c5cd3f4bd3c7d3d4406b0f8e3e00436d
parent40f0318e99b714619c029e788c8de3af1c286e14 (diff)
downloadgdb-1e5a1abc158e35ce44f0e3b1eb1319569c0520f3.zip
gdb-1e5a1abc158e35ce44f0e3b1eb1319569c0520f3.tar.gz
gdb-1e5a1abc158e35ce44f0e3b1eb1319569c0520f3.tar.bz2
* linespec.c (lookup_prefix_sym): Lookup the symbol
in both STRUCT_DOMAIN and VAR_DOMAIN.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/linespec.c22
2 files changed, 26 insertions, 1 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 42715c2..b840509 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2009-11-11 Keith Seitz <keiths@redhat.com>
+
+ * linespec.c (lookup_prefix_sym): Lookup the symbol
+ in both STRUCT_DOMAIN and VAR_DOMAIN.
+
2009-11-11 Michael Snyder <msnyder@vmware.com>
* darwin-nat-info.c: Update copyright.
diff --git a/gdb/linespec.c b/gdb/linespec.c
index 1be2686..80aa3e1 100644
--- a/gdb/linespec.c
+++ b/gdb/linespec.c
@@ -1428,6 +1428,7 @@ lookup_prefix_sym (char **argptr, char *p)
{
char *p1;
char *copy;
+ struct symbol *sym;
/* Extract the class name. */
p1 = p;
@@ -1446,7 +1447,26 @@ lookup_prefix_sym (char **argptr, char *p)
/* At this point p1->"::inA::fun", p->"inA::fun" copy->"AAA",
argptr->"inA::fun" */
- return lookup_symbol (copy, 0, STRUCT_DOMAIN, 0);
+ sym = lookup_symbol (copy, 0, STRUCT_DOMAIN, 0);
+ if (sym == NULL)
+ {
+ /* Typedefs are in VAR_DOMAIN so the above symbol lookup will
+ fail when the user attempts to lookup a method of a class
+ via a typedef'd name (NOT via the class's name, which is already
+ handled in symbol_matches_domain). So try the lookup again
+ using VAR_DOMAIN (where typedefs live) and double-check that we
+ found a struct/class type. */
+ struct symbol *s = lookup_symbol (copy, 0, VAR_DOMAIN, 0);
+ if (s != NULL)
+ {
+ struct type *t = SYMBOL_TYPE (s);
+ CHECK_TYPEDEF (t);
+ if (TYPE_CODE (t) == TYPE_CODE_STRUCT)
+ return s;
+ }
+ }
+
+ return sym;
}
/* This finds the method COPY in the class whose type is T and whose