Debugger Predefined types for STL

General questions regarding the usage of CodeLite
galileo
CodeLite Curious
Posts: 1
Joined: Mon Dec 14, 2009 1:09 pm
Genuine User: Yes
IDE Question: C++
Contact:

Debugger Predefined types for STL

Post 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.
User avatar
kspes
CodeLite Enthusiast
Posts: 41
Joined: Sat Jan 30, 2010 2:18 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Predefined types for STL

Post 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
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Predefined types for STL

Post 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
Make sure you have read the HOW TO POST thread
User avatar
kspes
CodeLite Enthusiast
Posts: 41
Joined: Sat Jan 30, 2010 2:18 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Predefined types for STL

Post 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.
User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Predefined types for STL

Post 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
Make sure you have read the HOW TO POST thread
User avatar
kspes
CodeLite Enthusiast
Posts: 41
Joined: Sat Jan 30, 2010 2:18 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Debugger Predefined types for STL

Post 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?
Post Reply