diff --git a/gdb/testsuite/gdb.hp/hwwatchbus.c b/gdb/testsuite/gdb.hp/hwwatchbus.c new file mode 100644 index 0000000000..7a02c9b449 --- /dev/null +++ b/gdb/testsuite/gdb.hp/hwwatchbus.c @@ -0,0 +1,9 @@ +/* This program raises a SIGBUS signal on HP-UX when the + pointer "bogus_p" is dereferenced. + */ +int * bogus_p = (int *)3; + +main() +{ + *bogus_p = 0xdeadbeef; +} diff --git a/gdb/testsuite/gdb.hp/hwwatchbus.exp b/gdb/testsuite/gdb.hp/hwwatchbus.exp new file mode 100644 index 0000000000..d4899a997e --- /dev/null +++ b/gdb/testsuite/gdb.hp/hwwatchbus.exp @@ -0,0 +1,84 @@ +# Copyright (C) 1997, 1998 Free Software Foundation, Inc. + +# 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 2 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +if $tracelevel then { + strace $tracelevel + } + +set prms_id 0 +set bug_id 0 + +# are we on a target board +if ![isnative] then { + return +} + +if { ![istarget "hppa*-*-hpux10.30"] && ![istarget "hppa*-*-hpux11.*"] } { + verbose "HPUX h/w watch test ignored for non-hppa or pre-HP/UX-10.30 targets." + return 0 +} + +set testfile "hwwatchbus" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +# build the first test case +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + +if [get_compiler_info ${binfile}] { + return -1 +} + +# Start with a fresh gdb + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + + +# We ought to be able to set a hardware watchpoint, step, and +# get a SIGBUS signal reported. +# +if ![runto_main] then { + fail "can't run to main" + return 0 +} + +send_gdb "watch bogus_p\n" +gdb_expect { + -re "Hardware watchpoint \[0-9\]*: bogus_p.*$gdb_prompt $"\ + {pass "set h/w watchpoint"} + -re "$gdb_prompt $"\ + {fail "set h/w watchpoint"} + timeout {fail "(timeout) set h/w watchpoint"} +} + +send_gdb "step\n" +gdb_expect { + -re "Program received signal SIGBUS, Bus error.* in main .*${srcfile}:8.*$gdb_prompt $"\ + {pass "see real SIGBUS when h/w watchpoint set"} + -re "$gdb_prompt $"\ + {fail "see real SIGBUS when h/w watchpoint set"} + timeout {fail "(timeout) see real SIGBUS when h/w watchpoint set"} +} + +return 0 diff --git a/gdb/testsuite/gdb.hp/templates-hp.cc b/gdb/testsuite/gdb.hp/templates-hp.cc deleted file mode 100644 index 25241dc6db..0000000000 --- a/gdb/testsuite/gdb.hp/templates-hp.cc +++ /dev/null @@ -1,785 +0,0 @@ -/* This test code is from Wendell Baker (wbaker@comet.berkeley.edu) */ - -#include - -int a_i; -char a_c; -double a_d; - -typedef void *Pix; - -int -f(int i) -{ return 0; } - -int -f(int i, char c) -{ return 0; } - -int -f(int i, char c, double d) -{ return 0; } - -int -f(int i, char c, double d, char *cs) -{ return 0; } - -int -f(int i, char c, double d, char *cs, void (*fig)(int, char)) -{ return 0; } - -int -f(int i, char c, double d, char *cs, void (*fig)(char, int)) -{ return 0; } - -class R { -public: - int i; -}; -class S { -public: - int i; -}; -class T { -public: - int i; -}; - -char g(char, const char, volatile char) -{ return 'c'; } -char g(R, char&, const char&, volatile char&) -{ return 'c'; } -char g(char*, const char*, volatile char*) -{ return 'c'; } -char g(S, char*&, const char*&, volatile char*&) -{ return 'c'; } - -signed char g(T,signed char, const signed char, volatile signed char) -{ return 'c'; } -signed char g(T, R, signed char&, const signed char&, volatile signed char&) -{ return 'c'; } -signed char g(T, signed char*, const signed char*, volatile signed char*) -{ return 'c'; } -signed char g(T, S, signed char*&, const signed char*&, volatile signed char*&) -{ return 'c'; } - -unsigned char g(unsigned char, const unsigned char, volatile unsigned char) -{ return 'c'; } -unsigned char g(R, unsigned char&, const unsigned char&, volatile unsigned char&) -{ return 'c'; } -unsigned char g(unsigned char*, const unsigned char*, volatile unsigned char*) -{ return 'c'; } -unsigned char g(S, unsigned char*&, const unsigned char*&, volatile unsigned char*&) -{ return 'c'; } - -short g(short, const short, volatile short) -{ return 0; } -short g(R, short&, const short&, volatile short&) -{ return 0; } -short g(short*, const short*, volatile short*) -{ return 0; } -short g(S, short*&, const short*&, volatile short*&) -{ return 0; } - -signed short g(T, signed short, const signed short, volatile signed short) -{ return 0; } -signed short g(T, R, signed short&, const signed short&, volatile signed short&) -{ return 0; } -signed short g(T, signed short*, const signed short*, volatile signed short*) -{ return 0; } -signed short g(T, S, double, signed short*&, const signed short*&, volatile signed short*&) -{ return 0; } - -unsigned short g(unsigned short, const unsigned short, volatile unsigned short) -{ return 0; } -unsigned short g(R, unsigned short&, const unsigned short&, volatile unsigned short&) -{ return 0; } -unsigned short g(unsigned short*, const unsigned short*, volatile unsigned short*) -{ return 0; } -unsigned short g(S, unsigned short*&, const unsigned short*&, volatile unsigned short*&) -{ return 0; } - -int g(int, const int, volatile int) -{ return 0; } -int g(R, int&, const int&, volatile int&) -{ return 0; } -int g(int*, const int*, volatile int*) -{ return 0; } -int g(S, int*&, const int*&, volatile int*&) -{ return 0; } - -signed int g(T, signed int, const signed int, volatile signed int) -{ return 0; } -signed int g(T, R, signed int&, const signed int&, volatile signed int&) -{ return 0; } -signed int g(T, signed int*, const signed int*, volatile signed int*) -{ return 0; } -signed int g(T, S, signed int*&, const signed int*&, volatile signed int*&) -{ return 0; } - -unsigned int g(unsigned int, const unsigned int, volatile unsigned int) -{ return 0; } -unsigned int g(R, unsigned int&, const unsigned int&, volatile unsigned int&) -{ return 0; } -unsigned int g(unsigned int*, const unsigned int*, volatile unsigned int*) -{ return 0; } -unsigned int g(S, unsigned int*&, const unsigned int*&, volatile unsigned int*&) -{ return 0; } - -long g(long, const long, volatile long) -{ return 0; } -long g(R, long&, const long&, volatile long&) -{ return 0; } -long g(long*, const long*, volatile long*) -{ return 0; } -long g(S, long*&, const long*&, volatile long*&) -{ return 0; } - -signed long g(T, signed long, const signed long, volatile signed long) -{ return 0; } -signed long g(T, R, signed long&, const signed long&, volatile signed long&) -{ return 0; } -signed long g(T, signed long*, const signed long*, volatile signed long*) -{ return 0; } -signed long g(T, S, signed long*&, const signed long*&, volatile signed long*&) -{ return 0; } - -unsigned long g(unsigned long, const unsigned long, volatile unsigned long) -{ return 0; } -unsigned long g(S, unsigned long&, const unsigned long&, volatile unsigned long&) -{ return 0; } -unsigned long g(unsigned long*, const unsigned long*, volatile unsigned long*) -{ return 0; } -unsigned long g(S, unsigned long*&, const unsigned long*&, volatile unsigned long*&) -{ return 0; } - -#ifdef __GNUC__ -long long g(long long, const long long, volatile long long) -{ return 0; } -long long g(S, long long&, const long long&, volatile long long&) -{ return 0; } -long long g(long long*, const long long*, volatile long long*) -{ return 0; } -long long g(R, long long*&, const long long*&, volatile long long*&) -{ return 0; } - -signed long long g(T, signed long long, const signed long long, volatile signed long long) -{ return 0; } -signed long long g(T, R, signed long long&, const signed long long&, volatile signed long long&) -{ return 0; } -signed long long g(T, signed long long*, const signed long long*, volatile signed long long*) -{ return 0; } -signed long long g(T, S, signed long long*&, const signed long long*&, volatile signed long long*&) -{ return 0; } - -unsigned long long g(unsigned long long, const unsigned long long, volatile unsigned long long) -{ return 0; } -unsigned long long g(R, unsigned long long*, const unsigned long long*, volatile unsigned long long*) -{ return 0; } -unsigned long long g(unsigned long long&, const unsigned long long&, volatile unsigned long long&) -{ return 0; } -unsigned long long g(S, unsigned long long*&, const unsigned long long*&, volatile unsigned long long*&) -{ return 0; } -#endif - -float g(float, const float, volatile float) -{ return 0; } -float g(char, float&, const float&, volatile float&) -{ return 0; } -float g(float*, const float*, volatile float*) -{ return 0; } -float g(char, float*&, const float*&, volatile float*&) -{ return 0; } - -double g(double, const double, volatile double) -{ return 0; } -double g(char, double&, const double&, volatile double&) -{ return 0; } -double g(double*, const double*, volatile double*) -{ return 0; } -double g(char, double*&, const double*&, volatile double*&) -{ return 0; } - -#ifdef __GNUC__ -long double g(long double, const long double, volatile long double) -{ return 0; } -long double g(char, long double&, const long double&, volatile long double&) -{ return 0; } -long double g(long double*, const long double*, volatile long double*) -{ return 0; } -long double g(char, long double*&, const long double*&, volatile long double*&) -{ return 0; } -#endif - -class c { -public: - c(int) {}; - int i; -}; - -class c g(c, const c, volatile c) -{ return 0; } -c g(char, c&, const c&, volatile c&) -{ return 0; } -c g(c*, const c*, volatile c*) -{ return 0; } -c g(char, c*&, const c*&, volatile c*&) -{ return 0; } - -/* -void h(char = 'a') -{ } -void h(char, signed char = 'a') -{ } -void h(unsigned char = 'a') -{ } -*/ -/* -void h(char = (char)'a') -{ } -void h(char, signed char = (signed char)'a') -{ } -void h(unsigned char = (unsigned char)'a') -{ } - - -void h(short = (short)43) -{ } -void h(char, signed short = (signed short)43) -{ } -void h(unsigned short = (unsigned short)43) -{ } - -void h(int = (int)43) -{ } -void h(char, signed int = (signed int)43) -{ } -void h(unsigned int = (unsigned int)43) -{ } - - -void h(long = (long)43) -{ } -void h(char, signed long = (signed long)43) -{ } -void h(unsigned long = (unsigned long)43) -{ } - -#ifdef __GNUC__ -void h(long long = 43) -{ } -void h(char, signed long long = 43) -{ } -void h(unsigned long long = 43) -{ } -#endif - -void h(float = 4.3e-10) -{ } -void h(double = 4.3) -{ } -#ifdef __GNUC__ -void h(long double = 4.33e33) -{ } -#endif -*/ -void printf(const char *format, ... ) -{ - // elipsis -} - -class T1 { -public: - static void* operator new(size_t); - static void operator delete(void *pointer); - - void operator=(const T1&); - T1& operator=(int); - - int operator==(int) const; - int operator==(const T1&) const; - int operator!=(int) const; - int operator!=(const T1&) const; - - int operator<=(int) const; - int operator<=(const T1&) const; - int operator<(int) const; - int operator<(const T1&) const; - int operator>=(int) const; - int operator>=(const T1&) const; - int operator>(int) const; - int operator>(const T1&) const; - - void operator+(int) const; - T1& operator+(const T1&) const; - void operator+=(int) const; - T1& operator+=(const T1&) const; - - T1& operator++() const; - - void operator-(int) const; - T1& operator-(const T1&) const; - void operator-=(int) const; - T1& operator-=(const T1&) const; - - T1& operator--() const; - - void operator*(int) const; - T1& operator*(const T1&) const; - void operator*=(int) const; - T1& operator*=(const T1&) const; - - void operator/(int) const; - T1& operator/(const T1&) const; - void operator/=(int) const; - T1& operator/=(const T1&) const; - - void operator%(int) const; - T1& operator%(const T1&) const; - void operator%=(int) const; - T1& operator%=(const T1&) const; - - void operator&&(int) const; - T1& operator&&(const T1&) const; - - void operator||(int) const; - T1& operator||(const T1&) const; - - void operator&(int) const; - T1& operator&(const T1&) const; - void operator&=(int) const; - T1& operator&=(const T1&) const; - - void operator|(int) const; - T1& operator|(const T1&) const; - void operator|=(int) const; - T1& operator|=(const T1&) const; - - void operator^(int) const; - T1& operator^(const T1&) const; - void operator^=(int) const; - T1& operator^=(const T1&) const; - - T1& operator!() const; - T1& operator~() const; -}; - -void* -T1::operator new(size_t) -{ return 0; } - -void -T1::operator delete(void *pointer) -{ } - -class T2 { -public: - T2(int i): integer(i) - { } - int integer; -}; - -int operator==(const T2&, const T2&) -{ return 0; } -int operator==(const T2&, char) -{ return 0; } -int operator!=(const T2&, const T2&) -{ return 0; } -int operator!=(const T2&, char) -{ return 0; } - -int operator<=(const T2&, const T2&) -{ return 0; } -int operator<=(const T2&, char) -{ return 0; } -int operator<(const T2&, const T2&) -{ return 0; } -int operator<(const T2&, char) -{ return 0; } -int operator>=(const T2&, const T2&) -{ return 0; } -int operator>=(const T2&, char) -{ return 0; } -int operator>(const T2&, const T2&) -{ return 0; } -int operator>(const T2&, char) -{ return 0; } - -T2 operator+(const T2 t, int i) -{ return t.integer + i; } -T2 operator+(const T2 a, const T2& b) -{ return a.integer + b.integer; } -T2& operator+=(T2& t, int i) -{ t.integer += i; return t; } -T2& operator+=(T2& a, const T2& b) -{ a.integer += b.integer; return a; } - -T2 operator-(const T2 t, int i) -{ return t.integer - i; } -T2 operator-(const T2 a, const T2& b) -{ return a.integer - b.integer; } -T2& operator-=(T2& t, int i) -{ t.integer -= i; return t; } -T2& operator-=(T2& a, const T2& b) -{ a.integer -= b.integer; return a; } - -T2 operator*(const T2 t, int i) -{ return t.integer * i; } -T2 operator*(const T2 a, const T2& b) -{ return a.integer * b.integer; } -T2& operator*=(T2& t, int i) -{ t.integer *= i; return t; } -T2& operator*=(T2& a, const T2& b) -{ a.integer *= b.integer; return a; } - -T2 operator/(const T2 t, int i) -{ return t.integer / i; } -T2 operator/(const T2 a, const T2& b) -{ return a.integer / b.integer; } -T2& operator/=(T2& t, int i) -{ t.integer /= i; return t; } -T2& operator/=(T2& a, const T2& b) -{ a.integer /= b.integer; return a; } - -T2 operator%(const T2 t, int i) -{ return t.integer % i; } -T2 operator%(const T2 a, const T2& b) -{ return a.integer % b.integer; } -T2& operator%=(T2& t, int i) -{ t.integer %= i; return t; } -T2& operator%=(T2& a, const T2& b) -{ a.integer %= b.integer; return a; } - -template -class T5 { -public: - T5(int); - T5(const T5&); - ~T5(); - static void* operator new(size_t); - static void operator delete(void *pointer); - int value(); - - static T X; - T x; - int val; -}; - -template -T5::T5(int v) -{ val = v; } - -template -T5::T5(const T5&) -{} - -template -T5::~T5() -{} - -template -void* -T5::operator new(size_t) -{ return 0; } - -template -void -T5::operator delete(void *pointer) -{ } - -template -int -T5::value() -{ return val; } - - -#if ! defined(__GNUC__) || defined(GCC_BUG) -template -T T5::X; -#endif - - - - -T5 t5c(1); -T5 t5i(2); -T5 t5fi1(3); -T5 t5fi2(4); - - - - - - -class x { -public: - int (*manage[5])(double, - void *(*malloc)(unsigned size), - void (*free)(void *pointer)); - int (*device[5])(int open(const char *, unsigned mode, unsigned perms, int extra = 0), - int *(*read)(int fd, void *place, unsigned size), - int *(*write)(int fd, void *place, unsigned size), - void (*close)(int fd)); -}; -T5 t5x(5); - -#if !defined(__GNUC__) || (__GNUC__ >= 2 && __GNUC_MINOR__ >= 6) -template class T5; -template class T5; -template class T5; -template class T5; -template class T5; -#endif - -class T7 { -public: - static int get(); - static void put(int); -}; - -int -T7::get() -{ return 1; } - -void -T7::put(int i) -{ - // nothing -} - -// More template kinds. GDB 4.16 didn't handle these, but -// Wildebeest does. Note: Assuming HP aCC is used to compile -// this file; with g++ or HP cfront or other compilers the -// demangling may not get done correctly. - -// Ordinary template, to be instantiated with different types -template -class Foo { -public: - int x; - T t; - T foo (int, T); -}; - - -template T Foo::foo (int i, T tt) -{ - return tt; -} - -// Template with int parameter - -template -class Bar { -public: - int x; - T t; - T bar (int, T); -}; - - -template T Bar::bar (int i, T tt) -{ - if (i < sz) - return tt; - else - return 0; -} - -// function template with int parameter -template int dummy (T tt, int i) -{ - return tt; -} - -// Template with partial specializations -template -class Spec { -public: - int x; - T1 spec (T2); -}; - -template -T1 Spec::spec (T2 t2) -{ - return 0; -} - -template -class Spec { -public: - int x; - T spec (T*); -}; - -template -T Spec::spec (T * tp) -{ - return *tp; -} - -// Template with char parameter -template -class Baz { -public: - int x; - T t; - T baz (int, T); -}; - -template T Baz::baz (int i, T tt) -{ - if (i < sz) - return tt; - else - return 0; -} - -// Template with char * parameter -template -class Qux { -public: - int x; - T t; - T qux (int, T); -}; - -template T Qux::qux (int i, T tt) -{ - if (sz[0] == 'q') - return tt; - else - return 0; -} - -// Template with a function pointer parameter -template -class Qux1 { -public: - int x; - T t; - T qux (int, T); -}; - -template T Qux1::qux (int i, T tt) -{ - if (f != 0) - return tt; - else - return 0; -} - -// Some functions to provide as arguments to template -int gf1 (int a) { - return a * 2 + 13; -} -int gf2 (int a) { - return a * 2 + 26; -} - -char string[3]; - - -// Template for nested instantiations - -template -class Garply { -public: - int x; - T t; - T garply (int, T); -}; - -template T Garply::garply (int i, T tt) -{ - if (i > x) - return tt; - else - { - x += i; - return tt; - } -} - - -int main() -{ - int i; -#ifdef usestubs - set_debug_traps(); - breakpoint(); -#endif - i = i + 1; - - // New tests added here - - Foo fint; - Foo fchar; - Foo fvpchar; - - Bar bint; - Bar 3)> bint2; - - Baz bazint; - Baz bazint2; - - Qux quxint2; - Qux quxint; - - Qux1 qux11; - - int x = fint.foo(33, 47); - char c = fchar.foo(33, 'x'); - volatile char * cp = fvpchar.foo(33, 0); - - int y = dummy (400, 600); - - int z = bint.bar(55, 66); - z += bint2.bar(55, 66); - - c = bazint2.baz(4, 'y'); - c = quxint2.qux(4, 'z'); - - y = bazint.baz(4,3); - y = quxint.qux(4, 22); - y += qux11.qux(4, 22); - - y *= gf1(y) - gf2(y); - - Spec sic; - Spec siip; - - sic.spec ('c'); - siip.spec (&x); - - Garply f; - Garply fc; - f.x = 13; - - Garply > nf; - nf.x = 31; - - x = f.garply (3, 4); - - fc = nf.garply (3, fc); - - y = x + fc.x; - - - return 0; - -} - - - - - - - - - - - - - diff --git a/gdb/testsuite/gdb.hp/virtfunc-hp.cc b/gdb/testsuite/gdb.hp/virtfun-hp.cc similarity index 100% rename from gdb/testsuite/gdb.hp/virtfunc-hp.cc rename to gdb/testsuite/gdb.hp/virtfun-hp.cc diff --git a/gdb/testsuite/gdb.hp/virtfun-hp.exp b/gdb/testsuite/gdb.hp/virtfun-hp.exp new file mode 100644 index 0000000000..f5b3637508 --- /dev/null +++ b/gdb/testsuite/gdb.hp/virtfun-hp.exp @@ -0,0 +1,773 @@ +# Copyright (C) 1992, 1994, 1997 Free Software Foundation, Inc. + +# 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 2 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +# Please email any bugs, comments, and/or additions to this file to: +# bug-gdb@prep.ai.mit.edu + +# This file was written by Fred Fish. (fnf@cygnus.com) + +set ws "\[\r\n\t \]+" + +if $tracelevel then { + strace $tracelevel +} + +set testfile "virtfun-hp" +set srcfile ${testfile}.cc +set binfile ${objdir}/${subdir}/${testfile} + +if [get_compiler_info ${binfile} "c++"] { + return -1; +} + + +if {[skip_hp_tests $gcc_compiled]} then { continue } + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } { + gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail." +} + + +proc gdb_virtfunc_init {} { + global srcdir subdir binfile + global gdb_prompt + + gdb_reinitialize_dir $srcdir/$subdir + gdb_load $binfile + + send_gdb "set language c++\n" + gdb_expect -re "$gdb_prompt $" + send_gdb "set width 0\n" + gdb_expect -re "$gdb_prompt $" +} + +proc gdb_virtfunc_restart {} { + gdb_exit; + gdb_start; + gdb_virtfunc_init; + runto 'test_calls(void)'; +} + +# +# Test printing of the types of various classes. +# + +proc test_ptype_of_classes {} { + global gdb_prompt + global ws + + # This used to be a fail if it printed "struct" not "class". But + # since this struct doesn't use any special C++ features, it is + # considered right for GDB to print it as "struct". + send_gdb "ptype VA\n" + gdb_expect { + -re "type = (struct|class) VA \{(${ws}public:|)${ws}int va;${ws}VA & operator=\\(VA const &\\);${ws}VA\\(VA const &\\);${ws}VA\\(void\\);${ws}\}.*$gdb_prompt $" { + pass "ptype VA" + } + -re "type = (struct|class) VA \{(${ws}public:|)${ws}int va;((${ws}VA & operator=\\(VA const &\\);)|(${ws}VA\\(VA const &\\);)|(${ws}VA\\(void\\);))*${ws}\}.*$gdb_prompt $" { + pass "ptype VA (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype VA" + } + timeout { + fail "ptype VA (timeout)" + } + } + + send_gdb "ptype VB\n" + gdb_expect { + -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\}.*$gdb_prompt $" { + pass "ptype VB" + } + -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\}.*$gdb_prompt $" { + pass "ptype VB (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype VB" + } + timeout { + fail "ptype VB (timeout)" + } + } + + send_gdb "ptype V\n" + gdb_expect { + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype V" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype V (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype V" + } + timeout { + fail "ptype V (timeout)" + } + } + + send_gdb "ptype A\n" + gdb_expect { + -re "type = class A : public virtual V \{\[\r\n\t \]+private:\[\r\n\t \]+int a;\[\r\n\t \]+public:\[\r\n\t \]+virtual int f\\(void\\);\[\r\n\t \]+\}\r\n$gdb_prompt $" { + pass "ptype A (aCC)" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb\[\\\$\.\]+V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype A" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb\[\\\$\.\]+V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype A (obsolescent gcc or gdb)" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.FOO;${ws}int a;${ws}public:${ws}virtual int f.void.;${ws}\}\r\n$gdb_prompt $" { + # This happens because the type is defined only after it is + # too late. + fail "ptype A (known failure with gcc cygnus-2.4.5-930417)" + # Many of the rest of these tests have the same problem. + return 0 + } + -re ".*$gdb_prompt $" { + fail "ptype A" + } + timeout { + fail "ptype A (timeout)" + } + } + + send_gdb "ptype B\n" + gdb_expect { + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype B" + } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype B (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype B" + } + timeout { + fail "ptype B (timeout)" + } + } + + send_gdb "ptype C\n" + gdb_expect { + -re "type = class C : public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int c;\[\r\n\t \]+\}\r\n$gdb_prompt $" { + pass "ptype C (aCC)" + } + -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype C" + } + -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype C (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype C" + } + timeout { + fail "ptype C (timeout)" + } + } + + send_gdb "ptype AD\n" + gdb_expect { + -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype AD" + } + -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype AD (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype AD" + } + timeout { + fail "ptype AD (timeout)" + } + } + + send_gdb "ptype D\n" + gdb_expect { + -re "type = class D : public AD, public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int d;\[\r\n\t \]+static void s\\(void\\);\[\r\n\t \]+virtual int vg\\(void\\);\[\r\n\t \]+virtual int vd\\(void\\);\[\r\n\t \]+int fd\\(void\\);\[\r\n\t \]+\}\r\n$gdb_prompt $" { + pass "ptype D (aCC)" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype D" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype D (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype D" + } + timeout { + fail "ptype D (timeout)" + } + } + + send_gdb "ptype E\n" + gdb_expect { + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype E" + } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype E (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype E" + } + timeout { + fail "ptype E (timeout)" + } + } + + send_gdb "ptype dd\n" + gdb_expect { + -re "type = class D : public AD, public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int d;\[\r\n\t \]+static void s\\(void\\);\[\r\n\t \]+virtual int vg\\(void\\);\[\r\n\t \]+virtual int vd\\(void\\);\[\r\n\t \]+int fd\\(void\\);\[\r\n\t \]+\}\r\n$gdb_prompt $" { + pass "ptype dd (aCC)" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype dd" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype dd (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype dd" + } + timeout { + fail "ptype dd (timeout)" + } + } + + send_gdb "ptype ppd\n" + gdb_expect { + -re "type = class D : public AD, public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int d;\[\r\n\t \]+static void s\\(void\\);\[\r\n\t \]+virtual int vg\\(void\\);\[\r\n\t \]+virtual int vd\\(void\\);\[\r\n\t \]+int fd\\(void\\);\[\r\n\t \]+\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype ppd (aCC)" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype ppd" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype ppd (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype ppd" + } + timeout { + fail "ptype ppd (timeout)" + } + } + + send_gdb "ptype pAd\n" + gdb_expect { + -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pAd" + } + -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pAd (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pAd" + } + timeout { + fail "ptype pAd (timeout)" + } + } + + send_gdb "ptype a\n" + gdb_expect { + -re "type = class A : public virtual V \{\[\r\n\t \]+private:\[\r\n\t \]+int a;\[\r\n\t \]+public:\[\r\n\t \]+virtual int f\\(void\\);\[\r\n\t \]+\}\r\n$gdb_prompt $" { + pass "ptype a (aCC)" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype a" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype a (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype a" + } + timeout { + fail "ptype a (timeout)" + } + } + + send_gdb "ptype b\n" + gdb_expect { + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype b" + } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype b (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype b" + } + timeout { + fail "ptype b (timeout)" + } + } + + send_gdb "ptype c\n" + gdb_expect { + -re "type = class C : public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int c;\[\r\n\t \]+\}\r\n$gdb_prompt $" { + pass "ptype c (aCC)" + } + -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;${ws}C & operator=\\(C const &\\);${ws}C\\(int, C const &\\);${ws}C\\(int\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype c" + } + -re "type = class C : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int c;((${ws}C & operator=\\(C const &\\);)|(${ws}C\\(int, C const &\\);)|(${ws}C\\(int\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype c (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype c" + } + timeout { + fail "ptype c (timeout)" + } + } + + send_gdb "ptype d\n" + gdb_expect { + -re "type = class D : public AD, public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int d;\[\r\n\t \]+static void s\\(void\\);\[\r\n\t \]+virtual int vg\\(void\\);\[\r\n\t \]+virtual int vd\\(void\\);\[\r\n\t \]+int fd\\(void\\);\[\r\n\t \]+\}\r\n$gdb_prompt $" { + pass "ptype d (aCC)" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype d" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype d (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype d" + } + timeout { + fail "ptype d (timeout)" + } + } + + send_gdb "ptype e\n" + gdb_expect { + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype e" + } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype e (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype e" + } + timeout { + fail "ptype e (timeout)" + } + } + + send_gdb "ptype v\n" + gdb_expect { + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype v" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype v (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype v" + } + timeout { + fail "ptype v (timeout)" + } + } + + send_gdb "ptype vb\n" + gdb_expect { + -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\}\r\n$gdb_prompt $" { + pass "ptype vb" + } + -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\}\r\n$gdb_prompt $" { + pass "ptype vb (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype vb" + } + timeout { + fail "ptype vb (timeout)" + } + } + + send_gdb "ptype pAa\n" + gdb_expect { + -re "type = class A : public virtual V \{\[\r\n\t \]+private:\[\r\n\t \]+int a;\[\r\n\t \]+public:\[\r\n\t \]+virtual int f\\(void\\);\[\r\n\t \]+\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pAa (aCC)" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pAa" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pAa (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pAa" + } + timeout { + fail "ptype pAa (timeout)" + } + } + + send_gdb "ptype pAe\n" + gdb_expect { + -re "type = class A : public virtual V \{\[\r\n\t \]+private:\[\r\n\t \]+int a;\[\r\n\t \]+public:\[\r\n\t \]+virtual int f\\(void\\);\[\r\n\t \]+\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pAe (aCC)" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:${ws}A & operator=\\(A const &\\);${ws}A\\(int, A const &\\);${ws}A\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pAe" + } + -re "type = class A : public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}int a;${ws}public:((${ws}A & operator=\\(A const &\\);)|(${ws}A\\(int, A const &\\);)|(${ws}A\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pAe (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pAe" + } + timeout { + fail "ptype pAe (timeout)" + } + } + + send_gdb "ptype pBe\n" + gdb_expect { + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:${ws}B & operator=\\(B const &\\);${ws}B\\(int, B const &\\);${ws}B\\(int\\);${ws}virtual int f\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pBe" + } + -re "type = class B : public A \{${ws}private:${ws}int b;${ws}public:((${ws}B & operator=\\(B const &\\);)|(${ws}B\\(int, B const &\\);)|(${ws}B\\(int\\);)|(${ws}virtual int f\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pBe (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pBe" + } + timeout { + fail "ptype pBe (timeout)" + } + } + + send_gdb "ptype pDd\n" + gdb_expect { + -re "type = class D : public AD, public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int d;\[\r\n\t \]+static void s\\(void\\);\[\r\n\t \]+virtual int vg\\(void\\);\[\r\n\t \]+virtual int vd\\(void\\);\[\r\n\t \]+int fd\\(void\\);\[\r\n\t \]+\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pDd (aCC)" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pDd" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pDd (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pDd" + } + timeout { + fail "ptype pDd (timeout)" + } + } + + send_gdb "ptype pDe\n" + gdb_expect { + -re "type = class D : public AD, public virtual V \{\[\r\n\t \]+public:\[\r\n\t \]+int d;\[\r\n\t \]+static void s\\(void\\);\[\r\n\t \]+virtual int vg\\(void\\);\[\r\n\t \]+virtual int vd\\(void\\);\[\r\n\t \]+int fd\\(void\\);\[\r\n\t \]+\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pDe (aCC)" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;${ws}D & operator=\\(D const &\\);${ws}D\\(int, D const &\\);${ws}D\\(int\\);${ws}static void s\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vd\\(void\\);${ws}int fd\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pDe" + } + -re "type = class D : public AD, public virtual V \{${ws}private:${ws}V \[*\]+_vb.V;${ws}public:${ws}int d;((${ws}D & operator=\\(D const &\\);)|(${ws}D\\(int, D const &\\);)|(${ws}D\\(int\\);)|(${ws}static void s\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vd\\(void\\);)|(${ws}int fd\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pDe (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pDe" + } + timeout { + fail "ptype pDe (timeout)" + } + } + + send_gdb "ptype pVa\n" + gdb_expect { + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pVa" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pVa (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pVa" + } + timeout { + fail "ptype pVa (timeout)" + } + } + + send_gdb "ptype pVv\n" + gdb_expect { + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pVv" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pVv (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pVv" + } + timeout { + fail "ptype pVv (timeout)" + } + } + + send_gdb "ptype pVe\n" + gdb_expect { + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pVe" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pVe (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pVe" + } + timeout { + fail "ptype pVe (timeout)" + } + } + + send_gdb "ptype pVd\n" + gdb_expect { + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;${ws}V & operator=\\(V const &\\);${ws}V\\(V const &\\);${ws}V\\(void\\);${ws}int f\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pVd" + } + -re "type = class V : public VA, public VB \{${ws}public:${ws}int w;((${ws}V & operator=\\(V const &\\);)|(${ws}V\\(V const &\\);)|(${ws}V\\(void\\);)|(${ws}int f\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pVd (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pVd" + } + timeout { + fail "ptype pVd (timeout)" + } + } + + send_gdb "ptype pADe\n" + gdb_expect { + -re "type = class AD \{${ws}public:${ws}AD & operator=\\(AD const &\\);${ws}AD\\(AD const &\\);${ws}AD\\(void\\);${ws}virtual int vg\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pADe" + } + -re "type = class AD \{${ws}public:((${ws}AD & operator=\\(AD const &\\);)|(${ws}AD\\(AD const &\\);)|(${ws}AD\\(void\\);)|(${ws}virtual int vg\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pADe (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pADe" + } + timeout { + fail "ptype pADe (timeout)" + } + } + + send_gdb "ptype pEe\n" + gdb_expect { + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;${ws}E & operator=\\(E const &\\);${ws}E\\(int, E const &\\);${ws}E\\(int\\);${ws}virtual int f\\(void\\);${ws}virtual int vg\\(void\\);${ws}virtual int vv\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pEe" + } + -re "type = class E : public B, public virtual V, public D, public C \{${ws}public:${ws}int e;((${ws}E & operator=\\(E const &\\);)|(${ws}E\\(int, E const &\\);)|(${ws}E\\(int\\);)|(${ws}virtual int f\\(void\\);)|(${ws}virtual int vg\\(void\\);)|(${ws}virtual int vv\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pEe (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pEe" + } + timeout { + fail "ptype pEe (timeout)" + } + } + + send_gdb "ptype pVB\n" + gdb_expect { + -re "type = class VB \{${ws}public:${ws}int vb;${ws}VB & operator=\\(VB const &\\);${ws}VB\\(VB const &\\);${ws}VB\\(void\\);${ws}int fvb\\(void\\);${ws}virtual int vvb\\(void\\);${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pVB" + } + -re "type = class VB \{${ws}public:${ws}int vb;((${ws}VB & operator=\\(VB const &\\);)|(${ws}VB\\(VB const &\\);)|(${ws}VB\\(void\\);)|(${ws}int fvb\\(void\\);)|(${ws}virtual int vvb\\(void\\);))*${ws}\} \[*\]+\r\n$gdb_prompt $" { + pass "ptype pVB (obsolescent gcc or gdb)" + } + -re ".*$gdb_prompt $" { + fail "ptype pVB" + } + timeout { + fail "ptype pVB (timeout)" + } + } +} + +# +# Test calling of virtual functions. +# + +proc test_virtual_calls {} { + global gdb_prompt + global GDB + + if [target_info exists gdb,cannot_call_functions] { + setup_xfail "*-*-*" 2416 + fail "This target can not call functions" + return 0 + } + + send_gdb "print pAe->f()\n" + gdb_expect { + -re ".* = 20\r\n$gdb_prompt $" { pass "print pAe->f()" } + -re "Cannot invoke functions on this machine.*$gdb_prompt $" { + fail "print pAe->f() (cannot invoke functions, skipping virtual calls)" + return 0 + } + -re ".*Cannot access memory at address 0x8.*$gdb_prompt $" { + fail "print pAe->f() \ +(known failure with gcc cygnus-2.4.5-930417, skipping virtual calls)" + return 0 + } + -re ".*$gdb_prompt $" { fail "print pAe->f()" } + timeout { fail "print pAe->f() (timeout)" } + eof { fail "print pAe->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pAa->f()\n" + gdb_expect { + -re ".* = 1\r\n$gdb_prompt $" { pass "print pAa->f()" } + -re ".*$gdb_prompt $" { fail "print pAa->f()" } + timeout { fail "print pAa->f() (timeout)" } + eof { fail "print pAa->f() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pDe->vg()\n" +# setup_xfail "*-*-*" + gdb_expect { + -re ".* = 202\r\n$gdb_prompt $" { pass "print pDe->vg()" } + -re ".*$gdb_prompt $" { fail "print pDe->vg()" } + timeout { fail "print pDe->vg() (timeout)" } + eof { fail "print pDe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pADe->vg()\n" + gdb_expect { + -re ".* = 202\r\n$gdb_prompt $" { pass "print pADe->vg()" } + -re ".*$gdb_prompt $" { fail "print pADe->vg()" } + timeout { fail "print pADe->vg() (timeout)" } + eof { fail "print pADe->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pDd->vg()\n" +# setup_xfail "*-*-*" + gdb_expect { + -re ".* = 101\r\n$gdb_prompt $" { pass "print pDd->vg()" } + -re ".*$gdb_prompt $" { fail "print pDd->vg()" } + timeout { fail "print pDd->vg() (timeout)" } + eof { fail "print pDd->vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pEe->vvb()\n" +# setup_xfail "*-*-*" + gdb_expect { + -re ".* = 411\r\n$gdb_prompt $" { pass "print pEe->vvb()" } + -re ".*$gdb_prompt $" { fail "print pEe->vvb()" } + timeout { fail "print pEe->vvb() (timeout)" } + eof { fail "print pEe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pVB->vvb()\n" + gdb_expect { + -re ".* = 407\r\n$gdb_prompt $" { pass "print pVB->vvb()" } + -re ".*$gdb_prompt $" { fail "print pVB->vvb()" } + timeout { fail "print pVB->vvb() (timeout)" } + eof { fail "print pVB->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pBe->vvb()\n" +# setup_xfail "*-*-*" + gdb_expect { + -re ".* = 411\r\n$gdb_prompt $" { pass "print pBe->vvb()" } + -re ".*$gdb_prompt $" { fail "print pBe->vvb()" } + timeout { fail "print pBe->vvb() (timeout)" } + eof { fail "print pBe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pDe->vvb()\n" +# setup_xfail "*-*-*" + gdb_expect { + -re ".* = 411\r\n$gdb_prompt $" { pass "print pDe->vvb()" } + -re ".*$gdb_prompt $" { fail "print pDe->vvb()" } + timeout { fail "print pDe->vvb() (timeout)" } + eof { fail "print pDe->vvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pEe->vd()\n" +# setup_xfail "*-*-*" + gdb_expect { + -re ".* = 282\r\n$gdb_prompt $" { pass "print pEe->vd()" } + -re ".*$gdb_prompt $" { fail "print pEe->vd()" } + timeout { fail "print pEe->vd() (timeout)" } + eof { fail "print pEe->vd() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pEe->fvb()\n" +# setup_xfail "*-*-*" + gdb_expect { + -re ".* = 311\r\n$gdb_prompt $" { pass "print pEe->fvb()" } + -re ".*$gdb_prompt $" { fail "print pEe->fvb()" } + timeout { fail "print pEe->fvb() (timeout)" } + eof { fail "print pEe->fvb() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } + + send_gdb "print pEe->D::vg()\n" + setup_xfail "*-*-*" + gdb_expect { + -re ".* = 102\r\n$gdb_prompt $" { pass "print pEe->D::vg()" } + -re ".*$gdb_prompt $" { fail "print pEe->D::vg()" } + timeout { fail "print pEe->D::vg() (timeout)" } + eof { fail "print pEe->D::vg() ($GDB dumped core) (FIXME)" ; gdb_virtfunc_restart; return } + } +} + +proc do_tests {} { + global prms_id + global bug_id + + set prms_id 0 + set bug_id 0 + + gdb_start; + gdb_virtfunc_init; + + # Get the debug format for the compiled test case. If that + # format is DWARF 1 then just skip all the tests since none of + # them will pass. + + if [ runto_main ] then { + get_debug_format + if [ setup_xfail_format "DWARF 1" ] then { + fail "C++ tests skipped due to limited C++ support in DWARF 1 debug format" + return + } + clear_xfail "*-*-*" + } + + test_ptype_of_classes + + if [ runto 'test_calls(void)' ] then { + test_virtual_calls + } +} + +do_tests