Home | History | Annotate | Download | only in ltrace.minor
      1 /* Ltrace Test : demangle.cpp
      2    Objectives  : Verify that ltrace can demangle C++ symbols.
      3 
      4    This file was written by Yao Qi <qiyao (at) cn.ibm.com>.  */
      5 
      6 #include<stddef.h>
      7 #include"demangle.h"
      8 
      9 /* Number of arguments */
     10 extern int Fi_i(int);
     11 extern int Fi_s (short);
     12 extern int Fii_i(int , int);
     13 extern int Fiii_i(int, int, int);
     14 extern int Fie_i(int bar, ...);
     15 
     16 /* Return types */
     17 extern void Fv_v(void);
     18 extern char Fv_c(void);
     19 extern signed char Fv_Sc(void);
     20 extern unsigned char Fv_Uc(void);
     21 extern short Fv_s(void);
     22 extern unsigned short Fv_Us(void);
     23 extern int Fv_i(void);
     24 extern const int Fv_Ci(void);
     25 extern unsigned int Fv_Ui(void);
     26 extern volatile int Fv_Vi(void);
     27 extern long Fv_l(void);
     28 extern unsigned long Fv_Ul(void);
     29 extern float Fv_f(void) ;
     30 extern double Fv_g(void);
     31 extern long double Fv_Lg(void);
     32 
     33 
     34 /* Pointers */
     35 extern void * Fv_Pv(void);
     36 extern void ** Fv_PPv(void);
     37 
     38 /* References */
     39 extern int& Fv_Ri(void);
     40 
     41 /* Argument types */
     42 extern int FPi_i(int *a);
     43 extern int FA10_i_i(int a[10]) ;
     44 extern int Fc_i(char bar);
     45 extern int Ff_i(float bar);
     46 extern int Fg_i(double bar);
     47 
     48 /* Function pointers */
     49 typedef int (*x)(int);
     50 typedef int (*y)(short);
     51 
     52 extern int Fx_i(x);
     53 extern int Fxx_i(x fnptr, x fnptr2);
     54 extern int Fxxx_i(x fnptr, x fnptr2, x fnptr3);
     55 extern int Fxxi_i(x fnptr, x fnptr2, x fnptr3, int i);
     56 extern int Fxix_i(x fnptr, int i, x fnptr3);
     57 extern int Fxyxy_i(x fnptr, y fnptr2, x fnptr3, y fnptr4);
     58 
     59 
     60 extern void Fmyclass_v(myclass m);
     61 extern void Fmxmx_v(myclass arg1, x arg2, myclass arg3, x arg4);
     62 
     63 int main ()
     64 {
     65   int i;
     66 
     67   i = Fi_i (0);
     68   i = Fii_i (0,0);
     69   i = Fiii_i (0,0,0);
     70   i = Fie_i (0);
     71 
     72   Fv_v ();
     73   Fv_c ();
     74   Fv_Sc ();
     75   Fv_Uc ();
     76   Fv_s ();
     77   Fv_Us ();
     78   Fv_i ();
     79   Fv_Ci ();
     80   Fv_Ui ();
     81   Fv_Vi ();
     82   Fv_l ();
     83   Fv_Ul ();
     84   Fv_f ();
     85   Fv_g ();
     86   Fv_Lg ();
     87 
     88   Fv_Pv ();
     89   Fv_PPv ();
     90 
     91   Fv_Ri ();
     92 
     93   FPi_i (&i);
     94   FA10_i_i (&i);
     95   Fc_i ('a');
     96   Ff_i (1.1f);
     97   Fg_i (1.1);
     98 
     99   Fx_i (Fi_i);
    100   Fxx_i (Fi_i, Fi_i);
    101   Fxxx_i (Fi_i, Fi_i, Fi_i);
    102   Fxxi_i (Fi_i, Fi_i, Fi_i, 0);
    103   Fxyxy_i (Fi_i, Fi_s, Fi_i, Fi_s);
    104 
    105   myclass a,c;
    106   myclass* b;
    107 
    108   a.Fi_i (0);
    109   a.Fis_i (0);
    110   a++;
    111   c = a + 2;
    112 
    113   nested n;
    114   n.Fi_i (0);
    115 
    116   b = (myclass*) new myclass(0);
    117   delete (b);
    118   Fmyclass_v (a);
    119 
    120   return 0;
    121 }
    122