Re: Natvis, CV8, dAssocArray

2018-09-26 Thread Void-995 via Digitalmars-d-debugger
On Wednesday, 26 September 2018 at 18:06:48 UTC, Rainer Schuetze 
wrote:



On 26/09/2018 09:45, Void-995 wrote:
On Wednesday, 26 September 2018 at 07:37:26 UTC, Rainer 
Schuetze wrote:

[...]


Makes sense. I've tried to move them to "member" but they 
obviously did not point anywhere, which is logical if that is 
just "typedef". Is there any way to expose real key/values 
from backend or get them via some Natvis magic? That's 
basically only thing that stops from using MS C/C++ plug-in 
for debugging from VS Code. Natvis support may be valuable for 
Linux and Mac as well, as they've added minimal support for 
Natvis to GDB and LLDB via their plug-in.


Not sure if you can define new structs in NatVis, but the void 
pointer points to rt.aaA.Impl which contains an array of 
Buckets, and their entry member points to a 
std::pair<__key_t,__val_t>.


Thanks, I did something like that meanwhile: 
https://www.dropbox.com/s/h70m4v63jxp79g1/d.natvis?dl=0


Need to take a look at other ideas as well. Of course it won't 
hurt to clean that up, but this one works.


Re: Natvis, CV8, dAssocArray

2018-09-26 Thread Rainer Schuetze via Digitalmars-d-debugger




On 26/09/2018 09:45, Void-995 wrote:

On Wednesday, 26 September 2018 at 07:37:26 UTC, Rainer Schuetze wrote:



On 25/09/2018 22:08, Void-995 wrote:
I almost finished my -gc for Natvis experiment (to use MS C++ 
Debugger from VS Code, fully translating type names from what comes 
from DMD frontend to valid C++ type name so Natvis works), but then I 
encountered dAssocArray, which has form of: void* as CodeView 
structure member, KeyType __key_t and ValueType __val_t as nested types.


As for someone who just found about CodeView today: what is nested 
type, what is the deal with void*, what to do with __key_t and 
__val_t to get values.


Nested types are types declared in another type, e.g. in C++

struct dAssocArray
{
typedef int __key_t;
typedef long __val_t;
void* ptr;
};

The AA data structures are not exposed by the compiler, but the mago 
debugger rebuilds them from these types.


Makes sense. I've tried to move them to "member" but they obviously did 
not point anywhere, which is logical if that is just "typedef". Is there 
any way to expose real key/values from backend or get them via some 
Natvis magic? That's basically only thing that stops from using MS C/C++ 
plug-in for debugging from VS Code. Natvis support may be valuable for 
Linux and Mac as well, as they've added minimal support for Natvis to 
GDB and LLDB via their plug-in.


Not sure if you can define new structs in NatVis, but the void pointer 
points to rt.aaA.Impl which contains an array of Buckets, and their 
entry member points to a std::pair<__key_t,__val_t>.




Re: Natvis, CV8, dAssocArray

2018-09-26 Thread Void-995 via Digitalmars-d-debugger
On Wednesday, 26 September 2018 at 07:37:26 UTC, Rainer Schuetze 
wrote:



On 25/09/2018 22:08, Void-995 wrote:
I almost finished my -gc for Natvis experiment (to use MS C++ 
Debugger from VS Code, fully translating type names from what 
comes from DMD frontend to valid C++ type name so Natvis 
works), but then I encountered dAssocArray, which has form of: 
void* as CodeView structure member, KeyType __key_t and 
ValueType __val_t as nested types.


As for someone who just found about CodeView today: what is 
nested type, what is the deal with void*, what to do with 
__key_t and __val_t to get values.


Nested types are types declared in another type, e.g. in C++

struct dAssocArray
{
typedef int __key_t;
typedef long __val_t;
void* ptr;
};

The AA data structures are not exposed by the compiler, but the 
mago debugger rebuilds them from these types.


Makes sense. I've tried to move them to "member" but they 
obviously did not point anywhere, which is logical if that is 
just "typedef". Is there any way to expose real key/values from 
backend or get them via some Natvis magic? That's basically only 
thing that stops from using MS C/C++ plug-in for debugging from 
VS Code. Natvis support may be valuable for Linux and Mac as 
well, as they've added minimal support for Natvis to GDB and LLDB 
via their plug-in.


Re: Natvis, CV8, dAssocArray

2018-09-26 Thread Rainer Schuetze via Digitalmars-d-debugger




On 25/09/2018 22:08, Void-995 wrote:
I almost finished my -gc for Natvis experiment (to use MS C++ Debugger 
from VS Code, fully translating type names from what comes from DMD 
frontend to valid C++ type name so Natvis works), but then I encountered 
dAssocArray, which has form of: void* as CodeView structure member, 
KeyType __key_t and ValueType __val_t as nested types.


As for someone who just found about CodeView today: what is nested type, 
what is the deal with void*, what to do with __key_t and __val_t to get 
values.


Nested types are types declared in another type, e.g. in C++

struct dAssocArray
{
typedef int __key_t;
typedef long __val_t;
void* ptr;
};

The AA data structures are not exposed by the compiler, but the mago 
debugger rebuilds them from these types.