-
Notifications
You must be signed in to change notification settings - Fork 5.4k
TEST #127397
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
base: main
Are you sure you want to change the base?
TEST #127397
Changes from all commits
6612fac
7ad8332
8b536d2
d5622ea
a386185
494e3a2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2937,6 +2937,8 @@ int ISOSDacInterface.GetMethodTableForEEClass(ClrDataAddress eeClassReallyCanonM | |||||||||||||||||||||||
| int ISOSDacInterface.GetMethodTableName(ClrDataAddress mt, uint count, char* mtName, uint* pNeeded) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| int hr = HResults.S_OK; | ||||||||||||||||||||||||
| char[] mtNametest = new char[4096]; | ||||||||||||||||||||||||
| uint counttest = 4096; | ||||||||||||||||||||||||
| try | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| if (mt == 0) | ||||||||||||||||||||||||
|
|
@@ -2946,6 +2948,10 @@ int ISOSDacInterface.GetMethodTableName(ClrDataAddress mt, uint count, char* mtN | |||||||||||||||||||||||
| Contracts.TypeHandle methodTableHandle = typeSystemContract.GetTypeHandle(mt.ToTargetPointer(_target, overrideCheck: true)); | ||||||||||||||||||||||||
| if (typeSystemContract.IsFreeObjectMethodTable(methodTableHandle)) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| fixed (char* pMtNametest = mtNametest) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| OutputBufferHelpers.CopyStringToBuffer(pMtNametest, counttest, pNeeded, "Free"); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| OutputBufferHelpers.CopyStringToBuffer(mtName, count, pNeeded, "Free"); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| else | ||||||||||||||||||||||||
|
|
@@ -2954,6 +2960,10 @@ int ISOSDacInterface.GetMethodTableName(ClrDataAddress mt, uint count, char* mtN | |||||||||||||||||||||||
| Contracts.ModuleHandle moduleHandle = loader.GetModuleHandleFromModulePtr(modulePointer); | ||||||||||||||||||||||||
| if (!loader.TryGetLoadedImageContents(moduleHandle, out _, out _, out _)) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| fixed (char* pMtNametest = mtNametest) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| OutputBufferHelpers.CopyStringToBuffer(pMtNametest, counttest, pNeeded, "<Unloaded Type>"); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| OutputBufferHelpers.CopyStringToBuffer(mtName, count, pNeeded, "<Unloaded Type>"); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| else | ||||||||||||||||||||||||
|
|
@@ -2972,6 +2982,10 @@ int ISOSDacInterface.GetMethodTableName(ClrDataAddress mt, uint count, char* mtN | |||||||||||||||||||||||
| methodTableName.Append(fallbackName); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| fixed (char* pMtNametest = mtNametest) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| OutputBufferHelpers.CopyStringToBuffer(pMtNametest, counttest, pNeeded, methodTableName.ToString()); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| OutputBufferHelpers.CopyStringToBuffer(mtName, count, pNeeded, methodTableName.ToString()); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
Comment on lines
2939
to
2990
|
||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
@@ -2985,18 +2999,41 @@ int ISOSDacInterface.GetMethodTableName(ClrDataAddress mt, uint count, char* mtN | |||||||||||||||||||||||
| #if DEBUG | ||||||||||||||||||||||||
| if (_legacyImpl is not null) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| char[] mtNameLocal = new char[count]; | ||||||||||||||||||||||||
| char[] mtNameLocal = new char[counttest]; | ||||||||||||||||||||||||
| uint neededLocal; | ||||||||||||||||||||||||
| int hrLocal; | ||||||||||||||||||||||||
| fixed (char* ptr = mtNameLocal) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| hrLocal = _legacyImpl.GetMethodTableName(mt, count, ptr, &neededLocal); | ||||||||||||||||||||||||
| hrLocal = _legacyImpl.GetMethodTableName(mt, counttest, ptr, &neededLocal); | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| Debug.ValidateHResult(hr, hrLocal); | ||||||||||||||||||||||||
| if (hr == HResults.S_OK) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| Debug.Assert(pNeeded == null || *pNeeded == neededLocal); | ||||||||||||||||||||||||
| Debug.Assert(mtName == null || new ReadOnlySpan<char>(mtNameLocal, 0, (int)neededLocal - 1).SequenceEqual(new string(mtName))); | ||||||||||||||||||||||||
| int maxComparableLength = 4095; | ||||||||||||||||||||||||
| ReadOnlySpan<char> localComparableSpan = mtNameLocal.AsSpan(0, maxComparableLength); | ||||||||||||||||||||||||
| int localNameLength = localComparableSpan.IndexOf('\0'); | ||||||||||||||||||||||||
| if (localNameLength < 0) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| localNameLength = maxComparableLength; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| int nameLength = 0; | ||||||||||||||||||||||||
| if (mtName is not null) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| ReadOnlySpan<char> comparableSpan = new(mtNametest, maxComparableLength); | ||||||||||||||||||||||||
| nameLength = comparableSpan.IndexOf('\0'); | ||||||||||||||||||||||||
| if (nameLength < 0) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| nameLength = maxComparableLength; | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
|
||||||||||||||||||||||||
| if (!(pNeeded is null || *pNeeded == neededLocal)) | ||||||||||||||||||||||||
| { | ||||||||||||||||||||||||
| string localNameString = new(mtNameLocal, 0, localNameLength); | ||||||||||||||||||||||||
| string nameString = mtNametest is null ? string.Empty : new(mtNametest, 0, nameLength); | ||||||||||||||||||||||||
| Debug.Fail($"local name = {localNameString}, name = {nameString}, neededlocal = {neededLocal}, pneeded = {pNeeded == null ? "null" : *pNeeded}"); | ||||||||||||||||||||||||
|
rcj1 marked this conversation as resolved.
|
||||||||||||||||||||||||
| } | ||||||||||||||||||||||||
|
Comment on lines
+3031
to
+3036
|
||||||||||||||||||||||||
| if (!(pNeeded is null || *pNeeded == neededLocal)) | |
| { | |
| string localNameString = new(mtNameLocal, 0, localNameLength); | |
| string nameString = mtName is null ? string.Empty : new(mtName, 0, nameLength); | |
| Debug.Fail($"local name = {localNameString}, name = {nameString}"); | |
| } | |
| string localNameString = new(mtNameLocal, 0, localNameLength); | |
| string nameString = mtName is null ? string.Empty : new(mtName, 0, nameLength); | |
| Debug.Assert( | |
| pNeeded is null || *pNeeded == neededLocal, | |
| $"pNeeded mismatch: actual={(pNeeded is null ? "null" : (*pNeeded).ToString())}, expected={neededLocal}, count={count}, local name = {localNameString}, name = {nameString}"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
counttestis declared asint, but it's passed to APIs that requireuint(OutputBufferHelpers.CopyStringToBuffer(..., uint bufferSize, ...)andISOSDacInterface.GetMethodTableName(..., uint count, ...)). This won’t compile without an explicit cast; consider making this aconst uint(oruint countTest = 4096u) to match the API surface.