Skip to content

Natvis Parity: Missing ,na[⋯] Specifiers #1533

@geometrian

Description

@geometrian

The following simple example serves as a minimal test case. It should work in VS and fail in VSCode.

The type:

template< class T, int n >
struct NatvisTestType final
{
	T arr[n];
};

The Natvis:

<?xml version="1.0" encoding="utf-8"?>
<AutoVisualizer xmlns="http://schemas.microsoft.com/vstudio/debugger/natvis/2010">
	<Type Name="NatvisTestType&lt;*,*&gt;">
		<DisplayString>{($T1*)arr,na$T2}</DisplayString>
		<Expand HideRawView="true">
			<ExpandedItem>arr</ExpandedItem>
		</Expand>
	</Type>
</AutoVisualizer>

On VSCode "cppdbg", the debugger will say "-var-create: unable to create variable object". Adding "logging": { "engineLogging": true } to the configuration in "launch.json", will show in the debug console that it attempted to do the following:

1: (814) ->(gdb)
1: (814) 1125: elapsed time 3
1: (814) <-1126-var-create  - * "(float*)((test).arr),na$T2"
1: (818) ->1126^error,msg="-var-create: unable to create variable object"

This obviously can't work. The syntax is not right, and $T2 didn't even get substituted in properly!

See also related issue (#1369) for the length itself. One also observes in this example that HideRawView is disrespected (#1458).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions