[clr-ios] Include macOS DAC/DBI in iOS CoreCLR runtime pack for remote debugging#126315
[clr-ios] Include macOS DAC/DBI in iOS CoreCLR runtime pack for remote debugging#126315kotlarmilos wants to merge 1 commit intodotnet:mainfrom
Conversation
When debugging iOS CoreCLR apps remotely, vsdbg runs on the macOS host and
needs macOS-platform DAC/DBI (libmscordaccore.dylib, libmscordbi.dylib) to
inspect the target process. The iOS runtime pack only contains iOS-platform
DAC/DBI, which vsdbg cannot dlopen.
This change adds an osxdac build subset (following the linuxdac/alpinedac
pattern) that builds the macOS CoreCLR debug component during Apple mobile
builds, and packages the resulting macOS DAC/DBI under tools/osx-{arch}/
in the iOS CoreCLR runtime pack. The macios SDK will extract these host-side
components to a debugger assets directory where vsdbg can load them.
Changes:
- eng/Subsets.props: Add OsxDac subset definition and include it in Apple
mobile default subsets (before packs, so artifacts exist at pack time)
- eng/liveBuilds.targets: Add CoreCLRHostDebugComponentDir property and
CoreCLRHostDebugFiles item group to pick up osx DAC/DBI artifacts
- Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj: Pack host debug files
under tools/osx-{arch}
Fixes dotnet#125974
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Tagging subscribers to 'os-ios': @vitek-karas, @kotlarmilos, @steveisok, @akoeplinger |
There was a problem hiding this comment.
Pull request overview
Adds host (macOS) DAC/DBI build + packaging to the iOS/tvOS CoreCLR runtime pack so remote debugging on Apple mobile targets can load the correct host-side diagnostic libraries.
Changes:
- Introduces an
osxdacbuild subset for Apple mobile builds that builds the macOS CoreCLR debug component (DAC/DBI). - Plumbs the macOS DAC/DBI outputs into the live-build item graph (
CoreCLRHostDebugFiles) for packing. - Packs the host macOS DAC/DBI into the Apple mobile CoreCLR runtime pack under
tools/osx-{arch}/.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| eng/Subsets.props | Adds osxdac subset and wires it into Apple mobile default subsets and AllSubsets on macOS. |
| eng/liveBuilds.targets | Adds properties/items to locate macOS DAC/DBI outputs and expose them as CoreCLRHostDebugFiles. |
| src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.CoreCLR.sfxproj | Packs CoreCLRHostDebugFiles into the runtime pack under tools/osx-$(BuildArchitecture) with PackOnly=true. |
| Condition="'$(CoreCLRCrossTargetComponentDirName)' != ''">$([MSBuild]::NormalizeDirectory('$(CoreCLRArtifactsPath)','$(CoreCLRCrossTargetComponentDirName)','sharedFramework'))</CoreCLRCrossTargetComponentDir> | ||
| <!-- For Apple mobile the host debugger needs host-platform DAC/DBI to inspect the remote process. --> | ||
| <CoreCLRHostDebugComponentDir | ||
| Condition="'$(TargetsAppleMobile)' == 'true'">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'coreclr', 'osx.$(BuildArchitecture).$(CoreCLRConfiguration)', 'sharedFramework'))</CoreCLRHostDebugComponentDir> |
There was a problem hiding this comment.
CoreCLRHostDebugComponentDir is hardcoded to
| Condition="'$(TargetsAppleMobile)' == 'true'">$([MSBuild]::NormalizeDirectory('$(RepoRoot)', 'artifacts', 'bin', 'coreclr', 'osx.$(BuildArchitecture).$(CoreCLRConfiguration)', 'sharedFramework'))</CoreCLRHostDebugComponentDir> | |
| Condition="'$(CoreCLRHostDebugComponentDir)' == '' and '$(TargetsAppleMobile)' == 'true'">$([MSBuild]::NormalizeDirectory('$(ArtifactsBinDir)', 'coreclr', 'osx.$(BuildArchitecture).$(CoreCLRConfiguration)', 'sharedFramework'))</CoreCLRHostDebugComponentDir> |
| <CoreCLRHostDebugFiles Condition="'$(CoreCLRHostDebugComponentDir)' != '' and Exists('$(CoreCLRHostDebugComponentDir)')" | ||
| Include="$(CoreCLRHostDebugComponentDir)$(LibPrefix)mscordaccore$(LibSuffix)" IsNative="true" /> | ||
| <CoreCLRHostDebugFiles Condition="'$(CoreCLRHostDebugComponentDir)' != '' and Exists('$(CoreCLRHostDebugComponentDir)')" |
There was a problem hiding this comment.
The item include is guarded by Exists('$(CoreCLRHostDebugComponentDir)'), but the items reference specific files. If the directory exists without one of the expected files (e.g., leftover artifacts from a different build), the pack build will fail when it tries to include a non-existent file. Guard each Include with an Exists('') check (or switch to a glob and filter) to ensure only existing files are added, and optionally emit an error when TargetsAppleMobile is true but the expected DAC/DBI outputs are missing.
| <CoreCLRHostDebugFiles Condition="'$(CoreCLRHostDebugComponentDir)' != '' and Exists('$(CoreCLRHostDebugComponentDir)')" | |
| Include="$(CoreCLRHostDebugComponentDir)$(LibPrefix)mscordaccore$(LibSuffix)" IsNative="true" /> | |
| <CoreCLRHostDebugFiles Condition="'$(CoreCLRHostDebugComponentDir)' != '' and Exists('$(CoreCLRHostDebugComponentDir)')" | |
| <CoreCLRHostDebugFiles Condition="'$(CoreCLRHostDebugComponentDir)' != '' and Exists('$(CoreCLRHostDebugComponentDir)$(LibPrefix)mscordaccore$(LibSuffix)')" | |
| Include="$(CoreCLRHostDebugComponentDir)$(LibPrefix)mscordaccore$(LibSuffix)" IsNative="true" /> | |
| <CoreCLRHostDebugFiles Condition="'$(CoreCLRHostDebugComponentDir)' != '' and Exists('$(CoreCLRHostDebugComponentDir)$(LibPrefix)mscordbi$(LibSuffix)')" |
|
After discussion with @thaystg, this isn't needed. The host debugger component should be sufficient |
Description
When debugging iOS CoreCLR apps remotely, debugger runs on the macOS host and needs macOS-platform DAC/DBI (
libmscordaccore.dylib,libmscordbi.dylib) to inspect the target process. The iOS runtime pack only contains iOS-platform DAC/DBI, which vsdbg cannot dlopen. This change adds anosxdacbuild subset (following thelinuxdac/alpinedacpattern) that builds the macOS CoreCLR debug component during Apple mobile builds, and packages the resulting macOS DAC/DBI undertools/osx-{arch}/in the iOS CoreCLR runtime pack.Related macios PR: dotnet/macios#25041
Fixes #125974