[In, MarshalAs(UnmanagedType.Struct)] ref SOSNetCoreCallbacks callbacks,
int callbacksSize,
[In, MarshalAs(UnmanagedType.LPStr)] string tempDirectory,
+ [In, MarshalAs(UnmanagedType.LPStr)] string runtimeModulePath,
bool isDesktop,
[In, MarshalAs(UnmanagedType.LPStr)] string dacFilePath,
[In, MarshalAs(UnmanagedType.LPStr)] string dbiFilePath,
ref s_callbacks,
Marshal.SizeOf<SOSNetCoreCallbacks>(),
tempDirectory,
+ AnalyzeContext.RuntimeModuleDirectory,
isDesktop,
dacFilePath,
dbiFilePath,
#endif // FEATURE_PAL
hostRuntimeDirectory.append(DIRECTORY_SEPARATOR_STR_A);
- // First attempt find the highest 2.1.x version. We want to start with the LTS
+ // First attempt find the highest LTS version. We want to start with the LTSs
// and only use the higher versions if it isn't installed.
- if (!FindDotNetVersion(2, 1, hostRuntimeDirectory))
+ if (!FindDotNetVersion(3, 1, hostRuntimeDirectory))
{
- // Find highest 2.2.x version
- if (!FindDotNetVersion(2, 2, hostRuntimeDirectory))
+ // Find highest 2.1 LTS version
+ if (!FindDotNetVersion(2, 1, hostRuntimeDirectory))
{
// Find highest 3.0.x version
if (!FindDotNetVersion(3, 0, hostRuntimeDirectory))
{
- // Find highest 3.1.x version
- if (!FindDotNetVersion(3, 1, hostRuntimeDirectory))
+ // Find highest 2.2.x version
+ if (!FindDotNetVersion(2, 2, hostRuntimeDirectory))
{
// Find highest 5.0.x version
if (!FindDotNetVersion(5, 0, hostRuntimeDirectory))
/**********************************************************************\
* Called when the managed SOS Host loads/initializes SOS.
\**********************************************************************/
-extern "C" HRESULT SOSInitializeByHost(SOSNetCoreCallbacks* callbacks, int callbacksSize, LPCSTR tempDirectory, bool isDesktop, LPCSTR dacFilePath, LPCSTR dbiFilePath, bool symbolStoreEnabled)
+extern "C" HRESULT SOSInitializeByHost(
+ SOSNetCoreCallbacks* callbacks,
+ int callbacksSize,
+ LPCSTR tempDirectory,
+ LPCSTR runtimeModulePath,
+ bool isDesktop,
+ LPCSTR dacFilePath,
+ LPCSTR dbiFilePath,
+ bool symbolStoreEnabled)
{
if (memcpy_s(&g_SOSNetCoreCallbacks, sizeof(g_SOSNetCoreCallbacks), callbacks, callbacksSize) != 0)
{
{
g_tmpPath = _strdup(tempDirectory);
}
+ if (runtimeModulePath != nullptr)
+ {
+ g_runtimeModulePath = _strdup(runtimeModulePath);
+ }
Runtime::SetDacDbiPath(isDesktop, dacFilePath, dbiFilePath);
#ifndef FEATURE_PAL
// When SOS is hosted on dotnet-dump, the ExtensionApis are not set so
\**********************************************************************/
void Runtime::DisplayStatus()
{
- ExtOut("%s runtime at %p (%08x)\n", GetRuntimeConfigurationName(GetRuntimeConfiguration()), m_address, m_size);
+ ExtOut("%s runtime at %p size %08llx\n", GetRuntimeConfigurationName(GetRuntimeConfiguration()), m_address, m_size);
if (m_runtimeDirectory != nullptr) {
ExtOut("Runtime directory: %s\n", m_runtimeDirectory);
}
table.WriteRow("BaseSize:", PrefixHex(vMethTable.BaseSize));
table.WriteRow("ComponentSize:", PrefixHex(vMethTable.ComponentSize));
+ table.WriteRow("DynamicStatics:", vMethTable.bIsDynamic ? "true" : "false");
+ table.WriteRow("ContainsPointers:", vMethTable.bContainsPointers ? "true" : "false");
table.WriteRow("Slots in VTable:", Decimal(vMethTable.wNumMethods));
table.SetColWidth(0, 29);
private string GetDacFile(ClrInfo clrInfo)
{
if (_dacFilePath == null)
- {
- string dac = clrInfo.LocalMatchingDac;
- if (dac != null && File.Exists(dac))
+ {
+ Debug.Assert(!string.IsNullOrEmpty(clrInfo.DacInfo.FileName));
+ var analyzeContext = _serviceProvider.GetService<AnalyzeContext>();
+ string dacFilePath = null;
+ if (!string.IsNullOrEmpty(analyzeContext.RuntimeModuleDirectory))
{
- _dacFilePath = dac;
+ dacFilePath = Path.Combine(analyzeContext.RuntimeModuleDirectory, clrInfo.DacInfo.FileName);
+ if (File.Exists(dacFilePath))
+ {
+ _dacFilePath = dacFilePath;
+ }
}
- else if (SymbolReader.IsSymbolStoreEnabled())
+ if (_dacFilePath == null)
{
- string dacFileName = Path.GetFileName(dac ?? clrInfo.DacInfo.FileName);
- if (dacFileName != null)
+ dacFilePath = clrInfo.LocalMatchingDac;
+ if (!string.IsNullOrEmpty(dacFilePath) && File.Exists(dacFilePath))
{
- SymbolStoreKey key = null;
-
- if (clrInfo.ModuleInfo.BuildId != null)
+ _dacFilePath = dacFilePath;
+ }
+ else if (SymbolReader.IsSymbolStoreEnabled())
+ {
+ string dacFileName = Path.GetFileName(dacFilePath ?? clrInfo.DacInfo.FileName);
+ if (dacFileName != null)
{
- IEnumerable<SymbolStoreKey> keys = ELFFileKeyGenerator.GetKeys(
- KeyTypeFlags.ClrKeys, clrInfo.ModuleInfo.FileName, clrInfo.ModuleInfo.BuildId, symbolFile: false, symbolFileName: null);
+ SymbolStoreKey key = null;
+
+ if (clrInfo.ModuleInfo.BuildId != null)
+ {
+ IEnumerable<SymbolStoreKey> keys = ELFFileKeyGenerator.GetKeys(
+ KeyTypeFlags.ClrKeys, clrInfo.ModuleInfo.FileName, clrInfo.ModuleInfo.BuildId, symbolFile: false, symbolFileName: null);
- key = keys.SingleOrDefault((k) => Path.GetFileName(k.FullPathName) == dacFileName);
+ key = keys.SingleOrDefault((k) => Path.GetFileName(k.FullPathName) == dacFileName);
- if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
+ {
+ // We are opening a Linux dump on Windows
+ // We need to use the Windows index and filename
+ key = new SymbolStoreKey(key.Index.Replace("libmscordaccore.so", "mscordaccore.dll"),
+ key.FullPathName.Replace("libmscordaccore.so", "mscordaccore.dll"),
+ key.IsClrSpecialFile,
+ key.PdbChecksums);
+ }
+ }
+ else
{
- // We are opening a Linux dump on Windows
- // We need to use the Windows index and filename
- key = new SymbolStoreKey(key.Index.Replace("libmscordaccore.so", "mscordaccore.dll"),
- key.FullPathName.Replace("libmscordaccore.so", "mscordaccore.dll"),
- key.IsClrSpecialFile,
- key.PdbChecksums);
+ // Use the coreclr.dll's id (timestamp/filesize) to download the the dac module.
+ key = PEFileKeyGenerator.GetKey(dacFileName, clrInfo.ModuleInfo.TimeStamp, clrInfo.ModuleInfo.FileSize);
}
- }
- else
- {
- // Use the coreclr.dll's id (timestamp/filesize) to download the the dac module.
- key = PEFileKeyGenerator.GetKey(dacFileName, clrInfo.ModuleInfo.TimeStamp, clrInfo.ModuleInfo.FileSize);
- }
- if (key != null)
- {
- // Now download the DAC module from the symbol server
- _dacFilePath = SymbolReader.GetSymbolFile(key);
+ if (key != null)
+ {
+ // Now download the DAC module from the symbol server
+ _dacFilePath = SymbolReader.GetSymbolFile(key);
+ }
}
}
- }
- if (_dacFilePath == null)
- {
- throw new FileNotFoundException($"Could not find matching DAC for this runtime: {clrInfo.ModuleInfo.FileName}");
+ if (_dacFilePath == null)
+ {
+ throw new FileNotFoundException($"Could not find matching DAC for this runtime: {clrInfo.ModuleInfo.FileName}");
+ }
}
_isDesktop = clrInfo.Flavor == ClrFlavor.Desktop;
}
{
[Command(Name = "exit", Help = "Exit interactive mode.")]
[CommandAlias(Name = "quit")]
+ [CommandAlias(Name = "q")]
public class ExitCommand : CommandBase
{
public override void Invoke()
[Command(Name = "histobjfind", AliasExpansion = "HistObjFind", Help = "Displays all the log entries that reference an object at the specified address.")]
[Command(Name = "histroot", AliasExpansion = "HistRoot", Help = "Displays information related to both promotions and relocations of the specified root.")]
[Command(Name = "setsymbolserver", AliasExpansion = "SetSymbolServer", Help = "Enables the symbol server support ")]
- [Command(Name = "setclrpath", AliasExpansion = "setclrpath", Platform = CommandPlatform.Windows, Help = "Set the path to load the runtime DAC/DBI files.")]
[Command(Name = "dumprcw", AliasExpansion = "DumpRCW", Platform = CommandPlatform.Windows, Help = "Displays information about a Runtime Callable Wrapper.")]
[Command(Name = "dumpccw", AliasExpansion = "DumpCCW", Platform = CommandPlatform.Windows, Help = "Displays information about a COM Callable Wrapper.")]
[Command(Name = "dumppermissionset",AliasExpansion = "DumpPermissionSet", Platform = CommandPlatform.Windows, Help = "Displays a PermissionSet object (debug build only).")]
namespace Microsoft.Diagnostics.Tools.Dump
{
- [Command(Name = "setclrpath", Platform = CommandPlatform.Linux | CommandPlatform.OSX, Help = "Set the path to load coreclr DAC/DBI files.")]
+ [Command(Name = "setclrpath", Help = "Set the path to load coreclr DAC/DBI files.")]
public class SetClrPath: CommandBase
{
public AnalyzeContext AnalyzeContext { get; set; }