Page 1 of 1

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

Posted: Sat Sep 24, 2011 4:25 am
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. :)

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

Posted: Sat Sep 24, 2011 8:18 am
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