Skip to content

Make IsSSFlagEnabled signature consistent across all architectures#125678

Closed
Copilot wants to merge 2 commits intomainfrom
copilot/make-isssflagenabled-consistent
Closed

Make IsSSFlagEnabled signature consistent across all architectures#125678
Copilot wants to merge 2 commits intomainfrom
copilot/make-isssflagenabled-consistent

Conversation

Copy link
Contributor

Copilot AI commented Mar 17, 2026

Summary

IsSSFlagEnabled had inconsistent signatures across architectures:

  • AMD64 / i386: inline bool IsSSFlagEnabled(DT_CONTEXT * context) — 1 parameter (context only)
  • ARM64: same 1-param inline in header, plus a 2-param declaration in arm_primitives.h (two overloads)
  • ARM / LOONGARCH64 / RISCV64: bool IsSSFlagEnabled(DT_CONTEXT *pCtx, Thread *pThread) — 2 parameters

This forced call sites in debugger.cpp to use awkward ARM_ARG(pThread) ARM64_ARG(pThread) RISCV64_ARG(pThread) LOONGARCH64_ARG(pThread) macros to conditionally pass the thread.

Changes

All architectures now use a uniform signature: bool IsSSFlagEnabled(DT_CONTEXT *pCtx, Thread *pThread). Architectures that don't need the Thread* parameter (AMD64, i386, ARM64 without FEATURE_EMULATE_SINGLESTEP) simply ignore it.

  • debug/inc/amd64/primitives.h and debug/inc/i386/primitives.h: Added class Thread; forward declaration and Thread* /* pThread */ = nullptr parameter to the inline function. Consistent with the same pattern already used in arm/primitives.h, loongarch64/primitives.h, etc.
  • debug/inc/arm64/primitives.h: Removed the 1-param IsSSFlagEnabled inline. The 2-param declaration from the already-included arm_primitives.h now serves as the sole declaration.
  • debug/ee/arm64/primitives.cpp: In the !FEATURE_EMULATE_SINGLESTEP block, replaced return IsSSFlagEnabled(pContext) (which called the now-removed 1-param inline) with the CPSR check directly.
  • debug/di/arm64/primitives.cpp: Added a !FEATURE_EMULATE_SINGLESTEP implementation of IsSSFlagEnabled for Windows ARM64 DBI (which has FEATURE_INTEROP_DEBUGGING but not FEATURE_EMULATE_SINGLESTEP).
  • debug/di/rsthread.cpp: Updated 5 call sites to pass nullptr as the thread.
  • debug/di/process.cpp: Updated 2 call sites to pass nullptr as the thread.
  • debug/ee/debugger.cpp: Simplified the macro-based call to always pass pThread directly.

Note

SetSSFlag and UnsetSSFlag have the same signature inconsistency. That cleanup can be done as a follow-up.

Copilot AI and others added 2 commits March 17, 2026 20:20
Co-authored-by: davidwrighton <10779849+davidwrighton@users.noreply.github.com>
@dotnet-policy-service
Copy link
Contributor

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

@davidwrighton
Copy link
Member

Sigh. This doesn't actually look better.

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.

2 participants