Add some tests that validate debug info through ETW events (#61962)
authorJakob Botsch Nielsen <Jakob.botsch.nielsen@gmail.com>
Wed, 24 Nov 2021 13:48:50 +0000 (14:48 +0100)
committerGitHub <noreply@github.com>
Wed, 24 Nov 2021 13:48:50 +0000 (14:48 +0100)
commita46358c7e2ef1e0917f3672116d26cb78bfdf423
tree0c486642e0f127bdab91d7084a865bdb5569b73a
parent90773ac32a6ac44daa00f10eda80d51fc04290fb
Add some tests that validate debug info through ETW events (#61962)

Validate the debug mappings generated by the JIT using the
MethodILToNative event. Unfortunately we can not use EventListener as
the event there does not contain the actual mappings (#12678) so this
reuses some of the facilities from the tracing tests to use EventPipe
and TraceEvent.

This only adds the infrastructure and a small number of tests, but
at least this should make it easier to add more tests in this area in
the future.

There are some more limitations, for example we cannot validate the
CALL_INSTRUCTION mappings generated for the managed return value feature
because the debugger filters them out of the table reported. I am hoping
we can change these mappings to be included as normal in the future.

The tests themselves are added by adding a method to tests.il with an
ExpectedILMappings attribute that allows specifying a subset of IL
offsets that we expect mappings to be generated for, with separate
subsets under Debug and when optimizing. This was the best way I could
think of to be able to refer to the right IL offsets.
src/tests/JIT/Directed/debugging/debuginfo/README.txt [new file with mode: 0644]
src/tests/JIT/Directed/debugging/debuginfo/attribute.cs [new file with mode: 0644]
src/tests/JIT/Directed/debugging/debuginfo/attribute.csproj [new file with mode: 0644]
src/tests/JIT/Directed/debugging/debuginfo/isdebug.il [new file with mode: 0644]
src/tests/JIT/Directed/debugging/debuginfo/tester.cs [new file with mode: 0644]
src/tests/JIT/Directed/debugging/debuginfo/tester.csproj [new file with mode: 0644]
src/tests/JIT/Directed/debugging/debuginfo/tests.il [new file with mode: 0644]
src/tests/JIT/Directed/debugging/debuginfo/tests_d.ilproj [new file with mode: 0644]
src/tests/JIT/Directed/debugging/debuginfo/tests_r.ilproj [new file with mode: 0644]
src/tests/JIT/Directed/debugging/poisoning/poison.cs [moved from src/tests/JIT/Directed/debugging/poison.cs with 100% similarity]
src/tests/JIT/Directed/debugging/poisoning/poison.csproj [moved from src/tests/JIT/Directed/debugging/poison.csproj with 100% similarity]