From dbf6921a9ffb0d5d7c4e4a63a175a68d522784f3 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 5 Apr 2013 09:34:01 -0400 Subject: [PATCH] Extend DebuggerInterface for semaphore information retrieval. --- .../debugger_interface/DebuggerInterface.cpp | 20 +++++++++++++++++++ .../debugger_interface/DebuggerInterface.h | 3 +++ 2 files changed, 23 insertions(+) diff --git a/src/apps/debugger/debugger_interface/DebuggerInterface.cpp b/src/apps/debugger/debugger_interface/DebuggerInterface.cpp index 0bcb36bbb5..7093a5041d 100644 --- a/src/apps/debugger/debugger_interface/DebuggerInterface.cpp +++ b/src/apps/debugger/debugger_interface/DebuggerInterface.cpp @@ -27,6 +27,7 @@ #include "CpuState.h" #include "DebugEvent.h" #include "ImageInfo.h" +#include "SemaphoreInfo.h" #include "SymbolInfo.h" #include "ThreadInfo.h" @@ -539,6 +540,25 @@ DebuggerInterface::GetAreaInfos(BObjectList& infos) } +status_t +DebuggerInterface::GetSemaphoreInfos(BObjectList& infos) +{ + // get the team's semaphores + sem_info semInfo; + int32 cookie = 0; + while (get_next_sem_info(fTeamID, &cookie, &semInfo) == B_OK) { + SemaphoreInfo* info = new(std::nothrow) SemaphoreInfo(fTeamID, + semInfo.sem, semInfo.name, semInfo.count, semInfo.latest_holder); + if (info == NULL || !infos.AddItem(info)) { + delete info; + return B_NO_MEMORY; + } + } + + return B_OK; +} + + status_t DebuggerInterface::GetSymbolInfos(team_id team, image_id image, BObjectList& infos) diff --git a/src/apps/debugger/debugger_interface/DebuggerInterface.h b/src/apps/debugger/debugger_interface/DebuggerInterface.h index 3f8d2a09c6..2befa2ed74 100644 --- a/src/apps/debugger/debugger_interface/DebuggerInterface.h +++ b/src/apps/debugger/debugger_interface/DebuggerInterface.h @@ -19,6 +19,7 @@ class CpuState; class DebugEvent; class AreaInfo; class ImageInfo; +class SemaphoreInfo; class SymbolInfo; class ThreadInfo; @@ -56,6 +57,8 @@ public: virtual status_t GetThreadInfos(BObjectList& infos); virtual status_t GetImageInfos(BObjectList& infos); virtual status_t GetAreaInfos(BObjectList& infos); + virtual status_t GetSemaphoreInfos( + BObjectList& infos); virtual status_t GetSymbolInfos(team_id team, image_id image, BObjectList& infos); virtual status_t GetSymbolInfo(team_id team, image_id image,