News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Need help, about debug std::map

Started by Loaden, January 13, 2010, 08:14:09 AM

Previous topic - Next topic

Loaden

Hello everyone, I am using CB debugging, found it impossible to print std:: map <int, std::string> value.
You have any good ideas? Thanks!
#include <iostream>
#include <map>
#include <string>

using namespace std;

int main()
{
map<int, string> m = {{1, "Hello everybody!"}, {2, "How to debug map?"}};
m.insert (make_pair (3, "pmap m int int no-work!") );
m.insert (make_pair (4, "Need help, thanks!") );
return 0;
}




[attachment deleted by admin]

oBFusCATed

You can write a Evaluation script, see here http://wiki.codeblocks.org/index.php?title=Debugger_scripts
Also look at the implementation of the Vector's script, it uses the gdb's script "stl-views-1.0.3.gdb", which should have command for maps.

The script is taken from here: http://sourceware.org/gdb/wiki/STLSupport
You can use the python pretty printers if you have python enabled gdb-7.x+ (the windows one is not :( )

Also enable the debugger's debug log pane (settings -> compiler & debugger -> debugger)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Loaden

Thanks to oBFusCATed !
I will try it.