Commit c19d421
[cDAC] Set first-arg register to InterpreterFrame in per-arch InlinedCallFrame handlers
Mirror the per-architecture native InlinedCallFrame::UpdateRegDisplay_Impl
logic in the corresponding cDAC frame handlers:
- AMD64FrameHandler.HandleInlinedCallFrame: sets Rcx (Windows) or Rdi
(Unix SysV) to the InterpreterFrame address when the next Frame is an
InterpreterFrame, matching src/coreclr/vm/amd64/cgenamd64.cpp:212-218.
- ARM64FrameHandler.HandleInlinedCallFrame: sets X0 to the InterpreterFrame
address when the next Frame is an InterpreterFrame, matching
src/coreclr/vm/arm64/stubs.cpp:408-414.
ARM, x86, LoongArch64, and RISCV64 native InlinedCallFrame::UpdateRegDisplay_Impl
do NOT perform this update, so the corresponding cDAC handlers (or BaseFrameHandler
inheritance) do not either.
Two protected helpers are added to BaseFrameHandler so each handler can
inspect the chain itself without changing the IPlatformFrameHandler
interface:
- GetNextFrame(currentFrameAddress): returns the next Data.Frame in the
chain or null if the chain ends (handles the FRAME_TOP all-ones
terminator).
- IsInterpreterFrame(frame): compares the frame.Identifier against the
runtime's InterpreterFrameIdentifier global.
Without this update, cDAC reports the thread's literal saved Rcx for frames
between an InlinedCallFrame and its successor InterpreterFrame, while the
legacy DAC reports the InterpreterFrame address. This trips
Debug.Assert(contextStruct.Equals(localContextStruct)) in
ClrDataStackWalk.GetContext during !ClrStack on a thread captured during a
P/Invoke from interpreted code.
Verified locally against the SOS.InterpreterStackTest.Heap.dmp captured in
CI: !ClrStack and !PrintException both succeed with the cDAC parity check
enabled, walking through [InlinedCallFrame], JIT IL stub frames,
[InterpreterFrame: ...], and the interpreted method frames in correct
order. All 2081 cDAC unit tests continue to pass.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent b244f33 commit c19d421
3 files changed
Lines changed: 67 additions & 0 deletions
File tree
- src/native/managed/cdac/Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/StackWalk/FrameHandling
Lines changed: 22 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
43 | 65 | | |
Lines changed: 15 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
40 | 55 | | |
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
107 | 107 | | |
108 | 108 | | |
109 | 109 | | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
110 | 140 | | |
0 commit comments