Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some tests that validate debug info through ETW events #61962

Merged
merged 6 commits into from
Nov 24, 2021

Conversation

jakobbotsch
Copy link
Member

@jakobbotsch jakobbotsch commented Nov 23, 2021

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 (thanks for the help @noahfalk).

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.

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 (dotnet#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.
@ghost
Copy link

ghost commented Nov 23, 2021

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

Issue Details

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 (thanks for the help @noahfalk).

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.

Author: jakobbotsch
Assignees: -
Labels:

area-Diagnostics-coreclr

Milestone: -

Tiering should not affect the minimum mappings we get, only
DebuggableAttribute should. Also make sure we are testing optimized code
instead of quickjitted non-debuggable code.
Since we test with TC on and off in innerloop we can allow it to test
both flavors.
@jakobbotsch
Copy link
Member Author

cc @dotnet/jit-contrib

@jakobbotsch jakobbotsch added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI and removed area-Diagnostics-coreclr labels Nov 23, 2021
@ghost
Copy link

ghost commented Nov 23, 2021

Tagging subscribers to this area: @JulieLeeMSFT
See info in area-owners.md if you want to be subscribed.

Issue Details

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 (thanks for the help @noahfalk).

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.

Author: jakobbotsch
Assignees: -
Labels:

area-CodeGen-coreclr

Milestone: -

Copy link
Member

@BruceForstall BruceForstall left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool to add testing here!

My only suggestion would be that either at the top of tester.cs or perhaps as a separate README.md, write up a(n appropriately) detailed description of the methodology here, how to add tests, and what to do if a test fails (i.e., what kind of debugging should be done).

@JulieLeeMSFT JulieLeeMSFT added this to the 7.0.0 milestone Nov 24, 2021
@jakobbotsch jakobbotsch merged commit a46358c into dotnet:main Nov 24, 2021
@jakobbotsch jakobbotsch deleted the debug-info-tests branch November 24, 2021 13:48
@jakobbotsch
Copy link
Member Author

jakobbotsch commented Nov 25, 2021

My only suggestion would be that either at the top of tester.cs or perhaps as a separate README.md, write up a(n appropriately) detailed description of the methodology here, how to add tests, and what to do if a test fails (i.e., what kind of debugging should be done).

Forgot to reply, but I added a readme in the directory that explains the overall methodology and each file.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants