summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter LaFosse <peter@vector35.com>2023-02-03 10:05:44 -0500
committerPeter LaFosse <peter@vector35.com>2023-02-03 10:06:12 -0500
commit5bd02a445a8f7e4d560175ed6cdc35458ad78e7a (patch)
tree41376b203fd0e3a02e41f9e01ce755d1c13ab760
parent5b41ad47e381a8807e921977517c0108dfbf6367 (diff)
Expose GetSymbolsByRawName in the C++ API
-rw-r--r--binaryninjaapi.h8
-rw-r--r--binaryview.cpp17
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;