|
|
| Re: Exploring std::map and std::list in debugger [message #544855 is a reply to message #544844] |
Mon, 05 July 2010 13:44   |
Eclipse User |
|
|
|
No any binaries, there were only screenshots inside messages on the forum.
For a very simple program like this one:
#include <map>
#include <list>
#include <string>
using namespace std;
int main()
{
typedef map<string, list<string> > map_t;
map_t m;
m["one"].push_back("a");
m["one"].push_back("b");
m["one"].push_back("c");
m["two"].push_back("1");
m["two"].push_back("2");
m["two"].push_back("3");
map_t::const_iterator i = m.begin();
i++;
return 0; // <= break point on this line
}
I've set break point on the line with return statement.
In MSVC2008 debugger I see something like:
[-] m[2]("one",[3]("a","b","c")),("two",[3]("1","2","3")))
[+] [0] ("one",[3]("a","b","c"))
[+] [1] ("two",[3]("1","2","3"))
and
[+] i ("two",[3]("1","2","3"))
And Eclipse shows me like this:
[-] m | map_t | {...}
[+] _M_t | std::_Rb_tree<std::basic_strin.. | {...}
and
[-] i | std::_Rb_tree_const_iterator<s.. | {...}
[+] _M_node | std::_Rb_tree<std::basic_strin.. | 0x3e2550
no actual data inside std::map or std::list is displayed.
|
|
|
|
|
|
|
|
| Re: Exploring std::map and std::list in debugger [message #545103 is a reply to message #545090] |
Tue, 06 July 2010 12:03   |
Eclipse User |
|
|
|
| Andrey Kourskov wrote on Tue, 06 July 2010 11:23 | Try to instal this MinGW GDB build
|
Thanks for the link. How did you get it by the way?
Now I have this in gdb console:
(gdb) break 18
Breakpoint 1 at 0x401a40: file ..\src\test.cpp, line 18.
(gdb) run
Starting program: ...\Projects\Eclipse\CDT\test\Debug/test.exe
[New Thread 3784.0xb20]
Breakpoint 1, main () at ..\src\test.cpp:18
18 return 0;
(gdb) print m
$1 = std::map with 2 elements = {
["one"] = std::list = {
[0] = "a",
[1] = "b",
[2] = "c"
},
["two"] = std::list = {
[0] = "1",
[1] = "2",
[2] = "3"
}
}
So it seems that now GDB can show values inside STL container now.
But almost nothing has changed inside Eclipse when I point to new GDB and .gdbinit file. I mean that it still shows me something like this:
[-] m | map_t | {...}
[+] _M_t | std::_Rb_tree<std::basic_strin.. | {...}
The only progress is in Details below:
Name : m
Details:std::map with 2 elements = {\n ["one"] = std::list = {\n [0] = "a",\n ... [2] = "3"\n }\n}
Default:{...}
Decimal:{...}
...
So it is still not usable. Just look at the screenshot with MSVC above: only the required data is displayed in a very compact way. How can something similar be achived in Eclipse?
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.07447 seconds