Copy createdump alongside NativeAOT test binaries for crash dumps#127588
Copy createdump alongside NativeAOT test binaries for crash dumps#127588agocke wants to merge 1 commit intodotnet:mainfrom
Conversation
NativeAOT tests set DOTNET_DbgEnableMiniDump=1 via RunnerTemplate.sh but createdump was not being deployed next to the test binary, so crash dumps could not be collected on Helix. Regular CoreCLR tests get createdump via the testhost shared framework, but NativeAOT tests are self-contained and don't have a testhost. Copy createdump from CoreCLR artifacts into the NativeAOT test publish directory after Publish, so it's included in the test archive sent to Helix. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR updates the NativeAOT test publishing flow to include the createdump tool in the published output so that DOTNET_DbgEnableMiniDump=1 can successfully generate crash dumps on Helix for self-contained NativeAOT test apps.
Changes:
- Adds an MSBuild target that runs after
PublishforTestNativeAotbuilds (non-Windows) to copycreatedumpinto the NativeAOT test publish directory. - Uses an OS-specific source path for
createdumpon macOS vs. other Unix platforms.
| <!-- Copy createdump next to the published NativeAOT test binary so crash dumps can be collected on Helix. --> | ||
| <Target Name="CopyCreatedumpForNativeAot" | ||
| Condition="'$(TestNativeAot)' == 'true' and '$(TargetOS)' != 'windows'" | ||
| AfterTargets="Publish"> | ||
| <PropertyGroup> | ||
| <_CreatedumpSource Condition="'$(TargetOS)' == 'osx'">$(CoreCLRArtifactsPath)sharedFramework/createdump</_CreatedumpSource> | ||
| <_CreatedumpSource Condition="'$(TargetOS)' != 'osx'">$(CoreCLRArtifactsPath)createdump</_CreatedumpSource> | ||
| </PropertyGroup> | ||
| <Copy SourceFiles="$(_CreatedumpSource)" |
There was a problem hiding this comment.
Copying only the createdump executable is likely insufficient: createdump unconditionally dlopen()s the DAC (mscordaccore / libmscordaccore.*) from the same directory as the createdump binary (see src/coreclr/debug/createdump/createdumppal.cpp). If the DAC isn't also present next to createdump in $(BundleDir), dump generation will fail with a dlopen error, so Helix still won't get dumps. Consider copying the matching mscordaccore binary from the same CoreCLR artifacts location alongside createdump (and any other required adjacent dependencies, if applicable).
| <!-- Copy createdump next to the published NativeAOT test binary so crash dumps can be collected on Helix. --> | |
| <Target Name="CopyCreatedumpForNativeAot" | |
| Condition="'$(TestNativeAot)' == 'true' and '$(TargetOS)' != 'windows'" | |
| AfterTargets="Publish"> | |
| <PropertyGroup> | |
| <_CreatedumpSource Condition="'$(TargetOS)' == 'osx'">$(CoreCLRArtifactsPath)sharedFramework/createdump</_CreatedumpSource> | |
| <_CreatedumpSource Condition="'$(TargetOS)' != 'osx'">$(CoreCLRArtifactsPath)createdump</_CreatedumpSource> | |
| </PropertyGroup> | |
| <Copy SourceFiles="$(_CreatedumpSource)" | |
| <!-- Copy createdump and its colocated DAC next to the published NativeAOT test binary so crash dumps can be collected on Helix. --> | |
| <Target Name="CopyCreatedumpForNativeAot" | |
| Condition="'$(TestNativeAot)' == 'true' and '$(TargetOS)' != 'windows'" | |
| AfterTargets="Publish"> | |
| <PropertyGroup> | |
| <_CreatedumpSourceDir Condition="'$(TargetOS)' == 'osx'">$(CoreCLRArtifactsPath)sharedFramework/</_CreatedumpSourceDir> | |
| <_CreatedumpSourceDir Condition="'$(TargetOS)' != 'osx'">$(CoreCLRArtifactsPath)</_CreatedumpSourceDir> | |
| <_CreatedumpSource>$(_CreatedumpSourceDir)createdump</_CreatedumpSource> | |
| </PropertyGroup> | |
| <ItemGroup> | |
| <_CreatedumpArtifacts Include="$(_CreatedumpSource)" Condition="Exists('$(_CreatedumpSource)')" /> | |
| <_CreatedumpArtifacts Include="$(_CreatedumpSourceDir)libmscordaccore.*" /> | |
| </ItemGroup> | |
| <Copy SourceFiles="@(_CreatedumpArtifacts)" |
We get the native dumps though. If dumps with createdump have everything native dumps would have, this works for me. I've never (knowingly) debugged a dump obtained with createdump. |
| </PropertyGroup> | ||
| <Copy SourceFiles="$(_CreatedumpSource)" | ||
| DestinationFolder="$(BundleDir)" | ||
| Condition="Exists('$(_CreatedumpSource)')" |
There was a problem hiding this comment.
This makes all of this a NOP because we don't build createdump in any native AOT test legs.
|
|
||
| <!-- Copy createdump next to the published NativeAOT test binary so crash dumps can be collected on Helix. --> | ||
| <Target Name="CopyCreatedumpForNativeAot" | ||
| Condition="'$(TestNativeAot)' == 'true' and '$(TargetOS)' != 'windows'" |
Note
This PR was generated with the help of GitHub Copilot.
NativeAOT tests set
DOTNET_DbgEnableMiniDump=1viaRunnerTemplate.shbutcreatedumpwas not being deployed next to the test binary, so crash dumps could not be collected on Helix. Regular CoreCLR tests getcreatedumpvia the testhost shared framework, but NativeAOT tests are self-contained and don't have a testhost.This adds an MSBuild target that copies
createdumpfrom CoreCLR artifacts into the NativeAOT test publish directory afterPublish, so it's included in the test archive sent to Helix.