diff --git a/lldb/include/lldb/Symbol/SymbolContext.h b/lldb/include/lldb/Symbol/SymbolContext.h index f6c05b0895b332cf2a5aaa2078f77c850f582950..719fac162c7619d0c329a26ba7b9bff9f264f116 100644 --- a/lldb/include/lldb/Symbol/SymbolContext.h +++ b/lldb/include/lldb/Symbol/SymbolContext.h @@ -131,7 +131,7 @@ public: /// to their default state. //------------------------------------------------------------------ void - Clear (); + Clear (bool clear_target); //------------------------------------------------------------------ /// Dump a description of this object to a Stream. diff --git a/lldb/source/API/SBSymbolContext.cpp b/lldb/source/API/SBSymbolContext.cpp index a310d25565cf8b63086cd43eb688db7bf2867e70..780364cc7872d671dc837fd68110d91c3302123d 100644 --- a/lldb/source/API/SBSymbolContext.cpp +++ b/lldb/source/API/SBSymbolContext.cpp @@ -72,7 +72,7 @@ SBSymbolContext::SetSymbolContext (const SymbolContext *sc_ptr) else { if (m_opaque_ap.get()) - m_opaque_ap->Clear(); + m_opaque_ap->Clear(true); } } diff --git a/lldb/source/Commands/CommandObjectSource.cpp b/lldb/source/Commands/CommandObjectSource.cpp index 0beaadf5728451ec2ec64e8c3a106eeaefcbb468..d7daa497fe6f280cbb6e5e33c1c9631d2483394e 100644 --- a/lldb/source/Commands/CommandObjectSource.cpp +++ b/lldb/source/Commands/CommandObjectSource.cpp @@ -482,7 +482,7 @@ protected: ModuleSP module_sp (module_list.GetModuleAtIndex(i)); if (module_sp && module_sp->ResolveFileAddress(m_options.address, so_addr)) { - sc.Clear(); + sc.Clear(true); if (module_sp->ResolveSymbolContextForAddress (so_addr, eSymbolContextEverything, sc) & eSymbolContextLineEntry) sc_list.Append(sc); } @@ -505,7 +505,7 @@ protected: ModuleSP module_sp (so_addr.GetModule()); if (module_sp) { - sc.Clear(); + sc.Clear(true); if (module_sp->ResolveSymbolContextForAddress (so_addr, eSymbolContextEverything, sc) & eSymbolContextLineEntry) { sc_list.Append(sc); diff --git a/lldb/source/Core/Address.cpp b/lldb/source/Core/Address.cpp index 5c9ed1a51fb0578c2bbabc35a2a5cd998d4f9fe4..66093bcc2e100587bf627912819eb7ffae6f51f0 100644 --- a/lldb/source/Core/Address.cpp +++ b/lldb/source/Core/Address.cpp @@ -762,7 +762,7 @@ Address::Dump (Stream *s, ExecutionContextScope *exe_scope, DumpStyle style, Dum uint32_t Address::CalculateSymbolContext (SymbolContext *sc, uint32_t resolve_scope) const { - sc->Clear(); + sc->Clear(false); // Absolute addresses don't have enough information to reconstruct even their target. SectionSP section_sp (GetSection()); diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp index 0d29e01ecc9e4c8bff46dd4de9ae43a89fab5cfb..b74238c65e62f7a2f2c341785d5d0e4b7460637e 100644 --- a/lldb/source/Core/Disassembler.cpp +++ b/lldb/source/Core/Disassembler.cpp @@ -445,7 +445,7 @@ Disassembler::PrintInstructions } else { - sc.Clear(); + sc.Clear(true); } } diff --git a/lldb/source/Core/Module.cpp b/lldb/source/Core/Module.cpp index 9490d2e2ece406259dd78322e3f62cbbb153bbb9..953a81bfdbe03b88db823a6f33dfecbb270f3d3d 100644 --- a/lldb/source/Core/Module.cpp +++ b/lldb/source/Core/Module.cpp @@ -442,8 +442,8 @@ Module::ResolveSymbolContextForAddress (const Address& so_addr, uint32_t resolve Mutex::Locker locker (m_mutex); uint32_t resolved_flags = 0; - // Clear the result symbol context in case we don't find anything - sc.Clear(); + // Clear the result symbol context in case we don't find anything, but don't clear the target + sc.Clear(false); // Get the section from the section/offset address. SectionSP section_sp (so_addr.GetSection()); diff --git a/lldb/source/Expression/ClangExpressionDeclMap.cpp b/lldb/source/Expression/ClangExpressionDeclMap.cpp index 9851a46676894f3e95a16addbdb0e3e41003e0e1..db1ef1684dd4c9e736dd256c75ebcae32c16eb33 100644 --- a/lldb/source/Expression/ClangExpressionDeclMap.cpp +++ b/lldb/source/Expression/ClangExpressionDeclMap.cpp @@ -86,12 +86,12 @@ ClangExpressionDeclMap::WillParse(ExecutionContext &exe_ctx) m_parser_vars->m_sym_ctx = exe_ctx.GetThreadPtr()->GetStackFrameAtIndex(0)->GetSymbolContext(lldb::eSymbolContextEverything); else if (exe_ctx.GetProcessPtr()) { - m_parser_vars->m_sym_ctx.Clear(); + m_parser_vars->m_sym_ctx.Clear(true); m_parser_vars->m_sym_ctx.target_sp = exe_ctx.GetTargetSP(); } else if (target) { - m_parser_vars->m_sym_ctx.Clear(); + m_parser_vars->m_sym_ctx.Clear(true); m_parser_vars->m_sym_ctx.target_sp = exe_ctx.GetTargetSP(); } diff --git a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp index cb691c552f17b64633c1d05761a232bfd3bb7978..6b52a62ecb27911e797adf7b4c1e4306a7d50d62 100644 --- a/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp +++ b/lldb/source/Plugins/Process/Utility/RegisterContextLLDB.cpp @@ -60,7 +60,7 @@ RegisterContextLLDB::RegisterContextLLDB m_registers(), m_parent_unwind (unwind_lldb) { - m_sym_ctx.Clear(); + m_sym_ctx.Clear(false); m_sym_ctx_valid = false; if (IsFrameZero ()) @@ -409,7 +409,7 @@ RegisterContextLLDB::InitializeNonZerothFrame() { Address temporary_pc(m_current_pc); temporary_pc.SetOffset(m_current_pc.GetOffset() - 1); - m_sym_ctx.Clear(); + m_sym_ctx.Clear(false); m_sym_ctx_valid = false; if ((pc_module_sp->ResolveSymbolContextForAddress (temporary_pc, eSymbolContextFunction| eSymbolContextSymbol, m_sym_ctx) & eSymbolContextSymbol) == eSymbolContextSymbol) { diff --git a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp index d7e5db1d3d0c2a34b3986a33b264459d844d3b63..95e049c6c7d64246f019f4d1d4003e60b1083495 100644 --- a/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp +++ b/lldb/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp @@ -2564,7 +2564,7 @@ SymbolFileDWARF::GetCompUnitForDWARFCompUnit (DWARFCompileUnit* dwarf_cu, uint32 bool SymbolFileDWARF::GetFunction (DWARFCompileUnit* dwarf_cu, const DWARFDebugInfoEntry* func_die, SymbolContext& sc) { - sc.Clear(); + sc.Clear(false); // Check if the symbol vendor already knows about this compile unit? sc.comp_unit = GetCompUnitForDWARFCompUnit(dwarf_cu, UINT32_MAX); diff --git a/lldb/source/Symbol/SymbolContext.cpp b/lldb/source/Symbol/SymbolContext.cpp index b3d9748a256a0bb40553ef2110267336516a147a..b4b777b52fff8719ce694c2b3e5f68ee8c36e415 100644 --- a/lldb/source/Symbol/SymbolContext.cpp +++ b/lldb/source/Symbol/SymbolContext.cpp @@ -108,9 +108,10 @@ SymbolContext::operator= (const SymbolContext& rhs) } void -SymbolContext::Clear() +SymbolContext::Clear(bool clear_target) { - target_sp.reset(); + if (clear_target) + target_sp.reset(); module_sp.reset(); comp_unit = NULL; function = NULL; @@ -453,7 +454,7 @@ SymbolContext::GetParentOfInlinedScope (const Address &curr_frame_pc, SymbolContext &next_frame_sc, Address &next_frame_pc) const { - next_frame_sc.Clear(); + next_frame_sc.Clear(false); next_frame_pc.Clear(); if (block) diff --git a/lldb/source/Symbol/Variable.cpp b/lldb/source/Symbol/Variable.cpp index 8172875f8a37aa7140ea5e51d269d347d3e8aa77..309e3926c8701cd12346809ff7ede40247b2ab8c 100644 --- a/lldb/source/Symbol/Variable.cpp +++ b/lldb/source/Symbol/Variable.cpp @@ -203,7 +203,7 @@ Variable::CalculateSymbolContext (SymbolContext *sc) if (m_owner_scope) m_owner_scope->CalculateSymbolContext(sc); else - sc->Clear(); + sc->Clear(false); } bool diff --git a/lldb/source/Target/StackFrame.cpp b/lldb/source/Target/StackFrame.cpp index 2cc46ef9b31663cb4d799466bb00341777c7263c..98249a4f5e2eea58c943851a31de6716f53fc8dc 100644 --- a/lldb/source/Target/StackFrame.cpp +++ b/lldb/source/Target/StackFrame.cpp @@ -250,7 +250,7 @@ void StackFrame::ChangePC (addr_t pc) { m_frame_code_addr.SetRawAddress(pc); - m_sc.Clear(); + m_sc.Clear(false); m_flags.Reset(0); ThreadSP thread_sp (GetThread()); if (thread_sp)