Skip to content

Making IPC events platform neutral#127943

Merged
rcj1 merged 5 commits intodotnet:mainfrom
rcj1:ipc-xplat
May 8, 2026
Merged

Making IPC events platform neutral#127943
rcj1 merged 5 commits intodotnet:mainfrom
rcj1:ipc-xplat

Conversation

@rcj1
Copy link
Copy Markdown
Contributor

@rcj1 rcj1 commented May 8, 2026

  • Widening VMPTR to 8 bytes
  • Widening LsPtr to 8 bytes
  • Wrapping IPC event fields in Portable<> for endianness independence
  • Misc event cleanup

@dotnet-policy-service
Copy link
Copy Markdown
Contributor

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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR refactors CoreCLR debugger IPC event structures and related sender/receiver code to be more platform-neutral (notably by widening pointer-like fields and wrapping many event fields in Portable<> for endianness independence), while also removing a set of legacy/unused IPC event types and helpers.

Changes:

  • Update IPC event/pointer representations (e.g., VMPTR, LsPtr) to use 64-bit address storage and Portable<> wrappers.
  • Adjust DI/EE codepaths to use CORDB_ADDRESS-based fields and (in some cases) read target memory directly (e.g., log message strings, variable-size context payloads).
  • Remove deprecated/unused IPC event types and related interface methods (log switch updates, GC handle info, SQL fiber connection notifications, etc.).
Show a summary per file
File Description
src/coreclr/vm/eedbginterfaceimpl.h Removes unused DebuggerModifyingLogSwitch declaration.
src/coreclr/vm/eedbginterfaceimpl.cpp Removes empty DebuggerModifyingLogSwitch implementation.
src/coreclr/vm/eedbginterface.h Removes DebuggerModifyingLogSwitch from EEDebugInterface.
src/coreclr/vm/dbginterface.h Removes legacy debug interface methods (log switch/connection notifications).
src/coreclr/debug/shared/dbgtransportsession.cpp Updates IPC event base sizing and prunes removed event cases.
src/coreclr/debug/inc/dbgipceventtypes.h Removes legacy IPC event type IDs.
src/coreclr/debug/inc/dbgipcevents.h Widens pointer-like fields and wraps many IPC fields in Portable<>.
src/coreclr/debug/ee/funceval.cpp Switches various funceval address/register fields to CORDB_ADDRESS/ULONG64 and updates conversions.
src/coreclr/debug/ee/debugger.h Removes next usage and updates buffer cleanup for widened IPC fields.
src/coreclr/debug/ee/debugger.cpp Updates event payload writes for new portable layouts; removes legacy event handling; adds context size for databreakpoint.
src/coreclr/debug/di/valuehome.cpp Updates marshaling of RemoteAddress / reference/value-class writeback with CORDB_ADDRESS.
src/coreclr/debug/di/shimcallback.cpp Treats databreakpoint context as variable-sized byte payload.
src/coreclr/debug/di/rsthread.cpp Updates remote write for remap-IP and func-eval argument marshalling to CORDB_ADDRESS forms.
src/coreclr/debug/di/rspriv.h Removes old marshalling entrypoint; introduces helper to read null-terminated target strings; widens m_EnCRemapFunctionIP.
src/coreclr/debug/di/process.cpp Removes old managed-event marshalling cleanup; adds target string reader; updates databreakpoint dispatch to use contextSize.
src/coreclr/debug/di/module.cpp Updates metadata update request to pass target address directly.
src/coreclr/debug/di/divalue.cpp Updates handle creation event to pass target address directly.
src/coreclr/debug/di/breakpoint.cpp Updates breakpoint payload fields to fixed-width portable integer types.

Copilot's findings

Comments suppressed due to low confidence (1)

src/coreclr/debug/di/rsthread.cpp:10177

  • cbString was changed from SIZE_T to UINT and computed as (UINT)(iLength * sizeof(WCHAR)). This can overflow/truncate for large iLength, producing a too-small byte count and potentially causing incorrect remote buffer writes. Please add an overflow check (e.g., validate iLength <= UINT_MAX / sizeof(WCHAR) or use a wider intermediate) and return an appropriate failure HRESULT if it doesn't fit.

    // Length of the string? Don't account for null as COMString::NewString is length-based
    UINT cbString = (UINT)(iLength * sizeof(WCHAR));

    // Remember that we're doing a func eval for a new string.
    m_function = NULL;
    m_evalType = DB_IPCE_FET_NEW_STRING;

    // Send over to the left side and get it to setup this eval.
    DebuggerIPCEvent event;

    m_thread->GetProcess()->InitIPCEvent(&event, DB_IPCE_FUNC_EVAL, true, m_thread->GetAppDomain()->GetADToken());

    event.FuncEval.vmThreadToken = m_thread->m_vmThreadToken;
    event.FuncEval.funcEvalType = m_evalType;
    event.FuncEval.funcEvalKey = hFuncEval.Ptr();
    event.FuncEval.stringSize = cbString;
  • Files reviewed: 18/18 changed files
  • Comments generated: 8

Comment thread src/coreclr/debug/ee/debugger.cpp Outdated
Comment thread src/coreclr/debug/ee/debugger.cpp
Comment thread src/coreclr/debug/inc/dbgipcevents.h
Comment thread src/coreclr/debug/inc/dbgipcevents.h
Comment thread src/coreclr/debug/ee/debugger.h Outdated
Comment thread src/coreclr/debug/di/shimcallback.cpp Outdated
Comment thread src/coreclr/debug/di/process.cpp Outdated
Comment thread src/coreclr/debug/ee/debugger.cpp Outdated
@jkotas
Copy link
Copy Markdown
Member

jkotas commented May 8, 2026

Widening VMPTR to 8 bits
Widening LsPtr to 8 bits

Nit: bits -> bytes

Copy link
Copy Markdown
Member

@jkotas jkotas left a comment

Choose a reason for hiding this comment

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

LGTM, it may be a good idea to run the internal debugger tests before merging

@rcj1
Copy link
Copy Markdown
Contributor Author

rcj1 commented May 8, 2026

LGTM, it may be a good idea to run the internal debugger tests before merging

Already did 👍 no regressions

Copilot AI review requested due to automatic review settings May 8, 2026 04:32
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 20/20 changed files
  • Comments generated: 4

Comment thread src/coreclr/debug/di/process.cpp
Comment thread src/coreclr/debug/di/process.cpp
Comment thread src/coreclr/debug/di/shimcallback.cpp Outdated
Comment thread src/coreclr/debug/di/rsthread.cpp
Copilot AI review requested due to automatic review settings May 8, 2026 05:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot's findings

  • Files reviewed: 20/20 changed files
  • Comments generated: 2

Comment thread src/coreclr/debug/di/process.cpp
Comment thread src/coreclr/debug/di/shimcallback.cpp
@rcj1 rcj1 merged commit 9a712d9 into dotnet:main May 8, 2026
109 checks passed
@rcj1 rcj1 deleted the ipc-xplat branch May 8, 2026 15:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants