[Lldb-commits] [lldb] r175953 - <rdar://problem/13265297>

Greg Clayton gclayton at apple.com
Fri Feb 22 20:12:48 PST 2013


Author: gclayton
Date: Fri Feb 22 22:12:47 2013
New Revision: 175953

URL: http://llvm.org/viewvc/llvm-project?rev=175953&view=rev
Log:
<rdar://problem/13265297> 

StackFrame assumes m_sc is additive, but m_sc can lose its target. So now the SymbolContext::Clear() method takes a bool that indicates if the target should be cleared. Modified all existing code to properly set the bool argument.


Modified:
    lldb/trunk/include/lldb/Symbol/SymbolContext.h
    lldb/trunk/source/API/SBSymbolContext.cpp
    lldb/trunk/source/Commands/CommandObjectSource.cpp
    lldb/trunk/source/Core/Address.cpp
    lldb/trunk/source/Core/Disassembler.cpp
    lldb/trunk/source/Core/Module.cpp
    lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
    lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
    lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
    lldb/trunk/source/Symbol/SymbolContext.cpp
    lldb/trunk/source/Symbol/Variable.cpp
    lldb/trunk/source/Target/StackFrame.cpp

Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContext.h?rev=175953&r1=175952&r2=175953&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolContext.h Fri Feb 22 22:12:47 2013
@@ -131,7 +131,7 @@ public:
     /// to their default state.
     //------------------------------------------------------------------
     void
-    Clear ();
+    Clear (bool clear_target);
 
     //------------------------------------------------------------------
     /// Dump a description of this object to a Stream.

Modified: lldb/trunk/source/API/SBSymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBSymbolContext.cpp?rev=175953&r1=175952&r2=175953&view=diff
==============================================================================
--- lldb/trunk/source/API/SBSymbolContext.cpp (original)
+++ lldb/trunk/source/API/SBSymbolContext.cpp Fri Feb 22 22:12:47 2013
@@ -72,7 +72,7 @@ SBSymbolContext::SetSymbolContext (const
     else
     {
         if (m_opaque_ap.get())
-            m_opaque_ap->Clear();
+            m_opaque_ap->Clear(true);
     }
 }
 

Modified: lldb/trunk/source/Commands/CommandObjectSource.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Commands/CommandObjectSource.cpp?rev=175953&r1=175952&r2=175953&view=diff
==============================================================================
--- lldb/trunk/source/Commands/CommandObjectSource.cpp (original)
+++ lldb/trunk/source/Commands/CommandObjectSource.cpp Fri Feb 22 22:12:47 2013
@@ -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);

Modified: lldb/trunk/source/Core/Address.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Address.cpp?rev=175953&r1=175952&r2=175953&view=diff
==============================================================================
--- lldb/trunk/source/Core/Address.cpp (original)
+++ lldb/trunk/source/Core/Address.cpp Fri Feb 22 22:12:47 2013
@@ -762,7 +762,7 @@ Address::Dump (Stream *s, ExecutionConte
 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());

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=175953&r1=175952&r2=175953&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Fri Feb 22 22:12:47 2013
@@ -445,7 +445,7 @@ Disassembler::PrintInstructions
                 }
                 else
                 {
-                    sc.Clear();
+                    sc.Clear(true);
                 }
             }
 

Modified: lldb/trunk/source/Core/Module.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Module.cpp?rev=175953&r1=175952&r2=175953&view=diff
==============================================================================
--- lldb/trunk/source/Core/Module.cpp (original)
+++ lldb/trunk/source/Core/Module.cpp Fri Feb 22 22:12:47 2013
@@ -442,8 +442,8 @@ Module::ResolveSymbolContextForAddress (
     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());

Modified: lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp?rev=175953&r1=175952&r2=175953&view=diff
==============================================================================
--- lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp (original)
+++ lldb/trunk/source/Expression/ClangExpressionDeclMap.cpp Fri Feb 22 22:12:47 2013
@@ -86,12 +86,12 @@ ClangExpressionDeclMap::WillParse(Execut
         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();
     }
     

Modified: lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp?rev=175953&r1=175952&r2=175953&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Utility/RegisterContextLLDB.cpp Fri Feb 22 22:12:47 2013
@@ -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::InitializeNonZeroth
     {
         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)
         {

Modified: lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp?rev=175953&r1=175952&r2=175953&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp (original)
+++ lldb/trunk/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp Fri Feb 22 22:12:47 2013
@@ -2564,7 +2564,7 @@ SymbolFileDWARF::GetCompUnitForDWARFComp
 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);
 

Modified: lldb/trunk/source/Symbol/SymbolContext.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/SymbolContext.cpp?rev=175953&r1=175952&r2=175953&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/SymbolContext.cpp (original)
+++ lldb/trunk/source/Symbol/SymbolContext.cpp Fri Feb 22 22:12:47 2013
@@ -108,9 +108,10 @@ SymbolContext::operator= (const SymbolCo
 }
 
 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 (
                                         SymbolContext &next_frame_sc, 
                                         Address &next_frame_pc) const
 {
-    next_frame_sc.Clear();
+    next_frame_sc.Clear(false);
     next_frame_pc.Clear();
 
     if (block)

Modified: lldb/trunk/source/Symbol/Variable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/Variable.cpp?rev=175953&r1=175952&r2=175953&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/Variable.cpp (original)
+++ lldb/trunk/source/Symbol/Variable.cpp Fri Feb 22 22:12:47 2013
@@ -203,7 +203,7 @@ Variable::CalculateSymbolContext (Symbol
     if (m_owner_scope)
         m_owner_scope->CalculateSymbolContext(sc);
     else
-        sc->Clear();
+        sc->Clear(false);
 }
 
 bool

Modified: lldb/trunk/source/Target/StackFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/StackFrame.cpp?rev=175953&r1=175952&r2=175953&view=diff
==============================================================================
--- lldb/trunk/source/Target/StackFrame.cpp (original)
+++ lldb/trunk/source/Target/StackFrame.cpp Fri Feb 22 22:12:47 2013
@@ -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)





More information about the lldb-commits mailing list