Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support fully qualified names for enums
This commit enables full support for enums in the following ways: 1) Enums now are also produced with fully-qualified names (such as those nested in classes, or namespaces). Thus two enums `Foo` in two classes can be uniquely examined in a debugger. 2) Fix the way in which we emit the underlying enum type in the PDB. Previously, we were emitting a "UDT reference" for almost all enum types, even "unsigned long", which it turns out Windows debuggers do not like. WinDbg crashes when encountering such a symbol in some cases, and Visual Studio Debugger fails to resolve the value. It turns out that the root cause here is that enums in a PDB must always use a "base type," never a UDT. To do this, I unwind the DIE type reference by walking its "type" chain until the last element, and produce a CV base type from the encoding and byte size of said record. E.g. for cases like enum Foo : size_t { ... }, we walk the size_t UDT reference and find, for example, an `unsigned long` UDT reference, and follow that, and ultimately find a base type with encoding `DW_ATE_unsigned` and byte size = 4, and generate a T_ULONG CV type for the enum. Also, a minor improvement: We now correctly indicate whether a structure is a class or struct, instead of always emitting "struct" in the CV record.
- Loading branch information