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

Update SOS to resolve first level byref fields #2829

Merged
merged 3 commits into from
Jan 26, 2022

Conversation

AaronRobinsonMSFT
Copy link
Member

@AaronRobinsonMSFT AaronRobinsonMSFT commented Jan 26, 2022

This feature adds support for resolving byref fields via SOS. Used the dotnet/runtime RefFields test to validate. A design decision to retain the actual value was made in the display as opposed to resolving to the target and showing that in the pretty print.

There is a fair bit of whitespace change. Recommend using https://github.com/dotnet/diagnostics/pull/2829/files?diff=split&w=1 to view files.

Before:

0:000> !DumpVC 00007ff943c82c78 @rbp-10h
Name:        InvalidCSharp.WithRefField
MethodTable: 00007ff943c82c78
EEClass:     00007ff943c78938
Size:        24(0x18) bytes
File:        D:\runtime\artifacts\tests\coreclr\windows.x64.Release\Loader\classloader\RefFields\Validate\InvalidCSharp.dll
Fields:
              MT    Field   Offset                 Type VT     Attr            Value Name
0000000000000000  4000002        0                BYREF  0 instance 000000e9f5f7d1e8 Str
0:000> !DumpObj /d 000000e9f5f7d1e8
<Note: this object has an invalid CLASS field>
Invalid object

After:

0:000> !DumpVC 00007ff943c72c78 @rbp-10h
Name:        InvalidCSharp.WithRefField
MethodTable: 00007ff943c72c78
EEClass:     00007ff943c68938
Size:        24(0x18) bytes
File:        D:\runtime\artifacts\tests\coreclr\windows.x64.Release\Loader\classloader\RefFields\Validate\InvalidCSharp.dll
Fields:
              MT    Field   Offset                 Type VT     Attr            Value Name
0000000000000000  4000002        0                BYREF  0 instance 0000001833d7d2f8 Str
0:000> !DumpObj /d 00000177a0e73d68
Name:        System.String
MethodTable: 00007ff94393d710
EEClass:     00007ff943949050
Tracked Type: false
Size:        70(0x46) bytes
File:        D:\runtime\artifacts\tests\coreclr\windows.x64.Debug\Tests\Core_Root\System.Private.CoreLib.dll
String:      Validate_Create_RefField
Fields:
              MT    Field   Offset                 Type VT     Attr            Value Name
00007ff9438d2580  40002f7        8         System.Int32  1 instance               24 _stringLength
00007ff94388b2f8  40002f8        c          System.Char  1 instance               56 _firstChar
00007ff94393d710  40002f6       e8        System.String  0   static 00000177a0e61240 Empty

Contributes to dotnet/runtime#63768

@AaronRobinsonMSFT AaronRobinsonMSFT added this to the .NET 7.0 milestone Jan 26, 2022
@AaronRobinsonMSFT AaronRobinsonMSFT requested a review from a team as a code owner January 26, 2022 05:22
@AaronRobinsonMSFT
Copy link
Member Author

AaronRobinsonMSFT commented Jan 26, 2022

/cc @noahfalk @tommcdon @davidwrighton

Copy link
Member

@noahfalk noahfalk left a comment

Choose a reason for hiding this comment

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

Thanks @AaronRobinsonMSFT, lgtm other than a suggestion on the failure case.
@mikem8361 what do you think of it?

src/SOS/Strike/util.cpp Show resolved Hide resolved
@mikem8361
Copy link
Member

The Windows x86 CI failure is a build problem.

@AaronRobinsonMSFT AaronRobinsonMSFT merged commit 9845163 into main Jan 26, 2022
@AaronRobinsonMSFT AaronRobinsonMSFT deleted the resolve_byref_fields branch January 26, 2022 21:45
@github-actions github-actions bot locked and limited conversation to collaborators Jan 13, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants