From: David Carlton Date: Fri, 5 Mar 2004 17:32:25 +0000 (+0000) Subject: 2004-03-05 David Carlton X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1198ecbe719975c4549f5cae42f1150e6f75a950;p=binutils-gdb.git 2004-03-05 David Carlton * cp-namespace.c (cp_lookup_transparent_type_loop): Fix recursion bug. 2004-03-05 David Carlton * gdb.cp/rtti.exp: Add 'print *obj3' test. * gdb.cp/rtti.h: Update copyright. (namespace n2::n3): New. * gdb.cp/rtti1.cc: (refer_to (n2::n3::C3 *)): New. (n2::n3::func3): New. (main): Call n2::n3::func3. * gdb.cp/rtti2.cc: Update copyright. (n2::create3): New. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 82dfcb8ab87..2be613061ef 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2004-03-05 David Carlton + + * cp-namespace.c (cp_lookup_transparent_type_loop): Fix recursion + bug. + 2004-03-05 Mark Kettenis * sparc-tdep.c: Fix typo in comment. diff --git a/gdb/cp-namespace.c b/gdb/cp-namespace.c index a731352c6e4..910289ff3ce 100644 --- a/gdb/cp-namespace.c +++ b/gdb/cp-namespace.c @@ -603,7 +603,7 @@ static struct type * cp_lookup_transparent_type_loop (const char *name, const char *scope, int length) { - int scope_length = cp_find_first_component (scope + length); + int scope_length = length + cp_find_first_component (scope + length); char *full_name; /* If the current scope is followed by "::", look in the next diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 569351c66d5..d782a27924e 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,14 @@ +2004-03-05 David Carlton + + * gdb.cp/rtti.exp: Add 'print *obj3' test. + * gdb.cp/rtti.h: Update copyright. + (namespace n2::n3): New. + * gdb.cp/rtti1.cc: (refer_to (n2::n3::C3 *)): New. + (n2::n3::func3): New. + (main): Call n2::n3::func3. + * gdb.cp/rtti2.cc: Update copyright. + (n2::create3): New. + 2004-03-04 Mark Kettenis * gdb.asm/openbsd.inc: Fix typo. diff --git a/gdb/testsuite/gdb.cp/rtti.exp b/gdb/testsuite/gdb.cp/rtti.exp index 0a8a2d70b31..18f3cc295da 100644 --- a/gdb/testsuite/gdb.cp/rtti.exp +++ b/gdb/testsuite/gdb.cp/rtti.exp @@ -140,5 +140,10 @@ gdb_continue_to_breakpoint "end of constructors in func" gdb_test "print *obj" "\\$\[0-9\]* = { = .*}" +gdb_breakpoint [gdb_get_line_number "func3-constructs-done"] +gdb_continue_to_breakpoint "end of constructors in func3" + +gdb_test "print *obj3" "\\$\[0-9\]* = { = .*}" + gdb_exit return 0 diff --git a/gdb/testsuite/gdb.cp/rtti.h b/gdb/testsuite/gdb.cp/rtti.h index 879896d0dc8..c3249252f09 100644 --- a/gdb/testsuite/gdb.cp/rtti.h +++ b/gdb/testsuite/gdb.cp/rtti.h @@ -1,6 +1,6 @@ /* Code to go along with tests in rtti.exp. - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2004 Free Software Foundation, Inc. Contributed by David Carlton and by Kealia, Inc. @@ -45,4 +45,12 @@ namespace n2 { }; extern C2 *create2(); + + namespace n3 { + class C3 : public C2 { + public: + }; + } + + extern n3::C3 *create3(); } diff --git a/gdb/testsuite/gdb.cp/rtti1.cc b/gdb/testsuite/gdb.cp/rtti1.cc index de8e12fc8e4..d32ac047d44 100644 --- a/gdb/testsuite/gdb.cp/rtti1.cc +++ b/gdb/testsuite/gdb.cp/rtti1.cc @@ -63,16 +63,33 @@ void refer_to (n2::C2 *obj) // Do nothing. } +void refer_to (n2::n3::C3 *obj) +{ + // Do nothing. +} + namespace n2 { void func () { C2 *obj = create2 (); - refer_to (obj); // func-constructs-done + refer_to (obj); // func-constructs-done return; } + + namespace n3 + { + void func3 () + { + C3 *obj3 = create3 (); + + refer_to (obj3); // func3-constructs-done + + return; + } + } } int main() @@ -84,6 +101,7 @@ int main() C2 *e2 = create2(); n2::func(); // main-constructs-done + n2::n3::func3(); return 0; } diff --git a/gdb/testsuite/gdb.cp/rtti2.cc b/gdb/testsuite/gdb.cp/rtti2.cc index 8bb1ed6c99f..353a1f8c7b8 100644 --- a/gdb/testsuite/gdb.cp/rtti2.cc +++ b/gdb/testsuite/gdb.cp/rtti2.cc @@ -1,6 +1,6 @@ /* Code to go along with tests in rtti.exp. - Copyright 2003 Free Software Foundation, Inc. + Copyright 2003, 2004 Free Software Foundation, Inc. Contributed by David Carlton and by Kealia, Inc. @@ -33,4 +33,8 @@ namespace n2 { return new D2(0, 0); } + n3::C3 *create3() { + return new n3::C3(); + } + }