调试时如何在代码块中查看地图内容?

问题描述 投票:0回答:1

我正在为我的 C++ 程序使用代码块。如何在调试时查看地图的内容。

我的地图定义如下-

map< int , int > myMap;

我输入数据如下-

myMap[1]=5;

在执行上述两行后调试时,我在 watches 窗口中看到以下内容。

为什么我看不到 map[1]=5 ?我该怎么做。

对不起,我是 c++ 的新手,来自 visual studio code 上的 python,我从来没有遇到过这样的问题。

我正在使用 8.1.0 gcc 和 8.1 gdb。 我在跑步时得到以下信息

print myMap

{_M_t = {_M_impl = {<std::allocator<std::_Rb_tree_node<std::pair<int const, int> > >> = {<__gnu_cxx::new_allocator<std::_Rb_tree_node<std::pair<int const, int> > >> = {<No data fields>}, <No data fields>}, <std::_Rb_tree_key_compare<std::less<int> >> = {_M_key_compare = {<std::binary_function<int, int, bool>> = {<No data fields>}, <No data fields>}}, <std::_Rb_tree_header> = {_M_header = {_M_color = std::_S_red, _M_parent = 0x3e3720, _M_left = 0x3e3720, _M_right = 0x3e3720}, _M_node_count = 1}, <No data fields>}}}
c++ dictionary gdb mingw codeblocks
1个回答
0
投票

请在MinGW目录下搜索gdbinit

调试器设置 --> 默认 --> 初始化命令

源 $(TARGET_COMPILER_DIR)etc\gdbinit

© www.soinside.com 2019 - 2024. All rights reserved.