Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: leeguevara on February 06, 2010, 07:12:39 am

Title: How can I debug into the C++ source code?
Post by: leeguevara on February 06, 2010, 07:12:39 am
Hi, all. I am a begineer of C++. I use the code::blocks, and I want to debug into the c++ source code.
For example,I write a simple code.

int main()
{
     int i=10;
     cout<<i<<endl;
}

I toggle a break point before the "cout", and I want to step into the "cout".
In the "call stack" window, I can see such message "#0 0042E583   std::ostream::operator<<(std::ostream& (*)(std::ostream&) (C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/iostream:77)"   

How can I see source code of "std::ostream::operator<<(std::ostream& (*)(std::ostream&)"?
Thanks a lot.
Title: Re: How can I debug into the C++ source code?
Post by: rcoll on February 06, 2010, 07:35:07 am
Hi, all. I am a begineer of C++. I use the code::blocks, and I want to debug into the c++ source code.
For example,I write a simple code.

int main()
{
     int i=10;
     cout<<i<<endl;
}

I toggle a break point before the "cout", and I want to step into the "cout".
In the "call stack" window, I can see such message "#0 0042E583   std::ostream::operator<<(std::ostream& (*)(std::ostream&) (C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/iostream:77)"   

How can I see source code of "std::ostream::operator<<(std::ostream& (*)(std::ostream&)"?
Thanks a lot.

You need to actually have a copy of the source code somewhere on your hard-disk; all the debugger will ever do is read that source code file and show you which line you are currently on.  If the debugger can not find the source code, it will not be able to show it to you.

Also, you really need to be asking these sorts of questions on a forum dedicated to C++ programming.  This forum is for discussing Code::Blocks (which in an IDE, not a compiler).

Ringo
Title: Re: How can I debug into the C++ source code?
Post by: ollydbg on February 06, 2010, 07:37:46 am
Hi, all. I am a begineer of C++. I use the code::blocks, and I want to debug into the c++ source code.
For example,I write a simple code.

int main()
{
     int i=10;
     cout<<i<<endl;
}

I toggle a break point before the "cout", and I want to step into the "cout".
In the "call stack" window, I can see such message "#0 0042E583   std::ostream::operator<<(std::ostream& (*)(std::ostream&) (C:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../../../include/c++/3.4.5/iostream:77)"   

How can I see source code of "std::ostream::operator<<(std::ostream& (*)(std::ostream&)"?
Thanks a lot.
No, you can't debug into the source of "cout". only if you're using a debug version of c++ library.
So, did you build the c++ library yourself?
Title: Re: How can I debug into the C++ source code?
Post by: leeguevara on March 02, 2010, 10:10:51 am
I didn't build the C++ library myself. I just down load the MinGW from the internet.