Making IPC events platform neutral#127943
Conversation
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
There was a problem hiding this comment.
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 andPortable<>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
cbStringwas changed fromSIZE_TtoUINTand computed as(UINT)(iLength * sizeof(WCHAR)). This can overflow/truncate for largeiLength, producing a too-small byte count and potentially causing incorrect remote buffer writes. Please add an overflow check (e.g., validateiLength <= 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
Nit: bits -> bytes |
jkotas
left a comment
There was a problem hiding this comment.
LGTM, it may be a good idea to run the internal debugger tests before merging
Already did 👍 no regressions |
Uh oh!
There was an error while loading. Please reload this page.