Sysprogs forums › Forums › VisualGDB › watch std::unordered_map
- This topic has 25 replies, 2 voices, and was last updated 3 years ago by elikfir.
-
AuthorPosts
-
April 25, 2021 at 05:33 #30401elikfirParticipant
Hi,
I tried to watch std::unordered_map on visualGDB and I can see only hashtable members without any pretty printing for that.
do you have any quick solution? (any natvis file that I can use to fix that?)
code:
#include <iostream>
#include <string>
#include <unordered_map>int main(int argc, char *argv[])
{
std::unordered_map<int32_t, std::string> tmp;
tmp[0] = “str0”;
tmp[1] = “str1”;return 0;
}thanks
April 25, 2021 at 08:25 #30402supportKeymasterHi,
Sorry, we don’t have a ready-to-use visualizer of unordered_map yet. It is on the roadmap, however it’s hard to give any time estimates now. As a workaround, please consider creating one manually as shown in this tutorial.
April 25, 2021 at 09:55 #30405elikfirParticipantthanks.
Once you have any solution for that It will be great to get it even a temporary/walkaround solution (like a working visualizer that just need to plug and play)
August 24, 2021 at 12:06 #31195elikfirParticipantHi,
any updates with ready-to-use visualizer of unordered_map/set?
thanks
August 24, 2021 at 12:22 #31196supportKeymasterHi,
We generally prioritize feature requests based on the number of affected users. As this is a very specific request affecting a very small number of users, and can be achieved by implementing a custom visualizer, it has a very low priority and will likely not be added anytime soon.
If your company holds multiple VisualGDB licenses, please let us know the email associated with your key, and we will assign a higher priority to this.
October 14, 2021 at 04:43 #31533elikfirParticipanthi,
first of all it’s not a weird question, it’s a STD container that VisualGDB cannot show. I don’t know about other users, but I guess I’m not the only one who need that, I just the first one to report about that.
second, I don’t know how to read the this container and how to write a custom visualizer for it. if it simple you’re welcome to share it, if it’s not so simple it doesn’t make any sense to ask users to do it.
About the company I worked on, I don’t know which one uses VisualGDB, and even I knew it’s not something I can share here.
I guess I will need to wait for Visual-Studio 2022 or other extension which will help me to build/debug a custom Linux/WSL2 and get rid of VisualGDB.
October 14, 2021 at 08:28 #31534supportKeymasterPlease note that VisualGDB focuses on improving the typical development scenarios that would otherwise take a lot of our customers’ time. E.g. we provide a powerful Clang-based IntellISense engine that allows exploring large code bases, more reliable debugger integration, convenient GUI for configuring common settings, deep integration with Valgrind, CMake and numerous other tools, etc. You can find more about VisualGDB features for Linux here.
If none of these features made VisualGDB worthwhile for you in 6 months, adding support for visualizing a very specific container will not make much of a difference. So instead, we have to focus on features that would make a difference in the context of common tasks (e.g. the newly added Code Explorer is a huge help when dealing with large projects).
November 10, 2021 at 06:50 #31744elikfirParticipantI just found a way to get it print correctly when using VS2022 (by using libstdcxx pretty printing). it works fine when using native VS2022 Linux debugger.
It doesn’t work on VisualGDB, I can see the values on GDB Session window but not on the Watch.
Is there any way to enable it on the watch as it’s done on native Linux debugger on VS2022?
November 10, 2021 at 07:48 #31745supportKeymasterHi,
No problem, you can use the GDB session window to send commands directly to GDB, including the ones to evaluate variables via libstdcxx.
November 10, 2021 at 09:53 #31749elikfirParticipantHi,
yes, that’s what I did (or a better way to put it on additional gdb commands part).
But I want to see it on the watch window. I don’t want to go back to use command line GDB, that’s why I purchased VisualGDB
November 10, 2021 at 09:57 #31750supportKeymasterWe are sorry, as we have explained before, we do not have any plans for supporting it in the watch window and will not be able to change it.
As a workaround, please use the GDB session window. All other functionality provided by VisualGDB will work as expected.
November 10, 2021 at 10:00 #31751elikfirParticipantbut here my question is different – the data is already there when using pretty-printer, is there any simple step that I can do to see it on the watch? (VS2022 native Linux debugger has it)
November 10, 2021 at 10:04 #31752supportKeymasterIf GDB recognizes and reports the data via the MI interface, both Visual Studio and VisualGDB will show it out-of-the-box. If the data appears when using the regular VS debugger, but not with VisualGDB, most likely you are using different GDB settings.
If you could capture a GDB log from both VisualGDB and the regular VS debugger, and let us know the variable name in question, we can help you configure VisualGDB to show it the same way the VS debugger does.
November 10, 2021 at 10:57 #31753elikfirParticipanthere is the summary:
the code is:#include <iostream>
#include <unordered_map>int main()
{
std::unordered_map<int32_t, float> m;
m[5] = 5.1f;
int c = getchar();
return 0;
}Visual Studio debugging without any change to the configuration – works fine and I can see the data on the watch.
Visual Studio debugging with adding verbose log to the launch.vs.json – same behavior as Visual GDB – I can see the data on the GDB command line only but not in the watch.
VisualGDB – as mentioned – I can see the data on command line after manually loading pretty-printing for libgcc but not on the watch.
this is the way I added verbose to the configuration:
“setupCommands”: [
{
“description”: “verbose”,
“text”: “set verbose on”,
“ignoreFailures”: true
}
]Attachments:
You must be logged in to view attached files.November 10, 2021 at 11:04 #31758supportKeymasterHi,
No problem, if the verbose mode is interfering with the unordered_map visualization, you can turn it off via VisualGDB Project Properties -> Advanced GDB Settings -> Request verbose output from GDB.
If it doesn’t help, please make sure the native VS log does include the used GDB command line and the full output from gdb (including commands like -var-create –frame 0 –thread 1 – * “m”). Any differences in the watch window contents come from different output from -var-list-children and the only way to troubleshoot them is to understand what is causing this difference.
-
AuthorPosts
- You must be logged in to reply to this topic.