[Lldb-commits] [lldb] r121112 - in /lldb/trunk: include/lldb/API/SBModule.h include/lldb/API/SBSymbol.h source/API/SBModule.cpp source/API/SBSymbol.cpp
Greg Clayton
gclayton at apple.com
Mon Dec 6 21:40:32 PST 2010
Author: gclayton
Date: Mon Dec 6 23:40:31 2010
New Revision: 121112
URL: http://llvm.org/viewvc/llvm-project?rev=121112&view=rev
Log:
Added symbol table access through the module for now. We might need to expose
a SBSymtab class, but for now, we expose the symbols through the module.
Modified:
lldb/trunk/include/lldb/API/SBModule.h
lldb/trunk/include/lldb/API/SBSymbol.h
lldb/trunk/source/API/SBModule.cpp
lldb/trunk/source/API/SBSymbol.cpp
Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=121112&r1=121111&r2=121112&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Mon Dec 6 23:40:31 2010
@@ -59,6 +59,12 @@
bool
GetDescription (lldb::SBStream &description);
+ size_t
+ GetNumSymbols ();
+
+ SBSymbol
+ GetSymbolAtIndex (size_t idx);
+
private:
friend class SBSymbolContext;
friend class SBTarget;
Modified: lldb/trunk/include/lldb/API/SBSymbol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBSymbol.h?rev=121112&r1=121111&r2=121112&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBSymbol.h (original)
+++ lldb/trunk/include/lldb/API/SBSymbol.h Mon Dec 6 23:40:31 2010
@@ -62,9 +62,13 @@
private:
friend class SBFrame;
+ friend class SBModule;
friend class SBSymbolContext;
SBSymbol (lldb_private::Symbol *lldb_object_ptr);
+
+ void
+ SetSymbol (lldb_private::Symbol *lldb_object_ptr);
lldb_private::Symbol *m_opaque_ptr;
};
Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=121112&r1=121111&r2=121112&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Mon Dec 6 23:40:31 2010
@@ -181,3 +181,36 @@
return true;
}
+
+size_t
+SBModule::GetNumSymbols ()
+{
+ if (m_opaque_sp)
+ {
+ ObjectFile *obj_file = m_opaque_sp->GetObjectFile();
+ if (obj_file)
+ {
+ Symtab *symtab = obj_file->GetSymtab();
+ if (symtab)
+ return symtab->GetNumSymbols();
+ }
+ }
+ return 0;
+}
+
+SBSymbol
+SBModule::GetSymbolAtIndex (size_t idx)
+{
+ SBSymbol sb_symbol;
+ if (m_opaque_sp)
+ {
+ ObjectFile *obj_file = m_opaque_sp->GetObjectFile();
+ if (obj_file)
+ {
+ Symtab *symtab = obj_file->GetSymtab();
+ if (symtab)
+ sb_symbol.SetSymbol(symtab->SymbolAtIndex (idx));
+ }
+ }
+ return sb_symbol;
+}
Modified: lldb/trunk/source/API/SBSymbol.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbol.cpp?rev=121112&r1=121111&r2=121112&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbol.cpp (original)
+++ lldb/trunk/source/API/SBSymbol.cpp Mon Dec 6 23:40:31 2010
@@ -41,12 +41,17 @@
return *this;
}
-
SBSymbol::~SBSymbol ()
{
m_opaque_ptr = NULL;
}
+void
+SBSymbol::SetSymbol (lldb_private::Symbol *lldb_object_ptr)
+{
+ m_opaque_ptr = lldb_object_ptr;
+}
+
bool
SBSymbol::IsValid () const
{
More information about the lldb-commits
mailing list