Index: linespec.c =================================================================== RCS file: /cvs/src/src/gdb/linespec.c,v retrieving revision 1.92 diff -u -p -r1.92 linespec.c --- linespec.c 19 Oct 2009 09:51:41 -0000 1.92 +++ linespec.c 11 Nov 2009 22:37:47 -0000 @@ -1428,6 +1428,7 @@ lookup_prefix_sym (char **argptr, char * { char *p1; char *copy; + struct symbol *sym; /* Extract the class name. */ p1 = p; @@ -1446,7 +1447,26 @@ lookup_prefix_sym (char **argptr, char * /* 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 Index: testsuite/gdb.cp/classes.cc =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/classes.cc,v retrieving revision 1.7 diff -u -p -r1.7 classes.cc --- testsuite/gdb.cp/classes.cc 21 Sep 2009 19:23:22 -0000 1.7 +++ testsuite/gdb.cp/classes.cc 11 Nov 2009 22:37:48 -0000 @@ -417,6 +417,8 @@ class Foo int times (int y); }; +typedef Foo ByAnyOtherName; + class Bar : public Base1, public Foo { public: int z; @@ -431,7 +433,7 @@ int Foo::st = 100; Foo::operator int() { return x; } -Foo foo(10, 11); +ByAnyOtherName foo(10, 11); Bar bar(20, 21, 22); class ClassWithEnum { Index: testsuite/gdb.cp/classes.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/classes.exp,v retrieving revision 1.22 diff -u -p -r1.22 classes.exp --- testsuite/gdb.cp/classes.exp 21 Sep 2009 19:23:22 -0000 1.22 +++ testsuite/gdb.cp/classes.exp 11 Nov 2009 22:37:48 -0000 @@ -636,6 +636,8 @@ proc do_tests {} { gdb_test "print base1::Base1" "<.*Base1.*>" "print ctor of typedef class" gdb_test "print base1::~Base1" "<.*~Base1(\\(\\))?>" \ "print dtor of typedef class" + + gdb_test "list ByAnyOtherName::times" ".*int Foo::times.*" } do_tests