diff options
| author | Greg Clayton <gclayton@apple.com> | 2012-03-07 21:03:09 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2012-03-07 21:03:09 +0000 |
| commit | e761213428bb1ad8a8835ac4bf52233ae2121f3c (patch) | |
| tree | 746b13d7e3e796f69acc994362c23f732a380542 /lldb/source | |
| parent | 377f1f2d399171983cc26c13e81bad1699025dde (diff) | |
| download | bcm5719-llvm-e761213428bb1ad8a8835ac4bf52233ae2121f3c.tar.gz bcm5719-llvm-e761213428bb1ad8a8835ac4bf52233ae2121f3c.zip | |
<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.
llvm-svn: 152244
Diffstat (limited to 'lldb/source')
27 files changed, 147 insertions, 186 deletions
diff --git a/lldb/source/API/SBSymbol.cpp b/lldb/source/API/SBSymbol.cpp index 519f96be225..4a89567f3bb 100644 --- a/lldb/source/API/SBSymbol.cpp +++ b/lldb/source/API/SBSymbol.cpp @@ -129,16 +129,16 @@ SBSymbol::GetInstructions (SBTarget target) api_locker.Reset (target_sp->GetAPIMutex().GetMutex()); target_sp->CalculateExecutionContext (exe_ctx); } - const AddressRange *symbol_range = m_opaque_ptr->GetAddressRangePtr(); - if (symbol_range) + if (m_opaque_ptr->ValueIsAddress()) { - ModuleSP module_sp (symbol_range->GetBaseAddress().GetModule()); + ModuleSP module_sp (m_opaque_ptr->GetAddress().GetModule()); if (module_sp) { + AddressRange symbol_range (m_opaque_ptr->GetAddress(), m_opaque_ptr->GetByteSize()); sb_instructions.SetDisassembler (Disassembler::DisassembleRange (module_sp->GetArchitecture (), NULL, exe_ctx, - *symbol_range)); + symbol_range)); } } } @@ -161,14 +161,9 @@ SBAddress SBSymbol::GetStartAddress () { SBAddress addr; - if (m_opaque_ptr) + if (m_opaque_ptr && m_opaque_ptr->ValueIsAddress()) { - // Make sure the symbol is an address based symbol first: - AddressRange *symbol_arange_ptr = m_opaque_ptr->GetAddressRangePtr(); - if (symbol_arange_ptr) - { - addr.SetAddress (&symbol_arange_ptr->GetBaseAddress()); - } + addr.SetAddress (&m_opaque_ptr->GetAddress()); } return addr; } @@ -177,17 +172,13 @@ SBAddress SBSymbol::GetEndAddress () { SBAddress addr; - if (m_opaque_ptr) + if (m_opaque_ptr && m_opaque_ptr->ValueIsAddress()) { - AddressRange *symbol_arange_ptr = m_opaque_ptr->GetAddressRangePtr(); - if (symbol_arange_ptr) + lldb::addr_t range_size = m_opaque_ptr->GetByteSize(); + if (range_size > 0) { - addr_t byte_size = symbol_arange_ptr->GetByteSize(); - if (byte_size > 0) - { - addr.SetAddress (&symbol_arange_ptr->GetBaseAddress()); - addr->Slide (byte_size); - } + addr.SetAddress (&m_opaque_ptr->GetAddress()); + addr->Slide (m_opaque_ptr->GetByteSize()); } } return addr; diff --git a/lldb/source/Breakpoint/BreakpointResolverName.cpp b/lldb/source/Breakpoint/BreakpointResolverName.cpp index 616307a0906..83d99f66ac0 100644 --- a/lldb/source/Breakpoint/BreakpointResolverName.cpp +++ b/lldb/source/Breakpoint/BreakpointResolverName.cpp @@ -236,9 +236,9 @@ BreakpointResolverName::SearchCallback SymbolContext symbol_sc; if (sym_list.GetContextAtIndex(j, symbol_sc)) { - if (symbol_sc.symbol && symbol_sc.symbol->GetAddressRangePtr()) + if (symbol_sc.symbol && symbol_sc.symbol->ValueIsAddress()) { - if (sc.function->GetAddressRange().GetBaseAddress() == symbol_sc.symbol->GetAddressRangePtr()->GetBaseAddress()) + if (sc.function->GetAddressRange().GetBaseAddress() == symbol_sc.symbol->GetAddress()) { sym_list.RemoveContextAtIndex(j); continue; // Don't increment j @@ -297,9 +297,9 @@ BreakpointResolverName::SearchCallback { if (sym_list.GetContextAtIndex(i, sc)) { - if (sc.symbol && sc.symbol->GetAddressRangePtr()) + if (sc.symbol && sc.symbol->ValueIsAddress()) { - break_addr = sc.symbol->GetAddressRangePtr()->GetBaseAddress(); + break_addr = sc.symbol->GetAddress(); if (m_skip_prologue) { diff --git a/lldb/source/Commands/CommandObjectDisassemble.cpp b/lldb/source/Commands/CommandObjectDisassemble.cpp index c2d8968981c..357ff956a58 100644 --- a/lldb/source/Commands/CommandObjectDisassemble.cpp +++ b/lldb/source/Commands/CommandObjectDisassemble.cpp @@ -344,7 +344,10 @@ CommandObjectDisassemble::Execute } Symbol *symbol = frame->GetSymbolContext(eSymbolContextSymbol).symbol; if (symbol) - range = symbol->GetAddressRangeRef(); + { + range.GetBaseAddress() = symbol->GetAddress(); + range.SetByteSize(symbol->GetByteSize()); + } } // Did the "m_options.frame_line" find a valid range already? If so @@ -395,8 +398,8 @@ CommandObjectDisassemble::Execute SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol)); if (sc.function) range.GetBaseAddress() = sc.function->GetAddressRange().GetBaseAddress(); - else if (sc.symbol && sc.symbol->GetAddressRangePtr()) - range.GetBaseAddress() = sc.symbol->GetAddressRangePtr()->GetBaseAddress(); + else if (sc.symbol && sc.symbol->ValueIsAddress()) + range.GetBaseAddress() = sc.symbol->GetAddress(); else range.GetBaseAddress() = frame->GetFrameCodeAddress(); } @@ -437,8 +440,11 @@ CommandObjectDisassemble::Execute SymbolContext sc(frame->GetSymbolContext(eSymbolContextFunction | eSymbolContextSymbol)); if (sc.function) range = sc.function->GetAddressRange(); - else if (sc.symbol && sc.symbol->GetAddressRangePtr()) - range = *sc.symbol->GetAddressRangePtr(); + else if (sc.symbol && sc.symbol->ValueIsAddress()) + { + range.GetBaseAddress() = sc.symbol->GetAddress(); + range.SetByteSize (sc.symbol->GetByteSize()); + } else range.GetBaseAddress() = frame->GetFrameCodeAddress(); } diff --git a/lldb/source/Commands/CommandObjectTarget.cpp b/lldb/source/Commands/CommandObjectTarget.cpp index 1b74e08c0ca..a6d8262adc1 100644 --- a/lldb/source/Commands/CommandObjectTarget.cpp +++ b/lldb/source/Commands/CommandObjectTarget.cpp @@ -3586,11 +3586,7 @@ public: //ModuleSP new_module_sp (new Module (target_module_file, target_module_arch)); ModuleSP new_module_sp; - Error error (ModuleList::GetSharedModule (module_spec, - new_module_sp, - &target->GetExecutableSearchPaths(), - NULL, - NULL)); + new_module_sp = target->GetSharedModule (module_spec); if (new_module_sp) { diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index 75eb742fdfe..005a1a03e80 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -468,7 +468,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum if (symbol_name) { s->PutCString(symbol_name); - addr_t delta = file_Addr - symbol->GetAddressRangePtr()->GetBaseAddress().GetFileAddress(); + addr_t delta = file_Addr - symbol->GetAddress().GetFileAddress(); if (delta) s->Printf(" + %llu", delta); showed_info = true; @@ -632,9 +632,9 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum if (sc.function == NULL && sc.symbol != NULL) { // If we have just a symbol make sure it is in the right section - if (sc.symbol->GetAddressRangePtr()) + if (sc.symbol->ValueIsAddress()) { - if (sc.symbol->GetAddressRangePtr()->GetBaseAddress().GetSection() != GetSection()) + if (sc.symbol->GetAddress().GetSection() != GetSection()) { // don't show the module if the symbol is a trampoline symbol show_stop_context = false; @@ -685,7 +685,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum // as our address. If it isn't, then we might have just found // the last symbol that came before the address that we are // looking up that has nothing to do with our address lookup. - if (sc.symbol->GetAddressRangePtr() && sc.symbol->GetAddressRangePtr()->GetBaseAddress().GetSection() != GetSection()) + if (sc.symbol->ValueIsAddress() && sc.symbol->GetAddress().GetSection() != GetSection()) sc.symbol = NULL; } sc.GetDescription(s, eDescriptionLevelBrief, target); diff --git a/lldb/source/Core/AddressResolverName.cpp b/lldb/source/Core/AddressResolverName.cpp index 091a02f448f..f1874202fec 100644 --- a/lldb/source/Core/AddressResolverName.cpp +++ b/lldb/source/Core/AddressResolverName.cpp @@ -160,9 +160,9 @@ AddressResolverName::SearchCallback SymbolContext symbol_sc; if (sym_list.GetContextAtIndex(j, symbol_sc)) { - if (symbol_sc.symbol && symbol_sc.symbol->GetAddressRangePtr()) + if (symbol_sc.symbol && symbol_sc.symbol->ValueIsAddress()) { - if (sc.function->GetAddressRange().GetBaseAddress() == symbol_sc.symbol->GetAddressRangePtr()->GetBaseAddress()) + if (sc.function->GetAddressRange().GetBaseAddress() == symbol_sc.symbol->GetAddress()) { sym_list.RemoveContextAtIndex(j); continue; // Don't increment j @@ -206,10 +206,10 @@ AddressResolverName::SearchCallback { if (sym_list.GetContextAtIndex(i, sc)) { - if (sc.symbol && sc.symbol->GetAddressRangePtr()) + if (sc.symbol && sc.symbol->ValueIsAddress()) { - func_addr = sc.symbol->GetAddressRangePtr()->GetBaseAddress(); - addr_t byte_size = sc.symbol->GetAddressRangePtr()->GetByteSize(); + func_addr = sc.symbol->GetAddress(); + addr_t byte_size = sc.symbol->GetByteSize(); if (skip_prologue) { diff --git a/lldb/source/Core/Debugger.cpp b/lldb/source/Core/Debugger.cpp index d96b65baa05..3aff807b4ee 100644 --- a/lldb/source/Core/Debugger.cpp +++ b/lldb/source/Core/Debugger.cpp @@ -2163,8 +2163,8 @@ Debugger::FormatPrompt func_addr = inline_range.GetBaseAddress(); } } - else if (sc->symbol && sc->symbol->GetAddressRangePtr()) - func_addr = sc->symbol->GetAddressRangePtr()->GetBaseAddress(); + else if (sc->symbol && sc->symbol->ValueIsAddress()) + func_addr = sc->symbol->GetAddress(); } if (func_addr.IsValid()) diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp index 1ab77bb8f14..2882da90a79 100644 --- a/lldb/source/Core/Disassembler.cpp +++ b/lldb/source/Core/Disassembler.cpp @@ -484,9 +484,10 @@ Disassembler::Disassemble { range = sc.function->GetAddressRange(); } - else if (sc.symbol && sc.symbol->GetAddressRangePtr()) + else if (sc.symbol && sc.symbol->ValueIsAddress()) { - range = *sc.symbol->GetAddressRangePtr(); + range.GetBaseAddress() = sc.symbol->GetAddress(); + range.SetByteSize (sc.symbol->GetByteSize()); } else { diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index c9f08ebdc9a..12b35f99793 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -732,7 +732,7 @@ ClangExpressionDeclMap::GetFunctionAddress if (sym_ctx.function) func_so_addr = &sym_ctx.function->GetAddressRange().GetBaseAddress(); else if (sym_ctx.symbol) - func_so_addr = &sym_ctx.symbol->GetAddressRangeRef().GetBaseAddress(); + func_so_addr = &sym_ctx.symbol->GetAddress(); else return false; @@ -759,7 +759,7 @@ ClangExpressionDeclMap::GetSymbolAddress (Target &target, const ConstString &nam SymbolContext sym_ctx; sc_list.GetContextAtIndex(i, sym_ctx); - const Address *sym_address = &sym_ctx.symbol->GetAddressRangeRef().GetBaseAddress(); + const Address *sym_address = &sym_ctx.symbol->GetAddress(); if (!sym_address || !sym_address->IsValid()) return LLDB_INVALID_ADDRESS; @@ -1036,7 +1036,7 @@ ClangExpressionDeclMap::LookupDecl (clang::NamedDecl *decl, ClangExpressionVaria } else if (expr_var_sp->m_parser_vars->m_lldb_sym) { - const Address sym_address = expr_var_sp->m_parser_vars->m_lldb_sym->GetAddressRangeRef().GetBaseAddress(); + const Address sym_address = expr_var_sp->m_parser_vars->m_lldb_sym->GetAddress(); if (!sym_address.IsValid()) return Value(); @@ -3008,8 +3008,7 @@ ClangExpressionDeclMap::AddOneGenericVariable(NameSearchContext &context, std::auto_ptr<Value> symbol_location(new Value); - AddressRange &symbol_range = symbol.GetAddressRangeRef(); - Address &symbol_address = symbol_range.GetBaseAddress(); + Address &symbol_address = symbol.GetAddress(); lldb::addr_t symbol_load_addr = symbol_address.GetLoadAddress(target); symbol_location->SetContext(Value::eContextTypeClangType, user_type.GetOpaqueQualType()); @@ -3196,8 +3195,7 @@ ClangExpressionDeclMap::AddOneFunction (NameSearchContext &context, } else if (symbol) { - fun_address = &symbol->GetAddressRangeRef().GetBaseAddress(); - + fun_address = &symbol->GetAddress(); fun_decl = context.AddGenericFunDecl(); } else diff --git a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp index 48e9abe5c8d..dde33c390cd 100644 --- a/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp +++ b/lldb/source/Plugins/DynamicLoader/Darwin-Kernel/DynamicLoaderDarwinKernel.cpp @@ -315,7 +315,7 @@ DynamicLoaderDarwinKernel::LoadKernelModuleIfNeeded() const Symbol *symbol = m_kernel.module_sp->FindFirstSymbolWithNameAndType (kext_summary_symbol, eSymbolTypeData); if (symbol) { - m_kext_summary_header_ptr_addr = symbol->GetValue(); + m_kext_summary_header_ptr_addr = symbol->GetAddress(); // Update all image infos ReadAllKextSummaries (); } diff --git a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp index 31e3e5d1b62..3406a898850 100644 --- a/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp +++ b/lldb/source/Plugins/DynamicLoader/MacOSX-DYLD/DynamicLoaderMacOSXDYLD.cpp @@ -342,7 +342,7 @@ DynamicLoaderMacOSXDYLD::ReadDYLDInfoFromMemoryAndSetNotificationCallback(lldb:: static ConstString g_dyld_all_image_infos ("dyld_all_image_infos"); const Symbol *symbol = dyld_module_sp->FindFirstSymbolWithNameAndType (g_dyld_all_image_infos, eSymbolTypeData); if (symbol) - m_dyld_all_image_infos_addr = symbol->GetValue().GetLoadAddress(&m_process->GetTarget()); + m_dyld_all_image_infos_addr = symbol->GetAddress().GetLoadAddress(&m_process->GetTarget()); } // Update all image infos @@ -1333,11 +1333,7 @@ DynamicLoaderMacOSXDYLD::AlwaysRelyOnEHUnwindInfo (SymbolContext &sym_ctx) ModuleSP module_sp; if (sym_ctx.symbol) { - AddressRange *ar = sym_ctx.symbol->GetAddressRangePtr(); - if (ar) - { - module_sp = ar->GetBaseAddress().GetModule(); - } + module_sp = sym_ctx.symbol->GetAddress().GetModule(); } if (module_sp.get() == NULL && sym_ctx.function) { diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp index 3beab917eac..90fd352c3a0 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp @@ -184,7 +184,7 @@ AppleObjCRuntime::GetPrintForDebuggerAddr() contexts.GetContextAtIndex(0, context); - m_PrintForDebugger_addr.reset(new Address(context.symbol->GetValue())); + m_PrintForDebugger_addr.reset(new Address(context.symbol->GetAddress())); } return m_PrintForDebugger_addr.get(); diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp index eccec263fb8..b65ca92447f 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp @@ -546,7 +546,7 @@ AppleObjCRuntimeV2::GetByteOffsetForIvar (ClangASTType &parent_ast_type, const c || ivar_offset_symbol.symbol == NULL) return LLDB_INVALID_IVAR_OFFSET; - addr_t ivar_offset_address = ivar_offset_symbol.symbol->GetValue().GetLoadAddress (&target); + addr_t ivar_offset_address = ivar_offset_symbol.symbol->GetAddress().GetLoadAddress (&target); Error error; diff --git a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp index 5a9d2ab8fcf..53a41ee989d 100644 --- a/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp +++ b/lldb/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp @@ -355,10 +355,10 @@ AppleObjCTrampolineHandler::AppleObjCVTables::InitializeVTableSymbols () eSymbolTypeData); if (trampoline_symbol != NULL) { - if (!trampoline_symbol->GetValue().IsValid()) + if (!trampoline_symbol->GetAddress().IsValid()) return false; - m_trampoline_header = trampoline_symbol->GetValue().GetLoadAddress(&target); + m_trampoline_header = trampoline_symbol->GetAddress().GetLoadAddress(&target); if (m_trampoline_header == LLDB_INVALID_ADDRESS) return false; @@ -368,10 +368,10 @@ AppleObjCTrampolineHandler::AppleObjCVTables::InitializeVTableSymbols () eSymbolTypeCode); if (changed_symbol != NULL) { - if (!changed_symbol->GetValue().IsValid()) + if (!changed_symbol->GetAddress().IsValid()) return false; - lldb::addr_t changed_addr = changed_symbol->GetValue().GetOpcodeLoadAddress (&target); + lldb::addr_t changed_addr = changed_symbol->GetAddress().GetOpcodeLoadAddress (&target); if (changed_addr != LLDB_INVALID_ADDRESS) { BreakpointSP trampolines_changed_bp_sp = target.CreateBreakpoint (changed_addr, true); @@ -543,13 +543,13 @@ AppleObjCTrampolineHandler::AppleObjCTrampolineHandler (const ProcessSP &process const Symbol *msg_forward_stret = m_objc_module_sp->FindFirstSymbolWithNameAndType (msg_forward_stret_name, eSymbolTypeCode); if (class_getMethodImplementation) - m_impl_fn_addr = class_getMethodImplementation->GetValue().GetOpcodeLoadAddress (target); + m_impl_fn_addr = class_getMethodImplementation->GetAddress().GetOpcodeLoadAddress (target); if (class_getMethodImplementation_stret) - m_impl_stret_fn_addr = class_getMethodImplementation_stret->GetValue().GetOpcodeLoadAddress (target); + m_impl_stret_fn_addr = class_getMethodImplementation_stret->GetAddress().GetOpcodeLoadAddress (target); if (msg_forward) - m_msg_forward_addr = msg_forward->GetValue().GetOpcodeLoadAddress(target); + m_msg_forward_addr = msg_forward->GetAddress().GetOpcodeLoadAddress(target); if (msg_forward_stret) - m_msg_forward_stret_addr = msg_forward_stret->GetValue().GetOpcodeLoadAddress(target); + m_msg_forward_stret_addr = msg_forward_stret->GetAddress().GetOpcodeLoadAddress(target); // FIXME: Do some kind of logging here. if (m_impl_fn_addr == LLDB_INVALID_ADDRESS || m_impl_stret_fn_addr == LLDB_INVALID_ADDRESS) @@ -570,7 +570,7 @@ AppleObjCTrampolineHandler::AppleObjCTrampolineHandler (const ProcessSP &process // Problem is we also need to lookup the dispatch function. For now we could have a side table of stret & non-stret // dispatch functions. If that's as complex as it gets, we're fine. - lldb::addr_t sym_addr = msgSend_symbol->GetValue().GetOpcodeLoadAddress(target); + lldb::addr_t sym_addr = msgSend_symbol->GetAddress().GetOpcodeLoadAddress(target); m_msgSend_map.insert(std::pair<lldb::addr_t, int>(sym_addr, i)); } @@ -888,7 +888,7 @@ AppleObjCTrampolineHandler::GetStepThroughDispatchPlan (Thread &thread, bool sto SymbolContext sc; sc_list.GetContextAtIndex(0, sc); if (sc.symbol != NULL) - impl_code_address = sc.symbol->GetValue(); + impl_code_address = sc.symbol->GetAddress(); //lldb::addr_t addr = impl_code_address.GetOpcodeLoadAddress (exe_ctx.GetTargetPtr()); //printf ("Getting address for our_utility_function: 0x%llx.\n", addr); diff --git a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp index 68121b0c17a..e5e0473f9de 100644 --- a/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp +++ b/lldb/source/Plugins/ObjectFile/Mach-O/ObjectFileMachO.cpp @@ -606,10 +606,9 @@ ObjectFileMachO::GetAddressClass (lldb::addr_t file_addr) 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 @@ ObjectFileMachO::ParseSymtab (bool minimize) 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 @@ ObjectFileMachO::ParseSymtab (bool minimize) 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 @@ ObjectFileMachO::ParseSymtab (bool minimize) 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 @@ ObjectFileMachO::ParseSymtab (bool minimize) // 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 @@ ObjectFileMachO::ParseSymtab (bool minimize) 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 @@ ObjectFileMachO::GetEntryPointAddress () 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(); } } } diff --git a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp index 692e24ba9cc..407d76ae588 100644 --- a/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp +++ b/lldb/source/Plugins/ObjectFile/PECOFF/ObjectFilePECOFF.cpp @@ -539,7 +539,7 @@ ObjectFilePECOFF::GetSymtab() symbol.naux = symtab_data.GetU8 (&offset); Address symbol_addr(sect_list->GetSectionAtIndex(symbol.sect-1), symbol.value); symbols[i].GetMangled ().SetValue (symbol_name.c_str(), symbol_name[0]=='_' && symbol_name[1] == 'Z'); - symbols[i].SetValue(symbol_addr); + symbols[i].GetAddress() = symbol_addr; if (symbol.naux > 0) i += symbol.naux; diff --git a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp index 8cca12046ba..90913b961d5 100644 --- a/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp +++ b/lldb/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp @@ -136,10 +136,15 @@ UnwindMacOSXFrameBackchain::GetStackFrameData_i386 (const ExecutionContext &exe_ SymbolContext first_frame_sc (first_frame->GetSymbolContext(resolve_scope)); const AddressRange *addr_range_ptr = NULL; + AddressRange range; if (first_frame_sc.function) addr_range_ptr = &first_frame_sc.function->GetAddressRange(); else if (first_frame_sc.symbol) - addr_range_ptr = first_frame_sc.symbol->GetAddressRangePtr(); + { + range.GetBaseAddress() = first_frame_sc.symbol->GetAddress(); + range.SetByteSize (first_frame_sc.symbol->GetByteSize()); + addr_range_ptr = ⦥ + } if (addr_range_ptr) { @@ -230,10 +235,15 @@ UnwindMacOSXFrameBackchain::GetStackFrameData_x86_64 (const ExecutionContext &ex SymbolContext first_frame_sc(first_frame->GetSymbolContext(resolve_scope)); const AddressRange *addr_range_ptr = NULL; + AddressRange range; if (first_frame_sc.function) addr_range_ptr = &first_frame_sc.function->GetAddressRange(); else if (first_frame_sc.symbol) - addr_range_ptr = first_frame_sc.symbol->GetAddressRangePtr(); + { + range.GetBaseAddress() = first_frame_sc.symbol->GetAddress(); + range.SetByteSize (first_frame_sc.symbol->GetByteSize()); + addr_range_ptr = ⦥ + } if (addr_range_ptr) { diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp index 7d768ecbc29..5bc0e5e201e 100644 --- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp +++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp @@ -2482,7 +2482,7 @@ ProcessGDBRemote::GetDispatchQueueNameForThread dispatch_queue_offsets_symbol = module_sp->FindFirstSymbolWithNameAndType (g_dispatch_queue_offsets_symbol_name, eSymbolTypeData); } if (dispatch_queue_offsets_symbol) - m_dispatch_queue_offsets_addr = dispatch_queue_offsets_symbol->GetValue().GetLoadAddress(&m_target); + m_dispatch_queue_offsets_addr = dispatch_queue_offsets_symbol->GetAddress().GetLoadAddress(&m_target); if (m_dispatch_queue_offsets_addr == LLDB_INVALID_ADDRESS) return NULL; diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index a8a7c3617bf..058d72ef78b 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -6076,10 +6076,9 @@ SymbolFileDWARF::ParseVariableDIE Symtab::eVisibilityExtern); if (defined_symbol) { - const AddressRange *defined_range = defined_symbol->GetAddressRangePtr(); - if (defined_range) + if (defined_symbol->ValueIsAddress()) { - const addr_t defined_addr = defined_range->GetBaseAddress().GetFileAddress(); + const addr_t defined_addr = defined_symbol->GetAddress().GetFileAddress(); if (defined_addr != LLDB_INVALID_ADDRESS) { if (location.Update_DW_OP_addr (defined_addr)) diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp index 7e7204826aa..093ca8f50cb 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp @@ -330,8 +330,8 @@ SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit if (oso_fun_symbol) { // If we found the symbol, then we - SectionSP exe_fun_section (exe_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection()); - SectionSP oso_fun_section (oso_fun_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection()); + SectionSP exe_fun_section (exe_symbol->GetAddress().GetSection()); + SectionSP oso_fun_section (oso_fun_symbol->GetAddress().GetSection()); if (oso_fun_section) { // Now we create a section that we will add as a child of the @@ -342,17 +342,17 @@ SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit // size will reflect any size changes (ppc has been known to // shrink function sizes when it gets rid of jump islands that // aren't needed anymore). - SectionSP oso_fun_section_sp (new Section (oso_fun_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection(), + SectionSP oso_fun_section_sp (new Section (oso_fun_symbol->GetAddress().GetSection(), oso_module_sp, // Module (the .o file) sect_id++, // Section ID starts at 0x10000 and increments so the section IDs don't overlap with the standard mach IDs exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), // Name the section the same as the symbol for which is was generated! eSectionTypeDebug, - oso_fun_symbol->GetAddressRangePtr()->GetBaseAddress().GetOffset(), // File VM address offset in the current section + oso_fun_symbol->GetAddress().GetOffset(), // File VM address offset in the current section exe_symbol->GetByteSize(), // File size (we need the size from the executable) 0, 0, 0)); oso_fun_section_sp->SetLinkedLocation (exe_fun_section, - exe_symbol->GetValue().GetFileAddress() - exe_fun_section->GetFileAddress()); + exe_symbol->GetAddress().GetFileAddress() - exe_fun_section->GetFileAddress()); oso_fun_section->GetChildren().AddSection(oso_fun_section_sp); comp_unit_info->debug_map_sections_sp->AddSection(oso_fun_section_sp); } @@ -381,24 +381,24 @@ SymbolFileDWARFDebugMap::GetSymbolFileByCompUnitInfo (CompileUnitInfo *comp_unit Symtab::eDebugNo, Symtab::eVisibilityAny); - if (exe_symbol && oso_gsym_symbol && exe_symbol->GetAddressRangePtr() && oso_gsym_symbol->GetAddressRangePtr()) + if (exe_symbol && oso_gsym_symbol && exe_symbol->ValueIsAddress() && oso_gsym_symbol->ValueIsAddress()) { // If we found the symbol, then we - SectionSP exe_gsym_section (exe_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection()); - SectionSP oso_gsym_section (oso_gsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection()); + SectionSP exe_gsym_section (exe_symbol->GetAddress().GetSection()); + SectionSP oso_gsym_section (oso_gsym_symbol->GetAddress().GetSection()); if (oso_gsym_section) { - SectionSP oso_gsym_section_sp (new Section (oso_gsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetSection(), + SectionSP oso_gsym_section_sp (new Section (oso_gsym_symbol->GetAddress().GetSection(), oso_module_sp, // Module (the .o file) sect_id++, // Section ID starts at 0x10000 and increments so the section IDs don't overlap with the standard mach IDs exe_symbol->GetMangled().GetName(Mangled::ePreferMangled), // Name the section the same as the symbol for which is was generated! eSectionTypeDebug, - oso_gsym_symbol->GetAddressRangePtr()->GetBaseAddress().GetOffset(), // File VM address offset in the current section + oso_gsym_symbol->GetAddress().GetOffset(), // File VM address offset in the current section 1, // We don't know the size of the global, just do the main address for now. 0, 0, 0)); oso_gsym_section_sp->SetLinkedLocation (exe_gsym_section, - exe_symbol->GetValue().GetFileAddress() - exe_gsym_section->GetFileAddress()); + exe_symbol->GetAddress().GetFileAddress() - exe_gsym_section->GetFileAddress()); oso_gsym_section->GetChildren().AddSection(oso_gsym_section_sp); comp_unit_info->debug_map_sections_sp->AddSection(oso_gsym_section_sp); } diff --git a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp index d4164cd1d31..f4d9e032087 100644 --- a/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp +++ b/lldb/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp @@ -207,7 +207,7 @@ SymbolFileSymtab::ParseCompileUnitFunctions (const SymbolContext &sc) if (curr_symbol) { // Union of all ranges in the function DIE (if the function is discontiguous) - AddressRange func_range(curr_symbol->GetValue(), 0); + AddressRange func_range(curr_symbol->GetAddress(), 0); if (func_range.GetBaseAddress().IsSectionOffset()) { uint32_t symbol_size = curr_symbol->GetByteSize(); @@ -218,7 +218,7 @@ SymbolFileSymtab::ParseCompileUnitFunctions (const SymbolContext &sc) next_symbol = symtab->SymbolAtIndex(m_code_indexes[idx + 1]); if (next_symbol) { - func_range.SetByteSize(next_symbol->GetValue().GetOffset() - curr_symbol->GetValue().GetOffset()); + func_range.SetByteSize(next_symbol->GetAddress().GetOffset() - curr_symbol->GetAddress().GetOffset()); } } diff --git a/lldb/source/Symbol/ObjectFile.cpp b/lldb/source/Symbol/ObjectFile.cpp index 4f02a93de41..a45ef820f0e 100644 --- a/lldb/source/Symbol/ObjectFile.cpp +++ b/lldb/source/Symbol/ObjectFile.cpp @@ -266,10 +266,9 @@ ObjectFile::GetAddressClass (addr_t file_addr) Symbol *symbol = symtab->FindSymbolContainingFileAddress(file_addr); if (symbol) { - const AddressRange *range_ptr = symbol->GetAddressRangePtr(); - if (range_ptr) + if (symbol->ValueIsAddress()) { - const SectionSP section_sp (range_ptr->GetBaseAddress().GetSection()); + const SectionSP section_sp (symbol->GetAddress().GetSection()); if (section_sp) { const SectionType section_type = section_sp->GetType(); diff --git a/lldb/source/Symbol/Symbol.cpp b/lldb/source/Symbol/Symbol.cpp index 636670d994f..af7c2d4d527 100644 --- a/lldb/source/Symbol/Symbol.cpp +++ b/lldb/source/Symbol/Symbol.cpp @@ -158,28 +158,10 @@ Symbol::Clear() m_addr_range.Clear(); } -AddressRange * -Symbol::GetAddressRangePtr() +bool +Symbol::ValueIsAddress() const { - if (m_addr_range.GetBaseAddress().GetSection()) - { - if (!m_calculated_size) - GetByteSize(); - return &m_addr_range; - } - return NULL; -} - -const AddressRange * -Symbol::GetAddressRangePtr() const -{ - if (m_addr_range.GetBaseAddress().GetSection()) - { - if (!m_calculated_size) - GetByteSize(); - return &m_addr_range; - } - return NULL; + return m_addr_range.GetBaseAddress().GetSection().get() != NULL; } uint32_t @@ -245,8 +227,10 @@ Symbol::Dump(Stream *s, Target *target, uint32_t index) const m_is_external ? 'X' : ' ', GetTypeAsString()); - SectionSP section_sp (m_addr_range.GetBaseAddress().GetSection()); - if (section_sp) + // Make sure the size of the symbol is up to date before dumping + GetByteSize(); + + if (ValueIsAddress()) { if (!m_addr_range.GetBaseAddress().Dump(s, NULL, Address::DumpStyleFileAddress)) s->Printf("%*s", 18, ""); @@ -304,13 +288,6 @@ Symbol::GetPrologueByteSize () return 0; } -void -Symbol::SetValue(addr_t value) -{ - m_addr_range.GetBaseAddress().SetRawAddress(value); -} - - bool Symbol::Compare(const ConstString& name, SymbolType type) const { @@ -365,9 +342,8 @@ Symbol::CalculateSymbolContext (SymbolContext *sc) { // Symbols can reconstruct the symbol and the module in the symbol context sc->symbol = this; - const AddressRange *range = GetAddressRangePtr(); - if (range) - sc->module_sp = range->GetBaseAddress().GetModule(); + if (ValueIsAddress()) + sc->module_sp = GetAddress().GetModule(); else sc->module_sp.reset(); } @@ -375,9 +351,8 @@ Symbol::CalculateSymbolContext (SymbolContext *sc) ModuleSP Symbol::CalculateSymbolContextModule () { - const AddressRange *range = GetAddressRangePtr(); - if (range) - return range->GetBaseAddress().GetModule(); + if (ValueIsAddress()) + return GetAddress().GetModule(); return ModuleSP(); } @@ -392,10 +367,9 @@ void Symbol::DumpSymbolContext (Stream *s) { bool dumped_module = false; - const AddressRange *range = GetAddressRangePtr(); - if (range) - { - ModuleSP module_sp (range->GetBaseAddress().GetModule()); + if (ValueIsAddress()) + { + ModuleSP module_sp (GetAddress().GetModule()); if (module_sp) { dumped_module = true; @@ -416,10 +390,9 @@ Symbol::GetByteSize () const if (byte_size == 0 && !m_calculated_size) { const_cast<Symbol*>(this)->m_calculated_size = true; - const AddressRange *range = GetAddressRangePtr(); - if (range) + if (ValueIsAddress()) { - ModuleSP module_sp (range->GetBaseAddress().GetModule()); + ModuleSP module_sp (GetAddress().GetModule()); if (module_sp) { ObjectFile *objfile = module_sp->GetObjectFile(); @@ -428,7 +401,7 @@ Symbol::GetByteSize () const Symtab *symtab = objfile->GetSymtab(); if (symtab) { - const_cast<AddressRange &>(m_addr_range).SetByteSize(symtab->CalculateSymbolSize (const_cast<Symbol *>(this))); + const_cast<Symbol*>(this)->SetByteSize (symtab->CalculateSymbolSize (const_cast<Symbol *>(this))); byte_size = m_addr_range.GetByteSize(); } } diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index 1c764e89ef5..3fff6fbc52c 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -206,9 +206,9 @@ SymbolContext::DumpStopContext symbol->GetMangled().GetName().Dump(s); } - if (addr.IsValid() && symbol->GetAddressRangePtr()) + if (addr.IsValid() && symbol->ValueIsAddress()) { - const addr_t symbol_offset = addr.GetOffset() - symbol->GetAddressRangePtr()->GetBaseAddress().GetOffset(); + const addr_t symbol_offset = addr.GetOffset() - symbol->GetAddress().GetOffset(); if (symbol_offset) { dumped_something = true; @@ -431,10 +431,10 @@ SymbolContext::GetAddressRange (uint32_t scope, { if (range_idx == 0) { - const AddressRange *range_ptr = symbol->GetAddressRangePtr(); - if (range_ptr) + if (symbol->ValueIsAddress()) { - range = *range_ptr; + range.GetBaseAddress() = symbol->GetAddress(); + range.SetByteSize (symbol->GetByteSize()); return true; } } @@ -551,7 +551,7 @@ SymbolContext::GetFunctionName (Mangled::NamePreference preference) } return function->GetMangled().GetName(preference); } - else if (symbol && symbol->GetAddressRangePtr()) + else if (symbol && symbol->ValueIsAddress()) { return symbol->GetMangled().GetName(preference); } @@ -934,14 +934,13 @@ SymbolContextList::AppendIfUnique (const SymbolContext& sc, bool merge_symbol_in && sc.block == NULL && sc.line_entry.IsValid() == false) { - const AddressRange *symbol_range = sc.symbol->GetAddressRangePtr(); - if (symbol_range) + if (sc.symbol->ValueIsAddress()) { for (pos = m_symbol_contexts.begin(); pos != end; ++pos) { if (pos->function) { - if (pos->function->GetAddressRange().GetBaseAddress() == symbol_range->GetBaseAddress()) + if (pos->function->GetAddressRange().GetBaseAddress() == sc.symbol->GetAddress()) { // Do we already have a function with this symbol? if (pos->symbol == sc.symbol) diff --git a/lldb/source/Symbol/Symtab.cpp b/lldb/source/Symbol/Symtab.cpp index ea4ff608cb5..dd2a04d1ab2 100644 --- a/lldb/source/Symbol/Symtab.cpp +++ b/lldb/source/Symbol/Symtab.cpp @@ -442,15 +442,8 @@ namespace { const std::vector<Symbol>& symbols; SymbolIndexComparator(const std::vector<Symbol>& s) : symbols(s) { } bool operator()(uint32_t index_a, uint32_t index_b) { - addr_t value_a; - addr_t value_b; - if (symbols[index_a].GetValue().GetSection() == symbols[index_b].GetValue().GetSection()) { - value_a = symbols[index_a].GetValue ().GetOffset(); - value_b = symbols[index_b].GetValue ().GetOffset(); - } else { - value_a = symbols[index_a].GetValue ().GetFileAddress(); - value_b = symbols[index_b].GetValue ().GetFileAddress(); - } + addr_t value_a = symbols[index_a].GetAddress().GetFileAddress(); + addr_t value_b = symbols[index_b].GetAddress().GetFileAddress(); if (value_a == value_b) { // The if the values are equal, use the original symbol user ID @@ -741,10 +734,9 @@ SymbolWithFileAddress (SymbolSearchInfo *info, const uint32_t *index_ptr) // lldb::Symbol::GetAddressRangePtr() will only return a non NULL address // range if the symbol has a section! - const AddressRange *curr_range = curr_symbol->GetAddressRangePtr(); - if (curr_range) + if (curr_symbol->ValueIsAddress()) { - const addr_t curr_file_addr = curr_range->GetBaseAddress().GetFileAddress(); + const addr_t curr_file_addr = curr_symbol->GetAddress().GetFileAddress(); if (info_file_addr < curr_file_addr) return -1; if (info_file_addr > curr_file_addr) @@ -765,10 +757,9 @@ SymbolWithClosestFileAddress (SymbolSearchInfo *info, const uint32_t *index_ptr) return -1; const addr_t info_file_addr = info->file_addr; - const AddressRange *curr_range = symbol->GetAddressRangePtr(); - if (curr_range) + if (symbol->ValueIsAddress()) { - const addr_t curr_file_addr = curr_range->GetBaseAddress().GetFileAddress(); + const addr_t curr_file_addr = symbol->GetAddress().GetFileAddress(); if (info_file_addr < curr_file_addr) return -1; @@ -819,7 +810,7 @@ Symtab::InitAddressIndexes() const_iterator end = m_symbols.end(); for (const_iterator pos = m_symbols.begin(); pos != end; ++pos) { - if (pos->GetAddressRangePtr()) + if (pos->ValueIsAddress()) m_addr_indexes.push_back (std::distance(begin, pos)); } #endif @@ -851,15 +842,18 @@ Symtab::CalculateSymbolSize (Symbol *symbol) // Else if this is an address based symbol, figure out the delta between // it and the next address based symbol - if (symbol->GetAddressRangePtr()) + if (symbol->ValueIsAddress()) { if (!m_addr_indexes_computed) InitAddressIndexes(); const size_t num_addr_indexes = m_addr_indexes.size(); - SymbolSearchInfo info = FindIndexPtrForSymbolContainingAddress(this, symbol->GetAddressRangePtr()->GetBaseAddress().GetFileAddress(), &m_addr_indexes.front(), num_addr_indexes); + SymbolSearchInfo info = FindIndexPtrForSymbolContainingAddress (this, + symbol->GetAddress().GetFileAddress(), + &m_addr_indexes.front(), + num_addr_indexes); if (info.match_index_ptr != NULL) { - const lldb::addr_t curr_file_addr = symbol->GetAddressRangePtr()->GetBaseAddress().GetFileAddress(); + const lldb::addr_t curr_file_addr = symbol->GetAddress().GetFileAddress(); // We can figure out the address range of all symbols except the // last one by taking the delta between the current symbol and // the next symbol @@ -872,12 +866,11 @@ Symtab::CalculateSymbolSize (Symbol *symbol) if (next_symbol == NULL) break; - assert (next_symbol->GetAddressRangePtr()); - const lldb::addr_t next_file_addr = next_symbol->GetAddressRangePtr()->GetBaseAddress().GetFileAddress(); + const lldb::addr_t next_file_addr = next_symbol->GetAddress().GetFileAddress(); if (next_file_addr > curr_file_addr) { byte_size = next_file_addr - curr_file_addr; - symbol->GetAddressRangePtr()->SetByteSize(byte_size); + symbol->SetByteSize(byte_size); symbol->SetSizeIsSynthesized(true); break; } diff --git a/lldb/source/Target/ThreadPlanStepInRange.cpp b/lldb/source/Target/ThreadPlanStepInRange.cpp index 9fc3ad6360a..e7d5f8189a7 100644 --- a/lldb/source/Target/ThreadPlanStepInRange.cpp +++ b/lldb/source/Target/ThreadPlanStepInRange.cpp @@ -201,7 +201,7 @@ ThreadPlanStepInRange::ShouldStop (Event *event_ptr) } else if (sc.symbol) { - func_start_address = sc.symbol->GetValue(); + func_start_address = sc.symbol->GetAddress(); if (curr_addr == func_start_address.GetLoadAddress(m_thread.CalculateTarget().get())) bytes_to_skip = sc.symbol->GetPrologueByteSize(); } diff --git a/lldb/source/Target/ThreadPlanStepRange.cpp b/lldb/source/Target/ThreadPlanStepRange.cpp index e67cf28d17a..b504e1f18db 100644 --- a/lldb/source/Target/ThreadPlanStepRange.cpp +++ b/lldb/source/Target/ThreadPlanStepRange.cpp @@ -184,9 +184,10 @@ ThreadPlanStepRange::InSymbol() { return m_addr_context.function->GetAddressRange().ContainsLoadAddress (cur_pc, m_thread.CalculateTarget().get()); } - else if (m_addr_context.symbol != NULL) + else if (m_addr_context.symbol) { - return m_addr_context.symbol->GetAddressRangeRef().ContainsLoadAddress (cur_pc, m_thread.CalculateTarget().get()); + AddressRange range(m_addr_context.symbol->GetAddress(), m_addr_context.symbol->GetByteSize()); + return range.ContainsLoadAddress (cur_pc, m_thread.CalculateTarget().get()); } return false; } |

