aboutsummaryrefslogtreecommitdiff
path: root/source/Core/Section.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Core/Section.cpp')
-rw-r--r--source/Core/Section.cpp36
1 files changed, 24 insertions, 12 deletions
diff --git a/source/Core/Section.cpp b/source/Core/Section.cpp
index 28d7d93b9bb9..3267c1866221 100644
--- a/source/Core/Section.cpp
+++ b/source/Core/Section.cpp
@@ -13,6 +13,8 @@
#include "lldb/Target/SectionLoadList.h"
#include "lldb/Target/Target.h"
+#include <limits>
+
using namespace lldb;
using namespace lldb_private;
@@ -25,6 +27,7 @@ Section::Section (const ModuleSP &module_sp,
addr_t byte_size,
lldb::offset_t file_offset,
lldb::offset_t file_size,
+ uint32_t log2align,
uint32_t flags) :
ModuleChild (module_sp),
UserID (sect_id),
@@ -37,6 +40,7 @@ Section::Section (const ModuleSP &module_sp,
m_byte_size (byte_size),
m_file_offset (file_offset),
m_file_size (file_size),
+ m_log2align (log2align),
m_children (),
m_fake (false),
m_encrypted (false),
@@ -56,6 +60,7 @@ Section::Section (const lldb::SectionSP &parent_section_sp,
addr_t byte_size,
lldb::offset_t file_offset,
lldb::offset_t file_size,
+ uint32_t log2align,
uint32_t flags) :
ModuleChild (module_sp),
UserID (sect_id),
@@ -68,6 +73,7 @@ Section::Section (const lldb::SectionSP &parent_section_sp,
m_byte_size (byte_size),
m_file_offset (file_offset),
m_file_size (file_size),
+ m_log2align (log2align),
m_children (),
m_fake (false),
m_encrypted (false),
@@ -140,7 +146,7 @@ Section::GetLoadBaseAddress (Target *target) const
if (load_base_addr != LLDB_INVALID_ADDRESS)
load_base_addr += GetOffset();
}
- else
+ if (load_base_addr == LLDB_INVALID_ADDRESS)
{
load_base_addr = target->GetSectionLoadList().GetSectionLoadAddress (const_cast<Section *>(this)->shared_from_this());
}
@@ -331,10 +337,14 @@ SectionList::operator = (const SectionList& rhs)
size_t
SectionList::AddSection (const lldb::SectionSP& section_sp)
{
- assert (section_sp.get());
- size_t section_index = m_sections.size();
- m_sections.push_back(section_sp);
- return section_index;
+ if (section_sp)
+ {
+ size_t section_index = m_sections.size();
+ m_sections.push_back(section_sp);
+ return section_index;
+ }
+
+ return std::numeric_limits<size_t>::max ();
}
// Warning, this can be slow as it's removing items from a std::vector.
@@ -433,14 +443,16 @@ SectionList::FindSectionByName (const ConstString &section_dstr) const
for (sect_iter = m_sections.begin(); sect_iter != end && sect_sp.get() == NULL; ++sect_iter)
{
Section *child_section = sect_iter->get();
- assert (child_section);
- if (child_section->GetName() == section_dstr)
- {
- sect_sp = *sect_iter;
- }
- else
+ if (child_section)
{
- sect_sp = child_section->GetChildren().FindSectionByName(section_dstr);
+ if (child_section->GetName() == section_dstr)
+ {
+ sect_sp = *sect_iter;
+ }
+ else
+ {
+ sect_sp = child_section->GetChildren().FindSectionByName(section_dstr);
+ }
}
}
}