-
Notifications
You must be signed in to change notification settings - Fork 5.5k
[cDAC] Fix stub classification bugs #131839
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?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -1045,6 +1045,29 @@ CDAC_TYPE_INDETERMINATE(CodeRangeMapRangeList) | |
| CDAC_TYPE_FIELD(CodeRangeMapRangeList, T_INT32, RangeListType, cdac_data<CodeRangeMapRangeList>::RangeListType) | ||
| CDAC_TYPE_END(CodeRangeMapRangeList) | ||
|
|
||
| CDAC_TYPE_BEGIN(StubLinkStubManager) | ||
| CDAC_TYPE_INDETERMINATE(StubLinkStubManager) | ||
| CDAC_TYPE_FIELD(StubLinkStubManager, TYPE(RangeList), RangeList, cdac_data<StubLinkStubManager>::RangeList) | ||
| CDAC_TYPE_END(StubLinkStubManager) | ||
|
|
||
| CDAC_TYPE_BEGIN(RangeList) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This rangelist is redundant. We should get rid of all this and unify the stublinker memory management with other types of executable memory. I have sent copilot to do that https://github.com/dotnet/runtime/tasks/5715a400-48a1-4c09-b6d8-76d2ef2c289b |
||
| CDAC_TYPE_INDETERMINATE(RangeList) | ||
| CDAC_TYPE_FIELD(RangeList, TYPE(RangeListBlock), StarterBlock, cdac_data<RangeList>::StarterBlock) | ||
| CDAC_TYPE_END(RangeList) | ||
|
|
||
| CDAC_TYPE_BEGIN(RangeListBlock) | ||
| CDAC_TYPE_SIZE(cdac_data<RangeList>::RangeListBlock::Size) | ||
| CDAC_TYPE_FIELD(RangeListBlock, T_ARRAY(TYPE(RangeListRange)), Ranges, cdac_data<RangeList>::RangeListBlock::Ranges) | ||
| CDAC_TYPE_FIELD(RangeListBlock, T_POINTER, Next, cdac_data<RangeList>::RangeListBlock::Next) | ||
| CDAC_TYPE_END(RangeListBlock) | ||
|
|
||
| CDAC_TYPE_BEGIN(RangeListRange) | ||
| CDAC_TYPE_SIZE(cdac_data<RangeList>::Range::Size) | ||
| CDAC_TYPE_FIELD(RangeListRange, T_POINTER, Start, cdac_data<RangeList>::Range::Start) | ||
| CDAC_TYPE_FIELD(RangeListRange, T_POINTER, End, cdac_data<RangeList>::Range::End) | ||
| CDAC_TYPE_FIELD(RangeListRange, T_POINTER, Id, cdac_data<RangeList>::Range::Id) | ||
| CDAC_TYPE_END(RangeListRange) | ||
|
|
||
| CDAC_TYPE_BEGIN(EEJitManager) | ||
| CDAC_TYPE_INDETERMINATE(EEJitManager) | ||
| CDAC_TYPE_FIELD(EEJitManager, T_BOOL, StoreRichDebugInfo, cdac_data<EEJitManager>::StoreRichDebugInfo) | ||
|
|
@@ -1797,6 +1820,8 @@ CDAC_GLOBAL(StressLogEnabled, T_UINT8, 0) | |
| #endif | ||
| CDAC_GLOBAL_POINTER(ExecutionManagerCodeRangeMapAddress, cdac_data<ExecutionManager>::CodeRangeMapAddress) | ||
| CDAC_GLOBAL_POINTER(EEJitManagerAddress, cdac_data<ExecutionManager>::EEJitManagerAddress) | ||
| CDAC_GLOBAL(RangeListRangeCount, T_UINT32, RangeList::RANGE_COUNT) | ||
| CDAC_GLOBAL_POINTER(StubLinkStubManagerAddress, &StubLinkStubManager::g_pManager) | ||
| #ifdef TARGET_WASM | ||
| CDAC_GLOBAL_POINTER(FunctionTableIndexRangeList, cdac_data<ExecutionManager>::FunctionTableIndexRangeListAddress) | ||
| #endif // TARGET_WASM | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| using System.Collections.Generic; | ||
| using System.Diagnostics.CodeAnalysis; | ||
|
|
||
| namespace Microsoft.Diagnostics.DataContractReader.Data; | ||
|
|
||
| [CdacType(nameof(DataType.RangeList))] | ||
| internal sealed partial class RangeList : IData<RangeList> | ||
| { | ||
| [FieldAddress] | ||
| public partial TargetPointer StarterBlock { get; } | ||
|
|
||
| public IReadOnlyList<RangeListBlock> Blocks { get; private set; } = []; | ||
| public IReadOnlyList<RangeListRange> Ranges { get; private set; } = []; | ||
|
|
||
| [MemberNotNull(nameof(Blocks), nameof(Ranges))] | ||
| partial void OnInit(Target target, TargetPointer address) | ||
|
Check failure on line 19 in src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Data/RangeList.cs
|
||
| { | ||
| List<RangeListBlock> blocks = []; | ||
| List<RangeListRange> ranges = []; | ||
| uint rangeCount = target.ReadGlobal<uint>(Constants.Globals.RangeListRangeCount); | ||
| uint rangeSize = target.GetTypeInfo(DataType.RangeListRange).Size!.Value; | ||
| TargetPointer blockAddress = StarterBlock; | ||
|
|
||
| while (blockAddress != TargetPointer.Null) | ||
| { | ||
| RangeListBlock block = target.ProcessedData.GetOrAdd<RangeListBlock>(blockAddress); | ||
| blocks.Add(block); | ||
|
|
||
| for (uint i = 0; i < rangeCount; i++) | ||
| { | ||
| TargetPointer rangeAddress = block.Ranges + (i * rangeSize); | ||
| ranges.Add(target.ProcessedData.GetOrAdd<RangeListRange>(rangeAddress)); | ||
| } | ||
|
|
||
| blockAddress = block.Next; | ||
| } | ||
|
|
||
| Blocks = blocks; | ||
| Ranges = ranges; | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Microsoft.Diagnostics.DataContractReader.Data; | ||
|
|
||
| [CdacType(nameof(DataType.RangeListBlock))] | ||
| internal sealed partial class RangeListBlock : IData<RangeListBlock> | ||
| { | ||
| [FieldAddress] | ||
| public partial TargetPointer Ranges { get; } | ||
|
|
||
| [Field] | ||
| public partial TargetPointer Next { get; } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Microsoft.Diagnostics.DataContractReader.Data; | ||
|
|
||
| [CdacType(nameof(DataType.RangeListRange))] | ||
| internal sealed partial class RangeListRange : IData<RangeListRange> | ||
| { | ||
| [Field] public partial TargetPointer Start { get; } | ||
| [Field] public partial TargetPointer End { get; } | ||
| [Field] public partial TargetPointer Id { get; } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| // Licensed to the .NET Foundation under one or more agreements. | ||
| // The .NET Foundation licenses this file to you under the MIT license. | ||
|
|
||
| namespace Microsoft.Diagnostics.DataContractReader.Data; | ||
|
|
||
| [CdacType(nameof(DataType.StubLinkStubManager))] | ||
| internal sealed partial class StubLinkStubManager : IData<StubLinkStubManager> | ||
| { | ||
| [FieldAddress] | ||
| public partial TargetPointer RangeList { get; } | ||
| } |
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.
We probably need changes in the contract docs describing the new types and how to use them no?