[Lldb-commits] [lldb] r152942 - in /lldb/trunk: include/lldb/API/SBCompileUnit.h include/lldb/API/SBModule.h source/API/SBCompileUnit.cpp source/API/SBModule.cpp
Johnny Chen
johnny.chen at apple.com
Fri Mar 16 13:46:11 PDT 2012
Author: johnny
Date: Fri Mar 16 15:46:10 2012
New Revision: 152942
URL: http://llvm.org/viewvc/llvm-project?rev=152942&view=rev
Log:
Patch from dawn at burble.org:
GetSupportFileAtIndex(), GetNumSupportFiles(), FindSupportFileIndex():
Add API support for getting the list of files in a compilation unit.
GetNumCompileUnits(), GetCompileUnitAtIndex():
Add API support for retrieving the compilation units in a module.
Modified:
lldb/trunk/include/lldb/API/SBCompileUnit.h
lldb/trunk/include/lldb/API/SBModule.h
lldb/trunk/source/API/SBCompileUnit.cpp
lldb/trunk/source/API/SBModule.cpp
Modified: lldb/trunk/include/lldb/API/SBCompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBCompileUnit.h?rev=152942&r1=152941&r2=152942&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBCompileUnit.h (original)
+++ lldb/trunk/include/lldb/API/SBCompileUnit.h Fri Mar 16 15:46:10 2012
@@ -51,6 +51,15 @@
lldb::SBFileSpec *inline_file_spec,
bool exact) const;
+ SBFileSpec
+ GetSupportFileAtIndex (uint32_t idx) const;
+
+ uint32_t
+ GetNumSupportFiles () const;
+
+ uint32_t
+ FindSupportFileIndex (uint32_t start_idx, const SBFileSpec &sb_file, bool full);
+
bool
operator == (const lldb::SBCompileUnit &rhs) const;
@@ -64,6 +73,7 @@
friend class SBAddress;
friend class SBFrame;
friend class SBSymbolContext;
+ friend class SBModule;
SBCompileUnit (lldb_private::CompileUnit *lldb_object_ptr);
Modified: lldb/trunk/include/lldb/API/SBModule.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBModule.h?rev=152942&r1=152941&r2=152942&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBModule.h (original)
+++ lldb/trunk/include/lldb/API/SBModule.h Fri Mar 16 15:46:10 2012
@@ -108,6 +108,12 @@
bool
GetDescription (lldb::SBStream &description);
+ uint32_t
+ GetNumCompileUnits();
+
+ lldb::SBCompileUnit
+ GetCompileUnitAtIndex (uint32_t);
+
size_t
GetNumSymbols ();
Modified: lldb/trunk/source/API/SBCompileUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBCompileUnit.cpp?rev=152942&r1=152941&r2=152942&view=diff
==============================================================================
--- lldb/trunk/source/API/SBCompileUnit.cpp (original)
+++ lldb/trunk/source/API/SBCompileUnit.cpp Fri Mar 16 15:46:10 2012
@@ -143,6 +143,52 @@
return index;
}
+uint32_t
+SBCompileUnit::GetNumSupportFiles () const
+{
+ if (m_opaque_ptr)
+ {
+ FileSpecList& support_files = m_opaque_ptr->GetSupportFiles ();
+ return support_files.GetSize();
+ }
+ return 0;
+}
+
+SBFileSpec
+SBCompileUnit::GetSupportFileAtIndex (uint32_t idx) const
+{
+ LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+
+ SBFileSpec sb_file_spec;
+ if (m_opaque_ptr)
+ {
+ FileSpecList &support_files = m_opaque_ptr->GetSupportFiles ();
+ FileSpec file_spec = support_files.GetFileSpecAtIndex(idx);
+ sb_file_spec.SetFileSpec(file_spec);
+ }
+
+ if (log)
+ {
+ SBStream sstr;
+ sb_file_spec.GetDescription (sstr);
+ log->Printf ("SBCompileUnit(%p)::GetGetFileSpecAtIndex (idx=%u) => SBFileSpec(%p): '%s'",
+ m_opaque_ptr, idx, sb_file_spec.get(), sstr.GetData());
+ }
+
+ return sb_file_spec;
+}
+
+uint32_t
+SBCompileUnit::FindSupportFileIndex (uint32_t start_idx, const SBFileSpec &sb_file, bool full)
+{
+ if (m_opaque_ptr)
+ {
+ FileSpecList &support_files = m_opaque_ptr->GetSupportFiles ();
+ return support_files.FindFileIndex(start_idx, sb_file.ref(), full);
+ }
+ return 0;
+}
+
bool
SBCompileUnit::IsValid () const
{
Modified: lldb/trunk/source/API/SBModule.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBModule.cpp?rev=152942&r1=152941&r2=152942&view=diff
==============================================================================
--- lldb/trunk/source/API/SBModule.cpp (original)
+++ lldb/trunk/source/API/SBModule.cpp Fri Mar 16 15:46:10 2012
@@ -266,6 +266,30 @@
return true;
}
+uint32_t
+SBModule::GetNumCompileUnits()
+{
+ ModuleSP module_sp (GetSP ());
+ if (module_sp)
+ {
+ return module_sp->GetNumCompileUnits ();
+ }
+ return 0;
+}
+
+SBCompileUnit
+SBModule::GetCompileUnitAtIndex (uint32_t index)
+{
+ SBCompileUnit sb_cu;
+ ModuleSP module_sp (GetSP ());
+ if (module_sp)
+ {
+ CompUnitSP cu_sp = module_sp->GetCompileUnitAtIndex (index);
+ sb_cu.reset(cu_sp.get());
+ }
+ return sb_cu;
+}
+
size_t
SBModule::GetNumSymbols ()
{
More information about the lldb-commits
mailing list