Added SOS binaries to dotnet-sos tool package.
Automatically search for installed .NET Core runtime.
Create a symlink to the DAC in a temp directory where libcoreclrtraceptprovider.so
doesn't exist so it doesn't get loaded by the DAC causing a LTTng-UST exception. To
workaround issue #https://github.com/dotnet/coreclr/issues/20205.
Add temporary file clean up on SOS exit for both the above symlink
and the native symbol downloader code.
Fix various problems in the "clrstack -i" command that trash memory
and fail the tests that have been enabled in this change.
Update dotnet-sos package files.
Update to 2.1.503 SDK/2.1.7 runtime.
Test against 2.2 instead of 2.0
Merge "Fix SOS GCInfo for Arm/Arm64" PR #22188 from coreclr SOS.
Push test logs on public ci
(lldb) setsymbolserver -ms
+Before executing the "bt" command to dump native frames to load the native symbols (for live debugging only):
+
+ (lldb) loadsymbols
+
## Useful Links
* [The LLDB Debugger](http://lldb.llvm.org/index.html) - More information about lldb.
## Build Status
-[](https://dnceng.visualstudio.com/public/_build/latest?definitionId=72&branchName=master)
+[](https://dnceng.visualstudio.com/public/_build/latest?definitionId=72&branchName=master)
[//]: # (End current test results)
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "gcdump", "src\SOS\gcdump\gcdump.vcxproj", "{20EBC3C4-917C-402D-B778-9A6E3742BF5A}"
EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SOS.InstallHelper", "src\SOS\SOS.InstallHelper\SOS.InstallHelper.csproj", "{1F012743-941B-4915-8C55-02097894CF3F}"
+EndProject
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "dotnet-sos", "src\Tools\dotnet-sos\dotnet-sos.csproj", "{41351955-16D5-48D7-AF4C-AF25F5FB2E78}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Checked|Any CPU = Checked|Any CPU
{20EBC3C4-917C-402D-B778-9A6E3742BF5A}.RelWithDebInfo|x64.ActiveCfg = RelWithDebInfo|x64
{20EBC3C4-917C-402D-B778-9A6E3742BF5A}.RelWithDebInfo|x64.Build.0 = RelWithDebInfo|x64
{20EBC3C4-917C-402D-B778-9A6E3742BF5A}.RelWithDebInfo|x86.ActiveCfg = RelWithDebInfo|x64
+ {1F012743-941B-4915-8C55-02097894CF3F}.Checked|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Checked|Any CPU.Build.0 = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Checked|ARM.ActiveCfg = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Checked|ARM.Build.0 = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Checked|ARM64.ActiveCfg = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Checked|ARM64.Build.0 = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Checked|x64.ActiveCfg = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Checked|x64.Build.0 = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Checked|x86.ActiveCfg = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Checked|x86.Build.0 = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Debug|ARM.Build.0 = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Debug|x64.Build.0 = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Debug|x86.Build.0 = Debug|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Release|ARM.ActiveCfg = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Release|ARM.Build.0 = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Release|ARM64.Build.0 = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Release|x64.ActiveCfg = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Release|x64.Build.0 = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Release|x86.ActiveCfg = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.Release|x86.Build.0 = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.RelWithDebInfo|ARM.ActiveCfg = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.RelWithDebInfo|ARM.Build.0 = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.RelWithDebInfo|ARM64.ActiveCfg = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.RelWithDebInfo|ARM64.Build.0 = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
+ {1F012743-941B-4915-8C55-02097894CF3F}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Checked|Any CPU.ActiveCfg = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Checked|Any CPU.Build.0 = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Checked|ARM.ActiveCfg = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Checked|ARM.Build.0 = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Checked|ARM64.ActiveCfg = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Checked|ARM64.Build.0 = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Checked|x64.ActiveCfg = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Checked|x64.Build.0 = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Checked|x86.ActiveCfg = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Checked|x86.Build.0 = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Debug|ARM.ActiveCfg = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Debug|ARM.Build.0 = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Debug|ARM64.ActiveCfg = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Debug|ARM64.Build.0 = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Debug|x64.Build.0 = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Debug|x86.Build.0 = Debug|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Release|Any CPU.Build.0 = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Release|ARM.ActiveCfg = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Release|ARM.Build.0 = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Release|ARM64.ActiveCfg = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Release|ARM64.Build.0 = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Release|x64.ActiveCfg = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Release|x64.Build.0 = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Release|x86.ActiveCfg = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.Release|x86.Build.0 = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.RelWithDebInfo|ARM.ActiveCfg = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.RelWithDebInfo|ARM.Build.0 = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.RelWithDebInfo|ARM64.ActiveCfg = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.RelWithDebInfo|ARM64.Build.0 = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
{A9A7C879-C320-3327-BB84-16E1322E17AE} = {41638A4C-0DAF-47ED-A774-ECBBAC0315D7}
{6A94C5FE-8706-3505-834E-DA16242F3864} = {41638A4C-0DAF-47ED-A774-ECBBAC0315D7}
{20EBC3C4-917C-402D-B778-9A6E3742BF5A} = {41638A4C-0DAF-47ED-A774-ECBBAC0315D7}
+ {1F012743-941B-4915-8C55-02097894CF3F} = {41638A4C-0DAF-47ED-A774-ECBBAC0315D7}
+ {41351955-16D5-48D7-AF4C-AF25F5FB2E78} = {B62728C8-1267-4043-B46F-5537BBAEC692}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {46465737-C938-44FC-BE1A-4CE139EBB5E0}
|**PrintException** [**-nested**] [**-lines**] [\<*Exception object address*>]<br /><br /> -or-<br /><br /> **PE** [**-nested**] [\<*Exception object address*>]|Displays and formats fields of any object derived from the <xref:System.Exception> class at the specified address. If you do not specify an address, the **PrintException** command displays the last exception thrown on the current thread.<br /><br /> The **-nested** option displays details about nested exception objects.<br /><br /> The **-lines** option displays source information, if available.<br /><br /> You can use this command to format and view the `_stackTrace` field, which is a binary array.|
|**SyncBlk** [**-all** | \<*syncblk number*>]|Displays the specified `SyncBlock` structure or all `SyncBlock` structures. If you do not pass any arguments, the **SyncBlk** command displays the `SyncBlock` structure corresponding to objects that are owned by a thread.<br /><br /> A `SyncBlock` structure is a container for extra information that does not need to be created for every object. It can hold COM interop data, hash codes, and locking information for thread-safe operations.|
|**SOSFlush**|Flushes an internal SOS cache.|
-|**SetSymbolServer** [**-ms**] [**-disable**] [**-log**] [**-cache** \<cache-path>] [**-loadsymbols**] [\<symbol-server-URL>]|Enables the symbol server downloading support.<br/><br/>The **-ms** option enables downloading from the public Microsoft symbol server.<br/><br/>The **-disable** option turns on the symbol download support.<br/><br/>The **-cache** \<cache-path> option specifies a symbol cache directory. The default is $HOME/.sos/symbolcache if not specified.<br/><br/>The **-log** option enables symbol download logging.<br/><br/>The **-loadsymbols** option attempts to download the native .NET Core symbols for the runtime.|
+|**SetSymbolServer** [**-ms**] [**-disable**] [**-log**] [**-cache** \<cache-path>] [**-loadsymbols**] [\<symbol-server-URL>]|Enables the symbol server downloading support.<br/><br/>The **-ms** option enables downloading from the public Microsoft symbol server.<br/><br/>The **-disable** option turns on the symbol download support.<br/><br/>The **-cache** \<cache-path> option specifies a symbol cache directory. The default is $HOME/.dotnet/symbolcache if not specified.<br/><br/>The **-log** option enables symbol download logging.<br/><br/>The **-loadsymbols** option attempts to download the native .NET Core symbols for the runtime.|
|**Token2EE** \<*module name*> \<*token*>|Turns the specified metadata token in the specified module into a `MethodTable` structure or `MethodDesc` structure.<br /><br /> You can pass `*` for the module name parameter to find what that token maps to in every loaded managed module. You can also pass the debugger's name for a module, such as `mscorlib` or `image00400000`.|
|**Threads** (**clrthreads**) [**-live**] [**-special**]|Displays all managed threads in the process.<br /><br /> The **Threads** command displays the debugger shorthand ID, the CLR thread ID, and the operating system thread ID. Additionally, the **Threads** command displays a Domain column that indicates the application domain in which a thread is executing, an APT column that displays the COM apartment mode, and an Exception column that displays the last exception thrown in the thread.<br /><br /> The **-live** option displays threads associated with a live thread.<br /><br /> The **-special** option displays all special threads created by the CLR. Special threads include garbage collection threads (in concurrent and server garbage collection), debugger helper threads, finalizer threads, <xref:System.AppDomain> unload threads, and thread pool timer threads.|
|**ThreadState \<** *State value field* **>**|Displays the state of the thread. The `value` parameter is the value of the `State` field in the **Threads** report output.|
echo %__MsgPrefix%Assertion failed: dotnet cli not found at path "%__DotNetCli%"
exit /b 1
)
-set __MSBuildPath=%__ProjectDir%\.dotnet\sdk\2.1.401\MSBuild.dll
+set __MSBuildPath=%__ProjectDir%\.dotnet\sdk\2.1.503\MSBuild.dll
if not exist "%__MSBuildPath%" (
echo %__MsgPrefix%Assertion failed: dotnet cli sdk not found at path "%__MSBuildPath%"
exit /b 1
)
-set __DotNetRuntimeVersion=2.1.3
+set __DotNetRuntimeVersion=2.1.7
REM =========================================================================================
REM ===
<MicrosoftWin32PrimitivesVersion>4.3.0</MicrosoftWin32PrimitivesVersion>
<!-- Other libs -->
- <MicrosoftSymbolStoreVersion>1.0.0-dev-63604-01</MicrosoftSymbolStoreVersion>
+ <MicrosoftSymbolStoreVersion>1.0.0-dev-63716-01</MicrosoftSymbolStoreVersion>
</PropertyGroup>
<PropertyGroup>
__PackagesBinDir=$__RootBinDir/packages/$__BuildType/Shipping
__ExtraCmakeArgs="-DCLR_MANAGED_BINARY_DIR=$__RootBinDir/bin -DCLR_BUILD_TYPE=$__BuildType"
__DotNetCli=$__ProjectRoot/.dotnet/dotnet
-__MSBuildPath=$__ProjectRoot/.dotnet/sdk/2.1.401/MSBuild.dll
-__DotNetRuntimeVersion=2.1.3
+__MSBuildPath=$__ProjectRoot/.dotnet/sdk/2.1.503/MSBuild.dll
+__DotNetRuntimeVersion=2.1.7
if [ ! -e $__DotNetCli ]; then
echo "dotnet cli not installed $__DotNetCli"
artifactName: $(_PhaseName)_$(Agent.JobName)
condition: and(succeeded(), ne(variables['_PublishArtifacts'], ''))
- - task: CopyFiles@2
- displayName: Gather Build Logs
- inputs:
- sourceFolder: '$(Build.SourcesDirectory)/artifacts'
- contents: '?(log|TestResults)/**'
- targetFolder: '$(Build.StagingDirectory)/BuildLogs'
- continueOnError: true
- condition: always()
+ - task: CopyFiles@2
+ displayName: Gather Build Logs
+ inputs:
+ sourceFolder: '$(Build.SourcesDirectory)/artifacts'
+ contents: '?(log|TestResults)/**'
+ targetFolder: '$(Build.StagingDirectory)/BuildLogs'
+ continueOnError: true
+ condition: always()
- - task: PublishBuildArtifacts@1
- displayName: Publish Logs to VSTS
- inputs:
- PathtoPublish: '$(Build.StagingDirectory)/BuildLogs'
- PublishLocation: Container
- ArtifactName: Logs_$(_PhaseName)_$(Agent.JobName)
- continueOnError: true
- condition: always()
+ - task: PublishBuildArtifacts@1
+ displayName: Publish Logs to VSTS
+ inputs:
+ PathtoPublish: '$(Build.StagingDirectory)/BuildLogs'
+ PublishLocation: Container
+ ArtifactName: Logs_$(_PhaseName)_$(Agent.JobName)
+ continueOnError: true
+ condition: always()
Set-StrictMode -Version Latest
$ErrorActionPreference="Stop"
-$RuntimeVersion11="1.1.9"
-$RuntimeVersion20="2.0.9"
+$RuntimeVersion11="1.1.10"
+$RuntimeVersion22="2.2.1"
$DailyTestText="true"
-# Install the other versions of .NET Core runtime we are going to test. 1.1.x, 2.0.x, 2.1.x (installed with the CLI)
+# Install the other versions of .NET Core runtime we are going to test. 1.1.x, 2.1.x (installed with the CLI), 2.2.x
# and latest. Only install the latest master for daily jobs and leave the RuntimeVersion* config properties blank.
if (!$DailyTest) {
$DailyTestText="false"
. $DotNetDir\dotnet-install.ps1 -Version $RuntimeVersion11 -Architecture $BuildArch -SkipNonVersionedFiles -Runtime dotnet -InstallDir $DotNetDir
- . $DotNetDir\dotnet-install.ps1 -Version $RuntimeVersion20 -Architecture $BuildArch -SkipNonVersionedFiles -Runtime dotnet -InstallDir $DotNetDir
+ . $DotNetDir\dotnet-install.ps1 -Version $RuntimeVersion22 -Architecture $BuildArch -SkipNonVersionedFiles -Runtime dotnet -InstallDir $DotNetDir
}
. $DotNetDir\dotnet-install.ps1 -Channel $Branch -Version latest -Architecture $BuildArch -SkipNonVersionedFiles -Runtime dotnet -InstallDir $DotNetDir
'<Configuration>
<DailyTest>' + $DailyTestText +'</DailyTest>
<RuntimeVersion11>' + $RuntimeVersion11 + '</RuntimeVersion11>
-<RuntimeVersion20>' + $RuntimeVersion20 + '</RuntimeVersion20>
<RuntimeVersion21>' + $RuntimeVersion21 + '</RuntimeVersion21>
+<RuntimeVersion22>' + $RuntimeVersion22 + '</RuntimeVersion22>
<RuntimeVersionLatest>' + $RuntimeVersionLatest + '</RuntimeVersionLatest>
</Configuration>' | Set-Content $ConfigFile
branch="master"
uncached_feed="https://dotnetcli.blob.core.windows.net/dotnet"
-runtime_version_11="1.1.9"
-runtime_version_20="2.0.9"
+runtime_version_11="1.1.10"
+runtime_version_22="2.2.1"
runtime_version_21=
while [ $# -ne 0 ]; do
daily_test_text="true"
-# Install the other versions of .NET Core runtime we are going to test. 1.1.x, 2.0.x, 2.1.x (installed with the CLI)
+# Install the other versions of .NET Core runtime we are going to test. 1.1.x, 2.1.x (installed with the CLI), 2.2.x
# and latest. Only install the latest master for daily jobs and leave the RuntimeVersion* config properties blank.
if [ $daily_test == 0 ]; then
daily_test_text="false"
bash "$dotnet_dir/dotnet-install.sh" --version "$runtime_version_11" --architecture "$build_arch" --skip-non-versioned-files --runtime dotnet --install-dir "$dotnet_dir"
- bash "$dotnet_dir/dotnet-install.sh" --version "$runtime_version_20" --architecture "$build_arch" --skip-non-versioned-files --runtime dotnet --install-dir "$dotnet_dir"
+ bash "$dotnet_dir/dotnet-install.sh" --version "$runtime_version_22" --architecture "$build_arch" --skip-non-versioned-files --runtime dotnet --install-dir "$dotnet_dir"
fi
bash "$dotnet_dir/dotnet-install.sh" --channel $branch --version latest --architecture "$build_arch" --skip-non-versioned-files --runtime dotnet --install-dir "$dotnet_dir"
echo "<Configuration>
<DailyTest>$daily_test_text</DailyTest>
<RuntimeVersion11>$runtime_version_11</RuntimeVersion11>
-<RuntimeVersion20>$runtime_version_20</RuntimeVersion20>
<RuntimeVersion21>$runtime_version_21</RuntimeVersion21>
+<RuntimeVersion22>$runtime_version_22</RuntimeVersion22>
<RuntimeVersionLatest>$runtime_version_latest</RuntimeVersionLatest>
</Configuration>" > $config_file
{
"tools": {
- "dotnet": "2.1.401"
+ "dotnet": "2.1.503"
},
"msbuild-sdks": {
"Microsoft.DotNet.Arcade.Sdk": "1.0.0-beta.18516.5"
<!--
Tools and packages produced by this repository support infrastructure and are not shipping on NuGet or via any other official channel.
-->
- <IsShipping>false</IsShipping>
+ <IsShipping>true</IsShipping>
<NoPackageAnalysis>true</NoPackageAnalysis>
</PropertyGroup>
<CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
</PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)' == 'net45'">
+ <PropertyGroup Condition="'$(TargetFramework)' == 'net461'">
<DebugType>full</DebugType>
</PropertyGroup>
- <PropertyGroup Condition="'$(TargetFramework)' != 'net45'">
+ <PropertyGroup Condition="'$(TargetFramework)' != 'net461'">
<DebugType>portable</DebugType>
</PropertyGroup>
</Project>
--- /dev/null
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Reflection;
+using System.Runtime.InteropServices;
+
+namespace SOS.InstallHelper
+{
+ /// <summary>
+ /// Functions to install and configure SOS from the package containing this code.
+ /// </summary>
+ public sealed class InstallHelper
+ {
+ /// <summary>
+ /// Well known location to install SOS. Defaults to $HOME/.dotnet/sos on xplat and %USERPROFILE%/.dotnet/sos on Windows.
+ /// </summary>
+ public string InstallLocation { get; set; }
+
+ /// <summary>
+ /// On Linux/MacOS, the location of the lldb ".lldbinit" file. Defaults to $HOME/.lldbinit.
+ /// </summary>
+ public string LLDBInitFile { get; set; }
+
+ /// <summary>
+ /// If true, enable the symbol server support when configuring lldb.
+ /// </summary>
+ public bool EnableSymbolServer { get; set; } = true;
+
+ /// <summary>
+ /// The source path from which SOS is installed. Default is OS/architecture (RID) named directory in the same directory as this assembly.
+ /// </summary>
+ public string SOSSourcePath { get; set; }
+
+ /// <summary>
+ /// Create an instance of the installer.
+ /// </summary>
+ /// <exception cref="PlatformNotSupportedException">unknown operating system</exception>
+ public InstallHelper()
+ {
+ string home = null;
+ string os = null;
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ home = Environment.GetEnvironmentVariable("USERPROFILE");
+ os = "win";
+ }
+ else
+ {
+ home = Environment.GetEnvironmentVariable("HOME");
+ LLDBInitFile = Path.Combine(home, ".lldbinit");
+
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX)) {
+ os = "osx";
+ }
+ else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux)) {
+ os = "linux";
+ }
+ }
+ if (os == null) {
+ throw new PlatformNotSupportedException($"Unsupported operating system {RuntimeInformation.OSDescription}");
+ }
+ Debug.Assert(!string.IsNullOrEmpty(home));
+ InstallLocation = Path.GetFullPath(Path.Combine(home, ".dotnet", "sos"));
+
+ string architecture = RuntimeInformation.OSArchitecture.ToString().ToLowerInvariant();
+ string rid = os + "-" + architecture;
+ SOSSourcePath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), rid);
+ }
+
+ /// <summary>
+ /// Install SOS to well known location (InstallLocation).
+ /// </summary>
+ /// <exception cref="ArgumentException"></exception>
+ /// <exception cref="PlatformNotSupportedException">SOS not found for OS/architecture</exception>
+ public void Install()
+ {
+ Debug.Assert(!string.IsNullOrEmpty(InstallLocation));
+ Debug.Assert(!string.IsNullOrEmpty(SOSSourcePath));
+ if (!Directory.Exists(SOSSourcePath)) {
+ throw new PlatformNotSupportedException($"Operating system or architecture not supported: installing from {SOSSourcePath}");
+ }
+ Directory.CreateDirectory(InstallLocation);
+ foreach (string file in Directory.EnumerateFiles(SOSSourcePath))
+ {
+ string destinationFile = Path.Combine(InstallLocation, Path.GetFileName(file));
+ File.Copy(file, destinationFile, overwrite: true);
+ }
+ }
+
+ /// <summary>
+ /// Uninstalls and removes the SOS configuration.
+ /// </summary>
+ public void Uninstall()
+ {
+ if (!string.IsNullOrEmpty(LLDBInitFile)) {
+ Configure(remove: true);
+ }
+ if (Directory.Exists(InstallLocation))
+ {
+ foreach (string file in Directory.EnumerateFiles(InstallLocation))
+ {
+ File.Delete(file);
+ }
+ Directory.Delete(InstallLocation);
+ }
+ }
+
+ const string InitFileStart = "#START - ADDED BY SOS INSTALLER";
+ const string InitFileEnd = "#END - ADDED BY SOS INSTALLER";
+
+ /// <summary>
+ /// Configure lldb to load SOS.
+ /// </summary>
+ /// <param name="remove">if true, remove the configuration from the init file</param>
+ /// <exception cref="ArgumentException"></exception>
+ public void Configure(bool remove = false)
+ {
+ if (string.IsNullOrEmpty(LLDBInitFile)) {
+ throw new ArgumentException("No lldb configuration file");
+ }
+
+ // Remove the start/end marker from an existing .lldbinit file
+ var lines = new List<string>();
+ if (File.Exists(LLDBInitFile))
+ {
+ bool markerFound = false;
+ foreach (string line in File.ReadAllLines(LLDBInitFile))
+ {
+ if (line.Contains(InitFileEnd)) {
+ markerFound = false;
+ continue;
+ }
+ if (!markerFound) {
+ if (line.Contains(InitFileStart)) {
+ markerFound = true;
+ continue;
+ }
+ lines.Add(line);
+ }
+ }
+ if (markerFound) {
+ throw new ArgumentException(".lldbinit file end marker not found");
+ }
+ }
+
+ // If configure (not remove), add the plugin load, etc. configuration between the start/end markers.
+ if (!remove)
+ {
+ lines.Add(InitFileStart);
+ string plugin = Path.Combine(InstallLocation, "libsosplugin");
+ string extension = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? ".dylib" : ".so";
+ lines.Add($"plugin load {plugin}{extension}");
+
+ if (EnableSymbolServer) {
+ lines.Add(string.Format("setsymbolserver -ms"));
+ }
+ lines.Add(InitFileEnd);
+ }
+
+ // If there is anything to write, write the lldb init file
+ if (lines.Count > 0) {
+ File.WriteAllLines(LLDBInitFile, lines.ToArray());
+ }
+ }
+ }
+}
\ No newline at end of file
--- /dev/null
+<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <TargetFramework>netstandard2.0</TargetFramework>
+ <AssemblyName>SOS.InstallHelper</AssemblyName>
+ <NoWarn>;1591;1701</NoWarn>
+ <Description>Diagnostic SOS Install Helper</Description>
+ <PackageReleaseNotes>$(Description)</PackageReleaseNotes>
+ <PackageTags>SOS</PackageTags>
+ <DebugSymbols>true</DebugSymbols>
+ </PropertyGroup>
+</Project>
<AssemblyName>SOS.NETCore</AssemblyName>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<NoWarn>;1591;1701</NoWarn>
- <IsPackable>true</IsPackable>
- <IsPublishable>true</IsPublishable>
<Description>.NET Core SOS</Description>
- <PackageId>SOS</PackageId>
- <PackageReleaseNotes>$(Description)</PackageReleaseNotes>
- <PackageTags>SOS</PackageTags>
- <IncludeBuildOutput>false</IncludeBuildOutput>
- <SOSNETCoreBinaries>$(ArtifactsBinDir)\SOS.NETCore\$(Configuration)\netcoreapp2.0\publish\*.dll</SOSNETCoreBinaries>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="System.Reflection.Metadata" Version="$(SystemReflectionMetadataVersion)" />
<PackageReference Include="Microsoft.SymbolStore" Version="$(MicrosoftSymbolStoreVersion)" />
</ItemGroup>
-
- <ItemGroup>
- <_PackageFiles Include="$(SOSNETCoreBinaries)">
- <BuildAction>None</BuildAction>
- <PackagePath>tools/win-x64</PackagePath>
- </_PackageFiles>
- <_PackageFiles Include="$(ArtifactsBinDir)\Windows_NT.x64.$(Configuration)\sos.dll">
- <BuildAction>None</BuildAction>
- <PackagePath>tools/win-x64</PackagePath>
- </_PackageFiles>
-
- <_PackageFiles Include="$(SOSNETCoreBinaries)">
- <BuildAction>None</BuildAction>
- <PackagePath>tools/win-x86</PackagePath>
- </_PackageFiles>
- <_PackageFiles Include="$(ArtifactsBinDir)\Windows_NT.x86.$(Configuration)\sos.dll">
- <BuildAction>None</BuildAction>
- <PackagePath>tools/win-x86</PackagePath>
- </_PackageFiles>
-
- <_PackageFiles Include="$(SOSNETCoreBinaries)">
- <BuildAction>None</BuildAction>
- <PackagePath>tools/linux-x64</PackagePath>
- </_PackageFiles>
- <_PackageFiles Include="$(ArtifactsBinDir)\Linux.x64.$(Configuration)\libsosplugin.so">
- <BuildAction>None</BuildAction>
- <PackagePath>tools/linux-x64</PackagePath>
- </_PackageFiles>
- <_PackageFiles Include="$(ArtifactsBinDir)\Linux.x64.$(Configuration)\libsos.so">
- <BuildAction>None</BuildAction>
- <PackagePath>tools/linux-x64</PackagePath>
- </_PackageFiles>
- <_PackageFiles Include="$(ArtifactsBinDir)\Linux.x64.$(Configuration)\sosdocsunix.txt">
- <BuildAction>None</BuildAction>
- <PackagePath>tools/linux-x64</PackagePath>
- </_PackageFiles>
-
- <_PackageFiles Include="$(SOSNETCoreBinaries)">
- <BuildAction>None</BuildAction>
- <PackagePath>tools/osx-x64</PackagePath>
- </_PackageFiles>
- <_PackageFiles Include="$(ArtifactsBinDir)\OSX.x64.$(Configuration)\libsosplugin.dylib">
- <BuildAction>None</BuildAction>
- <PackagePath>tools/osx-x64</PackagePath>
- </_PackageFiles>
- <_PackageFiles Include="$(ArtifactsBinDir)\OSX.x64.$(Configuration)\libsos.dylib">
- <BuildAction>None</BuildAction>
- <PackagePath>tools/osx-x64</PackagePath>
- </_PackageFiles>
- <_PackageFiles Include="$(ArtifactsBinDir)\OSX.x64.$(Configuration)\sosdocsunix.txt">
- <BuildAction>None</BuildAction>
- <PackagePath>tools/osx-x64</PackagePath>
- </_PackageFiles>
- </ItemGroup>
</Project>
static SymbolStore s_symbolStore = null;
static bool s_symbolCacheAdded = false;
- static string s_tempDirectory = null;
static ITracer s_tracer = null;
/// <summary>
return true;
}
+ /// <summary>
+ /// Displays the symbol server and cache configuration
+ /// </summary>
+ internal static void DisplaySymbolStore()
+ {
+ if (s_tracer != null)
+ {
+ SymbolStore symbolStore = s_symbolStore;
+ while (symbolStore != null)
+ {
+ if (symbolStore is CacheSymbolStore cache) {
+ s_tracer.WriteLine("Cache: {0}", cache.CacheDirectory);
+ }
+ else if (symbolStore is HttpSymbolStore http) {
+ s_tracer.WriteLine("Server: {0}", http.Uri);
+ }
+ else {
+ s_tracer.WriteLine("Unknown symbol store");
+ }
+ symbolStore = symbolStore.BackingStore;
+ }
+ }
+ }
+
/// <summary>
/// This function disables any symbol downloading support.
/// </summary>
/// <param name="address">module base address</param>
/// <param name="size">module size</param>
/// <param name="readMemory">read memory callback delegate</param>
- internal static void LoadNativeSymbols(SymbolFileCallback callback, IntPtr parameter, string moduleDirectory, string moduleFileName,
+ internal static void LoadNativeSymbols(SymbolFileCallback callback, IntPtr parameter, string tempDirectory, string moduleDirectory, string moduleFileName,
ulong address, int size, ReadMemoryDelegate readMemory)
{
if (s_symbolStore != null)
{
if (file != null)
{
- string downloadFileName = file.FileName;
-
- // If the downloaded doesn't already exists on disk in the cache, then write it to a temporary location.
- if (!File.Exists(downloadFileName))
+ try
{
- downloadFileName = Path.Combine(GetTempDirectory(), symbolFileName);
+ string downloadFileName = file.FileName;
- using (Stream destinationStream = File.OpenWrite(downloadFileName))
+ // If the downloaded doesn't already exists on disk in the cache, then write it to a temporary location.
+ if (!File.Exists(downloadFileName))
{
- file.Stream.CopyTo(destinationStream);
+ downloadFileName = Path.Combine(tempDirectory, symbolFileName);
+
+ using (Stream destinationStream = File.OpenWrite(downloadFileName)) {
+ file.Stream.CopyTo(destinationStream);
+ }
+ s_tracer.WriteLine("Downloaded symbol file {0}", key.FullPathName);
}
- s_tracer.WriteLine("Downloaded symbol file {0}", key.FullPathName);
+ s_tracer.Information("{0}: {1}", symbolFileName, downloadFileName);
+ callback(parameter, symbolFileName, downloadFileName);
+ }
+ catch (Exception ex) when (ex is UnauthorizedAccessException || ex is DirectoryNotFoundException)
+ {
+ s_tracer.Error("{0}", ex.Message);
}
- s_tracer.Information("{0}: {1}", symbolFileName, downloadFileName);
- callback(parameter, symbolFileName, downloadFileName);
}
}
}
Debug.Assert(codeViewEntry.MinorVersion == ImageDebugDirectory.PortablePDBMinorVersion);
SymbolStoreKey key = PortablePDBFileKeyGenerator.GetKey(pdbPath, data.Guid);
pdbStream = GetSymbolStoreFile(key)?.Stream;
+ if (pdbStream == null)
+ {
+ return null;
+ }
}
provider = MetadataReaderProvider.FromPortablePdbStream(pdbStream);
break;
default:
- return false;
+ // Directory path search (currently ignored)
+ break;
}
// Add the symbol stores to the chain
private static string GetDefaultSymbolCache()
{
- var sb = new StringBuilder();
-
- string environmentVar;
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
- {
- environmentVar = "ProgramData";
- }
- else
- {
- environmentVar = "HOME";
- }
- string userPath = Environment.GetEnvironmentVariable(environmentVar);
- sb.Append(userPath);
- sb.Append(Path.DirectorySeparatorChar);
-
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
- sb.Append("dbg");
- sb.Append(Path.DirectorySeparatorChar);
- sb.Append("sym");
+ return Path.Combine(Path.GetTempPath(), "SymbolCache");
}
else
{
- sb.Append(".dotnet");
- sb.Append(Path.DirectorySeparatorChar);
- sb.Append("symbolcache");
+ return Path.Combine(Environment.GetEnvironmentVariable("HOME"), ".dotnet", "symbolcache");
}
- return sb.ToString();
}
/// <summary>
}
}
- /// <summary>
- /// Create/return a temporary directory.
- /// </summary>
- private static string GetTempDirectory()
- {
- if (s_tempDirectory == null)
- {
- s_tempDirectory = Path.Combine(Path.GetTempPath(), Path.GetRandomFileName());
- Directory.CreateDirectory(s_tempDirectory);
- }
- return s_tempDirectory;
- }
-
/// <summary>
/// Quick fix for Path.GetFileName which incorrectly handles Windows-style paths on Linux
/// </summary>
-// Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
using System;
<RuntimeFrameworkVersion>$(RuntimeVersionLatest)</RuntimeFrameworkVersion>
</Option>
<Option Condition="'$(DailyTest)' != 'true'">
- <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion21)</BuildProjectMicrosoftNetCoreAppVersion>
+ <!-- Build the debuggee for 2.1 but run it on 2.2 -->
<BuildProjectFramework>netcoreapp2.1</BuildProjectFramework>
- <RuntimeFrameworkVersion>$(RuntimeVersion21)</RuntimeFrameworkVersion>
+ <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion22)</BuildProjectMicrosoftNetCoreAppVersion>
+ <RuntimeFrameworkVersion>$(RuntimeVersion22)</RuntimeFrameworkVersion>
</Option>
<Option Condition="'$(DailyTest)' != 'true'">
- <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion20)</BuildProjectMicrosoftNetCoreAppVersion>
- <BuildProjectFramework>netcoreapp2.0</BuildProjectFramework>
- <RuntimeFrameworkVersion>$(RuntimeVersion20)</RuntimeFrameworkVersion>
+ <BuildProjectFramework>netcoreapp2.1</BuildProjectFramework>
+ <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion21)</BuildProjectMicrosoftNetCoreAppVersion>
+ <RuntimeFrameworkVersion>$(RuntimeVersion21)</RuntimeFrameworkVersion>
</Option>
<Option Condition="Exists('$(RepoRootDir)/.dotnet/shared/Microsoft.NETCore.App/$(RuntimeVersion11)')">
- <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion11)</BuildProjectMicrosoftNetCoreAppVersion>
<BuildProjectFramework>netcoreapp1.1</BuildProjectFramework>
+ <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion11)</BuildProjectMicrosoftNetCoreAppVersion>
<RuntimeFrameworkVersion>$(RuntimeVersion11)</RuntimeFrameworkVersion>
<!-- createdump doesn't exists in 1.1 -->
<GenerateDumpWithGDB>true</GenerateDumpWithGDB>
<!-- SOS needs at least 2.0 to run. The default without this is to use the runtime being debuggged to host SOS.NETCore -->
- <SOSHostRuntime>$(RepoRootDir)/.dotnet/shared/Microsoft.NETCore.App/$(RuntimeVersion20)</SOSHostRuntime>
+ <SOSHostRuntime>$(RepoRootDir)/.dotnet/shared/Microsoft.NETCore.App/$(RuntimeVersion21)</SOSHostRuntime>
</Option>
</Options>
<Options>
<Option>
<!-- Build the debuggee for 2.1 but run it on latest -->
- <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion21)</BuildProjectMicrosoftNetCoreAppVersion>
<BuildProjectFramework>netcoreapp2.1</BuildProjectFramework>
+ <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion21)</BuildProjectMicrosoftNetCoreAppVersion>
<RuntimeFrameworkVersion>$(RuntimeVersionLatest)</RuntimeFrameworkVersion>
</Option>
<Option Condition="'$(DailyTest)' != 'true'">
- <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion21)</BuildProjectMicrosoftNetCoreAppVersion>
+ <!-- Build the debuggee for 2.1 but run it on 2.2 -->
<BuildProjectFramework>netcoreapp2.1</BuildProjectFramework>
- <RuntimeFrameworkVersion>$(RuntimeVersion21)</RuntimeFrameworkVersion>
+ <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion22)</BuildProjectMicrosoftNetCoreAppVersion>
+ <RuntimeFrameworkVersion>$(RuntimeVersion22)</RuntimeFrameworkVersion>
</Option>
<Option Condition="'$(DailyTest)' != 'true'">
- <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion20)</BuildProjectMicrosoftNetCoreAppVersion>
- <BuildProjectFramework>netcoreapp2.0</BuildProjectFramework>
- <RuntimeFrameworkVersion>$(RuntimeVersion20)</RuntimeFrameworkVersion>
+ <BuildProjectFramework>netcoreapp2.1</BuildProjectFramework>
+ <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion21)</BuildProjectMicrosoftNetCoreAppVersion>
+ <RuntimeFrameworkVersion>$(RuntimeVersion21)</RuntimeFrameworkVersion>
</Option>
<Option Condition="'$(DailyTest)' != 'true'">
- <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion11)</BuildProjectMicrosoftNetCoreAppVersion>
<BuildProjectFramework>netcoreapp1.1</BuildProjectFramework>
+ <BuildProjectMicrosoftNetCoreAppVersion>$(RuntimeVersion11)</BuildProjectMicrosoftNetCoreAppVersion>
<RuntimeFrameworkVersion>$(RuntimeVersion11)</RuntimeFrameworkVersion>
<!-- SOS needs at least 2.0 to run. The default without this is to use the runtime being debuggged to host SOS.NETCore -->
- <SOSHostRuntime>$(RepoRootDir)\.dotnet\shared\Microsoft.NETCore.App\$(RuntimeVersion20)</SOSHostRuntime>
+ <SOSHostRuntime>$(RepoRootDir)\.dotnet\shared\Microsoft.NETCore.App\$(RuntimeVersion21)</SOSHostRuntime>
</Option>
</Options>
<HostExe>$(RepoRootDir)\.dotnet\dotnet.exe</HostExe>
ENDIF:LIVE
# Verify that ClrStack with no options works
+SOSCOMMAND:SetSymbolServer -ms
+SOSCOMMAND:SetHostRuntime
SOSCOMMAND:ClrStack
VERIFY:.*OS Thread Id:\s+0x<HEXVAL>\s+.*
VERIFY:\s+Child\s+SP\s+IP\s+Call Site\s+
VERIFY:\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.Program\.Foo2\(.*\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 29\]\s*
VERIFY:\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.Program\.Foo1\(.*\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 24\]\s*
VERIFY:\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.Program\.Main\(.*\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 19\]\s*
+SOSCOMMAND:SetSymbolServer -disable
# Verify that ClrStack with managed/native mixed works
IFDEF:PROJECTK
VERIFY:.*\s+<HEXVAL>\s+<HEXVAL>\s+SymbolTestApp\.Program\.Main\(.*\)\s+\[(?i:.*[\\|/]SymbolTestApp\.cs) @ 19\]\s*
ENDIF:PROJECTK
-# Disable ClrStack -i until coreclr issue #17259
-IFDEF:DESKTOP
-
# Verify that ClrStack with the ICorDebug options works
SOSCOMMAND:ClrStack -i
IFDEF:PROJECTK
VERIFY:.*\s+Stack walk complete.\s+
ENDIF:PROJECTK
-ENDIF:DESKTOP
-
# Verify DumpStackObjects works
IFDEF:PROJECTK
SOSCOMMAND:DumpStackObjects
# 2) Verifying that ClrStack with managed/native mixed works
IFDEF:PROJECTK
+SOSCOMMAND:SetSymbolServer -ms -loadsymbols
+SOSCOMMAND:SetHostRuntime
SOSCOMMAND:ClrStack -f
VERIFY:.*OS Thread Id:\s+0x<HEXVAL>\s+.*
VERIFY:\s+Child\s+SP\s+IP\s+Call Site\s+
IFDEF:64BIT
VERIFY:.*\s+<HEXVAL>\s+<HEXVAL>\s+(?i:NestedExceptionTest.*)!NestedExceptionTest\.Program\.Main\(.*\)\s+\+\s+<DECVAL>\s+\[(?i:.*[\\|/]NestedExceptionTest\.cs) @ 13\s*\]\s+
ENDIF:64BIT
+SOSCOMMAND:SetSymbolServer -disable
ENDIF:PROJECTK
# 3) Verifying that ClrStack all option works (locals/params)
ENDIF:64BIT
ENDIF:PROJECTK
-# Disable ClrStack -i until coreclr issue #17259
-IFDEF:DESKTOP
-
# 5) Verifying that ClrStack with the ICorDebug options works
SOSCOMMAND:ClrStack -i
VERIFY:.*\s+Dumping managed stack and managed variables using ICorDebug.\s+
VERIFY:.*\s+Stack walk complete.\s+
ENDIF:PROJECTK
-ENDIF:DESKTOP
-
# 7) Verify DumpStackObjects works
IFDEF:PROJECTK
SOSCOMMAND:DumpStackObjects
#define VER_PRODUCTVERSION_W (0x0100)
+extern void SOSShutdown();
+
//
// globals
//
ExtRelease();
OnUnloadTask::Register(CleanupEventCallbacks);
+ OnUnloadTask::Register(SOSShutdown);
g_pCallbacksClient = DebugClient;
EventCallbacks* pCallbacksObj = new EventCallbacks(DebugClient);
IDebugEventCallbacks* pCallbacks = NULL;
LPCSTR g_hostRuntimeDirectory = nullptr;
LPCSTR g_dacFilePath = nullptr;
LPCSTR g_dbiFilePath = nullptr;
+LPCSTR g_tmpPath = nullptr;
SOSNetCoreCallbacks g_SOSNetCoreCallbacks;
#ifdef FEATURE_PAL
#define TPALIST_SEPARATOR_STR_A ";"
#endif
-void AddFilesFromDirectoryToTpaList(const char* directory, std::string& tpaList)
+//
+// Build the TPA list of assemblies for the runtime hosting api.
+//
+static void AddFilesFromDirectoryToTpaList(const char* directory, std::string& tpaList)
{
const char * const tpaExtensions[] = {
"*.ni.dll", // Probe for .ni.dll first so that it's preferred if ni and il coexist in the same dir
{
do
{
- if (!(data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY))
+ if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
{
-
std::string filename(data.cFileName);
size_t extPos = filename.length() - extLength;
std::string filenameWithoutExt(filename.substr(0, extPos));
#define symlinkEntrypointExecutable "/proc/curproc/exe"
#endif
-bool GetAbsolutePath(const char* path, std::string& absolutePath)
+static bool GetAbsolutePath(const char* path, std::string& absolutePath)
{
bool result = false;
return result;
}
-bool GetEntrypointExecutableAbsolutePath(std::string& entrypointExecutable)
+static bool GetEntrypointExecutableAbsolutePath(std::string& entrypointExecutable)
{
bool result = false;
#else // FEATURE_PAL
-bool GetEntrypointExecutableAbsolutePath(std::string& entrypointExecutable)
+static bool GetEntrypointExecutableAbsolutePath(std::string& entrypointExecutable)
{
ArrayHolder<char> hostPath = new char[MAX_LONGPATH+1];
if (::GetModuleFileName(NULL, hostPath, MAX_LONGPATH) == 0)
#endif // FEATURE_PAL
+/**********************************************************************\
+ * Returns the coreclr module/runtime directory of the target.
+\**********************************************************************/
HRESULT GetCoreClrDirectory(std::string& coreClrDirectory)
{
#ifdef FEATURE_PAL
return S_OK;
}
+//
+// Searches the runtime directory for a .NET Core runtime version
+//
+static bool FindDotNetVersion(int majorFilter, int minorFilter, std::string& hostRuntimeDirectory)
+{
+ std::string directory(hostRuntimeDirectory);
+ directory.append("*");
+ std::string versionFound;
+
+ WIN32_FIND_DATAA data;
+ HANDLE findHandle = FindFirstFileA(directory.c_str(), &data);
+
+ if (findHandle != INVALID_HANDLE_VALUE)
+ {
+ int highestRevision = 0;
+ do
+ {
+ if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
+ {
+ int major = 0;
+ int minor = 0;
+ int revision = 0;
+ if (sscanf_s(data.cFileName, "%d.%d.%d", &major, &minor, &revision) == 3)
+ {
+ if (major == majorFilter && minor == minorFilter)
+ {
+ if (revision >= highestRevision)
+ {
+ highestRevision = revision;
+ versionFound.assign(data.cFileName);
+ }
+ }
+ }
+ }
+ }
+ while (0 != FindNextFileA(findHandle, &data));
+
+ FindClose(findHandle);
+ }
+
+ if (versionFound.length() > 0)
+ {
+ hostRuntimeDirectory.append(versionFound);
+ return true;
+ }
+
+ return false;
+}
+
+#ifdef FEATURE_PAL
+const char *g_linuxPaths[] = {
+// "/rh-dotnet22/root/usr/bin/dotnet/shared/Microsoft.NETCore.App",
+ "/rh-dotnet21/root/usr/bin/dotnet/shared/Microsoft.NETCore.App",
+ "/rh-dotnet20/root/usr/bin/dotnet/shared/Microsoft.NETCore.App",
+ "/usr/share/dotnet/shared/Microsoft.NETCore.App",
+};
+#endif
+
+/**********************************************************************\
+ * Returns the path to the coreclr to use for hosting and it's
+ * directory. Attempts to use the best installed version of the
+ * runtime, otherwise it defaults to the target's runtime version.
+\**********************************************************************/
HRESULT GetHostRuntime(std::string& coreClrPath, std::string& hostRuntimeDirectory)
{
// If the hosting runtime isn't already set, use the runtime we are debugging
if (g_hostRuntimeDirectory == nullptr)
{
- HRESULT hr = GetCoreClrDirectory(hostRuntimeDirectory);
- if (FAILED(hr))
+#ifdef FEATURE_PAL
+#if defined(__APPLE__)
+ hostRuntimeDirectory.assign("/usr/local/share/dotnet/shared/Microsoft.NETCore.App");
+#elif defined (__FreeBSD__) || defined(__NetBSD__)
+ ExtErr("FreeBSD or NetBSD not supported\n");
+ return E_FAIL;
+#else
+ // Start with the possible RHEL's locations, then the regular Linux path
+ for (int i = 0; i < _countof(g_linuxPaths); i++)
+ {
+ hostRuntimeDirectory.assign(g_linuxPaths[i]);
+ if (access(hostRuntimeDirectory.c_str(), F_OK) == 0)
+ {
+ break;
+ }
+ }
+#endif
+#else
+ ArrayHolder<CHAR> programFiles = new CHAR[MAX_LONGPATH];
+ if (GetEnvironmentVariableA("PROGRAMFILES", programFiles, MAX_LONGPATH) == 0)
{
- return hr;
+ ExtErr("PROGRAMFILES environment variable not found\n");
+ return E_FAIL;
}
+ hostRuntimeDirectory.assign(programFiles);
+ hostRuntimeDirectory.append("\\dotnet\\shared\\Microsoft.NETCore.App");
+#endif
+ hostRuntimeDirectory.append(DIRECTORY_SEPARATOR_STR_A);
+
+ // First attempt find the highest 2.1.x version. We want to start with the LTS
+ // and only use the higher versions if it isn't installed.
+ if (!FindDotNetVersion(2, 1, hostRuntimeDirectory))
+ {
+ // Find highest 2.2.x version
+ if (!FindDotNetVersion(2, 2, hostRuntimeDirectory))
+ {
+ // Find highest 3.0.x version
+ if (!FindDotNetVersion(3, 0, hostRuntimeDirectory))
+ {
+ // If an installed runtime can not be found, use the target coreclr version
+ HRESULT hr = GetCoreClrDirectory(hostRuntimeDirectory);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+ }
+ }
+ }
+
+ // Save away the runtime version we are going to use to host the SOS managed code
g_hostRuntimeDirectory = _strdup(hostRuntimeDirectory.c_str());
}
hostRuntimeDirectory.assign(g_hostRuntimeDirectory);
return S_OK;
}
+//
+// Returns the unique temporary directory for this instnace of SOS
+//
+static LPCSTR GetTempDirectory()
+{
+ if (g_tmpPath == nullptr)
+ {
+ char tmpPath[MAX_LONGPATH];
+ if (::GetTempPathA(MAX_LONGPATH, tmpPath) == 0)
+ {
+ strcpy_s(tmpPath, MAX_LONGPATH, ".");
+ strcat_s(tmpPath, MAX_LONGPATH, DIRECTORY_SEPARATOR_STR_A);
+ }
+ char pidstr[128];
+ sprintf_s(pidstr, _countof(pidstr), "%d", GetCurrentProcessId());
+ strcat_s(tmpPath, MAX_LONGPATH, pidstr);
+ strcat_s(tmpPath, MAX_LONGPATH, DIRECTORY_SEPARATOR_STR_A);
+
+ CreateDirectoryA(tmpPath, NULL);
+ g_tmpPath = _strdup(tmpPath);
+ }
+ return g_tmpPath;
+}
+
+/**********************************************************************\
+ * Clean up the temporary directory files and DAC symlink.
+\**********************************************************************/
+#ifdef FEATURE_PAL
+__attribute__((destructor))
+#endif
+void SOSShutdown()
+{
+ LPCSTR tmpPath = (LPCSTR)InterlockedExchangePointer((PVOID *)&g_tmpPath, nullptr);
+ if (tmpPath != nullptr)
+ {
+ std::string directory(tmpPath);
+ directory.append("*");
+
+ WIN32_FIND_DATAA data;
+ HANDLE findHandle = FindFirstFileA(directory.c_str(), &data);
+
+ if (findHandle != INVALID_HANDLE_VALUE)
+ {
+ do
+ {
+ if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
+ {
+ std::string file(tmpPath);
+ file.append(data.cFileName);
+ DeleteFileA(file.c_str());
+ }
+ }
+ while (0 != FindNextFileA(findHandle, &data));
+
+ FindClose(findHandle);
+ }
+
+ RemoveDirectoryA(tmpPath);
+ free((void*)tmpPath);
+ }
+}
+
+/**********************************************************************\
+ * Returns the DAC module path to the rest of SOS.
+\**********************************************************************/
LPCSTR GetDacFilePath()
{
// If the DAC path hasn't been set by the symbol download support, use the one in the runtime directory.
#ifdef FEATURE_PAL
// if DAC file exists
if (access(dacModulePath.c_str(), F_OK) == 0)
+#endif
+ {
+#if defined(__linux__)
+ // We are creating a symlink to the DAC in a temp directory
+ // where libcoreclrtraceptprovider.so doesn't exist so it
+ // doesn't get loaded by the DAC causing a LTTng-UST exception.
+ //
+ // Issue #https://github.com/dotnet/coreclr/issues/20205
+ LPCSTR tmpPath = GetTempDirectory();
+ if (tmpPath != nullptr)
+ {
+ std::string dacSymLink(tmpPath);
+ dacSymLink.append(MAKEDLLNAME_A("mscordaccore"));
+
+ int error = symlink(dacModulePath.c_str(), dacSymLink.c_str());
+ if (error == 0)
+ {
+ dacModulePath.assign(dacSymLink);
+ }
+ else
+ {
+ ExtErr("symlink(%s, %s) FAILED %s\n", dacModulePath.c_str(), dacSymLink.c_str(), strerror(errno));
+ }
+ }
#endif
g_dacFilePath = _strdup(dacModulePath.c_str());
+ }
}
}
return g_dacFilePath;
}
+/**********************************************************************\
+ * Returns the DBI module path to the rest of SOS.
+\**********************************************************************/
LPCSTR GetDbiFilePath()
{
if (g_dbiFilePath == nullptr)
return g_dbiFilePath;
}
+/**********************************************************************\
+ * Returns true if the host runtime has already been initialized.
+\**********************************************************************/
BOOL IsHostingInitialized()
{
return g_hostingInitialized;
}
+/**********************************************************************\
+ * Initializes the host coreclr runtime and gets the managed entry
+ * points delegates.
+\**********************************************************************/
HRESULT InitializeHosting()
{
if (g_hostingInitialized)
}
IfFailRet(createDelegate(hostHandle, domainId, SymbolReaderDllName, SymbolReaderClassName, "InitializeSymbolStore", (void **)&g_SOSNetCoreCallbacks.InitializeSymbolStoreDelegate));
+ IfFailRet(createDelegate(hostHandle, domainId, SymbolReaderDllName, SymbolReaderClassName, "DisplaySymbolStore", (void **)&g_SOSNetCoreCallbacks.DisplaySymbolStoreDelegate));
IfFailRet(createDelegate(hostHandle, domainId, SymbolReaderDllName, SymbolReaderClassName, "DisableSymbolStore", (void **)&g_SOSNetCoreCallbacks.DisableSymbolStoreDelegate));
IfFailRet(createDelegate(hostHandle, domainId, SymbolReaderDllName, SymbolReaderClassName, "LoadNativeSymbols", (void **)&g_SOSNetCoreCallbacks.LoadNativeSymbolsDelegate));
IfFailRet(createDelegate(hostHandle, domainId, SymbolReaderDllName, SymbolReaderClassName, "LoadSymbolsForModule", (void **)&g_SOSNetCoreCallbacks.LoadSymbolsForModuleDelegate));
return Status;
}
+/**********************************************************************\
+ * Public entry point to set the managed callbacks (unused).
+\**********************************************************************/
extern "C" void InitializeSymbolReaderCallbacks(SOSNetCoreCallbacks sosNetCoreCallbacks)
{
g_SOSNetCoreCallbacks = sosNetCoreCallbacks;
}
//
-// Pass to managed helper code to read in-memory PEs/PDBs
+// Pass to managed helper code to read in-memory PEs/PDBs.
// Returns the number of bytes read.
//
static int ReadMemoryForSymbols(ULONG64 address, uint8_t *buffer, int cb)
#ifdef FEATURE_PAL
+//
+// Symbol downloader callback
+//
static void SymbolFileCallback(void* param, const char* moduleFileName, const char* symbolFileName)
{
if (strcmp(moduleFileName, MAIN_CLR_DLL_NAME_A) == 0) {
}
}
+//
+// Enumerate native module callback
+//
static void LoadNativeSymbolsCallback(void* param, const char* moduleDirectory, const char* moduleFileName, ULONG64 moduleAddress, int moduleSize)
{
_ASSERTE(g_hostingInitialized);
_ASSERTE(g_SOSNetCoreCallbacks.LoadNativeSymbolsDelegate != nullptr);
- g_SOSNetCoreCallbacks.LoadNativeSymbolsDelegate(SymbolFileCallback, param, moduleDirectory, moduleFileName, moduleAddress, moduleSize, ReadMemoryForSymbols);
+ g_SOSNetCoreCallbacks.LoadNativeSymbolsDelegate(SymbolFileCallback, param, GetTempDirectory(), moduleDirectory, moduleFileName, moduleAddress, moduleSize, ReadMemoryForSymbols);
}
#endif
+/**********************************************************************\
+ * Setup and initialize the symbol server support.
+\**********************************************************************/
HRESULT InitializeSymbolStore(BOOL logging, BOOL msdl, BOOL symweb, const char* symbolServer, const char* cacheDirectory)
{
HRESULT Status = S_OK;
return S_OK;
}
+/**********************************************************************\
+ * Enumerate the native modules and attempt to download the symbols
+ * for them. Depends on the lldb callback to enumerate modules. Not
+ * necessary on dbgeng because it already downloads native symbols.
+\**********************************************************************/
HRESULT LoadNativeSymbols()
{
HRESULT Status = S_OK;
return Status;
}
+/**********************************************************************\
+ * Displays the symbol server and cache status.
+\**********************************************************************/
+void DisplaySymbolStore()
+{
+ if (g_symbolStoreInitialized)
+ {
+ _ASSERTE(g_SOSNetCoreCallbacks.DisplaySymbolStoreDelegate != nullptr);
+ g_SOSNetCoreCallbacks.DisplaySymbolStoreDelegate();
+ }
+}
+
+/**********************************************************************\
+ * Turns off the symbol server support.
+\**********************************************************************/
void DisableSymbolStore()
{
if (g_symbolStoreInitialized)
}
}
+/**********************************************************************\
+ * Load symbols for an ICorDebugModule. Used by "clrstack -i".
+\**********************************************************************/
HRESULT SymbolReader::LoadSymbols(___in IMetaDataImport* pMD, ___in ICorDebugModule* pModule)
{
HRESULT Status = S_OK;
+
BOOL isDynamic = FALSE;
- BOOL isInMemory = FALSE;
IfFailRet(pModule->IsDynamic(&isDynamic));
- IfFailRet(pModule->IsInMemory(&isInMemory));
-
if (isDynamic)
{
// Dynamic and in memory assemblies are a special case which we will ignore for now
}
ULONG64 peAddress = 0;
- ULONG32 peSize = 0;
IfFailRet(pModule->GetBaseAddress(&peAddress));
- IfFailRet(pModule->GetSize(&peSize));
- ULONG32 len = 0;
- WCHAR moduleName[MAX_LONGPATH];
- IfFailRet(pModule->GetName(_countof(moduleName), &len, moduleName));
+ IXCLRDataModule* pClrModule;
+ IfFailRet(GetModuleFromAddress(peAddress, &pClrModule));
-#ifndef FEATURE_PAL
- if (SUCCEEDED(LoadSymbolsForWindowsPDB(pMD, peAddress, moduleName, isInMemory)))
- {
- return S_OK;
- }
-#endif // FEATURE_PAL
- return LoadSymbolsForPortablePDB(moduleName, isInMemory, isInMemory, peAddress, peSize, 0, 0);
+ return LoadSymbols(pMD, pClrModule);
}
+/**********************************************************************\
+ * Load symbols for a module.
+\**********************************************************************/
HRESULT SymbolReader::LoadSymbols(___in IMetaDataImport* pMD, ___in IXCLRDataModule* pModule)
{
ULONG32 flags;
#ifndef FEATURE_PAL
+/**********************************************************************\
+ * Attempts to load Windows PDBs on Windows.
+\**********************************************************************/
HRESULT SymbolReader::LoadSymbolsForWindowsPDB(___in IMetaDataImport* pMD, ___in ULONG64 peAddress, __in_z WCHAR* pModuleName, ___in BOOL isFileLayout)
{
HRESULT Status = S_OK;
IfFailRet(CoInitialize(NULL));
// We now need a binder object that will take the module and return a
- // reader object
ToRelease<ISymUnmanagedBinder3> pSymBinder;
if (FAILED(Status = CreateInstanceCustom(CLSID_CorSymBinder_SxS,
IID_ISymUnmanagedBinder3,
#endif // FEATURE_PAL
+/**********************************************************************\
+ * Attempts to load a portable or embeded PDB. Both Windows and xplat.
+\**********************************************************************/
HRESULT SymbolReader::LoadSymbolsForPortablePDB(__in_z WCHAR* pModuleName, ___in BOOL isInMemory, ___in BOOL isFileLayout,
___in ULONG64 peAddress, ___in ULONG64 peSize, ___in ULONG64 inMemoryPdbAddress, ___in ULONG64 inMemoryPdbSize)
{
return Status;
}
+/**********************************************************************\
+ * Return the source/line number info for method/il offset.
+\**********************************************************************/
HRESULT SymbolReader::GetLineByILOffset(___in mdMethodDef methodToken, ___in ULONG64 ilOffset,
___out ULONG *pLinenum, __out_ecount(cchFileName) WCHAR* pwszFileName, ___in ULONG cchFileName)
{
return E_FAIL;
}
+/**********************************************************************\
+ * Returns the name of the local variable from a PDB.
+\**********************************************************************/
HRESULT SymbolReader::GetNamedLocalVariable(___in ICorDebugFrame * pFrame, ___in ULONG localIndex, __out_ecount(paramNameLen) WCHAR* paramName,
___in ULONG paramNameLen, ___out ICorDebugValue** ppValue)
{
return GetNamedLocalVariable(NULL, pILFrame, methodDef, localIndex, paramName, paramNameLen, ppValue);
}
-HRESULT SymbolReader::ResolveSequencePoint(__in_z WCHAR* pFilename, ___in ULONG32 lineNumber, ___in TADDR mod, ___out mdMethodDef* pToken, ___out ULONG32* pIlOffset)
+/**********************************************************************\
+ * Returns the sequence point to bind breakpoints.
+\**********************************************************************/
+HRESULT SymbolReader::ResolveSequencePoint(__in_z WCHAR* pFilename, ___in ULONG32 lineNumber, ___out mdMethodDef* pToken, ___out ULONG32* pIlOffset)
{
HRESULT Status = S_OK;
typedef void (*SymbolFileCallbackDelegate)(void*, const char* moduleFileName, const char* symbolFileName);
typedef BOOL (*InitializeSymbolStoreDelegate)(BOOL, BOOL, BOOL, const char*, const char*, const char*);
+typedef void (*DisplaySymbolStoreDelegate)();
typedef void (*DisableSymbolStoreDelegate)();
-typedef void (*LoadNativeSymbolsDelegate)(SymbolFileCallbackDelegate, void*, const char*, const char*, ULONG64, int, ReadMemoryDelegate);
+typedef void (*LoadNativeSymbolsDelegate)(SymbolFileCallbackDelegate, void*, const char*, const char*, const char*, ULONG64, int, ReadMemoryDelegate);
typedef PVOID (*LoadSymbolsForModuleDelegate)(const char*, BOOL, ULONG64, int, ULONG64, int, ReadMemoryDelegate);
typedef void (*DisposeDelegate)(PVOID);
typedef BOOL (*ResolveSequencePointDelegate)(PVOID, const char*, unsigned int, unsigned int*, unsigned int*);
struct SOSNetCoreCallbacks
{
InitializeSymbolStoreDelegate InitializeSymbolStoreDelegate;
+ DisplaySymbolStoreDelegate DisplaySymbolStoreDelegate;
DisableSymbolStoreDelegate DisableSymbolStoreDelegate;
LoadNativeSymbolsDelegate LoadNativeSymbolsDelegate;
LoadSymbolsForModuleDelegate LoadSymbolsForModuleDelegate;
extern HRESULT InitializeHosting();
extern HRESULT InitializeSymbolStore(BOOL logging, BOOL msdl, BOOL symweb, const char* symbolServer, const char* cacheDirectory);
extern HRESULT LoadNativeSymbols();
+extern void DisplaySymbolStore();
extern void DisableSymbolStore();
class SymbolReader
HRESULT LoadSymbols(___in IMetaDataImport* pMD, ___in IXCLRDataModule* pModule);
HRESULT GetLineByILOffset(___in mdMethodDef MethodToken, ___in ULONG64 IlOffset, ___out ULONG *pLinenum, __out_ecount(cchFileName) WCHAR* pwszFileName, ___in ULONG cchFileName);
HRESULT GetNamedLocalVariable(___in ICorDebugFrame * pFrame, ___in ULONG localIndex, __out_ecount(paramNameLen) WCHAR* paramName, ___in ULONG paramNameLen, ___out ICorDebugValue** ppValue);
- HRESULT ResolveSequencePoint(__in_z WCHAR* pFilename, ___in ULONG32 lineNumber, ___in TADDR mod, ___out mdMethodDef* ___out pToken, ___out ULONG32* pIlOffset);
+ HRESULT ResolveSequencePoint(__in_z WCHAR* pFilename, ___in ULONG32 lineNumber, ___out mdMethodDef* ___out pToken, ___out ULONG32* pIlOffset);
};
HRESULT
* *
\**********************************************************************/
// Caller should guard against exception
-// !!! mdName should have at least mdNameLen WCHAR
static HRESULT NameForTypeDef_s(mdTypeDef tkTypeDef, IMetaDataImport *pImport,
__out_ecount (capacity_mdName) WCHAR *mdName, size_t capacity_mdName)
{
ULONG nameLen;
HRESULT hr = pImport->GetTypeDefProps(tkTypeDef, mdName,
- mdNameLen, &nameLen,
+ (ULONG)capacity_mdName, &nameLen,
&flags, NULL);
if (hr != S_OK) {
return hr;
}
WCHAR *name = (WCHAR*)_alloca((nameLen+1)*sizeof(WCHAR));
wcscpy_s (name, nameLen+1, mdName);
- hr = NameForTypeDef_s(tkEnclosingClass,pImport,mdName, capacity_mdName);
+ hr = NameForTypeDef_s(tkEnclosingClass, pImport, mdName, capacity_mdName);
if (hr != S_OK) {
return hr;
}
size_t Len = _wcslen (mdName);
- if (Len < mdNameLen-2) {
+ if (Len < capacity_mdName - 2) {
mdName[Len++] = L'+';
mdName[Len] = L'\0';
}
- Len = mdNameLen-1 - Len;
+ Len = capacity_mdName - 1 - Len;
if (Len > nameLen) {
Len = nameLen;
}
- wcsncat_s (mdName,capacity_mdName,name,Len);
+ wcsncat_s (mdName, capacity_mdName, name, Len);
return hr;
}
-/**********************************************************************\
-* Routine Description: *
-* *
-* This function is called to find the name of a TypeDef using *
-* metadata API. *
-* *
-\**********************************************************************/
-// Caller should guard against exception
-// !!! mdName should have at least mdNameLen WCHAR
-/*
-static HRESULT NameForTypeDefNew(mdTypeDef tkTypeDef, IMDInternalImport *pImport,
- WCHAR *mdName)
-{
- DWORD flags;
- ULONG nameLen;
- char *name = (char *)_alloca((mdNameLen+1)*sizeof(char));
- char *namesp = (char *)_alloca((mdNameLen+1)*sizeof(char));
-
- HRESULT hr = pImport->GetNameOfTypeDef(tkTypeDef, name, namesp);
- if (FAILED(hr))
- {
- return hr;
- }
-
- strcpy (namesp, ".");
- strcpy (namesp, name);
- MultiByteToWideChar (CP_ACP,0,namesp,-1,mdName,mdNameLen);
- return hr;
-}
-*/
-
/**********************************************************************\
* Routine Description: *
* *
to be at least version 2.0.0 or greater. If there are spaces in directory, it
needs to be single-quoted (').
-The default is to use the same runtime (coreclr.dll) being debugged. Use this
-command when the runtime being debugged isn't working to run the SOS code or
-if the version is less than 2.0.0.
+Normally, SOS attempts to find an installed .NET Core runtime to run its
+managed code automatically but this command is available if it fails. The
+default is to use the same runtime (coreclr.dll) being debugged. Use this
+command if the default runtime being debugged isn't working enough to run
+the SOS code or if the version is less than 2.0.0.
If you received the following error message when running a SOS command, use
this command to set the path to 2.0.0 or greater .NET Core runtime.
-ms - Use the public Microsoft symbol server.
-mi - Use the internal symweb symbol server.
-disable - Disable symbol download support.
--cache - Specific a symbol cache directory. The default is $HOME/.sos/symbolcache if not specified.
+-cache - Specific a symbol cache directory. The default is %TEMP%\SymbolCache if not specified.
-log - Enable symbol download logging.
<symbol-server-URL> - Symbol server URL.
COMMAND: sethostruntime.
SetHostRuntime <runtime-directory>
-This command sets the path to the .NET Core runtime to use to host the managed
+This command sets the path to the .NET Core runtime to use to host the managed
code that runs as part of SOS in the debugger (lldb). The runtime needs
to be at least version 2.0.0 or greater. If there are spaces in directory, it
needs to be single-quoted (').
-The default is to use the same runtime (libcoreclr) being debugged. Use this
-command when the runtime being debugged isn't working enough to run the SOS
-code or if the version is less than 2.0.0.
+Normally, SOS attempts to find an installed .NET Core runtime to run its
+managed code automatically but this command is available if it fails. The
+default is to use the same runtime (libcoreclr) being debugged. Use this
+command if the default runtime being debugged isn't working enough to run
+the SOS code or if the version is less than 2.0.0.
If you received the following error message when running a SOS command, use
this command to set the path to 2.0.0 or greater .NET Core runtime.
-ms - Use the public Microsoft symbol server.
-disable - Disable symbol download support.
--cache - Specific a symbol cache directory. The default is $HOME/.sos/symbolcache if not specified.
+-cache - Specific a symbol cache directory. The default is $HOME/.dotnet/symbolcache if not specified.
-log - Enable symbol download logging.
-loadsymbols - Attempts to download the native .NET Core symbols for the runtime
<symbol-server-URL> - Symbol server URL.
mdMethodDef methodDef;
ULONG32 ilOffset;
- if(FAILED(Status = pSymbolReader->ResolveSequencePoint(pFilename, lineNumber, mod, &methodDef, &ilOffset)))
+ if(FAILED(Status = pSymbolReader->ResolveSequencePoint(pFilename, lineNumber, &methodDef, &ilOffset)))
{
return S_FALSE; // not binding in a module is typical
}
// if we have symbols then get the function name so we can lookup the MethodDescs
mdMethodDef methodDefToken;
ULONG32 ilOffset;
- if(SUCCEEDED(symbolReader.ResolveSequencePoint(Filename, lineNumber, moduleList[iModule], &methodDefToken, &ilOffset)))
+ if(SUCCEEDED(symbolReader.ResolveSequencePoint(Filename, lineNumber, &methodDefToken, &ilOffset)))
{
ToRelease<IXCLRDataMethodDefinition> pMethodDef = NULL;
if (SUCCEEDED(ModDef->GetMethodDefinitionByToken(methodDefToken, &pMethodDef)))
break;
}
- CROSS_PLATFORM_CONTEXT context;
+ // This is a workaround for a problem in the MacOS DAC/DBI PAL. The exception
+ // handling is enabled for DLLs and not passing them on to the OS causing an
+ // fatal fault. Putting this struct in the heap works around this fault.
+ ArrayHolder<CROSS_PLATFORM_CONTEXT> context = new CROSS_PLATFORM_CONTEXT[1];
ULONG32 cbContextActual;
- if ((Status=pStackWalk->GetContext(
+ if ((Status = pStackWalk->GetContext(
DT_CONTEXT_FULL,
- sizeof(context),
+ sizeof(CROSS_PLATFORM_CONTEXT),
&cbContextActual,
- (BYTE *)&context))!=S_OK)
+ (BYTE *)context.GetPtr())) != S_OK)
{
ExtOut("GetFrameContext failed: %lx\n",Status);
break;
}
// First find the info for the Frame object, if the current frame has an associated clr!Frame.
- CLRDATA_ADDRESS sp = GetSP(context);
- CLRDATA_ADDRESS ip = GetIP(context);
+ CLRDATA_ADDRESS sp = GetSP(*context.GetPtr());
+ CLRDATA_ADDRESS ip = GetIP(*context.GetPtr());
ToRelease<ICorDebugFrame> pFrame;
IfFailRet(pStackWalk->GetFrame(&pFrame));
IfFailRet(pFunction->GetModule(&pModule));
IfFailRet(pFunction->GetToken(&methodDef));
- WCHAR wszModuleName[100];
+ WCHAR wszModuleName[MAX_LONGPATH];
ULONG32 cchModuleNameActual;
IfFailRet(pModule->GetName(_countof(wszModuleName), &cchModuleNameActual, wszModuleName));
ExtOut("Symbol cache path: %s\n", symbolCache.data);
}
}
-
-#ifdef FEATURE_PAL
- if (loadNative)
+ else if (loadNative)
{
Status = LoadNativeSymbols();
}
-#endif
+ else
+ {
+ DisplaySymbolStore();
+ }
return Status;
}
return NULL;
}
+/**********************************************************************\
+* Routine Description: *
+* *
+* Find the IXCLRDataModule instance for the base address. *
+* *
+\**********************************************************************/
+HRESULT GetModuleFromAddress(___in CLRDATA_ADDRESS peAddress, ___out IXCLRDataModule** ppModule)
+{
+ HRESULT hr = E_FAIL;
+ *ppModule = nullptr;
+
+ int numModule;
+ ArrayHolder<DWORD_PTR> moduleList = ModuleFromName(NULL, &numModule);
+ if (moduleList != nullptr)
+ {
+ for (int i = 0; i < numModule; i++)
+ {
+ ToRelease<IXCLRDataModule> module;
+ hr = g_sos->GetModule(moduleList[i], &module);
+ if (FAILED(hr)) {
+ break;
+ }
+ DacpGetModuleData moduleData;
+ HRESULT hr = moduleData.Request(module);
+ if (FAILED(hr)) {
+ break;
+ }
+ if (peAddress == moduleData.LoadedPEAddress)
+ {
+ *ppModule = module.Detach();
+ break;
+ }
+ }
+ }
+
+ return hr;
+}
+
/**********************************************************************\
* Routine Description: *
* *
* ArrayHolder class.
*/
DWORD_PTR *ModuleFromName(__in_opt LPSTR name, int *numModules);
+HRESULT GetModuleFromAddress(___in CLRDATA_ADDRESS peAddress, ___out IXCLRDataModule** ppModule);
void GetInfoFromName(DWORD_PTR ModuleAddr, const char* name);
void GetInfoFromModule (DWORD_PTR ModuleAddr, ULONG token, DWORD_PTR *ret=NULL);
| DECODE_GENERICS_INST_CONTEXT
| DECODE_GC_LIFETIMES
| DECODE_PROLOG_LENGTH
- | DECODE_RETURN_KIND),
+ | DECODE_RETURN_KIND
+#if defined(_TARGET_ARM_) || defined(_TARGET_ARM64_)
+ | DECODE_HAS_TAILCALLS
+#endif
+ ),
0);
if (NO_SECURITY_OBJECT != hdrdecoder.GetSecurityObjectStackSlot() ||
<Project Sdk="Microsoft.NET.Sdk">
-
<PropertyGroup>
<OutputType>Exe</OutputType>
-
- <!-- Target .NET Core 2.1 so it will run on LTS -->
<TargetFramework>netcoreapp2.1</TargetFramework>
-
- <RootNamespace>Microsoft.Diagnostics.Tools.Analyze</RootNamespace>
-
+ <RuntimeFrameworkVersion>2.1.0</RuntimeFrameworkVersion>
<!-- Don't pack until ship engineering is done. Currently causing the official job to fail.
<IsPackable>true</IsPackable>
<PackAsTool>true</PackAsTool>
-->
+ <PackAsToolShimRuntimeIdentifiers>win-x64;win-x86;osx-x64</PackAsToolShimRuntimeIdentifiers>
+ <!-- The package version needs to be hard coded as a stable version so "dotnet tool install -g dotnet-analyze" works -->
+ <Version>1.0.0</Version>
+ <PackageVersion>1.0.0</PackageVersion>
+ <ToolCommandName>dotnet-analyze</ToolCommandName>
+ <RootNamespace>Microsoft.Diagnostics.Tools.Analyze</RootNamespace>
+ <Description>Diagnostic analyze tool</Description>
+ <PackageTags>Diagnostic</PackageTags>
+ <PackageReleaseNotes>$(Description)</PackageReleaseNotes>
+ <!-- Need to put the shims here to sign -->
+ <PackagedShimOutputRootDirectory>$(OutputPath)</PackagedShimOutputRootDirectory>
</PropertyGroup>
<ItemGroup>
-<Project Sdk="Microsoft.NET.Sdk">
+<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
-
<!-- Target .NET Core 2.1 so it will run on LTS -->
<TargetFramework>netcoreapp2.1</TargetFramework>
-
<RootNamespace>Microsoft.Diagnostics.Tools.Dump</RootNamespace>
+ <!-- Don't pack until ship engineering is done. Currently causing the official job to fail.
<IsPackable>true</IsPackable>
<PackAsTool>true</PackAsTool>
+ -->
</PropertyGroup>
<ItemGroup>
--- /dev/null
+// Copyright (c) .NET Foundation. All rights reserved.
+// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.
+
+using McMaster.Extensions.CommandLineUtils;
+using SOS.InstallHelper;
+using System;
+using System.Threading.Tasks;
+
+namespace Microsoft.Diagnostics.Tools.SOS
+{
+ [Command(Name = "dotnet-analyze", Description = "Install and configure SOS")]
+ internal class Program
+ {
+ [Option("--install", Description = "Install and configure SOS.")]
+ public bool InstallSOS { get; set; }
+
+ [Option("--uninstall", Description = "Uninstall SOS.")]
+ public bool UninstallSOS { get; set; }
+
+ public int OnExecute(IConsole console, CommandLineApplication app)
+ {
+ if (InstallSOS || UninstallSOS)
+ {
+ var sosInstaller = new InstallHelper();
+ try
+ {
+ if (UninstallSOS)
+ {
+ console.WriteLine("Uninstalling SOS from {0}", sosInstaller.InstallLocation);
+ sosInstaller.Uninstall();
+ }
+ else
+ {
+ console.WriteLine("Installing SOS to {0}", sosInstaller.InstallLocation);
+ sosInstaller.Install();
+
+ if (sosInstaller.LLDBInitFile != null) {
+ console.WriteLine("Configuring LLDB {0}", sosInstaller.LLDBInitFile);
+ sosInstaller.Configure();
+ }
+ }
+ }
+ catch (Exception ex)
+ {
+ console.Error.WriteLine(ex.Message);
+ return 1;
+ }
+ }
+ return 0;
+ }
+
+ private static int Main(string[] args)
+ {
+ try
+ {
+ return CommandLineApplication.Execute<Program>(args);
+ }
+ catch (OperationCanceledException)
+ {
+ return 0;
+ }
+ }
+ }
+}
--- /dev/null
+<Project Sdk="Microsoft.NET.Sdk">
+ <PropertyGroup>
+ <OutputType>Exe</OutputType>
+ <TargetFramework>netcoreapp2.1</TargetFramework>
+ <RuntimeFrameworkVersion>2.1.0</RuntimeFrameworkVersion>
+ <IsPackable>true</IsPackable>
+ <PackAsTool>true</PackAsTool>
+ <PackAsToolShimRuntimeIdentifiers>win-x64;win-x86;osx-x64</PackAsToolShimRuntimeIdentifiers>
+ <!-- The package version needs to be hard coded as a stable version so "dotnet tool install -g dotnet-sos" works -->
+ <Version>1.0.0</Version>
+ <PackageVersion>1.0.0</PackageVersion>
+ <ToolCommandName>dotnet-sos</ToolCommandName>
+ <RootNamespace>Microsoft.Diagnostics.Tools.SOS</RootNamespace>
+ <Description>Diagnostic SOS installer</Description>
+ <PackageTags>Diagnostic</PackageTags>
+ <PackageReleaseNotes>$(Description)</PackageReleaseNotes>
+ <!-- Need to put the shims here to sign -->
+ <PackagedShimOutputRootDirectory>$(OutputPath)</PackagedShimOutputRootDirectory>
+ <SOSNETCoreBinaries>$(ArtifactsBinDir)\SOS.NETCore\$(Configuration)\netcoreapp2.0\publish\*.dll</SOSNETCoreBinaries>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PackageReference Include="McMaster.Extensions.CommandLineUtils" Version="2.2.5" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <ProjectReference Include="..\..\SOS\SOS.InstallHelper\SOS.InstallHelper.csproj" />
+ </ItemGroup>
+
+ <ItemGroup>
+ <_PackageFiles Include="$(SOSNETCoreBinaries)">
+ <BuildAction>None</BuildAction>
+ <PackagePath>tools/netcoreapp2.1/any/win-x64</PackagePath>
+ </_PackageFiles>
+ <_PackageFiles Include="$(ArtifactsBinDir)\Windows_NT.x64.$(Configuration)\sos.dll">
+ <BuildAction>None</BuildAction>
+ <PackagePath>tools/netcoreapp2.1/any/win-x64</PackagePath>
+ </_PackageFiles>
+ <_PackageFiles Include="$(SOSNETCoreBinaries)">
+ <BuildAction>None</BuildAction>
+ <PackagePath>tools/netcoreapp2.1/any/win-x86</PackagePath>
+ </_PackageFiles>
+ <_PackageFiles Include="$(ArtifactsBinDir)\Windows_NT.x86.$(Configuration)\sos.dll">
+ <BuildAction>None</BuildAction>
+ <PackagePath>tools/netcoreapp2.1/any/win-x86</PackagePath>
+ </_PackageFiles>
+ <_PackageFiles Include="$(SOSNETCoreBinaries)">
+ <BuildAction>None</BuildAction>
+ <PackagePath>tools/netcoreapp2.1/any/linux-x64</PackagePath>
+ </_PackageFiles>
+ <_PackageFiles Include="$(ArtifactsBinDir)\Linux.x64.$(Configuration)\libsosplugin.so">
+ <BuildAction>None</BuildAction>
+ <PackagePath>tools/netcoreapp2.1/any/linux-x64</PackagePath>
+ </_PackageFiles>
+ <_PackageFiles Include="$(ArtifactsBinDir)\Linux.x64.$(Configuration)\libsos.so">
+ <BuildAction>None</BuildAction>
+ <PackagePath>tools/netcoreapp2.1/any/linux-x64</PackagePath>
+ </_PackageFiles>
+ <_PackageFiles Include="$(ArtifactsBinDir)\Linux.x64.$(Configuration)\sosdocsunix.txt">
+ <BuildAction>None</BuildAction>
+ <PackagePath>tools/netcoreapp2.1/any/linux-x64</PackagePath>
+ </_PackageFiles>
+ <_PackageFiles Include="$(SOSNETCoreBinaries)">
+ <BuildAction>None</BuildAction>
+ <PackagePath>tools/netcoreapp2.1/any/osx-x64</PackagePath>
+ </_PackageFiles>
+ <_PackageFiles Include="$(ArtifactsBinDir)\OSX.x64.$(Configuration)\libsosplugin.dylib">
+ <BuildAction>None</BuildAction>
+ <PackagePath>tools/netcoreapp2.1/any/osx-x64</PackagePath>
+ </_PackageFiles>
+ <_PackageFiles Include="$(ArtifactsBinDir)\OSX.x64.$(Configuration)\libsos.dylib">
+ <BuildAction>None</BuildAction>
+ <PackagePath>tools/netcoreapp2.1/any/osx-x64</PackagePath>
+ </_PackageFiles>
+ <_PackageFiles Include="$(ArtifactsBinDir)\OSX.x64.$(Configuration)\sosdocsunix.txt">
+ <BuildAction>None</BuildAction>
+ <PackagePath>tools/netcoreapp2.1/any/osx-x64</PackagePath>
+ </_PackageFiles>
+ </ItemGroup>
+</Project>
#endif
#if !defined(MAX_LONGPATH)
-#define MAX_LONGPATH 260 /* max. length of full pathname */
+#define MAX_LONGPATH 1024 /* max. length of full pathname */
#endif
#if !defined(MAX_PATH_FNAME)
-#define MAX_PATH_FNAME MAX_PATH /* max. length of full pathname */
+#define MAX_PATH_FNAME MAX_PATH /* max. length of full pathname */
#endif
#define __clr_reserved __reserved
#define IDYES 6
#define IDNO 7
+PALIMPORT
+int
+PALAPI
+MessageBoxA(
+ IN LPVOID hWnd, // NOTE: diff from winuser.h
+ IN LPCSTR lpText,
+ IN LPCSTR lpCaption,
+ IN UINT uType);
PALIMPORT
int
PALAPI
MessageBoxW(
- IN LPVOID hWnd, // NOTE: diff from winuser.h
- IN LPCWSTR lpText,
- IN LPCWSTR lpCaption,
- IN UINT uType);
+ IN LPVOID hWnd, // NOTE: diff from winuser.h
+ IN LPCWSTR lpText,
+ IN LPCWSTR lpCaption,
+ IN UINT uType);
#ifdef UNICODE
#define INVALID_SET_FILE_POINTER ((DWORD)-1)
+PALIMPORT
+HANDLE
+PALAPI
+CreateFileA(
+ IN LPCSTR lpFileName,
+ IN DWORD dwDesiredAccess,
+ IN DWORD dwShareMode,
+ IN LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ IN DWORD dwCreationDisposition,
+ IN DWORD dwFlagsAndAttributes,
+ IN HANDLE hTemplateFile);
PALIMPORT
HANDLE
PALAPI
CreateFileW(
- IN LPCWSTR lpFileName,
- IN DWORD dwDesiredAccess,
- IN DWORD dwShareMode,
- IN LPSECURITY_ATTRIBUTES lpSecurityAttributes,
- IN DWORD dwCreationDisposition,
- IN DWORD dwFlagsAndAttributes,
- IN HANDLE hTemplateFile);
+ IN LPCWSTR lpFileName,
+ IN DWORD dwDesiredAccess,
+ IN DWORD dwShareMode,
+ IN LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ IN DWORD dwCreationDisposition,
+ IN DWORD dwFlagsAndAttributes,
+ IN HANDLE hTemplateFile);
#ifdef UNICODE
#define CreateFile CreateFileW
#endif
+PALIMPORT
+DWORD
+PALAPI
+SearchPathA(
+ IN LPCSTR lpPath,
+ IN LPCSTR lpFileName,
+ IN LPCSTR lpExtension,
+ IN DWORD nBufferLength,
+ OUT LPSTR lpBuffer,
+ OUT LPSTR *lpFilePart);
+
PALIMPORT
DWORD
PALAPI
IN LPCWSTR lpExtension,
IN DWORD nBufferLength,
OUT LPWSTR lpBuffer,
- OUT LPWSTR *lpFilePart
- );
+ OUT LPWSTR *lpFilePart);
+
#ifdef UNICODE
#define SearchPath SearchPathW
#else
#endif // !UNICODE
+PALIMPORT
+BOOL
+PALAPI
+CopyFileA(
+ IN LPCSTR lpExistingFileName,
+ IN LPCSTR lpNewFileName,
+ IN BOOL bFailIfExists);
PALIMPORT
BOOL
PALAPI
CopyFileW(
- IN LPCWSTR lpExistingFileName,
- IN LPCWSTR lpNewFileName,
- IN BOOL bFailIfExists);
+ IN LPCWSTR lpExistingFileName,
+ IN LPCWSTR lpNewFileName,
+ IN BOOL bFailIfExists);
#ifdef UNICODE
#define CopyFile CopyFileW
#endif
+PALIMPORT
+BOOL
+PALAPI
+DeleteFileA(
+ IN LPCSTR lpFileName);
+
PALIMPORT
BOOL
PALAPI
DeleteFileW(
- IN LPCWSTR lpFileName);
+ IN LPCWSTR lpFileName);
#ifdef UNICODE
#define DeleteFile DeleteFileW
#endif
-
#define MOVEFILE_REPLACE_EXISTING 0x00000001
#define MOVEFILE_COPY_ALLOWED 0x00000002
+PALIMPORT
+BOOL
+PALAPI
+MoveFileExA(
+ IN LPCSTR lpExistingFileName,
+ IN LPCSTR lpNewFileName,
+ IN DWORD dwFlags);
PALIMPORT
BOOL
PALAPI
MoveFileExW(
- IN LPCWSTR lpExistingFileName,
- IN LPCWSTR lpNewFileName,
- IN DWORD dwFlags);
+ IN LPCWSTR lpExistingFileName,
+ IN LPCWSTR lpNewFileName,
+ IN DWORD dwFlags);
#ifdef UNICODE
#define MoveFileEx MoveFileExW
#define MoveFileEx MoveFileExA
#endif
+
+PALIMPORT
+BOOL
+PALAPI
+CreateDirectoryA(
+ IN LPCSTR lpPathName,
+ IN LPSECURITY_ATTRIBUTES lpSecurityAttributes);
+
PALIMPORT
BOOL
PALAPI
CreateDirectoryW(
- IN LPCWSTR lpPathName,
- IN LPSECURITY_ATTRIBUTES lpSecurityAttributes);
+ IN LPCWSTR lpPathName,
+ IN LPSECURITY_ATTRIBUTES lpSecurityAttributes);
#ifdef UNICODE
#define CreateDirectory CreateDirectoryW
#define CreateDirectory CreateDirectoryA
#endif
+
+PALIMPORT
+BOOL
+PALAPI
+RemoveDirectoryA(
+ IN LPCSTR lpPathName);
+
PALIMPORT
BOOL
PALAPI
RemoveDirectoryW(
- IN LPCWSTR lpPathName);
+ IN LPCWSTR lpPathName);
#ifdef UNICODE
#define RemoveDirectory RemoveDirectoryW
typedef LPWIN32_FIND_DATAA LPWIN32_FIND_DATA;
#endif
+PALIMPORT
+HANDLE
+PALAPI
+FindFirstFileA(
+ IN LPCSTR lpFileName,
+ OUT LPWIN32_FIND_DATAA lpFindFileData);
+
PALIMPORT
HANDLE
PALAPI
FindFirstFileW(
- IN LPCWSTR lpFileName,
- OUT LPWIN32_FIND_DATAW lpFindFileData);
+ IN LPCWSTR lpFileName,
+ OUT LPWIN32_FIND_DATAW lpFindFileData);
#ifdef UNICODE
#define FindFirstFile FindFirstFileW
#define FindFirstFile FindFirstFileA
#endif
+
+PALIMPORT
+BOOL
+PALAPI
+FindNextFileA(
+ IN HANDLE hFindFile,
+ OUT LPWIN32_FIND_DATAA lpFindFileData);
+
PALIMPORT
BOOL
PALAPI
FindNextFileW(
- IN HANDLE hFindFile,
- OUT LPWIN32_FIND_DATAW lpFindFileData);
+ IN HANDLE hFindFile,
+ OUT LPWIN32_FIND_DATAW lpFindFileData);
#ifdef UNICODE
#define FindNextFile FindNextFileW
#define FindNextFile FindNextFileA
#endif
+
PALIMPORT
BOOL
PALAPI
FindClose(
IN OUT HANDLE hFindFile);
+
+PALIMPORT
+DWORD
+PALAPI
+GetFileAttributesA(
+ IN LPCSTR lpFileName);
+
PALIMPORT
DWORD
PALAPI
GetFileAttributesW(
- IN LPCWSTR lpFileName);
+ IN LPCWSTR lpFileName);
#ifdef UNICODE
#define GetFileAttributes GetFileAttributesW
#define GetFileAttributes GetFileAttributesA
#endif
+
typedef enum _GET_FILEEX_INFO_LEVELS {
GetFileExInfoStandard
} GET_FILEEX_INFO_LEVELS;
BOOL
PALAPI
GetFileAttributesExW(
- IN LPCWSTR lpFileName,
- IN GET_FILEEX_INFO_LEVELS fInfoLevelId,
- OUT LPVOID lpFileInformation);
+ IN LPCWSTR lpFileName,
+ IN GET_FILEEX_INFO_LEVELS fInfoLevelId,
+ OUT LPVOID lpFileInformation);
#ifdef UNICODE
#define GetFileAttributesEx GetFileAttributesExW
#endif
+PALIMPORT
+BOOL
+PALAPI
+SetFileAttributesA(
+ IN LPCSTR lpFileName,
+ IN DWORD dwFileAttributes);
+
PALIMPORT
BOOL
PALAPI
#define SetFileAttributes SetFileAttributesA
#endif
+
typedef struct _OVERLAPPED {
ULONG_PTR Internal;
ULONG_PTR InternalHigh;
VOID
PALAPI
GetSystemTime(
- OUT LPSYSTEMTIME lpSystemTime);
+ OUT LPSYSTEMTIME lpSystemTime);
PALIMPORT
BOOL
PALAPI
FileTimeToSystemTime(
- IN CONST FILETIME *lpFileTime,
- OUT LPSYSTEMTIME lpSystemTime);
-
-
+ IN CONST FILETIME *lpFileTime,
+ OUT LPSYSTEMTIME lpSystemTime);
PALIMPORT
BOOL
PALAPI
FlushFileBuffers(
- IN HANDLE hFile);
+ IN HANDLE hFile);
PALIMPORT
UINT
PALAPI
GetConsoleOutputCP(
- VOID);
+ VOID);
+
+PALIMPORT
+DWORD
+PALAPI
+GetFullPathNameA(
+ IN LPCSTR lpFileName,
+ IN DWORD nBufferLength,
+ OUT LPSTR lpBuffer,
+ OUT LPSTR *lpFilePart);
PALIMPORT
DWORD
PALAPI
GetFullPathNameW(
- IN LPCWSTR lpFileName,
- IN DWORD nBufferLength,
- OUT LPWSTR lpBuffer,
- OUT LPWSTR *lpFilePart);
+ IN LPCWSTR lpFileName,
+ IN DWORD nBufferLength,
+ OUT LPWSTR lpBuffer,
+ OUT LPWSTR *lpFilePart);
#ifdef UNICODE
#define GetFullPathName GetFullPathNameW
#define GetFullPathName GetFullPathNameA
#endif
+
PALIMPORT
DWORD
PALAPI
GetLongPathNameW(
- IN LPCWSTR lpszShortPath,
- OUT LPWSTR lpszLongPath,
- IN DWORD cchBuffer);
+ IN LPCWSTR lpszShortPath,
+ OUT LPWSTR lpszLongPath,
+ IN DWORD cchBuffer);
#ifdef UNICODE
#define GetLongPathName GetLongPathNameW
DWORD
PALAPI
GetShortPathNameW(
- IN LPCWSTR lpszLongPath,
- OUT LPWSTR lpszShortPath,
- IN DWORD cchBuffer);
+ IN LPCWSTR lpszLongPath,
+ OUT LPWSTR lpszShortPath,
+ IN DWORD cchBuffer);
#ifdef UNICODE
#define GetShortPathName GetShortPathNameW
#endif
+PALIMPORT
+UINT
+PALAPI
+GetTempFileNameA(
+ IN LPCSTR lpPathName,
+ IN LPCSTR lpPrefixString,
+ IN UINT uUnique,
+ OUT LPSTR lpTempFileName);
+
PALIMPORT
UINT
PALAPI
GetTempFileNameW(
- IN LPCWSTR lpPathName,
- IN LPCWSTR lpPrefixString,
- IN UINT uUnique,
- OUT LPWSTR lpTempFileName);
+ IN LPCWSTR lpPathName,
+ IN LPCWSTR lpPrefixString,
+ IN UINT uUnique,
+ OUT LPWSTR lpTempFileName);
#ifdef UNICODE
#define GetTempFileName GetTempFileNameW
#define GetTempFileName GetTempFileNameA
#endif
+
+PALIMPORT
+DWORD
+PALAPI
+GetTempPathA(
+ IN DWORD nBufferLength,
+ OUT LPSTR lpBuffer);
+
PALIMPORT
DWORD
PALAPI
GetTempPathW(
- IN DWORD nBufferLength,
- OUT LPWSTR lpBuffer);
+ IN DWORD nBufferLength,
+ OUT LPWSTR lpBuffer);
#ifdef UNICODE
#define GetTempPath GetTempPathW
#define GetTempPath GetTempPathA
#endif
+
+PALIMPORT
+DWORD
+PALAPI
+GetCurrentDirectoryA(
+ IN DWORD nBufferLength,
+ OUT LPSTR lpBuffer);
+
PALIMPORT
DWORD
PALAPI
GetCurrentDirectoryW(
- IN DWORD nBufferLength,
- OUT LPWSTR lpBuffer);
+ IN DWORD nBufferLength,
+ OUT LPWSTR lpBuffer);
#ifdef UNICODE
#define GetCurrentDirectory GetCurrentDirectoryW
#define GetCurrentDirectory GetCurrentDirectoryA
#endif
+
+PALIMPORT
+BOOL
+PALAPI
+SetCurrentDirectoryA(
+ IN LPCSTR lpPathName);
+
PALIMPORT
BOOL
PALAPI
SetCurrentDirectoryW(
- IN LPCWSTR lpPathName);
+ IN LPCWSTR lpPathName);
#ifdef UNICODE
DWORD
PALAPI
GetCurrentProcessId(
- VOID);
+ VOID);
PALIMPORT
DWORD
PALAPI
GetCurrentSessionId(
- VOID);
+ VOID);
PALIMPORT
DWORD
PALAPI
GetCurrentThreadId(
- VOID);
+ VOID);
#define STARTF_USESTDHANDLES 0x00000100
#define MEM_WRITE_WATCH 0x200000
#define MEM_RESERVE_EXECUTABLE 0x40000000 // reserve memory using executable memory allocator
+PALIMPORT
+HANDLE
+PALAPI
+CreateFileMappingA(
+ IN HANDLE hFile,
+ IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
+ IN DWORD flProtect,
+ IN DWORD dwMaximumSizeHigh,
+ IN DWORD dwMaximumSizeLow,
+ IN LPCSTR lpName);
+
PALIMPORT
HANDLE
PALAPI
CreateFileMappingW(
- IN HANDLE hFile,
- IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
- IN DWORD flProtect,
- IN DWORD dwMaxmimumSizeHigh,
- IN DWORD dwMaximumSizeLow,
- IN LPCWSTR lpName);
+ IN HANDLE hFile,
+ IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
+ IN DWORD flProtect,
+ IN DWORD dwMaxmimumSizeHigh,
+ IN DWORD dwMaximumSizeLow,
+ IN LPCWSTR lpName);
#ifdef UNICODE
#define CreateFileMapping CreateFileMappingW
#define CreateFileMapping CreateFileMappingA
#endif
+
#define SECTION_QUERY 0x0001
#define SECTION_MAP_WRITE 0x0002
#define SECTION_MAP_READ 0x0004
PALIMPORT
HANDLE
PALAPI
-OpenFileMappingW(
+OpenFileMappingA(
IN DWORD dwDesiredAccess,
IN BOOL bInheritHandle,
- IN LPCWSTR lpName);
+ IN LPCSTR lpName);
+
+PALIMPORT
+HANDLE
+PALAPI
+OpenFileMappingW(
+ IN DWORD dwDesiredAccess,
+ IN BOOL bInheritHandle,
+ IN LPCWSTR lpName);
#ifdef UNICODE
#define OpenFileMapping OpenFileMappingW
#define OpenFileMapping OpenFileMappingA
#endif
+
PALIMPORT
LPVOID
PALAPI
MapViewOfFile(
- IN HANDLE hFileMappingObject,
- IN DWORD dwDesiredAccess,
- IN DWORD dwFileOffsetHigh,
- IN DWORD dwFileOffsetLow,
- IN SIZE_T dwNumberOfBytesToMap);
+ IN HANDLE hFileMappingObject,
+ IN DWORD dwDesiredAccess,
+ IN DWORD dwFileOffsetHigh,
+ IN DWORD dwFileOffsetLow,
+ IN SIZE_T dwNumberOfBytesToMap);
PALIMPORT
LPVOID
PALAPI
MapViewOfFileEx(
- IN HANDLE hFileMappingObject,
- IN DWORD dwDesiredAccess,
- IN DWORD dwFileOffsetHigh,
- IN DWORD dwFileOffsetLow,
- IN SIZE_T dwNumberOfBytesToMap,
- IN LPVOID lpBaseAddress);
+ IN HANDLE hFileMappingObject,
+ IN DWORD dwDesiredAccess,
+ IN DWORD dwFileOffsetHigh,
+ IN DWORD dwFileOffsetLow,
+ IN SIZE_T dwNumberOfBytesToMap,
+ IN LPVOID lpBaseAddress);
PALIMPORT
BOOL
PALAPI
UnmapViewOfFile(
- IN LPCVOID lpBaseAddress);
+ IN LPCVOID lpBaseAddress);
+
+
+PALIMPORT
+HMODULE
+PALAPI
+LoadLibraryA(
+ IN LPCSTR lpLibFileName);
+
+PALIMPORT
+HMODULE
+PALAPI
+LoadLibraryExA(
+ IN LPCSTR lpLibFileName,
+ IN /*Reserved*/ HANDLE hFile,
+ IN DWORD dwFlags);
PALIMPORT
HMODULE
PALAPI
LoadLibraryW(
- IN LPCWSTR lpLibFileName);
+ IN LPCWSTR lpLibFileName);
PALIMPORT
HMODULE
DisableThreadLibraryCalls(
IN HMODULE hLibModule);
+
+PALIMPORT
+DWORD
+PALAPI
+GetModuleFileNameA(
+ IN HMODULE hModule,
+ OUT LPSTR lpFileName,
+ IN DWORD nSize);
+
PALIMPORT
DWORD
PALAPI
#define GetModuleFileName GetModuleFileNameA
#endif
+
PALIMPORT
DWORD
PALAPI
VOID
PALAPI
DebugBreak(
- VOID);
+ VOID);
PALIMPORT
int
#define lstrlen lstrlenA
#endif
+PALIMPORT
+DWORD
+PALAPI
+GetEnvironmentVariableA(
+ IN LPCSTR lpName,
+ OUT LPSTR lpBuffer,
+ IN DWORD nSize);
+
PALIMPORT
DWORD
PALAPI
GetEnvironmentVariableW(
- IN LPCWSTR lpName,
- OUT LPWSTR lpBuffer,
- IN DWORD nSize);
+ IN LPCWSTR lpName,
+ OUT LPWSTR lpBuffer,
+ IN DWORD nSize);
#ifdef UNICODE
#define GetEnvironmentVariable GetEnvironmentVariableW
#define GetEnvironmentVariable GetEnvironmentVariableA
#endif
+
+PALIMPORT
+BOOL
+PALAPI
+SetEnvironmentVariableA(
+ IN LPCSTR lpName,
+ IN LPCSTR lpValue);
+
PALIMPORT
BOOL
PALAPI
SetEnvironmentVariableW(
- IN LPCWSTR lpName,
- IN LPCWSTR lpValue);
+ IN LPCWSTR lpName,
+ IN LPCWSTR lpValue);
#ifdef UNICODE
#define SetEnvironmentVariable SetEnvironmentVariableW
#define SetEnvironmentVariable SetEnvironmentVariableA
#endif
+PALIMPORT
+LPSTR
+PALAPI
+GetEnvironmentStringsA(
+ VOID);
+
PALIMPORT
LPWSTR
PALAPI
GetEnvironmentStringsW(
- VOID);
+ VOID);
#ifdef UNICODE
#define GetEnvironmentStrings GetEnvironmentStringsW
#define GetEnvironmentStrings GetEnvironmentStringsA
#endif
+
+PALIMPORT
+BOOL
+PALAPI
+FreeEnvironmentStringsA(
+ IN LPSTR);
+
PALIMPORT
BOOL
PALAPI
FreeEnvironmentStringsW(
- IN LPWSTR);
+ IN LPWSTR);
#ifdef UNICODE
#define FreeEnvironmentStrings FreeEnvironmentStringsW
#define FreeEnvironmentStrings FreeEnvironmentStringsA
#endif
+
PALIMPORT
BOOL
PALAPI
CloseHandle(
- IN OUT HANDLE hObject);
+ IN OUT HANDLE hObject);
PALIMPORT
DWORD
PALAPI
GetTickCount(
- VOID);
+ VOID);
PALIMPORT
ULONGLONG
PALAPI
-GetTickCount64(VOID);
+GetTickCount64(
+ VOID);
PALIMPORT
BOOL
#ifndef FEATURE_PAL_SXS
-typedef LONG (PALAPI *PTOP_LEVEL_EXCEPTION_FILTER)(
- struct _EXCEPTION_POINTERS *ExceptionInfo);
+typedef LONG (PALAPI *PTOP_LEVEL_EXCEPTION_FILTER)(struct _EXCEPTION_POINTERS *ExceptionInfo);
typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
PALIMPORT
IN DWORD nSize
);
-#if defined FEATURE_PAL_ANSI
-#include "palprivate.h"
-#endif //FEATURE_PAL_ANSI
-
/******************* C Runtime Entrypoints *******************************/
/* Some C runtime functions needs to be reimplemented by the PAL.
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-#ifndef __PAL_PRIVATE_H__
-#define __PAL_PRIVATE_H__
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-PALIMPORT
-int
-PALAPI
-MessageBoxA(
- IN LPVOID hWnd, // NOTE: diff from winuser.h
- IN LPCSTR lpText,
- IN LPCSTR lpCaption,
- IN UINT uType);
-
-
-PALIMPORT
-HANDLE
-PALAPI
-CreateFileA(
- IN LPCSTR lpFileName,
- IN DWORD dwDesiredAccess,
- IN DWORD dwShareMode,
- IN LPSECURITY_ATTRIBUTES lpSecurityAttributes,
- IN DWORD dwCreationDisposition,
- IN DWORD dwFlagsAndAttributes,
- IN HANDLE hTemplateFile);
-
-PALIMPORT
-DWORD
-PALAPI
-SearchPathA(
- IN LPCSTR lpPath,
- IN LPCSTR lpFileName,
- IN LPCSTR lpExtension,
- IN DWORD nBufferLength,
- OUT LPSTR lpBuffer,
- OUT LPSTR *lpFilePart
- );
-
-PALIMPORT
-BOOL
-PALAPI
-CopyFileA(
- IN LPCSTR lpExistingFileName,
- IN LPCSTR lpNewFileName,
- IN BOOL bFailIfExists);
-
-
-PALIMPORT
-BOOL
-PALAPI
-DeleteFileA(
- IN LPCSTR lpFileName);
-
-PALIMPORT
-BOOL
-PALAPI
-MoveFileExA(
- IN LPCSTR lpExistingFileName,
- IN LPCSTR lpNewFileName,
- IN DWORD dwFlags);
-
-PALIMPORT
-BOOL
-PALAPI
-CreateDirectoryA(
- IN LPCSTR lpPathName,
- IN LPSECURITY_ATTRIBUTES lpSecurityAttributes);
-
-PALIMPORT
-HANDLE
-PALAPI
-FindFirstFileA(
- IN LPCSTR lpFileName,
- OUT LPWIN32_FIND_DATAA lpFindFileData);
-
-PALIMPORT
-BOOL
-PALAPI
-FindNextFileA(
- IN HANDLE hFindFile,
- OUT LPWIN32_FIND_DATAA lpFindFileData);
-
-PALIMPORT
-DWORD
-PALAPI
-GetFileAttributesA(
- IN LPCSTR lpFileName);
-
-PALIMPORT
-BOOL
-PALAPI
-SetFileAttributesA(
- IN LPCSTR lpFileName,
- IN DWORD dwFileAttributes);
-
-PALIMPORT
-DWORD
-PALAPI
-GetFullPathNameA(
- IN LPCSTR lpFileName,
- IN DWORD nBufferLength,
- OUT LPSTR lpBuffer,
- OUT LPSTR *lpFilePart);
-
-PALIMPORT
-UINT
-PALAPI
-GetTempFileNameA(
- IN LPCSTR lpPathName,
- IN LPCSTR lpPrefixString,
- IN UINT uUnique,
- OUT LPSTR lpTempFileName);
-
-PALIMPORT
-DWORD
-PALAPI
-GetTempPathA(
- IN DWORD nBufferLength,
- OUT LPSTR lpBuffer);
-
-PALIMPORT
-DWORD
-PALAPI
-GetCurrentDirectoryA(
- IN DWORD nBufferLength,
- OUT LPSTR lpBuffer);
-
-PALIMPORT
-BOOL
-PALAPI
-SetCurrentDirectoryA(
- IN LPCSTR lpPathName);
-
-PALIMPORT
-HANDLE
-PALAPI
-CreateFileMappingA(
- IN HANDLE hFile,
- IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
- IN DWORD flProtect,
- IN DWORD dwMaximumSizeHigh,
- IN DWORD dwMaximumSizeLow,
- IN LPCSTR lpName);
-
-PALIMPORT
-HANDLE
-PALAPI
-OpenFileMappingA(
- IN DWORD dwDesiredAccess,
- IN BOOL bInheritHandle,
- IN LPCSTR lpName);
-
-PALIMPORT
-HMODULE
-PALAPI
-LoadLibraryA(
- IN LPCSTR lpLibFileName);
-
-PALIMPORT
-HMODULE
-PALAPI
-LoadLibraryExA(
- IN LPCSTR lpLibFileName,
- IN /*Reserved*/ HANDLE hFile,
- IN DWORD dwFlags);
-
-PALIMPORT
-DWORD
-PALAPI
-GetModuleFileNameA(
- IN HMODULE hModule,
- OUT LPSTR lpFileName,
- IN DWORD nSize);
-
-
-PALIMPORT
-LPSTR
-PALAPI
-GetEnvironmentStringsA(
- VOID);
-
-PALIMPORT
-BOOL
-PALAPI
-SetEnvironmentVariableA(
- IN LPCSTR lpName,
- IN LPCSTR lpValue);
-
-PALIMPORT
-DWORD
-PALAPI
-GetEnvironmentVariableA(
- IN LPCSTR lpName,
- OUT LPSTR lpBuffer,
- IN DWORD nSize);
-
-PALIMPORT
-BOOL
-PALAPI
-FreeEnvironmentStringsA(
- IN LPSTR);
-
-PALIMPORT
-BOOL
-PALAPI
-RemoveDirectoryA(
- IN LPCSTR lpPathName);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif// __PAL_PRIVATE_H__
#define FILE PAL_FILE
#include "pal.h"
-#include "palprivate.h"
-
#include "mbusafecrt.h"
#ifdef _VAC_