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

Fix debugger initialization #64523

Merged
merged 3 commits into from
Feb 2, 2022
Merged

Conversation

tommcdon
Copy link
Member

Fixes debugger initialization regression caused by #63157

@ghost
Copy link

ghost commented Jan 31, 2022

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

Issue Details

Fixes debugger initialization regression caused by #63157

Author: tommcdon
Assignees: tommcdon
Labels:

area-Diagnostics-coreclr, area-VM-coreclr

Milestone: -

@@ -65,14 +65,16 @@ enum NotificationStatus

class DomainAssembly final
{
VPTR_BASE_CONCRETE_VTABLE_CLASS(DomainAssembly)
Copy link
Member

Choose a reason for hiding this comment

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

This is a simple C++ type that nothing inherits from now. It does not need a vtable. This fix seems to be injecting useless vtable into the type.

What is the debugger code that is failing? Should the fix be made in that code instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

My goal is to perform a quick fix to unblock the debugger. The debugger is failing in DacDbiInterfaceImpl::GetAssemblyFromDomainAssembly and crashes while handling the assembly load event for System.Private.CoreLib. I'll create an issue to track removing the v-table.

Copy link
Member

Choose a reason for hiding this comment

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

I think the proper fix is to change VPTR to DPTR on these lines in vm:

typedef VPTR(class DomainAssembly)      PTR_DomainAssembly;
typedef VPTR(PEAssembly) PTR_PEAssembly;

The vtables and DAC are super fragile, and we have multiple workarounds like

//-----------------------------------------------------------------------------
// Frame depends on the location of its vtable within the object. This
// superclass ensures that the vtable for Frame objects is in the same
// location under both MSVC and GCC.
//-----------------------------------------------------------------------------
class FrameBase
to make them work on all platforms. If you want to go with this quick fix that adds back the vtables, make sure to test it on all platforms.

Copy link
Member

Choose a reason for hiding this comment

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

I assume there is no way to have a simple test for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

I assume there is no way to have a simple test for this?

CI testing is something we would like to accomplish in the future

@tommcdon
Copy link
Member Author

tommcdon commented Feb 2, 2022

test failures look unrelated to this PR, merging

@tommcdon tommcdon merged commit 77b69b8 into dotnet:main Feb 2, 2022
@ghost ghost locked as resolved and limited conversation to collaborators Mar 4, 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.

3 participants