This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
On Fri, Nov 20, 2009 at 01:07:49PM -0800, Keith Seitz wrote: > Running these tests on CVS HEAD currently gives (go ahead, try it: I > dare you :-): My previous test run I botched patch application and didn't have this test. I ran it seperately and found some problems. print base1::base1(int) $2 = {base1 *(base1 * const, int)} 0x9944 <base1::base1(int)> (gdb) FAIL: gdb.cp/cpexprs.exp: print base1::base1(int) I know what this one is - constructors on ARM return "this". The test expects void. So this one is just a pattern matching problem. print base::operator/= A syntax error in expression, near `'. (gdb) FAIL: gdb.cp/cpexprs.exp: print base::operator/= This one is caused by using gdb_load, but not running the test to main. If you have debug info for your startup code, and gdb_load connects to your target, you'll end up in the language (asm or C) of your startup code. I suggest an additional runto_main at the start of the test so that the parsing language is C++. That yields the attached incremental patch. The ctor/dtor bits are an interesting question; we could canonicalize the type, but I don't think it's necessary (or clear what to canonicalize *to*). All 18 of the other fails in the GCC multilibs are of the form: list base::overload(base&) const Junk at end of line specification. (gdb) FAIL: gdb.cp/cpexprs.exp: list base::overload(base&) const What might that be? Each RealView multilib has 309 failures. A sample: -$1 = {void (const base1 * const)} 0x999c <base1::a_function() const> -(gdb) PASS: gdb.cp/cpexprs.exp: print base1::a_function +$1 = {void (const base1 *)} 0x11614 <base1::a_function() const> +(gdb) FAIL: gdb.cp/cpexprs.exp: print base1::a_function This tests for exact output on something which is up to the vagaries of the producer :-( So this will require even more similar hacks. RealView is my example here, but expect similar changes between GCC versions. And there's: print flubber<int, int, int, char, short> -$64 = {void (void)} 0xa100 <flubber<int, int, int, char, short>()> -(gdb) PASS: gdb.cp/cpexprs.exp: print flubber<int, int, int, char, short> +No symbol "flubber<int, int, int, char, short>" in current context. +(gdb) FAIL: gdb.cp/cpexprs.exp: print flubber<int, int, int, char, short> Something seems to be broken in RealView templates, but that's not a problem with the test. So with this incremental patch (or something similar), and whatever the "Junk at end of arguments" issue turns out to be, these new tests look OK. -- Daniel Jacobowitz CodeSourcery 2009-11-21 Daniel Jacobowitz <dan@codesourcery.com> * gdb.cp/cpexprs.exp (escape): Delete. Change all callers to use string_to_regexp. (ctor, dtor): New functions. Use them to match constructor and destructor function types. (Top level): Use runto_main. --- gdb/testsuite/gdb.cp/cpexprs.exp | 117 +++++++++++++++++++++++---------------- 1 file changed, 69 insertions(+), 48 deletions(-) Index: gdb-mainline/gdb/testsuite/gdb.cp/cpexprs.exp =================================================================== --- gdb-mainline.orig/gdb/testsuite/gdb.cp/cpexprs.exp 2009-11-21 08:16:14.000000000 -0800 +++ gdb-mainline/gdb/testsuite/gdb.cp/cpexprs.exp 2009-11-21 08:58:40.000000000 -0800 @@ -31,26 +31,13 @@ proc test_breakpoint {func} { } else { gdb_breakpoint "$func" set i [expr {[string last : $func] + 1}] - set efunc [escape [string range $func $i end]] + set efunc [string_to_regexp [string range $func $i end]] gdb_test "continue" \ "Continuing.\r\n\r\nBreakpoint $DEC+,.*$efunc.*" \ "continue to $func" } } -# Escape expect-reserved characters in the string -proc escape {string} { - regsub -all {\*} $string {\*} string - regsub -all {\(} $string {\(} string - regsub -all {\)} $string {\)} string - regsub -all {\]} $string {\]} string - regsub -all {\[} $string {\[} string - regsub -all {\+} $string {\+} string - regsub -all {\^} $string {\^} string - regsub -all {\!} $string {\!} string - return $string -} - # Add a function to the list of tested functions # FUNC is the name of the function (which will be passed to gdb commands) # TYPE is the type of the function, as expected from the "print" command @@ -76,11 +63,11 @@ proc add {func type print lst} { set print [regsub {\(void\)} $print {()}] set all_functions($func,print) \ - "$CONVAR = {[escape $type]} $ADDR <[escape $print].*>" + "$CONVAR = {[string_to_regexp $type]} $ADDR <[string_to_regexp $print].*>" if {$lst == "-"} { set lst "$func" } - set all_functions($func,list) ".*// [escape $lst]" + set all_functions($func,list) ".*// [string_to_regexp $lst]" } proc get {func cmd} { @@ -145,34 +132,63 @@ add {base2::a_function} \ - # Constructors + +# On targets using the ARM EABI, the constructor is expected to return +# "this". +proc ctor { type arglist } { + if { [istarget arm*-*eabi*] } { + set ret "$type *" + } else { + set ret "void " + } + if { $arglist != "" } { + set arglist ", $arglist" + } + return "${ret}($type * const$arglist)" +} + add {derived::derived} \ - {void (derived * const)} \ + [ctor derived ""] \ - \ - add {base1::base1(void)} \ - {void (base1 * const, const void ** const)} \ + [ctor base1 "const void ** const"] \ - \ - add {base1::base1(int)} \ - {void (base1 * const, int)} \ + [ctor base1 "int"] \ - \ - add {base2::base2} \ - {void (base2 * const, const void ** const)} \ + [ctor base2 "const void ** const"] \ - \ - add {base::base(void)} \ - {void (base * const)} \ + [ctor base ""] \ - \ - add {base::base(int)} \ - {void (base * const, int)} \ - - \ + [ctor base "int"] \ - \ + - # Destructors + +# On targets using the ARM EABI, some destructors are expected +# to return "this". Others are void. For internal reasons, +# GCC returns void * instead of $type *; RealView appears to do +# the same. +proc dtor { type } { + if { [istarget arm*-*eabi*] } { + set ret "void *" + } else { + set ret "void " + } + return "${ret}($type * const)" +} + add {base::~base} \ - {void (base * const)} \ + [dtor base] \ - \ - @@ -499,19 +515,19 @@ add {tclass<base>::do_something} \ - \ {tclass<T>::do_something} add {policy1::policy} \ - {void (policy<int, operation_1<void*> > * const, int)} \ + [ctor "policy<int, operation_1<void*> >" "int"] \ {policy<int, operation_1<void*> >::policy} \ {policy<T, Policy>::policy} add {policy2::policy} \ - {void (policy<int, operation_2<void*> > * const, int)} \ + [ctor "policy<int, operation_2<void*> >" int] \ {policy<int, operation_2<void*> >::policy} \ {policy<T, Policy>::policy} add {policy3::policy} \ - {void (policy<int, operation_3<void*> > * const, int)} \ + [ctor "policy<int, operation_3<void*> >" "int"] \ {policy<int, operation_3<void*> >::policy} \ {policy<T, Policy>::policy} add {policy4::policy} \ - {void (policy<int, operation_4<void*> > * const, int)} \ + [ctor "policy<int, operation_4<void*> >" "int"] \ {policy<int, operation_4<void*> >::policy} \ {policy<T, Policy>::policy} add {policy1::function} \ @@ -531,83 +547,83 @@ add {policy4::function} \ {operation_4<void*>::function} \ {operation_4<T>::function} add {policyd<int, operation_1<int> >::policyd} \ - {void (policyd<int, operation_1<int> > * const, int)} \ + [ctor "policyd<int, operation_1<int> >" "int"] \ - \ {policyd<T, Policy>::policyd} add {policyd1::policyd} \ - {void (policyd<int, operation_1<int> > * const, int)} \ + [ctor "policyd<int, operation_1<int> >" "int"] \ {policyd<int, operation_1<int> >::policyd} \ {policyd<T, Policy>::policyd} add {policyd<int, operation_1<int> >::~policyd} \ - {void (policyd<int, operation_1<int> > * const)} \ + [dtor "policyd<int, operation_1<int> >"] \ - \ {policyd<T, Policy>::~policyd} add {policyd1::~policyd} \ - {void (policyd<int, operation_1<int> > * const)} \ + [dtor "policyd<int, operation_1<int> >"] \ {policyd<int, operation_1<int> >::~policyd} \ {policyd<T, Policy>::~policyd} add {policyd<long, operation_1<long> >::policyd} \ - {void (policyd<long, operation_1<long> > * const, long)} \ + [ctor "policyd<long, operation_1<long> >" "long"] \ - \ {policyd<T, Policy>::policyd} add {policyd2::policyd} \ - {void (policyd<long, operation_1<long> > * const, long)} \ + [ctor "policyd<long, operation_1<long> >" "long"] \ {policyd<long, operation_1<long> >::policyd} \ {policyd<T, Policy>::policyd} add {policyd<long, operation_1<long> >::~policyd} \ - {void (policyd<long, operation_1<long> > * const)} \ + [dtor "policyd<long, operation_1<long> >"] \ - \ {policyd<T, Policy>::~policyd} add {policyd2::~policyd} \ - {void (policyd<long, operation_1<long> > * const)} \ + [dtor "policyd<long, operation_1<long> >"] \ {policyd<long, operation_1<long> >::~policyd} \ {policyd<T, Policy>::~policyd} add {policyd<char, operation_1<char> >::policyd} \ - {void (policyd<char, operation_1<char> > * const, char)} \ + [ctor "policyd<char, operation_1<char> >" "char"] \ - \ {policyd<T, Policy>::policyd} add {policyd3::policyd} \ - {void (policyd<char, operation_1<char> > * const, char)} \ + [ctor "policyd<char, operation_1<char> >" "char"] \ {policyd<char, operation_1<char> >::policyd} \ {policyd<T, Policy>::policyd} add {policyd<char, operation_1<char> >::~policyd} \ - {void (policyd<char, operation_1<char> > * const)} \ + [dtor "policyd<char, operation_1<char> >"] \ - \ {policyd<T, Policy>::~policyd} add {policyd3::~policyd} \ - {void (policyd<char, operation_1<char> > * const)} \ + [dtor "policyd<char, operation_1<char> >"] \ {policyd<char, operation_1<char> >::~policyd} \ {policyd<T, Policy>::~policyd} add {policyd<base, operation_1<base> >::policyd} \ - {void (policyd<base, operation_1<base> > * const, base)} \ + [ctor "policyd<base, operation_1<base> >" "base"] \ - \ {policyd<T, Policy>::policyd} add {policyd4::policyd} \ - {void (policyd<base, operation_1<base> > * const, base)} \ + [ctor "policyd<base, operation_1<base> >" "base"] \ {policyd<base, operation_1<base> >::policyd} \ {policyd<T, Policy>::policyd} add {policyd<base, operation_1<base> >::~policyd} \ - {void (policyd<base, operation_1<base> > * const)} \ + [dtor "policyd<base, operation_1<base> >"] \ - \ {policyd<T, Policy>::~policyd} add {policyd4::~policyd} \ - {void (policyd<base, operation_1<base> > * const)} \ + [dtor "policyd<base, operation_1<base> >"] \ {policyd<base, operation_1<base> >::~policyd} \ {policyd<T, Policy>::~policyd} add {policyd<tclass<int>, operation_1<tclass<int> > >::policyd} \ - {void (policyd<tclass<int>, operation_1<tclass<int> > > * const, tclass<int>)} \ + [ctor "policyd<tclass<int>, operation_1<tclass<int> > >" "tclass<int>"] \ - \ {policyd<T, Policy>::policyd} add {policyd5::policyd} \ - {void (policyd<tclass<int>, operation_1<tclass<int> > > * const, tclass<int>)} \ + [ctor "policyd<tclass<int>, operation_1<tclass<int> > >" "tclass<int>"] \ {policyd<tclass<int>, operation_1<tclass<int> > >::policyd} \ {policyd<T, Policy>::policyd} add {policyd<tclass<int>, operation_1<tclass<int> > >::~policyd} \ - {void (policyd<tclass<int>, operation_1<tclass<int> > > * const)} \ + [dtor "policyd<tclass<int>, operation_1<tclass<int> > >"] \ - \ {policyd<T, Policy>::~policyd} add {policyd5::~policyd} \ - {void (policyd<tclass<int>, operation_1<tclass<int> > > * const)} \ + [dtor "policyd<tclass<int>, operation_1<tclass<int> > >"] \ {policyd<tclass<int>, operation_1<tclass<int> > >::~policyd} \ {policyd<T, Policy>::~policyd} add {policyd<int, operation_1<int> >::function} \ @@ -679,6 +695,11 @@ gdb_start gdb_reinitialize_dir [file join $srcdir $subdir] gdb_load $binfile +if {![runto_main]} { + perror "couldn't run to breakpoint" + continue +} + # Set the listsize to one. This will help with testing "list". gdb_test "set listsize 1"
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |