Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #96316 - michaelwoerister:debuginfo-fix-unit-msvc, r=we…
…sleywiser debuginfo: Emit ZST struct debuginfo for unit type when CPP-like debuginfo is enabled As already discovered in 24a728a, PDB does not play well with custom basic types. This PR extends to the fix to `()`: Instead of a custom basic type, we treat it like an empty tuple (i.e. it is described as a struct which happens to have no fields). Before this change anything with a `()` in it would cause trouble, which is especially bad for `*const ()` and `*mut ()` which are often used for opaque pointers. E.g. the test case added in this PR would look like: ``` 0:000> dx _ref Error: Unable to bind name '_ref' 0:000> dx _ptr Error: Unable to bind name '_ptr' 0:000> dx _local Error: Unable to bind name '_local' 0:000> dx _field,d _field,d [Type: unit_type::_TypeContainingUnitField] [+0x008] _a : 123 [Type: unsigned int] [+0x000] _unit : Unexpected failure to dereference object [+0x000] _b : 456 [Type: unsigned __int64] 0:000> dx ((__int64 *)_ptr),x Error: Unable to bind name '_ptr' ``` With the PR it produces the expected output: ``` 0:000> dx _ref _ref : 0x7ff6f2012230 : () [Type: tuple$<> *] 0:000> dx _ptr _ptr : 0x7e8ddffc20 : () [Type: tuple$<> *] 0:000> dx _local _local : () [Type: tuple$<>] 0:000> dx _field,d _field,d [Type: unit_type::_TypeContainingUnitField] [+0x008] _a : 123 [Type: unsigned int] [+0x000] _unit : () [Type: tuple$<>] [+0x000] _b : 456 [Type: unsigned __int64] 0:000> dx ((__int64 *)_ptr),x ((__int64 *)_ptr),x : 0x7e8ddffc20 : 0x1122334455667788 [Type: __int64 *] ``` r? `@wesleywiser`
- Loading branch information