-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
[cdac] Implement ISOSDacInterface::GetObjectData getting COM RCW/CCW #105846
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cdb6e31
Add SyncBlock, SyncTableEntry, InteropSyncBlockInfo to data descriptor
elinor-fung a0d1b56
Add GetComData to Object contract
elinor-fung 484d7d4
Populate COM data in GetObjectData
elinor-fung 5dfafa9
Add missing check for FEATURE_COMINTEROP
elinor-fung c0ad57c
Add mock globals
elinor-fung 5218f58
Add unit tests
elinor-fung 0800bf9
Apply suggestions from code review
elinor-fung df8d7b8
Rename GetComData -> GetBuiltInComData
elinor-fung File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/native/managed/cdacreader/src/Data/InteropSyncBlockInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// 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; | ||
|
||
internal sealed class InteropSyncBlockInfo : IData<InteropSyncBlockInfo> | ||
{ | ||
static InteropSyncBlockInfo IData<InteropSyncBlockInfo>.Create(Target target, TargetPointer address) | ||
=> new InteropSyncBlockInfo(target, address); | ||
|
||
public InteropSyncBlockInfo(Target target, TargetPointer address) | ||
{ | ||
Target.TypeInfo type = target.GetTypeInfo(DataType.InteropSyncBlockInfo); | ||
|
||
RCW = type.Fields.TryGetValue(nameof(RCW), out Target.FieldInfo rcwField) | ||
? target.ReadPointer(address + (ulong)rcwField.Offset) | ||
: TargetPointer.Null; | ||
CCW = type.Fields.TryGetValue(nameof(CCW), out Target.FieldInfo ccwField) | ||
? target.ReadPointer(address + (ulong)ccwField.Offset) | ||
: TargetPointer.Null; | ||
} | ||
|
||
public TargetPointer RCW { get; init; } | ||
public TargetPointer CCW { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 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; | ||
|
||
internal sealed class SyncBlock : IData<SyncBlock> | ||
{ | ||
static SyncBlock IData<SyncBlock>.Create(Target target, TargetPointer address) | ||
=> new SyncBlock(target, address); | ||
|
||
public SyncBlock(Target target, TargetPointer address) | ||
{ | ||
Target.TypeInfo type = target.GetTypeInfo(DataType.SyncBlock); | ||
|
||
TargetPointer interopInfoPointer = target.ReadPointer(address + (ulong)type.Fields[nameof(InteropInfo)].Offset); | ||
if (interopInfoPointer != TargetPointer.Null) | ||
InteropInfo = target.ProcessedData.GetOrAdd<InteropSyncBlockInfo>(interopInfoPointer); | ||
} | ||
|
||
public InteropSyncBlockInfo? InteropInfo { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// 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; | ||
|
||
internal sealed class SyncTableEntry : IData<SyncTableEntry> | ||
{ | ||
static SyncTableEntry IData<SyncTableEntry>.Create(Target target, TargetPointer address) | ||
=> new SyncTableEntry(target, address); | ||
|
||
public SyncTableEntry(Target target, TargetPointer address) | ||
{ | ||
Target.TypeInfo type = target.GetTypeInfo(DataType.SyncTableEntry); | ||
|
||
TargetPointer syncBlockPointer = target.ReadPointer(address + (ulong)type.Fields[nameof(SyncBlock)].Offset); | ||
if (syncBlockPointer != TargetPointer.Null) | ||
SyncBlock = target.ProcessedData.GetOrAdd<SyncBlock>(syncBlockPointer); | ||
} | ||
|
||
public SyncBlock? SyncBlock { get; init; } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,7 @@ public enum DataType | |
MethodDesc, | ||
MethodDescChunk, | ||
Array, | ||
SyncBlock, | ||
SyncTableEntry, | ||
InteropSyncBlockInfo, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I assume this is only for built-in. Are we going to defer
ComWrappers
support for later? Same for RCW.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.
Yeah. I deferred for later.
I went back and forth on object contract should have
GetComData
for built-in andGetComWrappersData
for ComWrappersGetComData
for both built-in and ComWrappersI ended up with (1) - definitely open to thoughts.
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.
What about if we call it "BuiltInComData" to match how our docs and current code talk about built-in COM vs ComWrappers?
Then in the future, the contract to pull data about built-in RCWs and CCWs could be called "BuiltInCom" and the ComWrappers one could be "ComWrappers".
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.
Renamed to
GetBuiltInComData