Home | History | Annotate | Line # | Download | only in gdb.cp
      1  1.1  christos #include <stddef.h>
      2  1.1  christos 
      3  1.1  christos class foo {
      4  1.1  christos public:
      5  1.1  christos   foo  (int);
      6  1.1  christos   foo  (int, const char *);
      7  1.1  christos   foo  (foo&);
      8  1.1  christos   ~foo ();
      9  1.1  christos 
     10  1.1  christos   void  operator *      (foo&);
     11  1.1  christos   void  operator %      (foo&);
     12  1.1  christos   void  operator -      (foo&);
     13  1.1  christos   void  operator >>     (foo&);
     14  1.1  christos   void  operator !=     (foo&);
     15  1.1  christos   void  operator >      (foo&);
     16  1.1  christos   void  operator >=     (foo&);
     17  1.1  christos   void  operator |      (foo&);
     18  1.1  christos   void  operator &&     (foo&);
     19  1.1  christos   void  operator !      (void);
     20  1.1  christos   void  operator ++     (int);
     21  1.1  christos   void  operator =      (foo&);
     22  1.1  christos   void  operator +=     (foo&);
     23  1.1  christos   void  operator *=     (foo&);
     24  1.1  christos   void  operator %=     (foo&);
     25  1.1  christos   void  operator >>=    (foo&);
     26  1.1  christos   void  operator |=     (foo&);
     27  1.1  christos   void  operator ,      (foo&);
     28  1.1  christos   void  operator /      (foo&);
     29  1.1  christos   void  operator +      (foo&);
     30  1.1  christos   void  operator <<     (foo&);
     31  1.1  christos   void  operator ==     (foo&);
     32  1.1  christos   void  operator <      (foo&);
     33  1.1  christos   void  operator <=     (foo&);
     34  1.1  christos   void  operator &      (foo&);
     35  1.1  christos   void  operator ^      (foo&);
     36  1.1  christos   void  operator ||     (foo&);
     37  1.1  christos   void  operator ~      (void);
     38  1.1  christos   void  operator --     (int);
     39  1.1  christos   foo*  operator ->     (void);
     40  1.1  christos   void  operator -=     (foo&);
     41  1.1  christos   void  operator /=     (foo&);
     42  1.1  christos   void  operator <<=    (foo&);
     43  1.1  christos   void  operator &=     (foo&);
     44  1.1  christos   void  operator ^=     (foo&);
     45  1.1  christos   void  operator ->*    (foo&);
     46  1.1  christos   void  operator []     (foo&);
     47  1.1  christos   void  operator ()     (foo&);
     48  1.1  christos   void* operator new    (size_t) throw ();
     49  1.1  christos   void* operator new[]  (size_t) throw ();
     50  1.1  christos   void  operator delete (void *);
     51  1.1  christos   void  operator delete[] (void *);
     52  1.1  christos   /**/  operator int    ();
     53  1.1  christos   /**/  operator char*  ();
     54  1.1  christos 
     55  1.1  christos   int foofunc (int); // forced to have int return type, which is required
     56  1.1  christos   int foofunc (int, signed char *); // forced to have int return type, which is required
     57  1.1  christos   int ifoo;
     58  1.1  christos   const char *ccpfoo;
     59  1.1  christos };
     60  1.1  christos 
     61  1.1  christos int main () {
     62  1.1  christos    int z=3;
     63  1.6  christos 
     64  1.6  christos    return 0;
     65  1.1  christos }
     66  1.1  christos 
     67  1.1  christos foo::foo  (int i)                  { ifoo = i;}
     68  1.1  christos foo::foo  (int i, const char *ccp) { ifoo = i; ccpfoo = ccp; }
     69  1.1  christos foo::foo  (foo& afoo)              { afoo.ifoo = 0; }
     70  1.1  christos foo::~foo ()                       {}
     71  1.1  christos 
     72  1.1  christos void  foo::operator *      (foo& afoo) { afoo.ifoo = 0; }
     73  1.1  christos void  foo::operator %      (foo& afoo) { afoo.ifoo = 0; }
     74  1.1  christos void  foo::operator -      (foo& afoo) { afoo.ifoo = 0; }
     75  1.1  christos void  foo::operator >>     (foo& afoo) { afoo.ifoo = 0; }
     76  1.1  christos void  foo::operator !=     (foo& afoo) { afoo.ifoo = 0; }
     77  1.1  christos void  foo::operator >      (foo& afoo) { afoo.ifoo = 0; }
     78  1.1  christos void  foo::operator >=     (foo& afoo) { afoo.ifoo = 0; }
     79  1.1  christos void  foo::operator |      (foo& afoo) { afoo.ifoo = 0; }
     80  1.1  christos void  foo::operator &&     (foo& afoo) { afoo.ifoo = 0; }
     81  1.1  christos void  foo::operator !      (void) {}
     82  1.1  christos void  foo::operator ++     (int ival) { ival = 0; }
     83  1.1  christos void  foo::operator =      (foo& afoo) { afoo.ifoo = 0; }
     84  1.1  christos void  foo::operator +=     (foo& afoo) { afoo.ifoo = 0; }
     85  1.1  christos void  foo::operator *=     (foo& afoo) { afoo.ifoo = 0; }
     86  1.1  christos void  foo::operator %=     (foo& afoo) { afoo.ifoo = 0; }
     87  1.1  christos void  foo::operator >>=    (foo& afoo) { afoo.ifoo = 0; }
     88  1.1  christos void  foo::operator |=     (foo& afoo) { afoo.ifoo = 0; }
     89  1.1  christos void  foo::operator ,      (foo& afoo) { afoo.ifoo = 0; }
     90  1.1  christos void  foo::operator /      (foo& afoo) { afoo.ifoo = 0; }
     91  1.1  christos void  foo::operator +      (foo& afoo) { afoo.ifoo = 0; }
     92  1.1  christos void  foo::operator <<     (foo& afoo) { afoo.ifoo = 0; }
     93  1.1  christos void  foo::operator ==     (foo& afoo) { afoo.ifoo = 0; }
     94  1.1  christos void  foo::operator <      (foo& afoo) { afoo.ifoo = 0; }
     95  1.1  christos void  foo::operator <=     (foo& afoo) { afoo.ifoo = 0; }
     96  1.1  christos void  foo::operator &      (foo& afoo) { afoo.ifoo = 0; }
     97  1.1  christos void  foo::operator ^      (foo& afoo) { afoo.ifoo = 0; }
     98  1.1  christos void  foo::operator ||     (foo& afoo) { afoo.ifoo = 0; }
     99  1.1  christos void  foo::operator ~      (void) {}
    100  1.1  christos void  foo::operator --     (int ival) { ival = 0; }
    101  1.1  christos foo*  foo::operator ->     (void) {return this;}
    102  1.1  christos void  foo::operator -=     (foo& afoo) { afoo.ifoo = 0; }
    103  1.1  christos void  foo::operator /=     (foo& afoo) { afoo.ifoo = 0; }
    104  1.1  christos void  foo::operator <<=    (foo& afoo) { afoo.ifoo = 0; }
    105  1.1  christos void  foo::operator &=     (foo& afoo) { afoo.ifoo = 0; }
    106  1.1  christos void  foo::operator ^=     (foo& afoo) { afoo.ifoo = 0; }
    107  1.1  christos void  foo::operator ->*    (foo& afoo) { afoo.ifoo = 0; }
    108  1.1  christos void  foo::operator []     (foo& afoo) { afoo.ifoo = 0; }
    109  1.1  christos void  foo::operator ()     (foo& afoo) { afoo.ifoo = 0; }
    110  1.1  christos void* foo::operator new    (size_t ival) throw () { ival = 0; return 0; }
    111  1.1  christos void* foo::operator new[]    (size_t ival) throw () { ival = 0; return 0; }
    112  1.1  christos void  foo::operator delete (void *ptr) { ptr = 0; }
    113  1.1  christos void  foo::operator delete[] (void *ptr) { ptr = 0; }
    114  1.1  christos /**/  foo::operator int    () { return 0; }
    115  1.1  christos /**/  foo::operator char*  () { return 0; }
    116  1.1  christos 
    117  1.1  christos /* Some functions to test overloading by varying one argument type. */
    118  1.1  christos 
    119  1.1  christos void overload1arg (void)		{          }
    120  1.1  christos void overload1arg (char arg)		{ arg = 0; }
    121  1.1  christos void overload1arg (signed char arg)	{ arg = 0; }
    122  1.1  christos void overload1arg (unsigned char arg)	{ arg = 0; }
    123  1.1  christos void overload1arg (short arg)		{ arg = 0; }
    124  1.1  christos void overload1arg (unsigned short arg)	{ arg = 0; }
    125  1.1  christos void overload1arg (int arg)		{ arg = 0; }
    126  1.1  christos void overload1arg (unsigned int arg)	{ arg = 0; }
    127  1.1  christos void overload1arg (long arg)		{ arg = 0; }
    128  1.1  christos void overload1arg (unsigned long arg)	{ arg = 0; }
    129  1.1  christos void overload1arg (float arg)		{ arg = 0; }
    130  1.1  christos void overload1arg (double arg)		{ arg = 0; }
    131  1.1  christos 
    132  1.1  christos /* Some functions to test overloading by varying argument count. */
    133  1.1  christos 
    134  1.1  christos void overloadargs (int a1)				{ a1 = 0; }
    135  1.1  christos void overloadargs (int a1, int a2)			{ a1 = a2 = 0; }
    136  1.1  christos void overloadargs (int a1, int a2, int a3)		{ a1 = a2 = a3 = 0; }
    137  1.1  christos void overloadargs (int a1, int a2, int a3, int a4)
    138  1.1  christos 			{ a1 = a2 = a3 = a4 = 0; }
    139  1.1  christos void overloadargs (int a1, int a2, int a3, int a4, int a5)
    140  1.1  christos 			{ a1 = a2 = a3 = a4 = a5 = 0; }
    141  1.1  christos void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6)
    142  1.1  christos 			{ a1 = a2 = a3 = a4 = a5 = a6 = 0; }
    143  1.1  christos void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7)
    144  1.1  christos 			{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = 0; }
    145  1.1  christos void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
    146  1.1  christos 		   int a8)
    147  1.1  christos 			{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = 0; }
    148  1.1  christos void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
    149  1.1  christos 		   int a8, int a9)
    150  1.1  christos 			{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 = 0; }
    151  1.1  christos void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
    152  1.1  christos 		   int a8, int a9, int a10)
    153  1.1  christos 			{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 =
    154  1.1  christos 			  a10 = 0; }
    155  1.1  christos void overloadargs (int a1, int a2, int a3, int a4, int a5, int a6, int a7,
    156  1.1  christos 		   int a8, int a9, int a10, int a11)
    157  1.1  christos 			{ a1 = a2 = a3 = a4 = a5 = a6 = a7 = a8 = a9 =
    158  1.1  christos 			  a10 = a11 == 0; }
    159  1.1  christos 
    160  1.1  christos /* Some hairy function definitions.
    161  1.1  christos    Use typedefs to help maintain sanity. */
    162  1.1  christos 
    163  1.1  christos typedef int   (*PFPc_i)(char *);
    164  1.1  christos typedef short (*PFPl_s)(long *);
    165  1.1  christos typedef short (*PFPc_s)(char *);
    166  1.1  christos typedef int   (*PFl_i)(long);
    167  1.1  christos typedef PFl_i (*PFPc_PFl_i)(char *);
    168  1.1  christos typedef PFl_i (*PFPi_PFl_i)(int *);
    169  1.1  christos typedef PFl_i (*PFPFPc_i_PFl_i)(PFPc_i);
    170  1.1  christos typedef PFl_i (*PFs_PFl_i)(short);
    171  1.1  christos typedef int   (*PFPFPl_s_i)(PFPl_s);
    172  1.1  christos typedef int   (*PFPFPc_s_i)(PFPc_s);
    173  1.1  christos 
    174  1.1  christos PFs_PFl_i hairyfunc1 (int arg)			{ arg = 0; return 0; }
    175  1.1  christos int       hairyfunc2 (PFPc_i arg)		{ arg = 0; return 0; }
    176  1.1  christos int	  hairyfunc3 (PFPFPl_s_i arg)		{ arg = 0; return 0; }
    177  1.1  christos int	  hairyfunc4 (PFPFPc_s_i arg)		{ arg = 0; return 0; }
    178  1.1  christos int	  hairyfunc5 (PFPc_PFl_i arg)		{ arg = 0; return 0; }
    179  1.1  christos int	  hairyfunc6 (PFPi_PFl_i arg)		{ arg = 0; return 0; }
    180  1.1  christos int	  hairyfunc7 (PFPFPc_i_PFl_i arg)	{ arg = 0; return 0; }
    181  1.1  christos 
    182  1.1  christos /* gdb has two demanglers (one for g++ 2.95, one for g++ 3).
    183  1.1  christos    These marker functions help me figure out which demangler is in use. */
    184  1.1  christos 
    185  1.1  christos char *	dm_type_char_star (char * p)		{ return p; }
    186  1.1  christos int	dm_type_foo_ref (foo & foo)		{ return foo.ifoo; }
    187  1.1  christos int *	dm_type_int_star (int * p)		{ return p; }
    188  1.1  christos long *	dm_type_long_star (long * p)		{ return p; }
    189  1.1  christos int	dm_type_short (short i)			{ return i; }
    190  1.1  christos int	dm_type_long (long i)			{ return i; }
    191  1.1  christos int	dm_type_unsigned_int (unsigned int i)	{ return i; }
    192  1.1  christos int	dm_type_unsigned_short (unsigned short i)	{ return i; }
    193  1.1  christos int	dm_type_unsigned_long (unsigned long i)	{ return i; }
    194  1.1  christos int	dm_type_void (void)			{ return 0; }
    195  1.1  christos void *	dm_type_void_star (void * p)		{ return p; }
    196  1.1  christos typedef int myint;
    197  1.1  christos int	dm_type_typedef (myint i)		{ return i; }
    198