diff options
author | Keith Seitz <keiths@redhat.com> | 2010-03-09 18:08:05 +0000 |
---|---|---|
committer | Keith Seitz <keiths@redhat.com> | 2010-03-09 18:08:05 +0000 |
commit | cec808ecec654eb5c43ca6281ee5e08aca3f2a7b (patch) | |
tree | 10667bc01e7568d6b02f1fd9e0ee2109a21267fa | |
parent | 9cb74f47a17c0c8c4dcf475892f4b27e961d05f8 (diff) | |
download | binutils-cec808ecec654eb5c43ca6281ee5e08aca3f2a7b.zip binutils-cec808ecec654eb5c43ca6281ee5e08aca3f2a7b.tar.gz binutils-cec808ecec654eb5c43ca6281ee5e08aca3f2a7b.tar.bz2 |
* gdb.cp/cp-relocate.exp: Remove single-quoting of C++ methods.
* gdb.cp/cplusfuncs.cc (dm_type_short): New function.
(dm_type_long): New function.
(dm_type_unsigned_short): New function.
(dm_type_unsigned_long): New function.
(myint): New typedef.
* gdb.cp/cplusfuncs.exp (probe_demangler): Add tests for short,
long, unsigned shor and long, operator char*, and typedef.
(test_lookup_operator_functions): Add operator char* test.
(test_paddr_operator_functions): Likewise.
(test_paddr_overloaded_functions): Use probe values for
short, long, and unsigned short and long.
(test_paddr_hairy_functions): If the demangler probe detected
gdb type printers, "expect" them. Otherwise "expect" the v2 or v3
demangler.
* gdb.cp/expand-sals.exp: Backtrace may contain class names.
* gdb.cp/member-ptr.exp: Refine expected result for "print pmf"
and "print null_pmf".
Add test "ptype a.*pmf".
* gdb.cp/overload.exp: Allow optional "int" to appear with
"short" and "long".
* gdb.cp/ovldbreak.exp: Use append to construct super-duper
long expect value for men_overload1arg.
Allow "int" to appear with "short" and "long".
When testing "info break", add argument for main (void).
Also allow "int" to appear with "short" and "long".
Ditto with "unsigned" and "long long".
* gdb.java/jmain.exp: Do not enclose methods names in single
quotes.
* gdb.java/jmisc.exp: Likewise.
* gdb.java/jprint.exp: Likewise.
* gdb.python/py-symbol.exp: Update expected "linkage_name" value.
From Jan Kratochvil <jan.kratochvil@redhat.com>:
* gdb.cp/exception.exp (backtrace after first throw)
(backtrace after second throw): Allow a namespace before __cxa_throw.
(backtrace after first catch, backtrace after second catch): Allow
a namespace before __cxa_begin_catch.
* gdb.cp/cpexprs.exp: New file.
* gdb.cp/cpexprs.cc: New file.
From 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.
-rw-r--r-- | gdb/testsuite/ChangeLog | 51 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/cp-relocate.exp | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/cpexprs.cc | 431 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/cpexprs.exp | 724 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/cplusfuncs.cc | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/cplusfuncs.exp | 195 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/exception.exp | 10 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/expand-sals.exp | 2 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/member-ptr.exp | 6 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/overload.exp | 8 | ||||
-rw-r--r-- | gdb/testsuite/gdb.cp/ovldbreak.exp | 49 | ||||
-rw-r--r-- | gdb/testsuite/gdb.java/jmain.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.java/jmisc.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.java/jprint.exp | 4 | ||||
-rw-r--r-- | gdb/testsuite/gdb.python/py-symbol.exp | 2 |
15 files changed, 1447 insertions, 55 deletions
diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 3efd2be..baba6eb 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,54 @@ +2010-03-08 Keith Seitz <keiths@redhat.com> + + * gdb.cp/cp-relocate.exp: Remove single-quoting of C++ methods. + * gdb.cp/cplusfuncs.cc (dm_type_short): New function. + (dm_type_long): New function. + (dm_type_unsigned_short): New function. + (dm_type_unsigned_long): New function. + (myint): New typedef. + * gdb.cp/cplusfuncs.exp (probe_demangler): Add tests for short, + long, unsigned shor and long, operator char*, and typedef. + (test_lookup_operator_functions): Add operator char* test. + (test_paddr_operator_functions): Likewise. + (test_paddr_overloaded_functions): Use probe values for + short, long, and unsigned short and long. + (test_paddr_hairy_functions): If the demangler probe detected + gdb type printers, "expect" them. Otherwise "expect" the v2 or v3 + demangler. + * gdb.cp/expand-sals.exp: Backtrace may contain class names. + * gdb.cp/member-ptr.exp: Refine expected result for "print pmf" + and "print null_pmf". + Add test "ptype a.*pmf". + * gdb.cp/overload.exp: Allow optional "int" to appear with + "short" and "long". + * gdb.cp/ovldbreak.exp: Use append to construct super-duper + long expect value for men_overload1arg. + Allow "int" to appear with "short" and "long". + When testing "info break", add argument for main (void). + Also allow "int" to appear with "short" and "long". + Ditto with "unsigned" and "long long". + * gdb.java/jmain.exp: Do not enclose methods names in single + quotes. + * gdb.java/jmisc.exp: Likewise. + * gdb.java/jprint.exp: Likewise. + * gdb.python/py-symbol.exp: Update expected "linkage_name" value. + + From Jan Kratochvil <jan.kratochvil@redhat.com>: + * gdb.cp/exception.exp (backtrace after first throw) + (backtrace after second throw): Allow a namespace before __cxa_throw. + (backtrace after first catch, backtrace after second catch): Allow + a namespace before __cxa_begin_catch. + + * gdb.cp/cpexprs.exp: New file. + * gdb.cp/cpexprs.cc: New file. + + From 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. + 2010-03-05 Tom Tromey <tromey@redhat.com> * gdb.python/py-prettyprint.py (pp_nullstr.to_string): Use diff --git a/gdb/testsuite/gdb.cp/cp-relocate.exp b/gdb/testsuite/gdb.cp/cp-relocate.exp index f81a212..30d362a 100644 --- a/gdb/testsuite/gdb.cp/cp-relocate.exp +++ b/gdb/testsuite/gdb.cp/cp-relocate.exp @@ -30,7 +30,7 @@ proc get_func_address { func } { global gdb_prompt hex set rfunc [string_to_regexp $func] - gdb_test_multiple "print '${func}'" "get address of ${func}" { + gdb_test_multiple "print ${func}" "get address of ${func}" { -re "\\\$\[0-9\]+ = \\{.*\\} (0|($hex) <${rfunc}>)\[\r\n\]+${gdb_prompt} $" { # $1 = {int ()} 0x24 <function_bar> # But if the function is at zero, the name may be omitted. @@ -130,7 +130,7 @@ gdb_test "add-symbol-file ${binfile} 0 -s ${func1_sec} 0x10000 -s ${func2_sec} 0 "y" # Make sure the function addresses were updated. -gdb_test "break *'$func1_name'" \ +gdb_test "break *$func1_name" \ "Breakpoint $decimal at 0x1....: file .*" -gdb_test "break *'$func2_name'" \ +gdb_test "break *$func2_name" \ "Breakpoint $decimal at 0x2....: file .*" diff --git a/gdb/testsuite/gdb.cp/cpexprs.cc b/gdb/testsuite/gdb.cp/cpexprs.cc new file mode 100644 index 0000000..2bca4cd --- /dev/null +++ b/gdb/testsuite/gdb.cp/cpexprs.cc @@ -0,0 +1,431 @@ +/* This testcase is part of GDB, the GNU debugger. + + Copyright 2008, 2009, 2010 Free Software Foundation, Inc. + + Contributed by Red Hat, originally written by Keith Seitz. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see <http://www.gnu.org/licenses/>. + + Please email any bugs, comments, and/or additions to this file to: + bug-gdb@gnu.org */ + +#include <stdlib.h> +#include <iostream> + +// Forward decls +class base; +class derived; + +// A simple template with specializations +template <typename T> +class tclass +{ +public: + void do_something () { } // tclass<T>::do_something +}; + +template <> +void tclass<char>::do_something () { } // tclass<char>::do_something + +template <> +void tclass<int>::do_something () { } // tclass<int>::do_something + +template<> +void tclass<long>::do_something () { } // tclass<long>::do_something + +template<> +void tclass<short>::do_something () { } // tclass<short>::do_something + +// A simple template with multiple template parameters +template <class A, class B, class C, class D, class E> +void flubber (void) // flubber +{ + A a; + B b; + C c; + D d; + E e; + + ++a; + ++b; + ++c; + ++d; + ++e; +} + +// Some contrived policies +template <class T> +struct operation_1 +{ + static void function (void) { } // operation_1<T>::function +}; + +template <class T> +struct operation_2 +{ + static void function (void) { } // operation_2<T>::function +}; + +template <class T> +struct operation_3 +{ + static void function (void) { } // operation_3<T>::function +}; + +template <class T> +struct operation_4 +{ + static void function (void) { } // operation_4<T>::function +}; + +// A policy-based class w/ and w/o default policy +template <class T, class Policy> +class policy : public Policy +{ +public: + policy (T obj) : obj_ (obj) { } // policy<T, Policy>::policy + +private: + T obj_; +}; + +template <class T, class Policy = operation_1<T> > +class policyd : public Policy +{ +public: + policyd (T obj) : obj_ (obj) { } // policyd<T, Policy>::policyd + ~policyd (void) { } // policyd<T, Policy>::~policyd + +private: + T obj_; +}; + +typedef policy<int, operation_1<void*> > policy1; +typedef policy<int, operation_2<void*> > policy2; +typedef policy<int, operation_3<void*> > policy3; +typedef policy<int, operation_4<void*> > policy4; + +typedef policyd<int> policyd1; +typedef policyd<long> policyd2; +typedef policyd<char> policyd3; +typedef policyd<base> policyd4; +typedef policyd<tclass<int> > policyd5; + +class fluff { }; +static fluff *g_fluff = new fluff (); + +class base +{ +protected: + int foo_; + +public: + base (void) : foo_ (42) { } // base::base(void) + base (int foo) : foo_ (foo) { } // base::base(int) + ~base (void) { } // base::~base + + // Some overloaded methods + int overload (void) const { return 0; } // base::overload(void) const + int overload (int i) const { return 1; } // base::overload(int) const + int overload (short s) const { return 2; } // base::overload(short) const + int overload (long l) const { return 3; } // base::overload(long) const + int overload (char* a) const { return 4; } // base::overload(char*) const + int overload (base& b) const { return 5; } // base::overload(base&) const + + // Operators + int operator+ (base const& o) const // base::operator+ + { return foo_ + o.foo_; } + + base operator++ (void) // base::operator++ + { ++foo_; return *this; } + + base operator+=(base const& o) // base::operator+= + { foo_ += o.foo_; return *this; } + + int operator- (base const& o) const // base::operator- + { return foo_ - o.foo_; } + + base operator-- (void) // base::operator-- + { --foo_; return *this; } + + base operator-= (base const& o) // base::operator-= + { foo_ -= o.foo_; return *this; } + + int operator* (base const& o) const // base::operator* + { return foo_ * o.foo_; } + + base operator*= (base const& o) // base::operator*= + { foo_ *= o.foo_; return *this; } + + int operator/ (base const& o) const // base::operator/ + { return foo_ / o.foo_; } + + base operator/= (base const& o) // base::operator/= + { foo_ /= o.foo_; return *this; } + + int operator% (base const& o) const // base::operator% + { return foo_ % o.foo_; } + + base operator%= (base const& o) // base::operator%= + { foo_ %= o.foo_; return *this; } + + bool operator< (base const& o) const // base::operator< + { return foo_ < o.foo_; } + + bool operator<= (base const& o) const // base::operator<= + { return foo_ <= o.foo_; } + + bool operator> (base const& o) const // base::operator> + { return foo_ > o.foo_; } + + bool operator>= (base const& o) const // base::operator>= + { return foo_ >= o.foo_; } + + bool operator!= (base const& o) const // base::operator!= + { return foo_ != o.foo_; } + + bool operator== (base const& o) const // base::operator== + { return foo_ == o.foo_; } + + bool operator! (void) const // base::operator! + { return !foo_; } + + bool operator&& (base const& o) const // base::operator&& + { return foo_ && o.foo_; } + + bool operator|| (base const& o) const // base::operator|| + { return foo_ || o.foo_; } + + int operator<< (int value) const // base::operator<< + { return foo_ << value; } + + base operator<<= (int value) // base::operator<<= + { foo_ <<= value; return *this; } + + int operator>> (int value) const // base::operator>> + { return foo_ >> value; } + + base operator>>= (int value) // base::operator>>= + { foo_ >>= value; return *this; } + + int operator~ (void) const // base::operator~ + { return ~foo_; } + + int operator& (base const& o) const // base::operator& + { return foo_ & o.foo_; } + + base operator&= (base const& o) // base::operator&= + { foo_ &= o.foo_; return *this; } + + int operator| (base const& o) const // base::operator| + { return foo_ | o.foo_; } + + base operator|= (base const& o) // base::operator|= + { foo_ |= o.foo_; return *this; } + + int operator^ (base const& o) const // base::operator^ + { return foo_ ^ o.foo_; } + + base operator^= (base const& o) // base::operator^= + { foo_ ^= o.foo_; return *this; } + + base operator= (base const& o) // base::operator= + { foo_ = o.foo_; return *this; } + + void operator() (void) const // base::operator() + { return; } + + int operator[] (int idx) const // base::operator[] + { return idx; } + + void* operator new (size_t size) throw () // base::operator new + { return malloc (size); } + + void operator delete (void* ptr) // base::operator delete + { free (ptr); } + + void* operator new[] (size_t size) throw () // base::operator new[] + { return malloc (size); } + + void operator delete[] (void* ptr) // base::operator delete[] + { free (ptr); } + + base const* operator-> (void) const // base::opeartor-> + { return this; } + + int operator->* (base const& b) const // base::operator->* + { return foo_ * b.foo_; } + + operator char* () const { return const_cast<char*> ("hello"); } // base::operator char* + operator int () const { return 21; } // base::operator int + operator fluff* () const { return new fluff (); } // base::operator fluff* + operator fluff** () const { return &g_fluff; } // base::operator fluff** +}; + +class base1 : public virtual base +{ +public: + base1 (void) : foo_ (21) { } // base1::base1(void) + base1 (int a) : foo_(a) { } // base1::base1(int) + void a_function (void) const { } // base1::a_function + +protected: + int foo_; +}; + +class base2 : public virtual base +{ +public: + base2 () : foo_ (3) { } // base2::base2 + +protected: + void a_function (void) const { } // base2::a_function + int foo_; +}; + +class derived : public base1, public base2 +{ + public: + derived(void) : foo_ (4) { } // derived::derived + void a_function (void) const // derived::a_function + { + this->base1::a_function (); + this->base2::a_function (); + } + + protected: + int foo_; +}; + +int +main (int argc, char* argv[]) // main +{ // main + derived d; + void (derived::*pfunc) (void) const = &derived::a_function; + (d.*pfunc) (); + + base a (1), b (3), c (8); + (void) a.overload (); + (void) a.overload (static_cast<int> (0)); + (void) a.overload (static_cast<short> (0)); + (void) a.overload (static_cast<long> (0)); + (void) a.overload (static_cast<char*> (0)); + (void) a.overload (a); + + int r; + r = b + c; + ++a; + a += b; + r = b - c; + --a; + a -= b; + r = b * c; + a *= b; + r = b / c; + a /= b; + r = b % c; + a %= b; + bool x = (b < c); + x = (b <= c); + x = (b > c); + x = (b >= c); + x = (b != c); + x = (b == c); + x = (!b); + x = (b && c); + x = (b || c); + r = b << 2; + a <<= 1; + r = b >> 2; + a >>= 1; + r = ~b; + r = b & c; + a &= c; + r = b | c; + a |= c; + r = b ^ c; + a ^= c; + a = c; + a (); + int i = a[3]; + derived* f = new derived (); + derived* g = new derived[3]; + delete f; + delete[] g; + a->overload (); + r = a->*b; + + tclass<char> char_tclass; + tclass<int> int_tclass; + tclass<short> short_tclass; + tclass<long> long_tclass; + tclass<base> base_tclass; + char_tclass.do_something (); + int_tclass.do_something (); + short_tclass.do_something (); + long_tclass.do_something (); + base_tclass.do_something (); + + flubber<int, int, int, int, int> (); + flubber<int, int, int, int, short> (); + flubber<int, int, int, int, long> (); + flubber<int, int, int, int, char> (); + flubber<int, int, int, short, int> (); + flubber<int, int, int, short, short> (); + flubber<int, int, int, short, long> (); + flubber<int, int, int, short, char> (); + flubber<int, int, int, long, int> (); + flubber<int, int, int, long, short> (); + flubber<int, int, int, long, long> (); + flubber<int, int, int, long, char> (); + flubber<int, int, int, char, int> (); + flubber<int, int, int, char, short> (); + flubber<int, int, int, char, long> (); + flubber<int, int, int, char, char> (); + flubber<int, int, short, int, int> (); + flubber<int, int, short, int, short> (); + flubber<int, int, short, int, long> (); + flubber<int, int, short, int, char> (); + flubber<int, int, short, short, int> (); + flubber<short, int, short, int, short> (); + flubber<long, short, long, short, long> (); + + policy1 p1 (1); + p1.function (); + policy2 p2 (2); + p2.function (); + policy3 p3 (3); + p3.function (); + policy4 p4 (4); + p4.function (); + + policyd1 pd1 (5); + pd1.function (); + policyd2 pd2 (6); + pd2.function (); + policyd3 pd3 (7); + pd3.function (); + policyd4 pd4 (d); + pd4.function (); + policyd5 pd5 (int_tclass); + pd5.function (); + + base1 b1 (3); + + r = a; + char* str = a; + fluff* flp = a; + fluff** flpp = a; +} + diff --git a/gdb/testsuite/gdb.cp/cpexprs.exp b/gdb/testsuite/gdb.cp/cpexprs.exp new file mode 100644 index 0000000..6074763 --- /dev/null +++ b/gdb/testsuite/gdb.cp/cpexprs.exp @@ -0,0 +1,724 @@ +# cpexprs.exp - C++ expressions tests +# +# Copyright 2008, 2009, 2010 Free Software Foundation, Inc. +# +# Contributed by Red Hat, originally written by Keith Seitz. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see <http://www.gnu.org/licenses/>. + +# This file is part of the gdb testsuite. + +# A helper proc which sets a breakpoint at FUNC and attempts to +# run to the breakpoint. +proc test_breakpoint {func} { + global DEC + + # Restart every time + if {![runto_main]} { + perror "could not run to main when attempting to break at $func" + } else { + gdb_breakpoint "$func" + set i [expr {[string last : $func] + 1}] + set efunc [string_to_regexp [string range $func $i end]] + gdb_test "continue" \ + "Continuing.\r\n\r\nBreakpoint $DEC+,.*$efunc.*" \ + "continue to $func" + } +} + +# 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 +# PRINT is the name of the function, as expected result of the print command +# *OR* "-", indicating that FUNC should be used (needed for virtual/inherited +# funcs) +# LST is either the expected result of the list command (the comment from +# the source code) *OR* "-", in which case FUNC will be used +# +# Usage: +# add NAME TYPE PRINT LST +# add NAME TYPE PRINT - +proc add {func type print lst} { + global all_functions CONVAR ADDR + + set all_functions($func,type) $type + if {$print == "-"} { + set print $func + } + + # An exception: since gdb canonicalizes C++ output, + # "(void)" must be mutated to "()". + regsub {\(void\)} $print {()} print + + set all_functions($func,print) \ + "$CONVAR = {[string_to_regexp $type]} $ADDR <[string_to_regexp $print].*>" + if {$lst == "-"} { + set lst "$func" + } + set all_functions($func,list) ".*// [string_to_regexp $lst]" +} + +proc get {func cmd} { + global all_functions + return $all_functions($func,$cmd) +} + +# Returns a list of function names for a given command +proc get_functions {cmd} { + global all_functions + set result {} + foreach i [array names all_functions *,$cmd] { + if {$all_functions($i) != ""} { + set idx [string last , $i] + if {$idx != -1} { + lappend result [string range $i 0 [expr {$idx - 1}]] + } + } + } + + return [lsort $result] +} + +# Some convenience variables for this test +set DEC {[0-9]}; # a decimal number +set HEX {[0-9a-fA-F]}; # a hexidecimal number +set CONVAR "\\\$$DEC+"; # convenience variable regexp +set ADDR "0x$HEX+"; # address + +# An array of functions/methods that we are testing... +# Each element consists is indexed by NAME,COMMAND, where +# NAME is the function name and COMMAND is the gdb command that +# we are testing. The value of the array for any index pair is +# the expected result of running COMMAND with the NAME as argument. + +# The array holding all functions/methods to test. Valid subindexes +# are (none need character escaping -- "add" will take care of that): + +# add name type print_name list +# NAME,type: value is type of function +# NAME,print: value is print name of function (careful w/inherited/virtual!) +# NAME,list: value is comment in source code on first line of function +# (without the leading "//") +array set all_functions {} + +# "Normal" functions/methods +add {main} \ + {int (int, char **)} \ + - \ + - +add {derived::a_function} \ + {void (const derived * const)} \ + - \ + - +add {base1::a_function} \ + {void (const base1 * const)} \ + - \ + - +add {base2::a_function} \ + {void (const base2 * const)} \ + - \ + - + +# 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} \ + [ctor derived ""] \ + - \ + - +add {base1::base1(void)} \ + [ctor base1 "const void ** const"] \ + - \ + - +add {base1::base1(int)} \ + [ctor base1 "int"] \ + - \ + - +add {base2::base2} \ + [ctor base2 "const void ** const"] \ + - \ + - +add {base::base(void)} \ + [ctor base ""] \ + - \ + - +add {base::base(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} \ + [dtor base] \ + - \ + - + +# Overloaded methods (all are const -- we try to use the void +# method with and without specifying "const") +add {base::overload(void)} \ + {int (const base * const)} \ + - \ + {base::overload(void) const} +add {base::overload(void) const} \ + {int (const base * const)} \ + - \ + {base::overload(void) const} +add {base::overload(int) const} \ + {int (const base * const, int)} \ + - \ + - +add {base::overload(short) const} \ + {int (const base * const, short)} \ + - \ + - +add {base::overload(long) const} \ + {int (const base * const, long)} \ + - \ + - +add {base::overload(char*) const} \ + {int (const base * const, char *)} \ + - \ + - +add {base::overload(base&) const} \ + {int (const base * const, base &)} \ + - \ + - + +# Operators +add {base::operator+} \ + {int (const base * const, const base &)} \ + - \ + - +add {base::operator++} \ + {base (base * const)} \ + - \ + - +add {base::operator+=} \ + {base (base * const, const base &)} \ + - \ + - +add {base::operator-} \ + {int (const base * const, const base &)} \ + - \ + - +add {base::operator--} \ + {base (base * const)} \ + - \ + - +add {base::operator-=} \ + {base (base * const, const base &)} \ + - \ + - +add {base::operator*} \ + {int (const base * const, const base &)} \ + - \ + - +add {base::operator*=} \ + {base (base * const, const base &)} \ + - \ + - +add {base::operator/} \ + {int (const base * const, const base &)} \ + - \ + - +add {base::operator/=} \ + {base (base * const, const base &)} \ + - \ + - +add {base::operator%} \ + {int (const base * const, const base &)} \ + - \ + - +add {base::operator%=} \ + {base (base * const, const base &)} \ + - \ + - +add {base::operator<} \ + {bool (const base * const, const base &)} \ + - \ + - +add {base::operator<=} \ + {bool (const base * const, const base &)} \ + - \ + - +add {base::operator>} \ + {bool (const base * const, const base &)} \ + - \ + - +add {base::operator>=} \ + {bool (const base * const, const base &)} \ + - \ + - +add {base::operator!=} \ + {bool (const base * const, const base &)} \ + - \ + - +add {base::operator==} \ + {bool (const base * const, const base &)} \ + - \ + - +add {base::operator!} \ + {bool (const base * const)} \ + - \ + - +add {base::operator&&} \ + {bool (const base * const, const base &)} \ + - \ + - +add {base::operator||} \ + {bool (const base * const, const base &)} \ + - \ + - +add {base::operator<<} \ + {int (const base * const, int)} \ + - \ + - +add {base::operator<<=} \ + {base (base * const, int)} \ + - \ + - +add {base::operator>>} \ + {int (const base * const, int)} \ + - \ + - +add {base::operator>>=} \ + {base (base * const, int)} \ + - \ + - +add {base::operator~} \ + {int (const base * const)} \ + - \ + - +add {base::operator&} \ + {int (const base * const, const base &)} \ + - \ + - +add {base::operator&=} \ + {base (base * const, const base &)} \ + - \ + - +add {base::operator|} \ + {int (const base * const, const base &)} \ + - \ + - +add {base::operator|=} \ + {base (base * const, const base &)} \ + - \ + - +add {base::operator^} \ + {int (const base * const, const base &)} \ + - \ + - +add {base::operator^=} \ + {base (base * const, const base &)} \ + - \ + - +add {base::operator=} \ + {base (base * const, const base &)} \ + - \ + - +add {base::operator()} \ + {void (const base * const)} \ + - \ + - +add {base::operator[]} \ + {int (const base * const, int)} \ + - \ + - +add {base::operator new} \ + {void *(size_t)} \ + - \ + - +add {base::operator delete} \ + {void (void *)} \ + - \ + - +add {base::operator new[]} \ + {void *(size_t)} \ + - \ + - +add {base::operator delete[]} \ + {void (void *)} \ + - \ + - +add {base::operator char*} \ + {char *(const base * const)} \ + - \ + - +add {base::operator fluff*} \ + {fluff *(const base * const)} \ + - \ + - +add {base::operator fluff**} \ + {fluff **(const base * const)} \ + - \ + - +add {base::operator int} \ + {int (const base * const)} \ + - \ + - + +# Templates +add {tclass<char>::do_something} \ + {void (tclass<char> * const)} \ + - \ + - +add {tclass<int>::do_something} \ + {void (tclass<int> * const)} \ + - \ + - +add {tclass<long>::do_something} \ + {void (tclass<long> * const)} \ + - \ + - +add {tclass<short>::do_something} \ + {void (tclass<short> * const)} \ + - \ + - +add {tclass<base>::do_something} \ + {void (tclass<base> * const)} \ + - \ + - +add {flubber<int, int, int, int, int>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, int, short>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, int, long>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, int, char>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, short, int>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, short, short>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, short, long>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, short, char>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, long, int>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, long, short>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, long, long>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, long, char>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, char, int>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, char, short>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, char, long>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, int, char, char>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, short, int, int>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, short, int, short>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, short, int, long>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, short, int, char>} \ + {void (void)} \ + - \ + flubber +add {flubber<int, int, short, short, int>} \ + {void (void)} \ + - \ + flubber +add {flubber<short, int, short, int, short>} \ + {void (void)} \ + - \ + flubber +add {flubber<long, short, long, short, long>} \ + {void (void)} \ + - \ + flubber +add {tclass<base>::do_something} \ + {void (tclass<base> * const)} \ + - \ + {tclass<T>::do_something} +add {policy1::policy} \ + [ctor "policy<int, operation_1<void*> >" "int"] \ + {policy<int, operation_1<void*> >::policy} \ + {policy<T, Policy>::policy} +add {policy2::policy} \ + [ctor "policy<int, operation_2<void*> >" int] \ + {policy<int, operation_2<void*> >::policy} \ + {policy<T, Policy>::policy} +add {policy3::policy} \ + [ctor "policy<int, operation_3<void*> >" "int"] \ + {policy<int, operation_3<void*> >::policy} \ + {policy<T, Policy>::policy} +add {policy4::policy} \ + [ctor "policy<int, operation_4<void*> >" "int"] \ + {policy<int, operation_4<void*> >::policy} \ + {policy<T, Policy>::policy} +add {policy1::function} \ + {void (void)} \ + {operation_1<void*>::function} \ + {operation_1<T>::function} +add {policy2::function} \ + {void (void)} \ + {operation_2<void*>::function} \ + {operation_2<T>::function} +add {policy3::function} \ + {void (void)} \ + {operation_3<void*>::function} \ + {operation_3<T>::function} +add {policy4::function} \ + {void (void)} \ + {operation_4<void*>::function} \ + {operation_4<T>::function} +add {policyd<int, operation_1<int> >::policyd} \ + [ctor "policyd<int, operation_1<int> >" "int"] \ + - \ + {policyd<T, Policy>::policyd} +add {policyd1::policyd} \ + [ctor "policyd<int, operation_1<int> >" "int"] \ + {policyd<int, operation_1<int> >::policyd} \ + {policyd<T, Policy>::policyd} +add {policyd<int, operation_1<int> >::~policyd} \ + [dtor "policyd<int, operation_1<int> >"] \ + - \ + {policyd<T, Policy>::~policyd} +add {policyd1::~policyd} \ + [dtor "policyd<int, operation_1<int> >"] \ + {policyd<int, operation_1<int> >::~policyd} \ + {policyd<T, Policy>::~policyd} +add {policyd<long, operation_1<long> >::policyd} \ + [ctor "policyd<long, operation_1<long> >" "long"] \ + - \ + {policyd<T, Policy>::policyd} +add {policyd2::policyd} \ + [ctor "policyd<long, operation_1<long> >" "long"] \ + {policyd<long, operation_1<long> >::policyd} \ + {policyd<T, Policy>::policyd} +add {policyd<long, operation_1<long> >::~policyd} \ + [dtor "policyd<long, operation_1<long> >"] \ + - \ + {policyd<T, Policy>::~policyd} +add {policyd2::~policyd} \ + [dtor "policyd<long, operation_1<long> >"] \ + {policyd<long, operation_1<long> >::~policyd} \ + {policyd<T, Policy>::~policyd} +add {policyd<char, operation_1<char> >::policyd} \ + [ctor "policyd<char, operation_1<char> >" "char"] \ + - \ + {policyd<T, Policy>::policyd} +add {policyd3::policyd} \ + [ctor "policyd<char, operation_1<char> >" "char"] \ + {policyd<char, operation_1<char> >::policyd} \ + {policyd<T, Policy>::policyd} +add {policyd<char, operation_1<char> >::~policyd} \ + [dtor "policyd<char, operation_1<char> >"] \ + - \ + {policyd<T, Policy>::~policyd} +add {policyd3::~policyd} \ + [dtor "policyd<char, operation_1<char> >"] \ + {policyd<char, operation_1<char> >::~policyd} \ + {policyd<T, Policy>::~policyd} +add {policyd<base, operation_1<base> >::policyd} \ + [ctor "policyd<base, operation_1<base> >" "base"] \ + - \ + {policyd<T, Policy>::policyd} +add {policyd4::policyd} \ + [ctor "policyd<base, operation_1<base> >" "base"] \ + {policyd<base, operation_1<base> >::policyd} \ + {policyd<T, Policy>::policyd} +add {policyd<base, operation_1<base> >::~policyd} \ + [dtor "policyd<base, operation_1<base> >"] \ + - \ + {policyd<T, Policy>::~policyd} +add {policyd4::~policyd} \ + [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} \ + [ctor "policyd<tclass<int>, operation_1<tclass<int> > >" "tclass<int>"] \ + - \ + {policyd<T, Policy>::policyd} +add {policyd5::policyd} \ + [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} \ + [dtor "policyd<tclass<int>, operation_1<tclass<int> > >"] \ + - \ + {policyd<T, Policy>::~policyd} +add {policyd5::~policyd} \ + [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} \ + {void (void)} \ + {operation_1<int>::function}\ + {operation_1<T>::function} +add {policyd1::function} \ + {void (void)} \ + {operation_1<int>::function} \ + {operation_1<T>::function} +add {policyd2::function} \ + {void (void)} \ + {operation_1<long>::function} \ + {operation_1<T>::function} +add {policyd<char, operation_1<char> >::function} \ + {void (void)} \ + {operation_1<char>::function} \ + {operation_1<T>::function} +add {policyd3::function} \ + {void (void)} \ + {operation_1<char>::function} \ + {operation_1<T>::function} +add {policyd<base, operation_1<base> >::function} \ + {void (void)} \ + {operation_1<base>::function} \ + {operation_1<T>::function} +add {policyd4::function} \ + {void (void)} \ + {operation_1<base>::function} \ + {operation_1<T>::function} +add {policyd<tclass<int>, operation_1<tclass<int> > >::function} \ + {void (void)} \ + {operation_1<tclass<int> >::function} \ + {operation_1<T>::function} +add {policyd5::function} \ + {void (void)} \ + {operation_1<tclass<int> >::function} \ + {operation_1<T>::function} + +# Start the test +if {$tracelevel} { + strace $tracelevel +} + +if {[skip_cplus_tests]} { continue } + +# +# test running programs +# +set prms_id 0 +set bug_id 0 + +set testfile "cpexprs" +set srcfile "${testfile}.cc" +set binfile [file join $objdir $subdir $testfile] + +if {[gdb_compile [file join $srcdir $subdir $srcfile] $binfile \ + executable {debug c++}] != "" } { + untested "$testfile.exp" + return -1 +} + +if {[get_compiler_info $binfile "c++"]} { + return -1 +} + +gdb_exit +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" + +# "print METHOD" +foreach name [get_functions print] { + gdb_test "print $name" [get $name print] "print $name" +} + +# "list METHOD" +foreach name [get_functions list] { + gdb_test "list $name" [get $name list] "list $name" +} + +# Running to breakpoint -- use any function we can "list" +foreach name [get_functions list] { + # Skip "main", since test_breakpoint uses it + if {[string compare $name "main"] != 0} { + test_breakpoint $name + } +} + +gdb_exit +return 0 diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.cc b/gdb/testsuite/gdb.cp/cplusfuncs.cc index f4f78a6..11dba06 100644 --- a/gdb/testsuite/gdb.cp/cplusfuncs.cc +++ b/gdb/testsuite/gdb.cp/cplusfuncs.cc @@ -195,6 +195,12 @@ char * dm_type_char_star (char * p) { return p; } int dm_type_foo_ref (foo & foo) { return foo.ifoo; } int * dm_type_int_star (int * p) { return p; } long * dm_type_long_star (long * p) { return p; } +int dm_type_short (short i) { return i; } +int dm_type_long (long i) { return i; } int dm_type_unsigned_int (unsigned int i) { return i; } +int dm_type_unsigned_short (unsigned short i) { return i; } +int dm_type_unsigned_long (unsigned long i) { return i; } int dm_type_void (void) { return 0; } void * dm_type_void_star (void * p) { return p; } +typedef int myint; +int dm_type_typedef (myint i) { return i; } diff --git a/gdb/testsuite/gdb.cp/cplusfuncs.exp b/gdb/testsuite/gdb.cp/cplusfuncs.exp index f322586..443af7a 100644 --- a/gdb/testsuite/gdb.cp/cplusfuncs.exp +++ b/gdb/testsuite/gdb.cp/cplusfuncs.exp @@ -66,9 +66,25 @@ set dm_type_unsigned_int "unsigned" set dm_type_void "void" set dm_type_void_star "void*" +# Some other vagaries of GDB's type printing machinery. The integer types +# may have unsigned before or after their length, and may have "int" +# appended. The char* conversion operator may have name "char*" even if +# the type is "char *", because the name comes from the debug information +# and the type from GDB. Function types may not see through typedefs. + +set dm_type_short "short" +set dm_type_long "long" +set dm_type_unsigned_short "unsigned short" +set dm_type_unsigned_long "unsigned long" +set dm_operator_char_star "char*" +set dm_operator_char_star_quoted "char\\*" +set dm_type_typedef 0 + proc probe_demangler { } { global gdb_prompt global dm_operator_comma + global dm_operator_char_star + global dm_operator_char_star_quoted global dm_type_char_star global dm_type_char_star_quoted global dm_type_foo_ref @@ -77,6 +93,11 @@ proc probe_demangler { } { global dm_type_unsigned_int global dm_type_void global dm_type_void_star + global dm_type_short + global dm_type_unsigned_short + global dm_type_long + global dm_type_unsigned_long + global dm_type_typedef send_gdb "print &foo::operator,(foo&)\n" gdb_expect { @@ -97,6 +118,26 @@ proc probe_demangler { } { } } + send_gdb "print &foo::operator char*($dm_type_void)\n" + gdb_expect { + -re ".*foo::operator char \\*\\(void\\).*\r\n$gdb_prompt $" { + # v2 demangler or GDB type printer + set dm_operator_char_star "char *" + set dm_operator_char_star_quoted "char \\*" + pass "detect dm_operator_char_star" + } + -re ".*foo::operator char\\*\\(\\).*\r\n$gdb_prompt $" { + # v3 demangler + pass "detect dm_operator_char_star" + } + -re ".*$gdb_prompt $" { + fail "detect dm_operator_char_star" + } + timeout { + fail "detect dm_operator_char_star" + } + } + send_gdb "print &dm_type_char_star\n" gdb_expect { -re ".*dm_type_char_star\\(char \\*\\).*\r\n$gdb_prompt $" { @@ -166,6 +207,11 @@ proc probe_demangler { } { # v3 demangler pass "detect dm_type_long_star" } + -re ".*dm_type_long_star\\(long int \\*\\).*\r\n$gdb_prompt $" { + # GCC v3 and GDB's type printer + set dm_type_long_star "long int *" + pass "detect dm_type_long_star" + } -re ".*$gdb_prompt $" { fail "detect dm_type_long_star" } @@ -230,6 +276,101 @@ proc probe_demangler { } { fail "detect dm_type_void_star (timeout)" } } + + send_gdb "print &dm_type_short\n" + gdb_expect { + -re ".*dm_type_short\\(short\\).*\r\n$gdb_prompt $" { + # v2 and v3 demanglers + pass "detect dm_type_short" + } + -re ".*dm_type_short\\(short int\\).*\r\n$gdb_prompt $" { + # GDB type printer + set dm_type_short "short int" + pass "detect dm_type_short" + } + -re ".*$gdb_prompt $" { + fail "detect dm_type_short" + } + timeout { + fail "detect dm_type_short (timeout)" + } + } + + send_gdb "print &dm_type_unsigned_short\n" + gdb_expect { + -re ".*dm_type_unsigned_short\\(unsigned short\\).*\r\n$gdb_prompt $" { + # v2 and v3 demanglers + pass "detect dm_type_unsigned_short" + } + -re ".*dm_type_unsigned_short\\(short unsigned int\\).*\r\n$gdb_prompt $" { + # GDB type printer + set dm_type_unsigned_short "short unsigned int" + pass "detect dm_type_unsigned_short" + } + -re ".*$gdb_prompt $" { + fail "detect dm_type_unsigned_short" + } + timeout { + fail "detect dm_type_unsigned_short (timeout)" + } + } + + send_gdb "print &dm_type_long\n" + gdb_expect { + -re ".*dm_type_long\\(long\\).*\r\n$gdb_prompt $" { + # v2 and v3 demanglers + pass "detect dm_type_long" + } + -re ".*dm_type_long\\(long int\\).*\r\n$gdb_prompt $" { + # GDB type printer + set dm_type_long "long int" + pass "detect dm_type_long" + } + -re ".*$gdb_prompt $" { + fail "detect dm_type_long" + } + timeout { + fail "detect dm_type_long (timeout)" + } + } + + send_gdb "print &dm_type_unsigned_long\n" + gdb_expect { + -re ".*dm_type_unsigned_long\\(unsigned long\\).*\r\n$gdb_prompt $" { + # v2 and v3 demanglers + pass "detect dm_type_unsigned_long" + } + -re ".*dm_type_unsigned_long\\(long unsigned int\\).*\r\n$gdb_prompt $" { + # GDB type printer + set dm_type_unsigned_long "long unsigned int" + pass "detect dm_type_unsigned_long" + } + -re ".*$gdb_prompt $" { + fail "detect dm_type_unsigned_long" + } + timeout { + fail "detect dm_type_unsigned_long (timeout)" + } + } + + send_gdb "print &dm_type_typedef\n" + gdb_expect { + -re ".*dm_type_typedef\\(int\\).*\r\n$gdb_prompt $" { + # v2 and v3 demanglers + pass "detect dm_type_typedef" + } + -re ".*dm_type_typedef\\(myint\\).*\r\n$gdb_prompt $" { + # GDB type printer + set dm_type_typedef 1 + pass "detect dm_type_typedef" + } + -re ".*$gdb_prompt $" { + fail "detect dm_type_typedef" + } + timeout { + fail "detect dm_type_typedef (timeout)" + } + } } # @@ -351,8 +492,9 @@ proc print_addr { name } { proc test_lookup_operator_functions {} { global dm_operator_comma + global dm_operator_char_star global dm_type_char_star - global dm_type_char_star_quoted + global dm_operator_char_star_quoted global dm_type_foo_ref global dm_type_void global dm_type_void_star @@ -410,8 +552,8 @@ proc test_lookup_operator_functions {} { info_func "operator int(" "int foo::operator int($dm_type_void);" info_func "operator()(" "void foo::operator()($dm_type_foo_ref);" - info_func "operator $dm_type_char_star_quoted\(" \ - "char *foo::operator $dm_type_char_star\($dm_type_void);" + info_func "operator $dm_operator_char_star_quoted\(" \ + "char *foo::operator $dm_operator_char_star\($dm_type_void);" } @@ -426,6 +568,7 @@ proc test_paddr_operator_functions {} { global dm_type_unsigned_int global dm_type_void global dm_type_void_star + global dm_operator_char_star print_addr "foo::operator*($dm_type_foo_ref)" print_addr "foo::operator%($dm_type_foo_ref)" @@ -479,7 +622,7 @@ proc test_paddr_operator_functions {} { } print_addr "foo::operator int($dm_type_void)" - print_addr "foo::operator $dm_type_char_star\($dm_type_void)" + print_addr "foo::operator $dm_operator_char_star\($dm_type_void)" } # @@ -489,17 +632,21 @@ proc test_paddr_operator_functions {} { proc test_paddr_overloaded_functions {} { global dm_type_unsigned_int global dm_type_void + global dm_type_short + global dm_type_unsigned_short + global dm_type_long + global dm_type_unsigned_long print_addr "overload1arg($dm_type_void)" print_addr "overload1arg(char)" print_addr "overload1arg(signed char)" print_addr "overload1arg(unsigned char)" - print_addr "overload1arg(short)" - print_addr "overload1arg(unsigned short)" + print_addr "overload1arg($dm_type_short)" + print_addr "overload1arg($dm_type_unsigned_short)" print_addr "overload1arg(int)" print_addr "overload1arg($dm_type_unsigned_int)" - print_addr "overload1arg(long)" - print_addr "overload1arg(unsigned long)" + print_addr "overload1arg($dm_type_long)" + print_addr "overload1arg($dm_type_unsigned_long)" print_addr "overload1arg(float)" print_addr "overload1arg(double)" @@ -522,17 +669,31 @@ proc test_paddr_hairy_functions {} { global dm_type_char_star global dm_type_int_star global dm_type_long_star + global dm_type_typedef print_addr_2 "hairyfunc1" "hairyfunc1(int)" - print_addr_2 "hairyfunc2" "hairyfunc2(int (*)($dm_type_char_star))" - print_addr_2 "hairyfunc3" "hairyfunc3(int (*)(short (*)($dm_type_long_star)))" - print_addr_2 "hairyfunc4" "hairyfunc4(int (*)(short (*)($dm_type_char_star)))" - - # gdb-gnats bug gdb/19: - # "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7" - print_addr_2_kfail "hairyfunc5" "hairyfunc5(int (*(*)($dm_type_char_star))(long))" "hairyfunc5(int (*)(long) (*)(char*))" "gdb/19" - print_addr_2_kfail "hairyfunc6" "hairyfunc6(int (*(*)($dm_type_int_star))(long))" "hairyfunc6(int (*)(long) (*)(int*))" "gdb/19" - print_addr_2_kfail "hairyfunc7" "hairyfunc7(int (*(*)(int (*)($dm_type_char_star)))(long))" "hairyfunc7(int (*)(long) (*)(int (*)(char*)))" "gdb/19" + + if {$dm_type_typedef == 0} { + print_addr_2 "hairyfunc2" "hairyfunc2(int (*)($dm_type_char_star))" + print_addr_2 "hairyfunc3" "hairyfunc3(int (*)(short (*)($dm_type_long_star)))" + print_addr_2 "hairyfunc4" "hairyfunc4(int (*)(short (*)($dm_type_char_star)))" + + # gdb-gnats bug gdb/19: + # "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7" + print_addr_2_kfail "hairyfunc5" "hairyfunc5(int (*(*)($dm_type_char_star))(long))" "hairyfunc5(int (*)(long) (*)(char*))" "gdb/19" + print_addr_2_kfail "hairyfunc6" "hairyfunc6(int (*(*)($dm_type_int_star))(long))" "hairyfunc6(int (*)(long) (*)(int*))" "gdb/19" + print_addr_2_kfail "hairyfunc7" "hairyfunc7(int (*(*)(int (*)($dm_type_char_star)))(long))" "hairyfunc7(int (*)(long) (*)(int (*)(char*)))" "gdb/19" + } else { + print_addr_2 "hairyfunc2" "hairyfunc2(PFPc_i)" + print_addr_2 "hairyfunc3" "hairyfunc3(PFPFPl_s_i)" + print_addr_2 "hairyfunc4" "hairyfunc4(PFPFPc_s_i)" + + # gdb-gnats bug gdb/19: + # "gdb v3 demangler fails on hairyfunc5 hairyfunc6 hairyfunc7" + print_addr_2 "hairyfunc5" "hairyfunc5(PFPc_PFl_i)" + print_addr_2 "hairyfunc6" "hairyfunc6(PFPi_PFl_i)" + print_addr_2 "hairyfunc7" "hairyfunc7(PFPFPc_i_PFl_i)" + } } proc do_tests {} { diff --git a/gdb/testsuite/gdb.cp/exception.exp b/gdb/testsuite/gdb.cp/exception.exp index 47890f1..03c8847 100644 --- a/gdb/testsuite/gdb.cp/exception.exp +++ b/gdb/testsuite/gdb.cp/exception.exp @@ -146,7 +146,9 @@ gdb_test_multiple "continue" $name { set name "backtrace after first throw" gdb_test_multiple "backtrace" $name { - -re ".*#\[0-9\]+${ws}($hex in |)__cxa_throw.*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:\[0-9\]+\r\n#\[0-9\]+${ws}$hex in main \\(.*\\) at .*${srcfile}:\[0-9\]+\r\n$gdb_prompt $" { + -re ".*#\[0-9\]+.*\[\[:<:\]\]__cxa_throw\[\[:>:\]\].*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:\[0-9\]+\r\n#\[0-9\]+${ws}$hex in main \\(.*\\) at .*${srcfile}:\[0-9\]+\r\n$gdb_prompt $" { + # Either __cxxabiv1::__cxa_throw or __cxa_throw can be printed + # depending on debug info presence. pass $name } } @@ -168,7 +170,7 @@ gdb_test_multiple "continue" $name { set name "backtrace after first catch" gdb_test_multiple "backtrace" $name { - -re ".*#\[0-9\]+${ws}($hex in |)__cxa_begin_catch.*#\[0-9\]+${ws}$hex in main \\(.*\\) at .*$srcfile:\[0-9\]+\r\n$gdb_prompt $" { + -re ".*#\[0-9\]+.*\[\[:<:\]\]__cxa_begin_catch\[\[:>:\]\].*#\[0-9\]+${ws}$hex in main \\(.*\\) at .*$srcfile:\[0-9\]+\r\n$gdb_prompt $" { pass $name } } @@ -190,7 +192,7 @@ gdb_test_multiple "continue" $name { set name "backtrace after second throw" gdb_test_multiple "backtrace" $name { - -re ".*#\[0-9\]+${ws}($hex in |)__cxa_throw.*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:\[0-9\]+\r\n#\[0-9\]+${ws}$hex in main \\(.*\\) at .*${srcfile}:\[0-9\]+\r\n$gdb_prompt $" { + -re ".*#\[0-9\]+.*\[\[:<:\]\]__cxa_throw\[\[:>:\]\].*#\[0-9\]+${ws}$hex in foo \\(i=20\\) at .*${srcfile}:\[0-9\]+\r\n#\[0-9\]+${ws}$hex in main \\(.*\\) at .*${srcfile}:\[0-9\]+\r\n$gdb_prompt $" { pass $name } } @@ -212,7 +214,7 @@ gdb_test_multiple "continue" $name { set name "backtrace after second catch" gdb_test_multiple "backtrace" $name { - -re ".*#\[0-9\]+${ws}($hex in |)__cxa_begin_catch.*#\[0-9\]+${ws}$hex in main \\(.*\\) at .*$srcfile:\[0-9\]+\r\n$gdb_prompt $" { + -re ".*#\[0-9\]+.*\[\[:<:\]\]__cxa_begin_catch\[\[:>:\]\].*#\[0-9\]+${ws}$hex in main \\(.*\\) at .*$srcfile:\[0-9\]+\r\n$gdb_prompt $" { pass $name } } diff --git a/gdb/testsuite/gdb.cp/expand-sals.exp b/gdb/testsuite/gdb.cp/expand-sals.exp index 25ec4a9..e4fd59b 100644 --- a/gdb/testsuite/gdb.cp/expand-sals.exp +++ b/gdb/testsuite/gdb.cp/expand-sals.exp @@ -46,7 +46,7 @@ gdb_continue_to_breakpoint "caller" ".*caller-line.*" # Test GDB caught this return call and not the next one through B::B() gdb_test "bt" \ - "#0 \[^\r\n\]* A \[^\r\n\]*\r\n#1 \[^\r\n\]* main \[^\r\n\]*" \ + "#0 \[^\r\n\]* (A::)?A \[^\r\n\]*\r\n#1 \[^\r\n\]* main \[^\r\n\]*" \ "bt from A" gdb_continue_to_breakpoint "next caller func" ".*func-line.*" diff --git a/gdb/testsuite/gdb.cp/member-ptr.exp b/gdb/testsuite/gdb.cp/member-ptr.exp index 6832f3b..083a329 100644 --- a/gdb/testsuite/gdb.cp/member-ptr.exp +++ b/gdb/testsuite/gdb.cp/member-ptr.exp @@ -420,7 +420,7 @@ gdb_test_multiple "ptype pmf" $name { set name "print pmf" gdb_test_multiple "print pmf" $name { - -re "$vhn = $hex <A::bar\\(int\\)>\r\n$gdb_prompt $" { + -re "$vhn = \\(int \\(A::\\*\\)\\(A \\*, int\\)\\) $hex <A::bar\\(int\\)>\r\n$gdb_prompt $" { pass $name } -re "$vhn = .*not supported with HP aCC.*\r\n$gdb_prompt $" { @@ -608,6 +608,8 @@ gdb_test_multiple "print (a.*pmf)(3)" $name { } } +gdb_test "ptype a.*pmf" "type = int \\(A \\*, int\\)" + # Print out a pointer to data member which requires looking into # a base class. gdb_test "print diamond_pmi" "$vhn = &Base::x" @@ -658,5 +660,5 @@ gdb_test "print null_pmi = &A::j" "$vhn = &A::j" gdb_test "print null_pmi = 0" "$vhn = NULL" gdb_test "print null_pmf" "$vhn = NULL" -gdb_test "print null_pmf = &A::foo" "$vhn = $hex <A::foo ?\\(int\\)>" +gdb_test "print null_pmf = &A::foo" "$vhn = \\(int \\(A::\\*\\)\\(A \\*, int\\)\\) $hex <A::foo ?\\(int\\)>" gdb_test "print null_pmf = 0" "$vhn = NULL" diff --git a/gdb/testsuite/gdb.cp/overload.exp b/gdb/testsuite/gdb.cp/overload.exp index c6d8bff..f879685 100644 --- a/gdb/testsuite/gdb.cp/overload.exp +++ b/gdb/testsuite/gdb.cp/overload.exp @@ -74,12 +74,12 @@ set re_methods "${re_methods}${ws}int overload1arg\\((void|)\\);" set re_methods "${re_methods}${ws}int overload1arg\\(char\\);" set re_methods "${re_methods}${ws}int overload1arg\\(signed char\\);" set re_methods "${re_methods}${ws}int overload1arg\\(unsigned char\\);" -set re_methods "${re_methods}${ws}int overload1arg\\(short\\);" -set re_methods "${re_methods}${ws}int overload1arg\\(unsigned short\\);" +set re_methods "${re_methods}${ws}int overload1arg\\(short( int)?\\);" +set re_methods "${re_methods}${ws}int overload1arg\\((unsigned short|short unsigned)( int)?\\);" set re_methods "${re_methods}${ws}int overload1arg\\(int\\);" set re_methods "${re_methods}${ws}int overload1arg\\(unsigned int\\);" -set re_methods "${re_methods}${ws}int overload1arg\\(long\\);" -set re_methods "${re_methods}${ws}int overload1arg\\(unsigned long\\);" +set re_methods "${re_methods}${ws}int overload1arg\\(long( int)?\\);" +set re_methods "${re_methods}${ws}int overload1arg\\((unsigned long|long unsigned)( int)?\\);" set re_methods "${re_methods}${ws}int overload1arg\\(float\\);" set re_methods "${re_methods}${ws}int overload1arg\\(double\\);" set re_methods "${re_methods}${ws}int overloadfnarg\\((void|)\\);" diff --git a/gdb/testsuite/gdb.cp/ovldbreak.exp b/gdb/testsuite/gdb.cp/ovldbreak.exp index 5b06b31..31ef63e 100644 --- a/gdb/testsuite/gdb.cp/ovldbreak.exp +++ b/gdb/testsuite/gdb.cp/ovldbreak.exp @@ -23,7 +23,8 @@ # overloaded member functions # - +global timeout +set timeout 15 if $tracelevel then { strace $tracelevel } @@ -127,10 +128,24 @@ proc set_bp_overloaded {name expectedmenu mychoice bpnumber linenumber} { } # This is the expected menu for overload1arg. -# Note the arg type variations on lines 6 and 13. +# Note the arg type variations for void and integer types. # This accommodates different versions of g++. -set menu_overload1arg "\\\[0\\\] cancel\r\n\\\[1\\\] all\r\n\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n\\\[4\\\] foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r\n\\\[5\\\] foo::overload1arg\\(long\\) at.*$srcfile:118\r\n\\\[6\\\] foo::overload1arg\\((unsigned int|unsigned)\\) at.*$srcfile:117\r\n\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n\\\[8\\\] foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r\n\\\[9\\\] foo::overload1arg\\(short\\) at.*$srcfile:114\r\n\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n\\\[13\\\] foo::overload1arg\\((void|)\\) at.*$srcfile:110\r\n> $" +set menu_overload1arg "\\\[0\\\] cancel\r\n" +append menu_overload1arg "\\\[1\\\] all\r\n" +append menu_overload1arg "\\\[2\\\] foo::overload1arg\\(double\\) at.*$srcfile:121\r\n" +append menu_overload1arg "\\\[3\\\] foo::overload1arg\\(float\\) at.*$srcfile:120\r\n" +append menu_overload1arg "\\\[4\\\] foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r\n" +append menu_overload1arg "\\\[5\\\] foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r\n" +append menu_overload1arg "\\\[6\\\] foo::overload1arg\\((unsigned int|unsigned)\\) at.*$srcfile:117\r\n" +append menu_overload1arg "\\\[7\\\] foo::overload1arg\\(int\\) at.*$srcfile:116\r\n" +append menu_overload1arg "\\\[8\\\] foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r\n" +append menu_overload1arg "\\\[9\\\] foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r\n" +append menu_overload1arg "\\\[10\\\] foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r\n" +append menu_overload1arg "\\\[11\\\] foo::overload1arg\\(signed char\\) at.*$srcfile:112\r\n" +append menu_overload1arg "\\\[12\\\] foo::overload1arg\\(char\\) at.*$srcfile:111\r\n" +append menu_overload1arg "\\\[13\\\] foo::overload1arg\\((void|)\\) at.*$srcfile:110\r\n" +append menu_overload1arg "> $" # Set multiple-symbols to "ask", to allow us to test the use # of the multiple-choice menu when breaking on an overloaded method. @@ -157,17 +172,17 @@ set_bp_overloaded "foo::overload1arg" "$menu_overload1arg" 13 13 110 gdb_test "info break" \ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main at.*$srcfile:49\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\r \[\t \]+breakpoint already hit 1 time\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short\\) at.*$srcfile:114\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long\\) at.*$srcfile:118\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ @@ -215,17 +230,17 @@ gdb_expect { gdb_test "info break" \ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main at.*$srcfile:49\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in main(\\((|void)\\))? at.*$srcfile:49\r \[\t \]+breakpoint already hit 1 time\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short\\) at.*$srcfile:114\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long\\) at.*$srcfile:118\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((void|)\\) at.*$srcfile:110" \ @@ -296,12 +311,12 @@ gdb_test "info break" \ "Num Type\[\t \]+Disp Enb Address\[\t \]+What.* \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(double\\) at.*$srcfile:121\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(float\\) at.*$srcfile:120\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned long\\) at.*$srcfile:119\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long\\) at.*$srcfile:118\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned long|long unsigned)( int)?\\) at.*$srcfile:119\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(long( int)?\\) at.*$srcfile:118\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned|unsigned int)\\) at.*$srcfile:117\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(int\\) at.*$srcfile:116\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned short\\) at.*$srcfile:115\r -\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short\\) at.*$srcfile:114\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\((unsigned short|short unsigned)( int)?\\) at.*$srcfile:115\r +\[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(short( int)?\\) at.*$srcfile:114\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(unsigned char\\) at.*$srcfile:113\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(signed char\\) at.*$srcfile:112\r \[0-9\]+\[\t \]+breakpoint keep y\[\t \]+$hex\[\t \]+in foo::overload1arg\\(char\\) at.*$srcfile:111\r diff --git a/gdb/testsuite/gdb.java/jmain.exp b/gdb/testsuite/gdb.java/jmain.exp index ab952473..9814921 100644 --- a/gdb/testsuite/gdb.java/jmain.exp +++ b/gdb/testsuite/gdb.java/jmain.exp @@ -65,7 +65,7 @@ gdb_test "break jmain.main" "${bpmain}" # Check that a fully qualified "main" works. gdb_load "${binfile}" -set cmd "break \'${testfile}.main(java.lang.String\[\])\'" +set cmd "break ${testfile}.main(java.lang.String\[\])" set msg $cmd gdb_test_multiple $cmd $msg { -re "${bpmain}\r\n$gdb_prompt $" { @@ -79,7 +79,7 @@ gdb_test_multiple $cmd $msg { gdb_test "n" "" "" # Check again with a method signature at the end. - set cmd "break \'${testfile}.main(java.lang.String\[\])void\'" + set cmd "break ${testfile}.main(java.lang.String\[\])void" set msg $cmd gdb_test_multiple $cmd $msg { -re "${bpmain}\r\n$gdb_prompt $" { diff --git a/gdb/testsuite/gdb.java/jmisc.exp b/gdb/testsuite/gdb.java/jmisc.exp index 6f7188d..e3ab657 100644 --- a/gdb/testsuite/gdb.java/jmisc.exp +++ b/gdb/testsuite/gdb.java/jmisc.exp @@ -71,8 +71,8 @@ if ![set_lang_java] then { # signature. runto_main set function "${testfile}.main(java.lang.String\[\])" - gdb_breakpoint "\'$function\'" { allow-pending } - gdb_breakpoint "\'${function}void\'" { allow-pending } + gdb_breakpoint "$function" { allow-pending } + gdb_breakpoint "${function}void" { allow-pending } gdb_continue_to_breakpoint $function send_gdb "ptype jmisc\n" diff --git a/gdb/testsuite/gdb.java/jprint.exp b/gdb/testsuite/gdb.java/jprint.exp index 29dbf4b..447ca73 100644 --- a/gdb/testsuite/gdb.java/jprint.exp +++ b/gdb/testsuite/gdb.java/jprint.exp @@ -70,8 +70,8 @@ if ![set_lang_java] then { # signature. runto_main set function "${testfile}.main(java.lang.String\[\])" - gdb_breakpoint "\'$function\'" { allow-pending } - gdb_breakpoint "\'${function}void\'" { allow-pending } + gdb_breakpoint "$function" { allow-pending } + gdb_breakpoint "${function}void" { allow-pending } gdb_continue_to_breakpoint $function gdb_test "p jvclass.addprint(4,5,6)" "sum is 15\r\n.*" "unambiguous static call" diff --git a/gdb/testsuite/gdb.python/py-symbol.exp b/gdb/testsuite/gdb.python/py-symbol.exp index 6eaa943..3ad978b 100644 --- a/gdb/testsuite/gdb.python/py-symbol.exp +++ b/gdb/testsuite/gdb.python/py-symbol.exp @@ -128,5 +128,5 @@ gdb_test "python print cplusfunc.is_argument" "False" "Test func.is_argument" gdb_test "python print cplusfunc.is_function" "True" "Test func.is_function" gdb_test "python print cplusfunc.name" "SimpleClass::valueofi().*" "Test func.name" gdb_test "python print cplusfunc.print_name" "SimpleClass::valueofi().*" "Test func.print_name" -gdb_test "python print cplusfunc.linkage_name" "_ZN11SimpleClass8valueofiEv" "Test func.linkage_name" +gdb_test "python print cplusfunc.linkage_name" "SimpleClass::valueofi().*" "Test func.linkage_name" gdb_test "python print cplusfunc.addr_class == gdb.SYMBOL_LOC_BLOCK" "True" "Test func.addr_class" |