Implement MemoryBlockRetrievalFailed() hook in
DebugReportGenerator. Use it to report failure to dump the
stack memory region instead of hanging forever waiting for
the request to succeed.
This commit is contained in:
Rene Gollent
2013-04-19 17:48:46 -04:00
parent 808bcad05c
commit 3c6ba4733b
2 changed files with 32 additions and 2 deletions
@@ -50,6 +50,7 @@ DebugReportGenerator::DebugReportGenerator(::Team* team,
fListener(listener),
fWaitingNode(NULL),
fCurrentBlock(NULL),
fBlockRetrievalStatus(B_OK),
fTraceWaitingThread(NULL)
{
fTeam->AddListener(this);
@@ -186,6 +187,24 @@ DebugReportGenerator::MemoryBlockRetrieved(TeamMemoryBlock* block)
fCurrentBlock = NULL;
}
fBlockRetrievalStatus = B_OK;
fCurrentBlock = block;
release_sem(fTeamDataSem);
}
void
DebugReportGenerator::MemoryBlockRetrievalFailed(TeamMemoryBlock* block,
status_t result)
{
if (fCurrentBlock != NULL) {
fCurrentBlock->ReleaseReference();
fCurrentBlock = NULL;
}
fBlockRetrievalStatus = result;
fCurrentBlock = block;
release_sem(fTeamDataSem);
}
@@ -484,8 +503,16 @@ DebugReportGenerator::_DumpStackFrameMemory(BString& _output,
}
_output << "\t\t\tFrame memory:\n";
UiUtils::DumpMemory(_output, 3, fCurrentBlock, startAddress, 1, 16,
endAddress - startAddress);
if (fBlockRetrievalStatus == B_OK) {
UiUtils::DumpMemory(_output, 3, fCurrentBlock, startAddress, 1, 16,
endAddress - startAddress);
} else {
BString data;
data.SetToFormat("\t\t\tUnavailable (%s)\n", strerror(
fBlockRetrievalStatus));
_output += data;
}
}
@@ -50,6 +50,8 @@ private:
// TeamMemoryBlock::Listener
virtual void MemoryBlockRetrieved(TeamMemoryBlock* block);
virtual void MemoryBlockRetrievalFailed(
TeamMemoryBlock* block, status_t result);
// ValueNodeContainer::Listener
virtual void ValueNodeValueChanged(ValueNode* node);
@@ -81,6 +83,7 @@ private:
UserInterfaceListener* fListener;
ValueNode* fWaitingNode;
TeamMemoryBlock* fCurrentBlock;
status_t fBlockRetrievalStatus;
::Thread* fTraceWaitingThread;
};