<rdar://problem/12750060>
Add the ability to get a symbol or symbols by name and type from a SBModule, and also the ability to get all symbols by name and type from SBTarget objects.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@169205 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/scripts/Python/interface/SBModule.i b/scripts/Python/interface/SBModule.i
index ccfbed6..b98afde 100644
--- a/scripts/Python/interface/SBModule.i
+++ b/scripts/Python/interface/SBModule.i
@@ -177,6 +177,15 @@
lldb::SBSymbol
GetSymbolAtIndex (size_t idx);
+ lldb::SBSymbol
+ FindSymbol (const char *name,
+ lldb::SymbolType type = eSymbolTypeAny);
+
+ lldb::SBSymbolContextList
+ FindSymbols (const char *name,
+ lldb::SymbolType type = eSymbolTypeAny);
+
+
size_t
GetNumSections ();
@@ -269,9 +278,10 @@
return self.sbmodule.GetSymbolAtIndex(key)
elif type(key) is str:
matches = []
- for idx in range(count):
- symbol = self.sbmodule.GetSymbolAtIndex(idx)
- if symbol.name == key or symbol.mangled == key:
+ sc_list = self.sbmodule.FindSymbols(key)
+ for sc in sc_list:
+ symbol = sc.symbol
+ if symbol:
matches.append(symbol)
return matches
elif isinstance(key, self.re_compile_type):
diff --git a/scripts/Python/interface/SBTarget.i b/scripts/Python/interface/SBTarget.i
index 8a304ee..bc4c228 100644
--- a/scripts/Python/interface/SBTarget.i
+++ b/scripts/Python/interface/SBTarget.i
@@ -687,6 +687,9 @@
lldb::SBInstructionList
GetInstructions (lldb::SBAddress base_addr, const void *buf, size_t size);
+ lldb::SBSymbolContextList
+ FindSymbols (const char *name, lldb::SymbolType type = eSymbolTypeAny);
+
bool
GetDescription (lldb::SBStream &description, lldb::DescriptionLevel description_level);