summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/Core/Section.h43
-rw-r--r--lldb/source/Core/Section.cpp19
2 files changed, 59 insertions, 3 deletions
diff --git a/lldb/include/lldb/Core/Section.h b/lldb/include/lldb/Core/Section.h
index 65d408e2986..8c92f1ba667 100644
--- a/lldb/include/lldb/Core/Section.h
+++ b/lldb/include/lldb/Core/Section.h
@@ -64,9 +64,6 @@ public:
lldb::SectionSP
FindSectionContainingFileAddress (lldb::addr_t addr, uint32_t depth = UINT32_MAX) const;
- bool
- GetSectionData (const DataExtractor& module_data, DataExtractor& section_data) const;
-
// Get the number of sections in this list only
size_t
GetSize () const
@@ -288,6 +285,46 @@ public:
return m_obj_file;
}
+ //------------------------------------------------------------------
+ /// Read the section data from the object file that the section
+ /// resides in.
+ ///
+ /// @param[in] dst
+ /// Where to place the data
+ ///
+ /// @param[in] dst_len
+ /// How many bytes of section data to read
+ ///
+ /// @param[in] offset
+ /// The offset in bytes within this section's data at which to
+ /// start copying data from.
+ ///
+ /// @return
+ /// The number of bytes read from the section, or zero if the
+ /// section has no data or \a offset is not a valid offset
+ /// in this section.
+ //------------------------------------------------------------------
+ lldb::offset_t
+ GetSectionData (void *dst, lldb::offset_t dst_len, lldb::offset_t offset = 0);
+
+ //------------------------------------------------------------------
+ /// Get the shared reference to the section data from the object
+ /// file that the section resides in. No copies of the data will be
+ /// make unless the object file has been read from memory. If the
+ /// object file is on disk, it will shared the mmap data for the
+ /// entire object file.
+ ///
+ /// @param[in] data
+ /// Where to place the data, address byte size, and byte order
+ ///
+ /// @return
+ /// The number of bytes read from the section, or zero if the
+ /// section has no data or \a offset is not a valid offset
+ /// in this section.
+ //------------------------------------------------------------------
+ lldb::offset_t
+ GetSectionData (DataExtractor& data) const;
+
uint32_t GetLog2Align()
{
return m_log2align;
diff --git a/lldb/source/Core/Section.cpp b/lldb/source/Core/Section.cpp
index 9a3f220beb4..cf1cbac8fd7 100644
--- a/lldb/source/Core/Section.cpp
+++ b/lldb/source/Core/Section.cpp
@@ -319,6 +319,25 @@ Section::Slide (addr_t slide_amount, bool slide_children)
return false;
}
+lldb::offset_t
+Section::GetSectionData (void *dst, lldb::offset_t dst_len, lldb::offset_t offset)
+{
+ if (m_obj_file)
+ return m_obj_file->ReadSectionData (this,
+ offset,
+ dst,
+ dst_len);
+ return 0;
+}
+
+lldb::offset_t
+Section::GetSectionData (DataExtractor& section_data) const
+{
+ if (m_obj_file)
+ return m_obj_file->ReadSectionData (this, section_data);
+ return 0;
+}
+
#pragma mark SectionList
SectionList::SectionList () :
OpenPOWER on IntegriCloud