Page 1 of 1

Debugger Predefined types for STL

Posted: Mon Dec 14, 2009 1:19 pm
by galileo
Hi, eranif!
What should I do to make CL recognize STL types like vector, set, map and show them more pretty in watches?
I tried to add this in predefined types:

Type: vector
Expresssion: $(Variable)
Debugger: pvector

But it doesn't help.

Re: Debugger Predefined types for STL

Posted: Tue Feb 23, 2010 8:51 pm
by kspes
I'm having problem with this feature, Predefined types has an entry for std::string, but locals (and watches) don't expand it properly. instead it gives me {...}

here's some demo code:

Code: Select all

#include <string>

int main(int argc, char **argv)
{
	std::string s="test";
	
	s="new value";
	return 0;
}
debugger "print s" gives:
$2 = {
static npos = 4294967295
,
_M_dataplus = {
<std::allocator<char>> = {
<__gnu_cxx::new_allocator<char>> = {<No data fields>}, <No data fields>},
members of std::basic_string<char, std::char_traits<char>, std::allocator<char> >::_Alloc_hider:
_M_p = 0x352c04 "test"

}

}
and locals gives {...}

I experienced this on multiple computers. Codelite 2.2.0.3681 and SVN trunk revision 3765

Re: Debugger Predefined types for STL

Posted: Tue Feb 23, 2010 9:11 pm
by eranif
kspes wrote:and locals gives {...}
You will need to double-click it to expand it / or click it (depends on the drop down selection you set)

The list control used is not capable of displaying trees.

Eran

Re: Debugger Predefined types for STL

Posted: Tue Feb 23, 2010 9:19 pm
by kspes
yeah, but what's the point of predefined debugger types then? I don't need to display a tree for std::string, just the string it represents. This way I have to click quite a few times to get the value I need and is usually burried in that stl clutter.
This is especially painful when using watches.

How are predefined types used? The default setting for string says "$(Variable)._M_dataplus._M_p"

"print s._M_dataplus._M_p" gives "$2 = 0x592c04 "test"" which would be great to be used in locals instead of {...}
The tree variant is useful, but for some types (like the debugger predefined types) I'd prefer this shortened version.

Re: Debugger Predefined types for STL

Posted: Wed Feb 24, 2010 10:52 am
by eranif
kspes wrote:"print s._M_dataplus._M_p" gives "$2 = 0x592c04 "test"" which would be great to be used in locals instead of {...}
Ah, ok. Now I understands what you want :P

Settings -> Debugger Settings and enable the option: 'Evaluate items in the 'Locals' view based on the 'PreDefined' types where possible'

Start your debugging session again.

EDIT:
The reason it is 'OFF' by default is because of performance, evaluating each item can slow down the debugging (when u have tens or entries in the locals view), but in most cases it is harmless.
Eran

Re: Debugger Predefined types for STL

Posted: Wed Feb 24, 2010 12:04 pm
by kspes
oooooh :) that's what I was looking for, thanks. I went over that dialog a dozen times, can't believe I missed that option :)

btw, why doesn't this work for watches as well? is this intentional or?