dlang-debug icon indicating copy to clipboard operation
dlang-debug copied to clipboard

Natvis and WinDbg Preview

Open andre2007 opened this issue 3 years ago • 6 comments

Is the Natvis script usable with WinDbg Preview (Windows 10 microsoft store)?

I tried to load the script during a debugging session and hit the script execute button but do not see any visual effect (e.g. representation of string arrays in the locals view).

andre2007 avatar May 25 '21 11:05 andre2007

the Natvis documentation is very sparse and only written for VS. I have developed and debugged it with VS so I can't really tell you how it's going to perform in other debuggers. Try to see if you can find some error log, in VS when it fails to parse something the entire natvis file refuses to load.

WebFreak001 avatar May 25 '21 11:05 WebFreak001

I checked the logs, there is only one interesting error message in the log:

GetLineByInlineContextWide failed. Symbols are not loaded or no source information available.

I started debugging for the executable, loaded the source code of the file. Then loaded thr Natvis script and executed it.

But I am now unsure whether I have to set additional Debugging paths in the settings window. Source paths to the project, druntime and Phobos are set, but maybe the error is related to the Symbol paths which I haven't set so far.

andre2007 avatar May 26 '21 04:05 andre2007

In VS you just have to drop the natvis into the project folder and it auto loads, in vscode you have to set it as "visualizer path" (and only a single one is supported)

Loading it should be all that is needed to be done.

Also did you compile your executable with the -gc flag using LDC? DMD has removed it and the native D debug information is incompatible with Natvis syntax and thus broken.

WebFreak001 avatar May 26 '21 11:05 WebFreak001

You are right, I was using dmd. I now tried ldc with the mentioned arguments and it seems to work.

After executing the script the graphical representation of e.g. a string array in the "Locals" view changed. I can now immediately see that there are 2 elements within the string array.

What I wonder, the actual string content is still not displayed. Only in the raw view I can see the number representation of the char (0x61 for the letter A).

andre2007 avatar May 27 '21 06:05 andre2007

can you attach a screenshot and information you can find about the type?

WebFreak001 avatar May 27 '21 07:05 WebFreak001

20210527_094959.jpg

andre2007 avatar May 27 '21 07:05 andre2007