Debugger: Implement remainder of #12729.

UserInterfaceListener:
- Add request hook for writing a core file. Implement in TeamDebugger.

Jobs/WriteCoreFileJob:
- Add new job to actually dispatch the core file request via the debugger
  interface.

Team{::Listener}
- Add listener event + hook for notifications when a core file gets written.
  Implement in CLI.

CliContext:
- Add event flag for core file changed.

CommandLineUserInterface:
- Add 'write-core' command. This optionally takes a path to write the core to,
  otherwise one is automatically generated by, similarly to debug reports. As
  such, one can now generate cores for things like app_server and registrar
  crashes if desired, in addition to reports.
This commit is contained in:
Rene Gollent
2016-04-26 22:36:26 -04:00
parent 5c8966c740
commit e2d845a47f
16 changed files with 284 additions and 8 deletions
@@ -846,6 +846,16 @@ TeamDebugger::MessageReceived(BMessage* message)
break;
}
case MSG_WRITE_CORE_FILE:
{
entry_ref ref;
if (message->FindRef("target", &ref) != B_OK)
break;
_HandleWriteCoreFile(ref);
break;
}
case MSG_THREAD_STATE_CHANGED:
{
int32 threadID;
@@ -1304,6 +1314,15 @@ TeamDebugger::DebugReportRequested(entry_ref* targetPath)
}
void
TeamDebugger::WriteCoreFileRequested(entry_ref* targetPath)
{
BMessage message(MSG_WRITE_CORE_FILE);
message.AddRef("target", targetPath);
PostMessage(&message);
}
void
TeamDebugger::TeamRestartRequested()
{
@@ -2305,6 +2324,19 @@ TeamDebugger::_HandleEvaluateExpression(SourceLanguage* language,
}
void
TeamDebugger::_HandleWriteCoreFile(const entry_ref& targetPath)
{
status_t result = fWorker->ScheduleJob(
new(std::nothrow) WriteCoreFileJob(fTeam, fDebuggerInterface,
targetPath));
if (result != B_OK) {
_NotifyUser("Write Core File", "Failed to write core file: %s",
strerror(result));
}
}
status_t
TeamDebugger::_HandleSetArguments(int argc, const char* const* argv)
{