Debugger: Fix #11411.
CliContext/CommandLineUserInterface:
- Process the debug report event asynchronously. The missing lock that
was fixed in commit 5ac34e5a78 highlighted
a problem in how the CLI was handling the case where it was intended to
exit immediately after saving a report, since it issued the quit request
directly from the report event handler. This resulted in locking issues,
as the team debugger would then attempt to tear itself down, during which
it needs to acquire the team lock. However, that was already being held
by the thread in which the CLI was initiating the quit, resulting in a
deadlock.
This commit is contained in:
@@ -128,6 +128,8 @@ CommandLineUserInterface::Init(Team* team, UserInterfaceListener* listener)
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
fContext.SetInteractive(!fSaveReport);
|
||||
|
||||
error = _RegisterCommands();
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
@@ -229,11 +231,7 @@ CommandLineUserInterface::Run()
|
||||
if (error != B_OK)
|
||||
return;
|
||||
|
||||
if (!fSaveReport) {
|
||||
_InputLoop();
|
||||
// Release the Show() semaphore to signal Terminate().
|
||||
release_sem(fShowSemaphore);
|
||||
} else {
|
||||
if (fSaveReport) {
|
||||
ArgumentVector args;
|
||||
char buffer[256];
|
||||
const char* parseErrorLocation;
|
||||
@@ -245,6 +243,10 @@ CommandLineUserInterface::Run()
|
||||
} else
|
||||
_SubmitSaveReport();
|
||||
}
|
||||
|
||||
_InputLoop();
|
||||
// Release the Show() semaphore to signal Terminate().
|
||||
release_sem(fShowSemaphore);
|
||||
}
|
||||
|
||||
|
||||
@@ -266,21 +268,6 @@ CommandLineUserInterface::ThreadStateChanged(const Team::ThreadEvent& event)
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
CommandLineUserInterface::DebugReportChanged(
|
||||
const Team::DebugReportEvent& event)
|
||||
{
|
||||
printf("Successfully saved debug report to %s\n",
|
||||
event.GetReportPath());
|
||||
|
||||
if (fSaveReport) {
|
||||
fContext.QuitSession(true);
|
||||
// Release the Show() semaphore to signal Terminate().
|
||||
release_sem(fShowSemaphore);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*static*/ status_t
|
||||
CommandLineUserInterface::_InputLoopEntry(void* data)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user