[Lldb-commits] [PATCH] D30249: Clear expression when breakpoint location becomes unresolved

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Wed Feb 22 11:03:45 PST 2017


Note that the breakpoint location's site gets cleared when you disable the breakpoint or its location, as well as when you delete it.  So if you have a workflow that does: "hit a breakpoint, disable it, hit another, reenable the first, hit the second" you'll end up re-evaluating the condition expression unnecessarily.  This isn't a terribly common workflow, and compiling the expression is not hugely expensive.  But in this instance, it was probably better to break the link at the SBBreakpoint level, and not here.

Jim




> On Feb 22, 2017, at 3:56 AM, Pavel Labath via Phabricator <reviews at reviews.llvm.org> wrote:
> 
> labath created this revision.
> 
> The compiled expression is not needed once the location goes away. Also,
> it holds a reference to the module, which prevents cleanup of the module
> if somebody holds a reference to the breakpoint object.
> 
> This fixes the StepOverBreakpoint test on windows, but I am unsure how
> to make a more generic test for this.
> 
> 
> https://reviews.llvm.org/D30249
> 
> Files:
>  packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
>  source/Breakpoint/BreakpointLocation.cpp
> 
> 
> Index: source/Breakpoint/BreakpointLocation.cpp
> ===================================================================
> --- source/Breakpoint/BreakpointLocation.cpp
> +++ source/Breakpoint/BreakpointLocation.cpp
> @@ -458,6 +458,7 @@
>       m_bp_site_sp->RemoveOwner(GetBreakpoint().GetID(), GetID());
> 
>     m_bp_site_sp.reset();
> +    m_user_expression_sp.reset();
>     return true;
>   }
>   return false;
> Index: packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
> ===================================================================
> --- packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
> +++ packages/Python/lldbsuite/test/functionalities/breakpoint/step_over_breakpoint/TestStepOverBreakpoint.py
> @@ -52,7 +52,6 @@
>         self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoint1)
>         self.assertIsNotNone(self.thread, "Didn't stop at breakpoint 1.")
> 
> -    @skipIf(bugnumber="llvm.org/pr31972", hostoslist=["windows"])
>     def test_step_instruction(self): 
>         # Count instructions between breakpoint_1 and breakpoint_4
>         contextList = self.target.FindFunctions('main', lldb.eFunctionNameTypeAuto)
> 
> 
> <D30249.89345.patch>



More information about the lldb-commits mailing list