dotnet / dotnet/runtime

[debugger] Replace `PRDIsEmpty(opcode)` activation check with explicit `m_activated` flag

Open
#124,499 3 comments 0 reactions 1 assignee Claimed by @matouskozak View on GitHub
area-Diagnostics-coreclr
Dominant language
C#
Stars
18.3k
Forks
5.6k
PR merge metrics
PR metrics pending

Description

`DebuggerControllerPatch::IsActivated()` uses `PRDIsEmpty(opcode)` (opcode == 0) as the sentinel for "patch not active." The interpreter has valid opcode with value 0, so it requires a workaround to work with existing infrastructure.

We should consider replacing the `PRDIsEmpty` activation check with a single `bool m_activated` field used by both JIT and interpreter paths. This requires updating `ApplyPatch`/`UnapplyPatch` (both execution control paths) to set `m_activated`, auditing all `PRDIsEmpty` call sites that check activation semantics, and verifying DAC/right-side compatibility since the right side currently assumes non-zero opcode + non-zero address = valid patch when reading the patch table out-of-process.

Another solution could be to to force interpreter to not use opcode with value 0 and keep existing check.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.