Dump semaphore information in reports.

Implements final part of #9510.
This commit is contained in:
Rene Gollent 2013-04-05 09:43:22 -04:00
parent 81ccf71fa2
commit 631624fb01
2 changed files with 34 additions and 0 deletions

View File

@ -23,6 +23,7 @@
#include "Image.h"
#include "MessageCodes.h"
#include "Register.h"
#include "SemaphoreInfo.h"
#include "StackFrame.h"
#include "StackTrace.h"
#include "StringUtils.h"
@ -129,6 +130,10 @@ DebugReportGenerator::_GenerateReport(const entry_ref& outputPath)
if (result != B_OK)
return result;
result = _DumpSemaphores(output);
if (result != B_OK)
return result;
result = _DumpRunningThreads(output);
if (result != B_OK)
return result;
@ -298,6 +303,34 @@ DebugReportGenerator::_DumpAreas(BString& _output)
}
status_t
DebugReportGenerator::_DumpSemaphores(BString& _output)
{
BObjectList<SemaphoreInfo> semaphores(20, true);
status_t result = fDebuggerInterface->GetSemaphoreInfos(semaphores);
if (result != B_OK)
return result;
_output << "\nSemaphores:\n";
BString data;
SemaphoreInfo* info;
for (int32 i = 0; (info = semaphores.ItemAt(i)) != NULL; i++) {
try {
data.SetToFormat("\t%s (%" B_PRId32 ") "
"Count: %" B_PRId32 ", Latest Holding Thread: %" B_PRId32 "\n",
info->Name().String(), info->SemID(), info->Count(),
info->LatestHolder());
_output << data;
} catch (...) {
return B_NO_MEMORY;
}
}
return B_OK;
}
status_t
DebugReportGenerator::_DumpRunningThreads(BString& _output)
{

View File

@ -60,6 +60,7 @@ private:
status_t _GenerateReportHeader(BString& _output);
status_t _DumpLoadedImages(BString& _output);
status_t _DumpAreas(BString& _output);
status_t _DumpSemaphores(BString& _output);
status_t _DumpRunningThreads(BString& _output);
status_t _DumpDebuggedThreadInfo(BString& _output,
::Thread* thread);