Skip to content

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

Open
kotlarmilos wants to merge 2 commits into
mainfrom
dev/kotlarmilos/r2r-keep-debug-info-in-debug
Open

[clr-ios] Keep R2R debug info in Debug for Apple mobile RIDs#54529
kotlarmilos wants to merge 2 commits into
mainfrom
dev/kotlarmilos/r2r-keep-debug-info-in-debug

Conversation

@kotlarmilos
Copy link
Copy Markdown
Member

@kotlarmilos kotlarmilos commented Jun 1, 2026

Description

PublishReadyToRunStripDebugInfo defaults to true for Apple mobile RIDs, 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: 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.

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
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

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>
<PublishReadyToRunStripDebugInfo Condition="'$(PublishReadyToRunStripDebugInfo)' == '' and '$(DebuggerSupport)' != 'true' and $(RuntimeIdentifier.StartsWith('tvos-'))">true</PublishReadyToRunStripDebugInfo>
<PublishReadyToRunStripDebugInfo Condition="'$(PublishReadyToRunStripDebugInfo)' == '' and '$(DebuggerSupport)' != 'true' and $(RuntimeIdentifier.StartsWith('iossimulator-'))">true</PublishReadyToRunStripDebugInfo>
<PublishReadyToRunStripDebugInfo Condition="'$(PublishReadyToRunStripDebugInfo)' == '' and '$(DebuggerSupport)' != 'true' and $(RuntimeIdentifier.StartsWith('tvossimulator-'))">true</PublishReadyToRunStripDebugInfo>
<PublishReadyToRunStripDebugInfo Condition="'$(PublishReadyToRunStripDebugInfo)' == '' and '$(DebuggerSupport)' != 'true' and $(RuntimeIdentifier.StartsWith('maccatalyst-'))">true</PublishReadyToRunStripDebugInfo>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I assume DebuggerSupport will always set by macios SDK targets from https://github.com/dotnet/macios/blob/53ffc7202a22a069931b5ef744224c2c772a096b/dotnet/targets/Xamarin.Shared.Sdk.targets#L127? Unlike for projects that don't use that SDK.

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.

4 participants