Debugging QuantLib::Array in msvc

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Debugging QuantLib::Array in msvc

Kim Kuen Tang
Hi all,

as we know debugging QuantLib::Array is not supported in msvc (2008 and
2009). The debugger just displays the name, the scoped_array and the size:
v {data_={...} n_=5 } QuantLib::Array
+ data_ {px=0x00295830 } boost::scoped_array<double>
                n_ 5 unsigned int

This is of course not human-friendly. And you can get around this
limitation by modifying the autoexp.dat file which can be found in

        %VSINSTALLDIR%\Common7\Packages\Debugger\autoexp.dat.
You just need to add these lines

;-------------------------------------
; QuantLib::Array
;------------------------------------

QuantLib::Array {
        preview
     (
         #(
        "[",
             $e.n_ ,
         "](",

         #array
         (
                expr: ((($c).data_).px)[$i],
                size : $c.n_
                        ),
                ")"
                )
        )

     children (
         #(
             [raw members]: [$c,!],
             [size]: [$c.n_, i],
             #array (
                 expr: ((($c).data_).px)[$i],
                 size: $c.n_
             )
         )
     )
}
.. Then you are able to get the information, the same as from std::vector:

+m[5](100.00000000000000,100.00000000000000,100.00000000000000,100.00000000000000,100.00000000000000)QuantLib::Array.

Back up autoesp.dat before proceeding.
Best regards,
Kim Tang



------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize  
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users
Reply | Threaded
Open this post in threaded view
|

Re: Debugging QuantLib::Array in msvc

Luigi Ballabio
Kim,
        thanks for the tip---I've been missing that.

Later,
        Luigi

P.S. A caveat for those interested: the code below works with Boost 1.39
only.  For earlier versions, replace .px with .ptr to make it work.


On Sat, 2009-07-18 at 23:04 +0200, Kim Kuen Tang wrote:

> as we know debugging QuantLib::Array is not supported in msvc (2008 and
> 2009). The debugger just displays the name, the scoped_array and the size:
> v {data_={...} n_=5 } QuantLib::Array
> + data_ {px=0x00295830 } boost::scoped_array<double>
> n_ 5 unsigned int
>
> This is of course not human-friendly. And you can get around this
> limitation by modifying the autoexp.dat file which can be found in
>
> You just need to add these lines
>
> ;-------------------------------------
> ; QuantLib::Array
> ;------------------------------------
>
> QuantLib::Array {
> preview
>      (
>          #(
> "[",
>              $e.n_ ,
>          "](",
>
>          #array
>          (
> expr: ((($c).data_).px)[$i],
> size : $c.n_
> ),
> ")"
> )
> )
>
>      children (
>          #(
>              [raw members]: [$c,!],
>              [size]: [$c.n_, i],
>              #array (
>                  expr: ((($c).data_).px)[$i],
>                  size: $c.n_
>              )
>          )
>      )
> }
> .. Then you are able to get the information, the same as from std::vector:
>
> +m[5](100.00000000000000,100.00000000000000,100.00000000000000,100.00000000000000,100.00000000000000)QuantLib::Array.
>
> Back up autoesp.dat before proceeding.


--

Vin: It's like this fellow I knew in El Paso. One day, he just took
all his clothes off and jumped in a mess of cactus. I asked him that
same question, "Why?"
Calvera: And?
Vin: He said, "It seemed like a good idea at the time."
-- The Magnificent Seven



------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
QuantLib-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/quantlib-users