Sun Studio 12 Update 1:使用 dbx 调试程序

whatis name 命令

使用 whatis 命令可打印函数模板和类模板的定义以及实例化的函数和类。

对于类模板:


(dbx) whatis -t Array
template<class T> class Array
To get the full template declaration, try `whatis -t Array<int>’;

对于类模板的构造函数:


(dbx) whatis Array
More than one identifier ’Array’.
Select one of the following:
 0) Cancel
 1) Array<int>::Array(int)
 2) Array<double>::Array(int>
> 1
Array<int>::Array(int 1);

对于函数模板:


(dbx) whatis square
More than one identifier ’square’.
Select one of the following:
 0) Cancel
 1) square<int(__type_0,__type_0*)
 2) square<double>(__type_0,__type_0*)
> 2
void square<double>(double num, double *result);

对于类模板实例化:


(dbx) whatis -t Array<double>
class Array<double>; {
public:
    int Array<double>::getlength()
    double &Array<double>::operator [](int i);
    Array<double>::Array<double>(int l);
    Array<double>::~Array<double>();
private:
    int length;
    double *array;
};

对于函数模板实例化:


(dbx) whatis square(int, int*)
void square(int num, int *result);

有关更多信息,请参见whatis 命令