Skip to content

Update the StubManager for better debugger stepping.#65947

Merged
AaronRobinsonMSFT merged 13 commits into
dotnet:mainfrom
AaronRobinsonMSFT:step_into_stubs
Mar 4, 2022
Merged

Update the StubManager for better debugger stepping.#65947
AaronRobinsonMSFT merged 13 commits into
dotnet:mainfrom
AaronRobinsonMSFT:step_into_stubs

Conversation

@AaronRobinsonMSFT

@AaronRobinsonMSFT AaronRobinsonMSFT commented Feb 28, 2022

Copy link
Copy Markdown
Member

The StubManager is now aware of InstantiatingMethods in IL Stub and StubLink scenarios.

Created the concept of a "StepThroughStub". This handles cases where the stub should be treated as an implementation detail and forward to the appropriate target.

Updates to various logging statements.

Fixes #63199
Fixes #38777

/cc @noahfalk @jkotas @jkoritzinsky @hoyosjs

  and StubLink scenarios
Created the concept of a "StepThroughStub". This handles cases where
  the stub should be treated like as an implementation details and
  simply forward to the appropriate target.
Updates to various logging mechanisms.
@ghost

ghost commented Feb 28, 2022

Copy link
Copy Markdown

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

Issue Details

The StubManager is now aware of InstantiatingMethods in IL Stub and StubLink scenarios.

Created the concept of a "StepThroughStub". This handles cases where the stub should be treated like as an implementation detail and forward to the appropriate target.

Updates to various logging statements.

Fixes #63199
Fixes #38777

/cc @noahfalk @jkotas @jkoritzinsky @hoyosjs

Author: AaronRobinsonMSFT
Assignees: -
Labels:

area-Diagnostics-coreclr

Milestone: 7.0.0

@AaronRobinsonMSFT AaronRobinsonMSFT changed the title Update the StubManager for better debugging stepping. Update the StubManager for better debugger stepping. Feb 28, 2022
Comment thread src/coreclr/vm/ilstubcache.cpp Outdated
@AaronRobinsonMSFT AaronRobinsonMSFT marked this pull request as ready for review February 28, 2022 19:49
Comment thread src/coreclr/vm/dynamicmethod.cpp Outdated

@noahfalk noahfalk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks a bunch for cleaning this all up 👍
I had a few suggestions and I am curious to see after with the enum change Jan was suggesting but I think it looks pretty good regardless.

Comment thread src/coreclr/debug/ee/amd64/amd64walker.cpp
Comment thread src/coreclr/debug/ee/controller.cpp Outdated
Comment thread src/coreclr/vm/stublink.cpp Outdated
Comment thread src/coreclr/vm/stublink.cpp Outdated
Comment thread src/coreclr/vm/stublink.h Outdated
Comment thread src/coreclr/vm/stublink.cpp Outdated
Comment thread src/coreclr/vm/stubmgr.cpp Outdated
Comment thread src/coreclr/vm/stubmgr.cpp
Comment thread src/coreclr/vm/stubmgr.cpp
@noahfalk

noahfalk commented Mar 1, 2022

Copy link
Copy Markdown
Member

cc @mikem8361 @dotnet/dotnet-diag

Comment thread src/coreclr/vm/method.hpp Outdated
Comment thread src/coreclr/vm/stublink.h Outdated
Comment thread src/coreclr/vm/method.hpp Outdated
Comment thread src/coreclr/vm/method.hpp Outdated
Comment thread src/coreclr/vm/stublink.h Outdated
Move CODE_SIZE_ALIGN to compilation unit.
@AaronRobinsonMSFT

Copy link
Copy Markdown
Member Author

The ARM64 issue is related to writing to executable memory. I know the fix, but I'd like to make it make sense with the existing Stub and StubLinker API.

For others, this issue looks like the following from the macOS's Console. The failing instruction is attempting to write back a pointer into the Stub and upon stepping over that instruction the OS tears down the corerun process.

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGBUS)
Exception Codes:       KERN_PROTECTION_FAILURE at 0x00000002800940c0
Exception Codes:       0x0000000000000002, 0x00000002800940c0
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace SIGNAL, Code 10 Bus error: 10
Terminating Process:   exc handler [34828]

VM Region Info: 0x2800940c0 is in 0x280094000-0x280098000;  bytes after start: 192  bytes before end: 16191
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      VM_ALLOCATE                 280070000-280094000    [  144K] rw-/rwx SM=ZER  
--->  VM_ALLOCATE                 280094000-280098000    [   16K] rwx/rwx SM=ZER  
      VM_ALLOCATE                 280098000-2800a0000    [   32K] ---/rwx SM=ZER  

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libcoreclr.dylib              	       0x1047548ac Stub::SetInstantiatedMethodDesc(MethodDesc*) + 72 (stublink.h:569)
1   libcoreclr.dylib              	       0x104754888 Stub::SetInstantiatedMethodDesc(MethodDesc*) + 36 (stublink.h:568)
2   libcoreclr.dylib              	       0x104754648 MakeUnboxingStubWorker(MethodDesc*) + 700 (prestub.cpp:1682)

/cc @dotnet/interop-contrib as an FYI.

@AaronRobinsonMSFT

Copy link
Copy Markdown
Member Author

Failures are #66100

@noahfalk noahfalk left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

Comment thread src/coreclr/vm/method.hpp Outdated
Comment thread src/coreclr/vm/method.hpp Outdated
@AaronRobinsonMSFT

Copy link
Copy Markdown
Member Author

Failures are #66143

@AaronRobinsonMSFT AaronRobinsonMSFT merged commit c8eeba7 into dotnet:main Mar 4, 2022
@AaronRobinsonMSFT AaronRobinsonMSFT deleted the step_into_stubs branch March 4, 2022 01:10
@ghost ghost locked as resolved and limited conversation to collaborators Apr 3, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ExecutionEngineException when using step-by-step Stepping into multidimensional array of tuples in debug causes internal CLR error

4 participants