ILE C/C++ Programmer's Guide

EVAL Commands for System and Space Pointers

The example below shows the use of the EVAL command with system and space pointers. The system and space pointers are based on the source in Source for Sample EVAL Commands for Displaying System and Space Pointers.

Figure 76. Sample EVAL Commands for System and Space Pointers


 System and Space Pointers
// System pointers are formatted
// :1934:QTEMP     :111111110
>eval pSYSptr
 pSYSptr =
           SYP:QTEUSERSPC
           0011100
// Space pointers return 8 bytes that can be used in
// System Service Tools
>eval pBuffer
 pBuffer = SPP:0000071ECD000200

You can use the EVAL command on C and C++ language features and constructs. The ILE source debugger can display a full class or structure but only with those fields defined in the derived class. You can display a base class in full by casting the derived class to the particular base class.

The example below shows the use of the EVAL command with C++ language constructs. The C++ language constructs are based on the source in Source for Sample EVAL Commands for Displaying C++ Constructs. Additional C++ examples are provided in the source debugger online help.

Figure 77. Sample EVAL Commands for C++ Expressions


// Follow the class hierarchy (specifying class D is optional)
> EVAL *(class D *)this
  (*(class D *)this).__vbp1B = SPP:C40F5E3D7F000490
  (*(class D *)this).__vbp1D = SPP:C40F5E3D7F000440
  (*(class D *)this).d = 4
 
// Follow the class hierarchy (without specifying class D)
> EVAL *(D *)this
  (*(D *)this).__vbp1B = SPP:C40F5E3D7F000490
  (*(D *)this).__vbp1D = SPP:C40F5E3D7F000440
  (*(D *)this).d = 4
 
// Look at a local variable
> EVAL VAR
  VAR = 1
 
// Look at a global variable
> EVAL ::VAR
  ::VAR = 2
 
// Look at a class member (specifying this-> is optional)
> EVAL this->f
  this->f = 6
 
// Look at a class member (without specifying this->)
> EVAL f
  f = 6
 
// Disambiguate variable ac
> EVAL A::ac
  A::ac = 12
 
// Scope operator with template
> EVAL E<int>::ac
  E<int>::ac = 12
 
// Cast with template:
> EVAL *(E<int> *)this
  (*(E<int> *)this).__vbp1B = SPP:C40F5E3D7F000490
  (*(E<int> *)this).__vbp1EXTi_ = SPP:C40F5E3D7F000400
  (*(E<int> *)this).e = 5
 
// Assign a value to a variable
> EVAL f=23
  f=23 = 23
 
// See all local variables in a single EVAL statement
> EVAL %LOCALVARS
  local = 828
  this = SPP:C40F5E3D7F000400
  VAR = 1

Displaying a Class Template and a Function Template

To display a class template or a function template, enter EVAL template-name on the debug command line. The variable template-name is the name of the class template or function template you want to display.

The example below shows the results of evaluating a class template. You must enter a template name that matches the demangled template name. Type definition names are not valid because the typedef information is removed when the template name is mangled.

Figure 78. Using EVAL with a Class Template


      > EVAL XX<int>::a
        XX<int>::= '1 '
      > EVAL XX<inttype>::a
        Identifier not found
      1  template < class A >        //Code evaluated at line 8
      2  class XX {                  //where a breakpoint was set
      3     static A a;
      4     static B b;
      5  };
      6  XX<int> x;
      7  typedef int inttype;
      8  int XX<int>::a =1;          //mangled name a__2XXXTi_
      9  int XX<inttype>::b = 2;     //mangled name b__2XXXTi_

The example below shows the results of evaluating a function template.

Figure 79. Using EVAL with a Function Template


      > EVAL XX<int,12>::sxa
        XX<int,12>::sxa = '1 '
      > EVAL xxobj.xca[0]
        xxobj.xca[0] = '2 '
      1  template < class A, int B>  //Code evaluated at lines 8 and 9
      2  class XX {                  //where breakpoints were set
      3     static A sxa;
      4     char     xca[B];
      5  public:
      6    XX(void) { xca[0] = 2; }
      7  };
      8  XX<int,12> xxobj;
      9  int XX<int,2*6>::sxa =1;
                                     //same as intXX<int,12>::sxa
                                     //mangled name sxa__2XXXTiSP12_


[ Top of Page | Previous Page | Next Page | Table of Contents ]