title: Observing a custom matrix class's content in Visual Studio 2008 debugger
body: <p>I'm trying to display the information from a custom matrix class in Visual Studio 2008's debugger by enhancing/modifying the file autoexp.dat. The custom class goes as follow :</p>
  
  <pre><code>LVSN::Matrix&lt;T&gt; {
  
  ... functions ...
  
  
  
    struct base_mat
    {
       T **Val;
       size_t Row, Col, RowSiz, ColSiz;
       int Refcnt;
       T Err;
  
       base_mat (size_t row, size_t col, T** v)
       {
          Row = row; RowSiz = row;
          Col = col; ColSiz = col;
          Refcnt = 1;
          Err = 0;
  
          Val = new T* [row];
          size_t rowlen = col * sizeof(T);
  
          for (size_t i=0; i &lt; row; i++)
          {
             Val[i] = new T [col];
             if (v) memcpy( Val[i], v[i], rowlen);
          }
       }
  
       ~base_mat ()
       {
          for (size_t i=0; i &lt; RowSiz; i++)
             delete [] Val[i];
          delete [] Val;
       }
    };
  
    base_mat *_m;
  
  } // end of matrix class
  </code></pre>
  
  <p>So I am basically accessing the base_mat _m in autoexp.dat.. What I have so far is this :</p>
  
  <pre><code>;------------------------------------------------------------------------------
  ;  LVSN::Matrix
  ;------------------------------------------------------------------------------
  LVSN::Matrix&lt;double&gt;{
  
  preview
  (
     #( "[", [(int)$c._m-&gt;Row], ",", [(int)$c._m-&gt;Col], "]")
  )
  
  children
  (
    #(
       #array 
       (
          expr : $c._m-&gt;Val[$i],
          size : ((unsigned int*)(&amp;($c._m-&gt;Row)))[$r],
          rank : 2
       )
    )   
  )
  
  }
  </code></pre>
  
  <p>This is able to display the preview properly, but I am unable to access the inner values of my matrix since it is an array of pointers to arrays of doubles. Rank will generate indexes as if it was one contiguous space in memory [col + row*rowsize]... and What I need is a double access [row][col]. If I understood correctly, autoexp does not allow for #if statements inside of #array, so I cannot rely on them.. I tried but I got an error message.</p>
  
  <p>Has anyone toyed with autoexp.dat ? Do you see any way to do what I'm looking to do (apart from modifying the base class, hehe!) ? </p>
  
  <p>thanks ! 
  JC</p>