debugging in MSVC 2005

View: New views
3 Messages — Rating Filter:   Alert me  

debugging in MSVC 2005

by John McDonald-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I am new to ublas (and boost) and am currently trying to get my head
around the library. I am using MS Visual Studio 2005.

The question I would like to raise is with regard to debugging in the
above environment. To try an keep things simple I have created and built
a (Debug) project around the following code (#includes not shown):
int main () {
    using namespace boost::numeric::ublas;
    vector<std::complex<double> > v (3);
    for (unsigned i = 0; i < v.size (); ++ i)
        v (i) = std::complex<double> (i, i);

    std::cout << - v << std::endl;
    std::cout << conj (v) << std::endl;
    std::cout << real (v) << std::endl;
    std::cout << imag (v) << std::endl;
    std::cout << trans (v) << std::endl;
    std::cout << herm (v) << std::endl;
}

The code compiles and executes without a problem. However if I step into
this code, and for example stop at the sixth line, and then try to
inspect a variable I can only get limited information on its state.
Specifically if I open an "immediate" window and try
v(0)
I get the following error
CXX0059: Error: left operand is class not a function name
If I try
v[0]
CXX0058: Error: overloaded operator not found

Both of these operators should be available (as can be seen from the
code, the first one is used in the for loop).

Can anyone give me some advice on how to get around this issue in visual
studio?

Thanks and regards,
John McDonald.
_______________________________________________
ublas mailing list
ublas@...
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: lists@...

Re: debugging in MSVC 2005

by Jesse Perla :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


On Tue, Oct 6, 2009 at 8:07 AM, John McDonald <johnmcd@...> wrote:
Hi,
The code compiles and executes without a problem. However if I step into
this code, and for example stop at the sixth line, and then try to
inspect a variable I can only get limited information on its state.
Specifically if I open an "immediate" window and try
v(0)
I get the following error
CXX0059: Error: left operand is class not a function name
If I try
v[0]
CXX0058: Error: overloaded operator not found

A few things:
1) I haven't tried to do what you are trying exactly but: Make sure you have made the debugging extensions described at the bottom of: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Effective_UBLAS

2) Also, don't forget that ublas is using expression templates, so things like "-v" are going to be complicated to step through.  It will generate a strange intermediate object without actually changing the sign of anything or executing any code.  Only when the cout << serialization begins would it start going through the vector and doing the negation.  If you want to look at intermediates, you should assign expressions to temporary classes of type ublas::vector<> etc.

3) Last, I have often thought that the "debug" build doesn't necessarily change all of the preprocessor definitions that change debugging, see the bottom of: http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Effective_UBLAS  and if there was any inlining in a build, etc. you would definetely be confused when stepping through.





_______________________________________________
ublas mailing list
ublas@...
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: lists@...

Re: debugging in MSVC 2005

by John McDonald-5 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Jesse,

Thanks for the help. I added the code to AutoExp.dat but it didn't seem
to change the debuggers behaviour.

However on looking through the code I figured out how to dereference
correctly into the data_ members (e.g. v(0).data_.data_[1], etc.), which
is in fact what I needed (i.e. some way of checking values without a
bunch of std::cout's).

Regards,
John.

Jesse Perla wrote:

>
> On Tue, Oct 6, 2009 at 8:07 AM, John McDonald <johnmcd@...
> <mailto:johnmcd@...>> wrote:
>
>     Hi,
>     The code compiles and executes without a problem. However if I
>     step into
>     this code, and for example stop at the sixth line, and then try to
>     inspect a variable I can only get limited information on its state.
>     Specifically if I open an "immediate" window and try
>     v(0)
>     I get the following error
>     CXX0059: Error: left operand is class not a function name
>     If I try
>     v[0]
>     CXX0058: Error: overloaded operator not found
>
>
> A few things:
> 1) I haven't tried to do what you are trying exactly but: Make sure
> you have made the debugging extensions described at the bottom of:
> http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Effective_UBLAS
>
> 2) Also, don't forget that ublas is using expression templates, so
> things like "-v" are going to be complicated to step through.  It will
> generate a strange intermediate object without actually changing the
> sign of anything or executing any code.  Only when the cout <<
> serialization begins would it start going through the vector and doing
> the negation.  If you want to look at intermediates, you should assign
> expressions to temporary classes of type ublas::vector<> etc.
>
> 3) Last, I have often thought that the "debug" build doesn't
> necessarily change all of the preprocessor definitions that change
> debugging, see the bottom of:
> http://www.crystalclearsoftware.com/cgi-bin/boost_wiki/wiki.pl?Effective_UBLAS 
> and if there was any inlining in a build, etc. you would definetely be
> confused when stepping through.
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ublas mailing list
> ublas@...
> http://lists.boost.org/mailman/listinfo.cgi/ublas
> Sent to: johnmcd@...

--
==================================
John Mc Donald,
Dept. of Computer Science,
National University of Ireland,
Maynooth,
Co. Kildare,
Ireland.

Email : johnmcd@...
Tel: +353-1-7084589
Fax: +353-1-7083848
Web: http://www.cs.nuim.ie/~johnmcd
GnuPG Key: http://www.cs.nuim.ie/~johnmcd/public_key.asc
==================================

_______________________________________________
ublas mailing list
ublas@...
http://lists.boost.org/mailman/listinfo.cgi/ublas
Sent to: lists@...