Debugging standard types (std::map, std::set, etc)

General questions regarding the usage of CodeLite
tankist02
CodeLite Veteran
Posts: 56
Joined: Thu Sep 22, 2011 11:29 pm
Genuine User: Yes
IDE Question: c++
Contact:

Debugging standard types (std::map, std::set, etc)

Post by tankist02 »

I input the following into Debugger New Type and it worked great:

Code: Select all

Type: vector
Expression: *($(Variable)._M_impl._M_start)@$(Variable).size()
Debugger Command: print
Are there any info how to do similar configuration for other STL types: std::map, std::set and others?

Why not to include predefined configurations for all standard types instead of forcing the user to do it manually? I suspect that expressions will be different between different STL implementations, so let's start with GCC since I am using it. :)
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugging standard types (std::map, std::set, etc)

Post by eranif »

This type *was* part of codelite in the past, however:
If the map is vector is not initialized properly, for example this code snippet:

Code: Select all

void foo()
{
printf("hello");                             // debugger is here
std::vector<wxString> v;
v.push_back(wxT("a string"));
}
At the above example, "v" is visible to the debugger, but not initialized yet so @v.size() will return a huge number which will either crash gdb or will cause codelite to hang.
It caused too many crashes of gdb / hanges in codelite. I took care of the hangs by disallowed types which contain the '@' operator to be automatically expanded in the "Locals" view.

(you can have a look at LiteEditor/localstable.cpp:279)

Eran
Make sure you have read the HOW TO POST thread
Post Reply