Skip to main content



      Home
Home » Language IDEs » C / C++ IDE (CDT) » failure to step into std::string constructor
failure to step into std::string constructor [message #213059] Sun, 30 March 2008 13:40 Go to next message
Eclipse UserFriend
Originally posted by: beluchin.hotmail.com

When debugging the program below:

#include <string>
#include <iostream>
using namespace std;

int main() {

std::string s("Hello World");
std::cout << s << '\n';
return 0;

}


I try to step into the constructor of the std::string. However, the
debugger apparently fails to do that. The iostream file is opened on the
editor and the next instruction is shown on line 77 of that file:
static ios_base::Init __ioinit;

Also, on the gdb console, the message:
mi_cmd_var_create: unable to create variable object

is shown. The program runs correctly, though. Can anything be done to make
gdb behave correctly when stepping into the constructor of std::string?

This is the first thing I try to do after I do a plain-vanilla
installation in Windows XP of (following the indicated order):
~ mingw 5.1.3 from sourceforge, with g++ and make
~ gdb 6.6 from the same page as mingw
~ classic Eclipse 3.3.2
~ CDT from inside Eclipse from
http://download.eclipse.org/tools/cdt/releases/europa
Re: failure to step into std::string constructor [message #213099 is a reply to message #213059] Mon, 31 March 2008 04:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fwein.lse.eei.uni-erlangen.de

Hi Abel.

> is shown. The program runs correctly, though. Can anything be done to
> make gdb behave correctly when stepping into the constructor of
> std::string?
Well, I guess, your libs are not compiled with debug information.

Fabian
Re: failure to step into std::string constructor [message #213107 is a reply to message #213099] Mon, 31 March 2008 05:44 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: beluchin.hotmail.com

> Well, I guess, your libs are not compiled with debug information.

I did not compile anything. I simply followed the steps I listed on my
previous post to install all the components:

>> ~ mingw 5.1.3 from sourceforge, with g++ and make
>> ~ gdb 6.6 from the same page as mingw
>> ~ classic Eclipse 3.3.2
>> ~ CDT from inside Eclipse from
http://download.eclipse.org/tools/cdt/releases/europa

One interesting thing: When I remove the #include <iostream> and the
statement to print the std::string, the debugger still fails to step into
the constructor. However, it moves the execution point to the line below
the call to the constructor (the return statement):

#include <string>
// #include <iostream> // Removed
using namespace std;

int main() {

std::string s("Hello World");
// std::cout << s << '\n'; // Removed
return 0;

}


I am kind of lost at this point.
Re: failure to step into std::string constructor [message #213115 is a reply to message #213107] Mon, 31 March 2008 09:04 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: fwein.lse.eei.uni-erlangen.de

>> Well, I guess, your libs are not compiled with debug information.
>
> I did not compile anything. I simply followed the steps I listed on my
> previous post to install all the components:

One can only debug code, that includes debug information. This normaly
makes
the code larger and much slower (because one generally cannot optimize
then).

Standard libraries are not meant for debugging and but to be small and
fast.

Furthermore, for a normal user there is no use in debugging standard libs.
If for any reason you really want to debug the c++ libs, I guess you have
to compile the by yourself.

It wouldn't be a surprise if this is a little complicated on Windows.


> One interesting thing: When I remove the #include <iostream> and the
> statement to print the std::string, the debugger still fails to step
> into the constructor. However, it moves the execution point to the line
> below the call to the constructor (the return statement):
Well, without debug information this makes sense - dont' you think?

> I am kind of lost at this point.
Do you really want to debug this stuff?

Fabian
Re: failure to step into std::string constructor [message #213130 is a reply to message #213115] Mon, 31 March 2008 21:03 Go to previous message
Eclipse UserFriend
Originally posted by: beluchin.hotmail.com

I took a second look at this. I initially thought that the definition of
the std::string constructor resided in a header file, for it was a member
function of a class template.

I inspected the header files, though, and noticed that the GNU compiler
already implements (and uses) the "export" extension for templates, which
means that the definitions of the member functions of the standard
library's class templates is no longer on header files.

That explains why the debugger fails to step into that method.

Thanks for the heads-up.
Previous Topic:Send signal to application
Next Topic:Run CDT project from CLI?
Goto Forum:
  


Current Time: Sat May 10 13:11:31 EDT 2025

Powered by FUDForum. Page generated in 0.04532 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top