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

[cdac] Read contract descriptor from target #101208

Merged
merged 9 commits into from
Apr 22, 2024

Conversation

elinor-fung
Copy link
Member

@elinor-fung elinor-fung commented Apr 17, 2024

  • Get DotNetRuntimeContractDescriptor address from the target
  • Read contract descriptor to determine endianness and pointer size
  • Parse JSON descriptor and store contracts

Depends on #100650 to actually work.

Contributes to #99298

Copy link
Contributor

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

@lambdageek
Copy link
Member

Please consider cherrypicking lambdageek@dad6f1e from https://github.com/lambdageek/runtime/tree/cdac-roundtrip-main to hook up JSON parser

@elinor-fung
Copy link
Member Author

Cherry-picked the JSON parser change. One edit I made on top of that was to make the ContractDescriptorParser specify a DynamicDependency to Root instead going through the xml file.

@elinor-fung elinor-fung marked this pull request as ready for review April 20, 2024 01:30
@elinor-fung
Copy link
Member Author

This change is also disabling the cDAC on platforms where we don't read export symbols via TryGetSymbol in dbgutil (c215266).

elfreader.cpp is not included for all platforms:

if(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_HAIKU)
list(APPEND DBGUTIL_SOURCES
elfreader.cpp
)

@mikem8361 do you know if there's a specific reason elfreader shouldn't work on other Unix platforms?

I could include it in freebsd with something like elinor-fung@18a7dee. That builds, but I don't know if it actually works.

@mikem8361
Copy link
Member

@mikem8361 do you know if there's a specific reason elfreader shouldn't work on other Unix platforms?
I could include it in freebsd with something like https://github.com/elinor-fung/runtime/commit/18a7deee67ecfccddc1e1b364333cabf8b56192b. That builds, but I don't know if it actually works.

The ELFReader should work just fine other platforms but it will just take some work/testing.

for (int i = 0; i < pointerDataCount; i++)
{
_pointerData[i] = ReadPointer(pointerData.Value + (uint)(i * _pointerSize));
if (!TryReadPointer(pointerDataAddr.Value + (uint)(i * pointerSize), config, reader, out pointerData[i]))
Copy link
Member

Choose a reason for hiding this comment

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

something to consider as we go forward: should we have a struct TargetSpan<T> where T: unmanaged for "pointer+length" for remote memory

@elinor-fung elinor-fung merged commit e751fe8 into dotnet:main Apr 22, 2024
150 of 152 checks passed
@elinor-fung elinor-fung deleted the cdac-read-target branch April 22, 2024 21:57
matouskozak pushed a commit to matouskozak/runtime that referenced this pull request Apr 30, 2024
- Get `DotNetRuntimeContractDescriptor` address from the target
- Read contract descriptor to determine endianness and pointer size
- Parse JSON descriptor and store contracts
michaelgsharp pushed a commit to michaelgsharp/runtime that referenced this pull request May 9, 2024
- Get `DotNetRuntimeContractDescriptor` address from the target
- Read contract descriptor to determine endianness and pointer size
- Parse JSON descriptor and store contracts
@github-actions github-actions bot locked and limited conversation to collaborators May 23, 2024
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.

4 participants