Commit 790f597
Fix error propagation, register mapping, and code offset in variable resolution
Three bugs found from CI SOS test failures:
1. CreateValueFromDebugInfo swallowed all exceptions and returned S_OK
with empty locations. Now uses a targeted catch matching native DAC's
ValueFromDebugInfo behavior (sets numVarInfo=0 and continues).
2. ClrDataValue.GetLocationByIndex returned the register value as the
address for register-based locations. The native DAC returns addr=0
for register locations (inspect.cpp:1295).
3. GetRegisterName did not handle REGNUM_AMBIENT_SP (register 17 on x64,
9 on x86, etc.) — a pseudo-register for the original stack pointer.
Variables stored relative to the ambient SP caused NotSupportedException,
producing 0 locations while the native DAC found 1. Fixed by mapping
REGNUM_AMBIENT_SP to the stack pointer register for each architecture.
4. GetMethodNativeVarInfo computed code offset from GetStartAddress (which
returns the code block / funclet start) instead of the method entry
point. NativeVarInfo offsets are relative to the method start, matching
the native DAC's use of NativeCodeVersion::GetNativeCode().
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent 487d34e commit 790f597
File tree
4 files changed
+28
-4
lines changed- src/native/managed/cdac
- Microsoft.Diagnostics.DataContractReader.Contracts/Contracts/DebugInfo
- Microsoft.Diagnostics.DataContractReader.Legacy
4 files changed
+28
-4
lines changedLines changed: 12 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
397 | 397 | | |
398 | 398 | | |
399 | 399 | | |
| 400 | + | |
| 401 | + | |
400 | 402 | | |
401 | 403 | | |
402 | 404 | | |
403 | 405 | | |
404 | 406 | | |
405 | 407 | | |
| 408 | + | |
| 409 | + | |
406 | 410 | | |
407 | 411 | | |
408 | 412 | | |
| |||
411 | 415 | | |
412 | 416 | | |
413 | 417 | | |
| 418 | + | |
| 419 | + | |
414 | 420 | | |
415 | 421 | | |
416 | 422 | | |
417 | 423 | | |
418 | | - | |
| 424 | + | |
| 425 | + | |
| 426 | + | |
| 427 | + | |
| 428 | + | |
| 429 | + | |
419 | 430 | | |
420 | 431 | | |
421 | 432 | | |
| |||
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
127 | 135 | | |
128 | 136 | | |
129 | 137 | | |
| |||
Lines changed: 6 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
246 | 249 | | |
247 | 250 | | |
248 | 251 | | |
| |||
416 | 419 | | |
417 | 420 | | |
418 | 421 | | |
| 422 | + | |
419 | 423 | | |
420 | 424 | | |
421 | 425 | | |
| |||
587 | 591 | | |
588 | 592 | | |
589 | 593 | | |
| 594 | + | |
| 595 | + | |
590 | 596 | | |
591 | 597 | | |
592 | 598 | | |
| |||
596 | 602 | | |
597 | 603 | | |
598 | 604 | | |
599 | | - | |
600 | 605 | | |
601 | 606 | | |
602 | 607 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
309 | 309 | | |
310 | 310 | | |
311 | 311 | | |
312 | | - | |
| 312 | + | |
313 | 313 | | |
314 | 314 | | |
315 | 315 | | |
| |||
0 commit comments