Page 1 of 1
about std container debugging
Posted: Wed Apr 27, 2011 8:53 pm
by kingsyj
hei, guys, thanks provide such a good IDE, it's the most VC alike IDE I have ever found currently. but there's still some important subject missing, because when I use STL containers or I use the container of my owner, I can't visualize the elements in the debugger window.
when we use visual studio, I know I can provide autoexp.dat script to visualize the elements of the containers, is there a similar method that can use when work with codelite? thank you!
Re: about std container debugging
Posted: Thu Apr 28, 2011 10:20 am
by eranif
You will need to give an example of such container.
Also, please read this before posting:
http://codelite.org/forum/viewtopic.php?f=3&t=804
Eran
Re: about std container debugging
Posted: Thu Apr 28, 2011 6:54 pm
by kingsyj
thanks for reminder, here is my profile
os: window xp version 2002 service pack 3
codelite version: v2.10.0.4778
gdb: I'm using the mingw version accompany along with the codelite download package.
for code examples, such
Code: Select all
#include <stdio.h>
#include <vector>
int main(int argc, char **argv)
{
printf("hello world\n");
int a = 3;
std::vector<int> array;
array.push_back(1);
array.push_back(2);
array.push_back(3);
array.clear();
return 0;
}
when I debugging, do I have any methods to visualize the array size, elements in the debugging window? thanks for reply.
Re: about std container debugging
Posted: Fri Apr 29, 2011 6:21 pm
by eranif
The problem is that gdb does not provide it automatically like the VS debugger, but it can be done.
For example, to display the content of std::vector, you can do this:
- First, since gdb is buggy when it comes to un-initial variables, you will need to turn off the following option in codelite:
settings | debugger settings ... | GNU Gdb debuggger | General | Use PreDefined types for the 'Locals' view
- Next, define new type for the debugger from:
settings | debugger settings ... | Pre Defined types
Code: Select all
Type: std::vector
Expression: *($(Variable)._M_impl._M_start)@$(Variable).size()
Debugger command: print
Click OK, and restart your debugging session.
Now, when clicking CTRL when hovering with the mouse over the word 'array' while debugging you will see this:
dbg-vector.png
Eran