Add command line option to ask Debugger to save a report.

- When invoked, starts up the CLI such that it bypasses waiting for
  input and instead save a crash report of the running team, then exits.
  Mainly intended to be used by debug_server.
This commit is contained in:
Rene Gollent
2012-11-23 13:04:49 -05:00
parent 137bb1e2aa
commit 6799de315e
3 changed files with 42 additions and 9 deletions
@@ -88,9 +88,12 @@ private:
// #pragma mark - CommandLineUserInterface
CommandLineUserInterface::CommandLineUserInterface()
CommandLineUserInterface::CommandLineUserInterface(bool saveReport,
const char* reportPath)
:
fCommands(20, true),
fReportPath(reportPath),
fSaveReport(saveReport),
fShowSemaphore(-1),
fShown(false),
fTerminating(false)
@@ -202,7 +205,18 @@ CommandLineUserInterface::Run()
if (error != B_OK)
return;
_InputLoop();
if (!fSaveReport)
_InputLoop();
else {
ArgumentVector args;
char buffer[256];
const char* parseErrorLocation;
snprintf(buffer, sizeof(buffer), "save-report %s",
fReportPath != NULL ? fReportPath : "");
args.Parse(buffer, &parseErrorLocation);
_ExecuteCommand(args.ArgumentCount(), args.Arguments());
fContext.QuitSession(true);
}
// Release the Show() semaphore to signal Terminate().
release_sem(fShowSemaphore);