diff --git a/src/apps/debugger/controllers/DebugReportGenerator.cpp b/src/apps/debugger/controllers/DebugReportGenerator.cpp index 49c37995b6..10407fceff 100644 --- a/src/apps/debugger/controllers/DebugReportGenerator.cpp +++ b/src/apps/debugger/controllers/DebugReportGenerator.cpp @@ -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 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) { diff --git a/src/apps/debugger/controllers/DebugReportGenerator.h b/src/apps/debugger/controllers/DebugReportGenerator.h index 457bc9cf6f..0a9e680457 100644 --- a/src/apps/debugger/controllers/DebugReportGenerator.h +++ b/src/apps/debugger/controllers/DebugReportGenerator.h @@ -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);