[Lldb-commits] [lldb] r272071 - Now that there are no cycles that cause leaks in the disassembler/instruction classes, we can get rid of the FIXME lines that were working around this issue.

Greg Clayton via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 7 16:19:00 PDT 2016


Author: gclayton
Date: Tue Jun  7 18:19:00 2016
New Revision: 272071

URL: http://llvm.org/viewvc/llvm-project?rev=272071&view=rev
Log:
Now that there are no cycles that cause leaks in the disassembler/instruction classes, we can get rid of the FIXME lines that were working around this issue.

<rdar://problem/26684190>


Modified:
    lldb/trunk/source/Core/DataExtractor.cpp
    lldb/trunk/source/Core/Disassembler.cpp
    lldb/trunk/source/Expression/IRExecutionUnit.cpp
    lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
    lldb/trunk/source/Target/Process.cpp
    lldb/trunk/source/Target/ThreadPlanStepRange.cpp

Modified: lldb/trunk/source/Core/DataExtractor.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/DataExtractor.cpp?rev=272071&r1=272070&r2=272071&view=diff
==============================================================================
--- lldb/trunk/source/Core/DataExtractor.cpp (original)
+++ lldb/trunk/source/Core/DataExtractor.cpp Tue Jun  7 18:19:00 2016
@@ -1475,10 +1475,6 @@ DataExtractor::Dump (Stream *s,
                     ExecutionContext exe_ctx;
                     exe_scope->CalculateExecutionContext(exe_ctx);
                     disassembler_sp->GetInstructionList().Dump (s,  show_address, show_bytes, &exe_ctx);
-                    
-                    // FIXME: The DisassemblerLLVMC has a reference cycle and won't go away if it has any active instructions.
-                    // I'll fix that but for now, just clear the list and it will go away nicely.
-                    disassembler_sp->GetInstructionList().Clear();
                 }
             }
         }

Modified: lldb/trunk/source/Core/Disassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/Disassembler.cpp?rev=272071&r1=272070&r2=272071&view=diff
==============================================================================
--- lldb/trunk/source/Core/Disassembler.cpp (original)
+++ lldb/trunk/source/Core/Disassembler.cpp Tue Jun  7 18:19:00 2016
@@ -302,19 +302,8 @@ Disassembler::Disassemble(Debugger &debu
             if (bytes_disassembled == 0)
                 return false;
 
-            bool result = PrintInstructions (disasm_sp.get(),
-                                             debugger,
-                                             arch,
-                                             exe_ctx,
-                                             num_instructions,
-                                             num_mixed_context_lines,
-                                             options,
-                                             strm);
-            
-            // FIXME: The DisassemblerLLVMC has a reference cycle and won't go away if it has any active instructions.
-            // I'll fix that but for now, just clear the list and it will go away nicely.
-            disasm_sp->GetInstructionList().Clear();
-            return result;
+            return PrintInstructions(disasm_sp.get(), debugger, arch, exe_ctx, num_instructions,
+                                     num_mixed_context_lines, options, strm);
         }
     }
     return false;
@@ -349,33 +338,17 @@ Disassembler::Disassemble(Debugger &debu
                                                                       prefer_file_cache);
             if (bytes_disassembled == 0)
                 return false;
-            bool result = PrintInstructions (disasm_sp.get(),
-                                             debugger,
-                                             arch,
-                                             exe_ctx,
-                                             num_instructions,
-                                             num_mixed_context_lines,
-                                             options,
-                                             strm);
-            
-            // FIXME: The DisassemblerLLVMC has a reference cycle and won't go away if it has any active instructions.
-            // I'll fix that but for now, just clear the list and it will go away nicely.
-            disasm_sp->GetInstructionList().Clear();
-            return result;
+            return PrintInstructions(disasm_sp.get(), debugger, arch, exe_ctx, num_instructions,
+                                     num_mixed_context_lines, options, strm);
         }
     }
     return false;
 }
-            
-bool 
-Disassembler::PrintInstructions(Disassembler *disasm_ptr,
-                                Debugger &debugger,
-                                const ArchSpec &arch,
-                                const ExecutionContext &exe_ctx,
-                                uint32_t num_instructions,
-                                uint32_t num_mixed_context_lines,
-                                uint32_t options,
-                                Stream &strm)
+
+bool
+Disassembler::PrintInstructions(Disassembler *disasm_ptr, Debugger &debugger, const ArchSpec &arch,
+                                const ExecutionContext &exe_ctx, uint32_t num_instructions,
+                                uint32_t num_mixed_context_lines, uint32_t options, Stream &strm)
 {
     // We got some things disassembled...
     size_t num_instructions_found = disasm_ptr->GetInstructionList().GetSize();

Modified: lldb/trunk/source/Expression/IRExecutionUnit.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Expression/IRExecutionUnit.cpp?rev=272071&r1=272070&r2=272071&view=diff
==============================================================================
--- lldb/trunk/source/Expression/IRExecutionUnit.cpp (original)
+++ lldb/trunk/source/Expression/IRExecutionUnit.cpp Tue Jun  7 18:19:00 2016
@@ -216,10 +216,6 @@ IRExecutionUnit::DisassembleFunction (St
 
     InstructionList &instruction_list = disassembler_sp->GetInstructionList();
     instruction_list.Dump(&stream, true, true, &exe_ctx);
-
-    // FIXME: The DisassemblerLLVMC has a reference cycle and won't go away if it has any active instructions.
-    // I'll fix that but for now, just clear the list and it will go away nicely.
-    disassembler_sp->GetInstructionList().Clear();
     return ret;
 }
 

Modified: lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp?rev=272071&r1=272070&r2=272071&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp (original)
+++ lldb/trunk/source/Plugins/UnwindAssembly/InstEmulation/UnwindAssemblyInstEmulation.cpp Tue Jun  7 18:19:00 2016
@@ -229,9 +229,6 @@ UnwindAssemblyInstEmulation::GetNonCallS
                     }
                 }
             }
-            // FIXME: The DisassemblerLLVMC has a reference cycle and won't go away if it has any active instructions.
-            // I'll fix that but for now, just clear the list and it will go away nicely.
-            disasm_sp->GetInstructionList().Clear();
         }
         
         if (log && log->GetVerbose ())

Modified: lldb/trunk/source/Target/Process.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Process.cpp?rev=272071&r1=272070&r2=272071&view=diff
==============================================================================
--- lldb/trunk/source/Target/Process.cpp (original)
+++ lldb/trunk/source/Target/Process.cpp Tue Jun  7 18:19:00 2016
@@ -6605,11 +6605,5 @@ Process::AdvanceAddressToNextBranchInstr
         }
     }
 
-    if (disassembler_sp)
-    {
-        // FIXME: The DisassemblerLLVMC has a reference cycle and won't go away if it has any active instructions.
-        disassembler_sp->GetInstructionList().Clear();
-    }
-
     return retval;
 }

Modified: lldb/trunk/source/Target/ThreadPlanStepRange.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/ThreadPlanStepRange.cpp?rev=272071&r1=272070&r2=272071&view=diff
==============================================================================
--- lldb/trunk/source/Target/ThreadPlanStepRange.cpp (original)
+++ lldb/trunk/source/Target/ThreadPlanStepRange.cpp Tue Jun  7 18:19:00 2016
@@ -64,16 +64,6 @@ ThreadPlanStepRange::ThreadPlanStepRange
 ThreadPlanStepRange::~ThreadPlanStepRange ()
 {
     ClearNextBranchBreakpoint();
-    
-    size_t num_instruction_ranges = m_instruction_ranges.size();
-    
-    // FIXME: The DisassemblerLLVMC has a reference cycle and won't go away if it has any active instructions.
-    // I'll fix that but for now, just clear the list and it will go away nicely.
-    for (size_t i = 0; i < num_instruction_ranges; i++)
-    {
-        if (m_instruction_ranges[i])
-            m_instruction_ranges[i]->GetInstructionList().Clear();
-    }
 }
 
 void




More information about the lldb-commits mailing list