diff options
| author | Peter LaFosse <peter@vector35.com> | 2023-02-03 10:05:44 -0500 |
|---|---|---|
| committer | Peter LaFosse <peter@vector35.com> | 2023-02-03 10:06:12 -0500 |
| commit | 5bd02a445a8f7e4d560175ed6cdc35458ad78e7a (patch) | |
| tree | 41376b203fd0e3a02e41f9e01ce755d1c13ab760 | |
| parent | 5b41ad47e381a8807e921977517c0108dfbf6367 (diff) | |
Expose GetSymbolsByRawName in the C++ API
| -rw-r--r-- | binaryninjaapi.h | 8 | ||||
| -rw-r--r-- | binaryview.cpp | 17 |
2 files changed, 25 insertions, 0 deletions
diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 05a5e1df..59b41e63 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -3959,6 +3959,14 @@ namespace BinaryNinja { */ std::vector<Ref<Symbol>> GetSymbolsByName(const std::string& name, const NameSpace& nameSpace = NameSpace()); + /*! Retrieves the list of all Symbol objects with a given raw name + + \param name RawName to search for + \param nameSpace The optional namespace of the symbols to retrieve + \return A list of symbols + */ + std::vector<Ref<Symbol>> GetSymbolsByRawName(const std::string& name, const NameSpace& nameSpace = NameSpace()); + /*! Retrieves the list of all Symbol objects \param nameSpace The optional namespace of the symbols to retrieve diff --git a/binaryview.cpp b/binaryview.cpp index 7232e647..ef8889ca 100644 --- a/binaryview.cpp +++ b/binaryview.cpp @@ -2448,6 +2448,23 @@ vector<Ref<Symbol>> BinaryView::GetSymbolsByName(const string& name, const NameS } +vector<Ref<Symbol>> BinaryView::GetSymbolsByRawName(const string& name, const NameSpace& nameSpace) +{ + size_t count; + BNNameSpace ns = nameSpace.GetAPIObject(); + BNSymbol** syms = BNGetSymbolsByRawName(m_object, name.c_str(), &count, &ns); + NameSpace::FreeAPIObject(&ns); + + vector<Ref<Symbol>> result; + result.reserve(count); + for (size_t i = 0; i < count; i++) + result.push_back(new Symbol(BNNewSymbolReference(syms[i]))); + + BNFreeSymbolList(syms, count); + return result; +} + + vector<Ref<Symbol>> BinaryView::GetSymbols(const NameSpace& nameSpace) { size_t count; |
