diff options
author | Jim Ingham <jingham@apple.com> | 2016-08-03 22:46:11 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2016-08-03 22:46:11 +0000 |
commit | 298de8f6a3698c46c538c37dcd8f84a87e2e4095 (patch) | |
tree | 85be06829c2afc709f87b85e45fb3b4e0c129edc /lldb/packages/Python | |
parent | 1873998b1643ab2b3628f790fbdc47a75788a627 (diff) | |
download | bcm5719-llvm-298de8f6a3698c46c538c37dcd8f84a87e2e4095.tar.gz bcm5719-llvm-298de8f6a3698c46c538c37dcd8f84a87e2e4095.zip |
Errors compiling breakpoint conditions will cause the breakpoint not to be hit
This was a shadowed variable error from the big Expression Parser plugin-ification. I also
added a test case for this.
<rdar://problem/27682376>
llvm-svn: 277662
Diffstat (limited to 'lldb/packages/Python')
-rw-r--r-- | lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py index 0d34dd85dc5..838015966d3 100644 --- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py +++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py @@ -36,6 +36,13 @@ class BreakpointConditionsTestCase(TestBase): self.build() self.breakpoint_conditions_python() + @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232) + @add_test_categories(['pyapi']) + def test_breakpoint_invalid_condition_and_python_api(self): + """Use Python APIs to set breakpoint conditions.""" + self.build() + self.breakpoint_invalid_conditions_python() + def setUp(self): # Call super's setUp(). TestBase.setUp(self) @@ -186,3 +193,40 @@ class BreakpointConditionsTestCase(TestBase): value = frame0.EvaluateExpression("$0", options) self.assertTrue(value.GetError().Fail(), "Conditions should not make result variables.") process.Continue() + + def breakpoint_invalid_conditions_python(self): + """Use Python APIs to set breakpoint conditions.""" + exe = os.path.join(os.getcwd(), "a.out") + + # Create a target by the debugger. + target = self.dbg.CreateTarget(exe) + self.assertTrue(target, VALID_TARGET) + + # Now create a breakpoint on main.c by name 'c'. + breakpoint = target.BreakpointCreateByName('c', 'a.out') + #print("breakpoint:", breakpoint) + self.assertTrue(breakpoint and + breakpoint.GetNumLocations() == 1, + VALID_BREAKPOINT) + + # Set the condition on the breakpoint. + breakpoint.SetCondition('no_such_variable == not_this_one_either') + self.expect(breakpoint.GetCondition(), exe=False, + startstr = 'no_such_variable == not_this_one_either') + + # Now launch the process, and do not stop at entry point. + process = target.LaunchSimple (None, None, self.get_process_working_directory()) + self.assertTrue(process, PROCESS_IS_VALID) + + # Frame #0 should be on self.line1 and the break condition should hold. + from lldbsuite.test.lldbutil import get_stopped_thread + thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint) + self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition") + frame0 = thread.GetFrameAtIndex(0) + var = frame0.FindValue('val', lldb.eValueTypeVariableArgument) + self.assertTrue(frame0.GetLineEntry().GetLine() == self.line1) + + # The hit count for the breakpoint should be 1. + self.assertTrue(breakpoint.GetHitCount() == 1) + + |