<rdar://problem/10997402>
This fix really needed to happen as a previous fix I had submitted for
calculating symbol sizes made many symbols appear to have zero size since
the function that was calculating the symbol size was calling another function
that would cause the calculation to happen again. This resulted in some symbols
having zero size when they shouldn't. This could then cause infinite stack
traces and many other side affects.
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@152244 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
index 68121b0..e5e0473 100644
--- a/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
+++ b/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp
@@ -606,10 +606,9 @@
Symbol *symbol = symtab->FindSymbolContainingFileAddress(file_addr);
if (symbol)
{
- const AddressRange *range_ptr = symbol->GetAddressRangePtr();
- if (range_ptr)
+ if (symbol->ValueIsAddress())
{
- SectionSP section_sp (range_ptr->GetBaseAddress().GetSection());
+ SectionSP section_sp (symbol->GetAddress().GetSection());
if (section_sp)
{
const SectionType section_type = section_sp->GetType();
@@ -1881,8 +1880,8 @@
sym[sym_idx].SetID (nlist_idx);
sym[sym_idx].SetType (type);
- sym[sym_idx].GetAddressRangeRef().GetBaseAddress().SetSection (symbol_section);
- sym[sym_idx].GetAddressRangeRef().GetBaseAddress().SetOffset (symbol_value);
+ sym[sym_idx].GetAddress().SetSection (symbol_section);
+ sym[sym_idx].GetAddress().SetOffset (symbol_value);
sym[sym_idx].SetFlags (nlist.n_type << 16 | nlist.n_desc);
++sym_idx;
@@ -1905,7 +1904,7 @@
nlist_idx < symtab_load_command.nsyms && (global_symbol = symtab->FindSymbolWithType (eSymbolTypeData, Symtab::eDebugYes, Symtab::eVisibilityAny, nlist_idx)) != NULL;
nlist_idx++)
{
- if (global_symbol->GetValue().GetFileAddress() == 0)
+ if (global_symbol->GetAddress().GetFileAddress() == 0)
{
std::vector<uint32_t> indexes;
if (symtab->AppendSymbolIndexesWithName (global_symbol->GetMangled().GetName(), indexes) > 0)
@@ -1917,7 +1916,7 @@
symbol_ptr = symtab->SymbolAtIndex(*pos);
if (symbol_ptr != global_symbol && symbol_ptr->IsDebug() == false)
{
- global_symbol->SetValue(symbol_ptr->GetValue());
+ global_symbol->GetAddress() = symbol_ptr->GetAddress();
break;
}
}
@@ -1997,8 +1996,8 @@
// for no good reason.
stub_symbol->SetType (eSymbolTypeTrampoline);
stub_symbol->SetExternal (false);
- stub_symbol->GetAddressRangeRef().GetBaseAddress() = so_addr;
- stub_symbol->GetAddressRangeRef().SetByteSize (symbol_stub_byte_size);
+ stub_symbol->GetAddress() = so_addr;
+ stub_symbol->SetByteSize (symbol_stub_byte_size);
}
else
{
@@ -2009,8 +2008,8 @@
sym[sym_idx].GetMangled() = stub_symbol->GetMangled();
sym[sym_idx].SetType (eSymbolTypeTrampoline);
sym[sym_idx].SetIsSynthetic (true);
- sym[sym_idx].GetAddressRangeRef().GetBaseAddress() = so_addr;
- sym[sym_idx].GetAddressRangeRef().SetByteSize (symbol_stub_byte_size);
+ sym[sym_idx].GetAddress() = so_addr;
+ sym[sym_idx].SetByteSize (symbol_stub_byte_size);
++sym_idx;
}
}
@@ -2252,7 +2251,7 @@
if (module_sp->FindSymbolsWithNameAndType(ConstString ("start"), eSymbolTypeCode, contexts))
{
if (contexts.GetContextAtIndex(0, context))
- m_entry_point_address = context.symbol->GetValue();
+ m_entry_point_address = context.symbol->GetAddress();
}
}
}