This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Issue with template_argument when template argument is an integer.


Hi,

I did a bit more digging and found that I also couldnt use non-type parameters either.  For example;
   bools, function pointers, double &flt_ref,  char *string, enum_types, ...

Cheers,
Luc

---------- SNIPPETS
---------- SNIPPETS
---------- SNIPPETS

enum en_some_ranges { EN_ONE=10, EN_TWO, EN_THREE } ;
double Yflt =2.125;
char hello_s[] = "hello world" ;
int func( int I )
{
  return 0 ;
}

template <typename W, class Z, int F, 
      en_some_ranges R,   // 3
      bool B,                     // 4
      int FF(int),                 // 5
      double &FLT,             // 6
      char *str  >               // 7
....
....

main()
{
    YABA<int, float, 12, EN_THREE, true, &func,  Yflt, hello_s > MYYABA ;
}

(gdb) py print gdb.history(0).type.template_argument(3)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
RuntimeError: No type named EN_THREE.
Error while executing Python code.
(gdb) py print gdb.history(0).type.template_argument(4)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
RuntimeError: No type named true.
Error while executing Python code.
(gdb) py print gdb.history(0).type.template_argument(5)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
RuntimeError: No type named func.
Error while executing Python code.
(gdb) py print gdb.history(0).type.template_argument(6)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
RuntimeError: No type named (double&)(&Y).
Error while executing Python code.
(gdb) py print gdb.history(0).type.template_argument(7)
Traceback (most recent call last):
  File "<string>", line 1, in <module>
RuntimeError: No type named (char*)(&cstr_two).
Error while executing Python code.





----- Original Message ----
From: Lucien Anti-Spam <lucienmp_antispam@yahoo.com>
To: archer@sourceware.org
Sent: Monday, August 3, 2009 4:22:49 PM
Subject: Issue with template_argument when template argument is an integer.


Hi,

I was attempting to write a pretty pritner for a class and found that I cant get the arguments to a template if they are NOT a type (eg if they are int).  

I was trying this with the 6.8.50 from 2009-08-3rd and got the following sort of output...
       gdb main
    b some-line
    run
    print MYYABA
    { var=10, woo=30 }
    py print gdb.history(0).type.template_argument(0)
    int
    py print gdb.history(0).type.template_argument(1)
    float
    py print gdb.history(0).type.template_argument(2)
    RuntimeError: No type named 12.

Am I approaching this from the wrong angle?


Cheers,
Luc

---------- CODE -------------
---------- CODE -------------
---------- CODE -------------

// SOME SORT OF CLASS
template <typename W, class Z, int F >
class YABA
{
public:
    W var ;
    Z woo ;

    YABA( )
    {
    }

    void set( W v )
    {
        var = v + F ;
        woo = woo / (F *1.0);
    }

    W get( void )
    {
        return( var+woo );
    }

};


// MAIN
void main( void )
{
    int result ;

    // print MYYABA
    // py print gdb.history(0).type.template_argument(0)
    // py print gdb.history(0).type.template_argument(1)
    //
    // error now, "RuntimeError: No type named 12."
    // py print gdb.history(0).type.template_argument(2)
    //
    YABA<int, float, 12 > MYYABA ;

    // Direct access...
    MYYABA.var = 10 ;
    MYYABA.woo = 30 ;

    MYYABA.set( 5 ) ; 
    result = MYYABA.get( ) ; 

    result = result ;
}


      


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]