Skip to content

[clr-ios] Keep R2R debug and inlining info in Debug for Apple mobile RIDs#54529

Merged
kotlarmilos merged 5 commits into
mainfrom
dev/kotlarmilos/r2r-keep-debug-info-in-debug
Jun 4, 2026
Merged

[clr-ios] Keep R2R debug and inlining info in Debug for Apple mobile RIDs#54529
kotlarmilos merged 5 commits into
mainfrom
dev/kotlarmilos/r2r-keep-debug-info-in-debug

Conversation

@kotlarmilos

@kotlarmilos kotlarmilos commented Jun 1, 2026

Copy link
Copy Markdown
Member

Description

PublishReadyToRunStripDebugInfo and PublishReadyToRunStripInliningInfo default to true for Apple mobile RIDs (ios-*, tvos-*, iossimulator-*, tvossimulator-*, maccatalyst-*), which passes --strip-debug-info and --strip-inlining-info to crossgen2 and drops READYTORUN_SECTION_DEBUG_INFO (and inlining info) from the R2R image.

Without that section, the CoreCLR debugger cannot map IL offsets to native offsets for R2R'd methods: ReadyToRunInfo::GetDebugInfo returns NULL, ReadyToRunJitManager::GetBoundariesAndVars returns FALSE, DebuggerJitInfo::LazyInitBounds never populates m_sequenceMap, and line-level breakpoints cannot bind to anything other than the method entry.

Change

Gate the default PublishReadyToRunStripDebugInfo=true and PublishReadyToRunStripInliningInfo=true for Apple mobile RIDs on '$(DebuggerSupport)' != 'true' and '$(Configuration)' != 'Debug':

  • DebuggerSupport is the canonical property the trimmers use to decide whether to keep debugger support (see trimming options). The macios SDK sets it from Xamarin.Shared.Sdk.targets.
  • Configuration != 'Debug' is kept as a fallback for projects that do not flow through the macios SDK and therefore never populate DebuggerSupport (ref #31918 on custom configuration names is acknowledged; the fallback only relaxes stripping for the literal Debug name, which is the documented default).

Release (and other non-Debug, non-DebuggerSupport=true) builds continue stripping R2R debug and inlining info via --strip-debug-info and --strip-inlining-info, preserving current size/perf characteristics.

PublishReadyToRunStripDebugInfo defaults to true for ios/tvos/iossimulator/
tvossimulator/maccatalyst, which passes --strip-debug-info to crossgen2 and
drops READYTORUN_SECTION_DEBUG_INFO from the R2R image. Without that section,
the CoreCLR debugger cannot map IL offsets to native offsets for R2R'd
methods, so line-level breakpoints fail to bind to anything other than the
method entry. Gate the default on Configuration != Debug so debug builds keep
the IL-to-native map. Release builds are unchanged.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings June 1, 2026 12:18
@kotlarmilos kotlarmilos changed the title Keep R2R debug info in Debug for Apple mobile RIDs [clr-ios] Keep R2R debug info in Debug for Apple mobile RIDs Jun 1, 2026
@kotlarmilos kotlarmilos self-assigned this Jun 1, 2026
@kotlarmilos kotlarmilos added this to the 11.0.1xx milestone Jun 1, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adjusts the default ReadyToRun (R2R) behavior for Apple mobile RuntimeIdentifiers so Debug publishes retain R2R debug-info sections needed for IL-to-native mapping in the CoreCLR debugger, while keeping existing stripping behavior for non-Debug configurations.

Changes:

  • Gates the default PublishReadyToRunStripDebugInfo=true for ios/tvos/iossimulator/tvossimulator/maccatalyst RIDs on $(Configuration) != 'Debug'.
  • Keeps Release (and other non-Debug) builds stripping R2R debug info via --strip-debug-info, preserving current size/perf characteristics outside Debug.
Show a summary per file
File Description
src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets Changes the default PublishReadyToRunStripDebugInfo behavior for Apple mobile RIDs so Debug builds keep R2R debug info, while non-Debug builds continue stripping.

Copilot's findings

  • Files reviewed: 1/1 changed files
  • Comments generated: 0

@kotlarmilos kotlarmilos requested a review from elinor-fung June 1, 2026 12:39
Comment thread src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets Outdated
Per review feedback: customers can use configuration names other than 'Debug'.
DebuggerSupport is the canonical trimmer-aware signal; Xamarin.Shared.Sdk.targets
in dotnet/macios already sets it from MtouchDebug/MmpDebug/Configuration, so
relying on it correctly handles custom debug configurations.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment thread src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets Outdated
dotnet/runtime CoreCLR Apple mobile tests publish for ios-*/tvos-*/etc.
without the Microsoft.iOS workload, so DebuggerSupport is empty there.
A DebuggerSupport-only gate would still strip in Debug for those tests
and defeat the PR's goal of preserving R2R debug info for the CoreCLR
debugger.

Strip only when both signals say so: DebuggerSupport explicitly not true
AND Configuration not Debug. macios SDK consumers (DebuggerSupport set
from MtouchDebug) still respect custom configuration names per the
earlier review.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kotlarmilos

Copy link
Copy Markdown
Member Author

@copilot do the same for PublishReadyToRunStripInliningInfo

Co-authored-by: kotlarmilos <11523312+kotlarmilos@users.noreply.github.com>

Copilot AI commented Jun 2, 2026

Copy link
Copy Markdown
Contributor

@copilot do the same for PublishReadyToRunStripInliningInfo

Done. Applied the same '$(DebuggerSupport)' != 'true' and '$(Configuration)' != 'Debug' gating to the default PublishReadyToRunStripInliningInfo=true for the Apple mobile RIDs.

Copilot AI changed the title [clr-ios] Keep R2R debug info in Debug for Apple mobile RIDs [clr-ios] Keep R2R debug and inlining info in Debug for Apple mobile RIDs Jun 2, 2026
Comment thread src/Tasks/Microsoft.NET.Build.Tasks/targets/Microsoft.NET.CrossGen.targets Outdated
Addresses review nit: replace the duplicated RuntimeIdentifier.StartsWith
checks across the EmitSymbols, StripInliningInfo, StripDebugInfo, and
StripILBodies property defaults with a single _IsIOSLikeRid property.
Behavior is unchanged; the osx- EmitSymbols case remains separate.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@kotlarmilos kotlarmilos merged commit 1016c54 into main Jun 4, 2026
25 checks passed
@kotlarmilos kotlarmilos deleted the dev/kotlarmilos/r2r-keep-debug-info-in-debug branch June 4, 2026 10:02
@dotnet-milestone-bot dotnet-milestone-bot Bot removed this from the 11.0.1xx milestone Jun 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants