A natvis file is a debug visualizer DSL that can be embedded inside of a PDB so that the debugger can do custom formatting of types at debug time.
The way this is implemented is that the linker piggybacks off of the existing "named stream" map in the PDB file. It seems like in theory you can store any kind of source file in here, so you could even archive your entire source tree inside of the PDB file. so you could debug without source. In any case, the linker needs to create a named stream named /src/files/<some unique name>, and then for the contents of that stream, just embed the contents of the xml. <some unique name> doesn't seem to matter as long as it's unique and appears to end in .natvis, so we just use the path to the file that was typed in on the command line.
There's no way currently to write a test that verifies that this actually works and causes the debugger to use our embedded natvis files, but I did confirm that part manually.
Hm, won't this make a UAF? The file is allocated here, we pass in a stringref, and nobody keeps the file mapping alive.