From 1fd63e773c9092d364a97281c60e9181919dac0c Mon Sep 17 00:00:00 2001 From: Mike McLaughlin Date: Wed, 15 Jan 2020 16:34:30 -0800 Subject: [PATCH 1/2] Build Windows arm64 version of SOS. Make sure that the "BuildArch" msbuild property is always passed to managed and native builds. Add the arm64 SOS to the various packages and zip files. The diasymreader package for Windows PDB support is currently disabled for arm64 waiting for issue https://github.com/dotnet/diagnostics/issues/324 to be addressed. --- .vsts-dotnet.yml | 14 ++++++++++++++ eng/Build-Native.cmd | 10 +++++----- eng/build.ps1 | 4 ++-- src/SOS/CMakeLists.txt | 4 +++- src/SOS/SOS.NETCore/CMakeLists.txt | 5 ++++- src/SOS/SOS.NETCore/SOS.NETCore.csproj | 3 ++- src/SOS/SOS.Package/SOS.Package.csproj | 17 +++++++++++++++++ src/SOS/SOS.Package/SOS.Symbol.Package.csproj | 3 +++ src/sos-packaging.props | 12 ++++++++++++ 9 files changed, 62 insertions(+), 10 deletions(-) diff --git a/.vsts-dotnet.yml b/.vsts-dotnet.yml index 87b5ae13df..43ba18a7a5 100644 --- a/.vsts-dotnet.yml +++ b/.vsts-dotnet.yml @@ -29,6 +29,11 @@ jobs: _BuildConfig: Release _BuildArch: arm _PublishArtifacts: bin/Windows_NT.arm.Release + Build_Release_arm64: + _BuildOnly: true + _BuildConfig: Release + _BuildArch: arm64 + _PublishArtifacts: bin/Windows_NT.arm64.Release - template: /eng/build.yml parameters: @@ -253,6 +258,15 @@ jobs: targetPath: '$(Build.SourcesDirectory)/artifacts/bin/Windows_NT.arm.Release' condition: succeeded() + # Windows arm64 download + + - task: DownloadPipelineArtifact@2 + displayName: Download Windows Arm64 Artifacts + inputs: + artifactName: Windows_arm64_Release + targetPath: '$(Build.SourcesDirectory)/artifacts/bin/Windows_NT.arm64.Release' + condition: succeeded() + # Linux x64 download - task: DownloadPipelineArtifact@2 diff --git a/eng/Build-Native.cmd b/eng/Build-Native.cmd index e8f4082386..5fbf6d3bfe 100644 --- a/eng/Build-Native.cmd +++ b/eng/Build-Native.cmd @@ -174,13 +174,13 @@ if /i %__BuildCrossArch% EQU 1 ( echo Generating Version Header set __GenerateVersionRestoreLog="%__LogDir%\GenerateVersionRestore.binlog" - "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionRestoreLog! /t:Restore /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% + "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionRestoreLog! /t:Restore /p:Configuration=%__BuildType% /p:BuildArch=%__BuildArch% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% if not !errorlevel! == 0 ( echo Generate Version Restore FAILED exit /b 1 ) set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog" - "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__CrossCompIntermediatesDir%\_version.h /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% + "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__CrossCompIntermediatesDir%\_version.h /p:Configuration=%__BuildType% /p:BuildArch=%__BuildArch% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% if not !errorlevel! == 0 ( echo Generate Version Header FAILED exit /b 1 @@ -258,13 +258,13 @@ if %__Build% EQU 1 ( echo Generating Version Header set __GenerateVersionRestoreLog="%__LogDir%\GenerateVersionRestore.binlog" - "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionRestoreLog! /t:Restore /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% + "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionRestoreLog! /t:Restore /p:Configuration=%__BuildType% /p:BuildArch=%__BuildArch% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% if not !errorlevel! == 0 ( echo Generate Version Restore FAILED exit /b 1 ) set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog" - "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__IntermediatesDir%\_version.h /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% + "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__IntermediatesDir%\_version.h /p:Configuration=%__BuildType% /p:BuildArch=%__BuildArch% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% if not !errorlevel! == 0 ( echo Generate Version Header FAILED exit /b 1 @@ -292,7 +292,7 @@ if %__Build% EQU 1 ( set __BuildLog="%__LogDir%\Native.Build.binlog" :: MSBuild.exe is the only one that has the C++ targets. "%__DotNetCli% msbuild" fails because VCTargetsPath isn't defined. - msbuild.exe %__IntermediatesDir%\install.vcxproj /v:!__Verbosity! /bl:!__BuildLog! /p:Configuration=%__BuildType% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% + msbuild.exe %__IntermediatesDir%\install.vcxproj /v:!__Verbosity! /bl:!__BuildLog! /p:Configuration=%__BuildType% /p:BuildArch=%__BuildArch% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% if not !ERRORLEVEL! == 0 ( echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details: diff --git a/eng/build.ps1 b/eng/build.ps1 index 7521165a17..8f32731eba 100644 --- a/eng/build.ps1 +++ b/eng/build.ps1 @@ -52,7 +52,7 @@ if ($ci) { # Install sdk for building, restore and build managed components. if (-not $skipmanaged) { - Invoke-Expression "& `"$engroot\common\build.ps1`" -build -configuration $configuration -verbosity $verbosity /p:TestArchitectures=$architecture $remainingargs" + Invoke-Expression "& `"$engroot\common\build.ps1`" -build -binaryLog -configuration $configuration -verbosity $verbosity /p:BuildArch=$architecture /p:TestArchitectures=$architecture $remainingargs" if ($lastExitCode -ne 0) { exit $lastExitCode } @@ -69,7 +69,7 @@ if (-not $skipnative) { # Run the xunit tests if ($test -or $dailytest) { if (-not $crossbuild) { - & "$engroot\common\build.ps1" -test -configuration $configuration -verbosity $verbosity -ci:$ci /bl:$logdir\Test.binlog /p:TestArchitectures=$architecture /p:BuildArch=$architecture /p:DailyTest=$dailyTest + & "$engroot\common\build.ps1" -test -configuration $configuration -verbosity $verbosity -ci:$ci /bl:$logdir\Test.binlog /p:BuildArch=$architecture /p:TestArchitectures=$architecture /p:DailyTest=$dailyTest if ($lastExitCode -ne 0) { exit $lastExitCode } diff --git a/src/SOS/CMakeLists.txt b/src/SOS/CMakeLists.txt index 07cf24bd60..c6578d7595 100644 --- a/src/SOS/CMakeLists.txt +++ b/src/SOS/CMakeLists.txt @@ -11,7 +11,9 @@ if(WIN32) add_compile_options(/Zl) # omit default library name in .OBJ add_subdirectory(runcommand) - add_subdirectory(SOS.UnitTests/Debuggees/DesktopClrHost) + if(NOT CLR_CMAKE_TARGET_ARCH_ARM64) + add_subdirectory(SOS.UnitTests/Debuggees/DesktopClrHost) + endif() endif(WIN32) add_definitions(-D_SECURE_SCL=0) diff --git a/src/SOS/SOS.NETCore/CMakeLists.txt b/src/SOS/SOS.NETCore/CMakeLists.txt index e92f5891f8..bc8caa12d0 100644 --- a/src/SOS/SOS.NETCore/CMakeLists.txt +++ b/src/SOS/SOS.NETCore/CMakeLists.txt @@ -22,5 +22,8 @@ if(NOT ${NUGET_PACKAGES} STREQUAL "") set(DIASYMREADER_ARCH amd64) endif() - install(FILES ${NUGET_PACKAGES}/microsoft.diasymreader.native/1.7.0/runtimes/win/native/Microsoft.DiaSymReader.Native.${DIASYMREADER_ARCH}.dll DESTINATION . ) + # Until issue https://github.com/dotnet/diagnostics/issues/324 is done there is no arm64 version of the diasymreader in this package + if(NOT CLR_CMAKE_TARGET_ARCH_ARM64) + install(FILES ${NUGET_PACKAGES}/microsoft.diasymreader.native/1.7.0/runtimes/win/native/Microsoft.DiaSymReader.Native.${DIASYMREADER_ARCH}.dll DESTINATION . ) + endif() endif() diff --git a/src/SOS/SOS.NETCore/SOS.NETCore.csproj b/src/SOS/SOS.NETCore/SOS.NETCore.csproj index 74decf10c1..d4487ca8a5 100644 --- a/src/SOS/SOS.NETCore/SOS.NETCore.csproj +++ b/src/SOS/SOS.NETCore/SOS.NETCore.csproj @@ -12,6 +12,7 @@ - + + diff --git a/src/SOS/SOS.Package/SOS.Package.csproj b/src/SOS/SOS.Package/SOS.Package.csproj index fa13882087..d429cbbbe7 100644 --- a/src/SOS/SOS.Package/SOS.Package.csproj +++ b/src/SOS/SOS.Package/SOS.Package.csproj @@ -41,6 +41,7 @@ + @@ -110,6 +111,18 @@ $(GallerySubDir)\win-arm + + + $(GallerySubDir)\win-arm64 + + + + $(GallerySubDir)\win-arm64 + @@ -138,6 +151,10 @@ $(SymbolsDir)\win-arm + + + $(SymbolsDir)\win-arm64 + diff --git a/src/SOS/SOS.Package/SOS.Symbol.Package.csproj b/src/SOS/SOS.Package/SOS.Symbol.Package.csproj index c1f326b0d7..cf0e5a0c8b 100644 --- a/src/SOS/SOS.Package/SOS.Symbol.Package.csproj +++ b/src/SOS/SOS.Package/SOS.Symbol.Package.csproj @@ -27,6 +27,9 @@ $(SOSPackagePathPrefix)/win-arm + + $(SOSPackagePathPrefix)/win-arm64 + $(SOSPackagePathPrefix)/linux-x64 diff --git a/src/sos-packaging.props b/src/sos-packaging.props index ff43ddee83..de482365cb 100644 --- a/src/sos-packaging.props +++ b/src/sos-packaging.props @@ -39,6 +39,18 @@ $(SOSPackagePathPrefix)/win-arm + + $(SOSPackagePathPrefix)/win-arm64 + + + $(SOSPackagePathPrefix)/win-arm64 + + + $(SOSPackagePathPrefix)/linux-x64 From 3cca956effae66e13e5bb7656de87aaaa7945d84 Mon Sep 17 00:00:00 2001 From: Mike McLaughlin Date: Thu, 16 Jan 2020 14:55:57 -0800 Subject: [PATCH 2/2] Code review feedback --- eng/Build-Native.cmd | 15 +++++++++------ src/SOS/Strike/hostcoreclr.cpp | 4 ++-- src/SOS/Strike/util.h | 4 +--- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/eng/Build-Native.cmd b/eng/Build-Native.cmd index 5fbf6d3bfe..bdd4b942a2 100644 --- a/eng/Build-Native.cmd +++ b/eng/Build-Native.cmd @@ -123,6 +123,9 @@ if NOT "%__CrossArch%" == "" set __CrossComponentBinDir=%__CrossComponentBinDir% set "__CMakeBinDir=%__BinDir%" set "__CMakeBinDir=%__CMakeBinDir:\=/%" +:: Common msbuild arguments +set "__CommonBuildArgs=/v:!__Verbosity! /p:Configuration=%__BuildType% /p:BuildArch=%__BuildArch% %__UnprocessedBuildArgs%" + if not exist "%__BinDir%" md "%__BinDir%" if not exist "%__IntermediatesDir%" md "%__IntermediatesDir%" if not exist "%__LogDir%" md "%__LogDir%" @@ -174,13 +177,13 @@ if /i %__BuildCrossArch% EQU 1 ( echo Generating Version Header set __GenerateVersionRestoreLog="%__LogDir%\GenerateVersionRestore.binlog" - "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionRestoreLog! /t:Restore /p:Configuration=%__BuildType% /p:BuildArch=%__BuildArch% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% + "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionRestoreLog! /t:Restore %__CommonBuildArgs% if not !errorlevel! == 0 ( echo Generate Version Restore FAILED exit /b 1 ) set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog" - "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__CrossCompIntermediatesDir%\_version.h /p:Configuration=%__BuildType% /p:BuildArch=%__BuildArch% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% + "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__CrossCompIntermediatesDir%\_version.h %__CommonBuildArgs% if not !errorlevel! == 0 ( echo Generate Version Header FAILED exit /b 1 @@ -209,7 +212,7 @@ if /i %__BuildCrossArch% EQU 1 ( set __BuildLog="%__LogDir%\Cross.Build.binlog" :: MSBuild.exe is the only one that has the C++ targets. "%__DotNetCli% msbuild" fails because VCTargetsPath isn't defined. - msbuild.exe %__CrossCompIntermediatesDir%\install.vcxproj /v:!__Verbosity! /bl:!__BuildLog! /p:Configuration=%__BuildType% /p:Platform=%__CrossArch% %__UnprocessedBuildArgs% + msbuild.exe %__CrossCompIntermediatesDir%\install.vcxproj /bl:!__BuildLog! %__CommonBuildArgs% if not !ERRORLEVEL! == 0 ( echo %__MsgPrefix%Error: cross-arch components build failed. Refer to the build log files for details: @@ -258,13 +261,13 @@ if %__Build% EQU 1 ( echo Generating Version Header set __GenerateVersionRestoreLog="%__LogDir%\GenerateVersionRestore.binlog" - "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionRestoreLog! /t:Restore /p:Configuration=%__BuildType% /p:BuildArch=%__BuildArch% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% + "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionRestoreLog! /t:Restore %__CommonBuildArgs% if not !errorlevel! == 0 ( echo Generate Version Restore FAILED exit /b 1 ) set __GenerateVersionLog="%__LogDir%\GenerateVersion.binlog" - "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /v:!__Verbosity! /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__IntermediatesDir%\_version.h /p:Configuration=%__BuildType% /p:BuildArch=%__BuildArch% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% + "%__DotNetCli%" msbuild "%__ProjectDir%\eng\CreateVersionFile.csproj" /bl:!__GenerateVersionLog! /t:GenerateVersionFiles /p:FileVersionFile=%__RootBinDir%\bin\FileVersion.txt /p:GenerateVersionHeader=true /p:NativeVersionHeaderFile=%__IntermediatesDir%\_version.h %__CommonBuildArgs% if not !errorlevel! == 0 ( echo Generate Version Header FAILED exit /b 1 @@ -292,7 +295,7 @@ if %__Build% EQU 1 ( set __BuildLog="%__LogDir%\Native.Build.binlog" :: MSBuild.exe is the only one that has the C++ targets. "%__DotNetCli% msbuild" fails because VCTargetsPath isn't defined. - msbuild.exe %__IntermediatesDir%\install.vcxproj /v:!__Verbosity! /bl:!__BuildLog! /p:Configuration=%__BuildType% /p:BuildArch=%__BuildArch% /p:Platform=%__BuildArch% %__UnprocessedBuildArgs% + msbuild.exe %__IntermediatesDir%\install.vcxproj /bl:!__BuildLog! %__CommonBuildArgs% if not !ERRORLEVEL! == 0 ( echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details: diff --git a/src/SOS/Strike/hostcoreclr.cpp b/src/SOS/Strike/hostcoreclr.cpp index 62e4dc1944..ea44f8431a 100644 --- a/src/SOS/Strike/hostcoreclr.cpp +++ b/src/SOS/Strike/hostcoreclr.cpp @@ -992,7 +992,7 @@ HRESULT SymbolReader::LoadSymbolsForWindowsPDB(___in IMetaDataImport* pMD, ___in size_t lastSlash = diasymreaderPath.rfind(DIRECTORY_SEPARATOR_CHAR_A); if (lastSlash == std::string::npos) { - ExtErr("Error: Failed to parse sos module name\n"); + ExtErr("Error: Failed to parse SOS module name\n"); return E_FAIL; } diasymreaderPath.erase(lastSlash + 1); @@ -1001,7 +1001,7 @@ HRESULT SymbolReader::LoadSymbolsForWindowsPDB(___in IMetaDataImport* pMD, ___in // We now need a binder object that will take the module and return a if (FAILED(Status = CreateInstanceFromPath(CLSID_CorSymBinder_SxS, IID_ISymUnmanagedBinder3, diasymreaderPath.c_str(), &g_hmoduleSymBinder, (void**)&g_pSymBinder))) { - ExtOut("SOS error: Unable to find the diasymreader module/interface %08x at %s\n", Status, diasymreaderPath.c_str()); + ExtDbgOut("SOS error: Unable to find the diasymreader module/interface %08x at %s\n", Status, diasymreaderPath.c_str()); return Status; } OnUnloadTask::Register(CleanupSymBinder); diff --git a/src/SOS/Strike/util.h b/src/SOS/Strike/util.h index 28b6cccda1..6c2fde13e0 100644 --- a/src/SOS/Strike/util.h +++ b/src/SOS/Strike/util.h @@ -97,9 +97,7 @@ DECLARE_HANDLE(OBJECTHANDLE); #elif defined(_ARM_) #define NATIVE_SYMBOL_READER_DLL "Microsoft.DiaSymReader.Native.arm.dll" #elif defined(_ARM64_) -// Use diasymreader until the package has an arm64 version - issue #7360 -//#define NATIVE_SYMBOL_READER_DLL "Microsoft.DiaSymReader.Native.arm64.dll" -#define NATIVE_SYMBOL_READER_DLL "diasymreader.dll" +#define NATIVE_SYMBOL_READER_DLL "Microsoft.DiaSymReader.Native.arm64.dll" #endif // PREFIX macros - Begin