Skip to content

Commit

Permalink
Allow REPL to start without dump path
Browse files Browse the repository at this point in the history
  • Loading branch information
mikem8361 committed Dec 28, 2024
1 parent 25f53c8 commit 7453831
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
14 changes: 8 additions & 6 deletions src/Tools/dotnet-dump/Analyzer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ public Analyzer()

public Task<int> Analyze(FileInfo dump_path, string[] command)
{
_fileLoggingConsoleService.WriteLine($"Loading core dump: {dump_path} ...");

// Attempt to load the persisted command history
string historyFileName = null;
try
Expand Down Expand Up @@ -97,13 +95,17 @@ or NotSupportedException

try
{
ITarget target = dumpTargetFactory.OpenDump(dump_path.FullName);
contextService.SetCurrentTarget(target);

// Automatically enable symbol server support, default cache and search for symbols in the dump directory
symbolService.AddSymbolServer(retryCount: 3);
symbolService.AddCachePath(symbolService.DefaultSymbolCache);
symbolService.AddDirectoryPath(Path.GetDirectoryName(dump_path.FullName));

if (dump_path is not null)
{
_fileLoggingConsoleService.WriteLine($"Loading core dump: {dump_path} ...");
ITarget target = dumpTargetFactory.OpenDump(dump_path.FullName);
contextService.SetCurrentTarget(target);
symbolService.AddDirectoryPath(Path.GetDirectoryName(dump_path.FullName));
}

// Run the commands from the dotnet-dump command line. Any errors/exceptions from the
// command execution will be displayed and dotnet-dump exited.
Expand Down
3 changes: 2 additions & 1 deletion src/Tools/dotnet-dump/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,8 @@ private static Argument DumpPath() =>
new Argument<FileInfo>(
name: "dump_path")
{
Description = "Name of the dump file to analyze."
Description = "Name of the dump file to analyze.",
Arity = ArgumentArity.ZeroOrOne
}.ExistingOnly();

private static Option RunCommand() =>
Expand Down

0 comments on commit 7453831

Please sign in to comment.