From fcbdf27c55b63874540b7253b4b63e134482e661 Mon Sep 17 00:00:00 2001 From: mrexodia Date: Mon, 11 Jan 2016 23:43:38 +0100 Subject: [PATCH] DBG: shit with label --- src/dbg/_global.h | 1 + src/dbg/label.cpp | 21 +++++++++++++++++++++ src/dbg/label.h | 3 ++- 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/dbg/_global.h b/src/dbg/_global.h index 37416281..b3d27124 100644 --- a/src/dbg/_global.h +++ b/src/dbg/_global.h @@ -16,6 +16,7 @@ #include #include #include +#include #include #include #include "..\dbg_types.h" diff --git a/src/dbg/label.cpp b/src/dbg/label.cpp index 8f46769e..bbc3d1b7 100644 --- a/src/dbg/label.cpp +++ b/src/dbg/label.cpp @@ -289,3 +289,24 @@ bool LabelGetInfo(duint Address, LABELSINFO* info) return true; } + +void LabelEnumCb(std::function cbEnum, const char* module) +{ + SHARED_ACQUIRE(LockLabels); + + for(auto i = labels.begin(); i != labels.end();) + { + auto j = i; + ++i; // Increment here, because the callback might remove the current entry + + if(module && module[0] != '\0') + { + if(strcmp(j->second.mod, module) != 0) + continue; + } + + SHARED_RELEASE(); + cbEnum(j->second); + SHARED_REACQUIRE(); + } +} diff --git a/src/dbg/label.h b/src/dbg/label.h index 97b6c557..90020a40 100644 --- a/src/dbg/label.h +++ b/src/dbg/label.h @@ -20,4 +20,5 @@ void LabelCacheLoad(JSON root); bool LabelEnum(LABELSINFO* List, size_t* Size); void LabelClear(); void LabelGetList(std::vector & list); -bool LabelGetInfo(duint Address, LABELSINFO* info); \ No newline at end of file +bool LabelGetInfo(duint Address, LABELSINFO* info); +void LabelEnumCb(std::function cbEnum, const char* module = nullptr); \ No newline at end of file