Added some functions to our API related to classifying symbols as code, data,
const data, etc, and also for SBAddress objects to classify their type of
section they are in and also getting the module for a section offset address.
lldb::SymbolType SBSymbol::GetType();
lldb::SectionType SBAddress::GetSectionType ();
lldb::SBModule SBAddress::GetModule ();
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128602 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBAddress.cpp b/source/API/SBAddress.cpp
index 61ad71b..6c357f9 100644
--- a/source/API/SBAddress.cpp
+++ b/source/API/SBAddress.cpp
@@ -12,6 +12,7 @@
#include "lldb/API/SBStream.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/Log.h"
+#include "lldb/Core/Module.h"
#include "lldb/Host/Mutex.h"
#include "lldb/Target/Target.h"
@@ -170,3 +171,31 @@
return true;
}
+
+SectionType
+SBAddress::GetSectionType ()
+{
+ if (m_opaque_ap.get())
+ {
+ const Section *section = m_opaque_ap->GetSection();
+ if (section)
+ return section->GetType();
+ }
+ return eSectionTypeInvalid;
+}
+
+
+SBModule
+SBAddress::GetModule ()
+{
+ SBModule sb_module;
+ if (m_opaque_ap.get())
+ {
+ const Module *module = m_opaque_ap->GetModule();
+ if (module)
+ *sb_module = module->GetSP();
+ }
+ return sb_module;
+}
+
+
diff --git a/source/API/SBSymbol.cpp b/source/API/SBSymbol.cpp
index ef8af55..ce232bf 100644
--- a/source/API/SBSymbol.cpp
+++ b/source/API/SBSymbol.cpp
@@ -198,3 +198,11 @@
return m_opaque_ptr->GetPrologueByteSize();
return 0;
}
+
+SymbolType
+SBSymbol::GetType ()
+{
+ if (m_opaque_ptr)
+ return m_opaque_ptr->GetType();
+ return eSymbolTypeInvalid;
+}
diff --git a/source/Core/Module.cpp b/source/Core/Module.cpp
index 708ff71..7ceff58 100644
--- a/source/Core/Module.cpp
+++ b/source/Core/Module.cpp
@@ -74,7 +74,7 @@
ModuleSP
-Module::GetSP ()
+Module::GetSP () const
{
return ModuleList::GetModuleSP (this);
}
diff --git a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
index 991d929..735fb54 100644
--- a/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
+++ b/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h
@@ -168,7 +168,9 @@
const DWARFDebugRanges* DebugRanges() const;
const lldb_private::DataExtractor&
- GetCachedSectionData (uint32_t got_flag, lldb_private::SectionType sect_type, lldb_private::DataExtractor &data);
+ GetCachedSectionData (uint32_t got_flag,
+ lldb::SectionType sect_type,
+ lldb_private::DataExtractor &data);
static bool
SupportedVersion(uint16_t version);