summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions
diff options
context:
space:
mode:
authorKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
committerKate Stone <katherine.stone@apple.com>2016-09-06 20:57:50 +0000
commitb9c1b51e45b845debb76d8658edabca70ca56079 (patch)
treedfcb5a13ef2b014202340f47036da383eaee74aa /lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions
parentd5aa73376966339caad04013510626ec2e42c760 (diff)
downloadbcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz
bcm5719-llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has *** two obvious implications: Firstly, merging this particular commit into a downstream fork may be a huge effort. Alternatively, it may be worth merging all changes up to this commit, performing the same reformatting operation locally, and then discarding the merge for this particular commit. The commands used to accomplish this reformatting were as follows (with current working directory as the root of the repository): find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} + find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ; The version of clang-format used was 3.9.0, and autopep8 was 1.2.4. Secondly, “blame” style tools will generally point to this commit instead of a meaningful prior commit. There are alternatives available that will attempt to look through this change and find the appropriate prior commit. YMMV. llvm-svn: 280751
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py100
1 files changed, 64 insertions, 36 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 8d2732fd3c2..3fd9b13c711 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
@@ -5,38 +5,43 @@ Test breakpoint conditions with 'breakpoint modify -c <expr> id'.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BreakpointConditionsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ @skipIfWindows
def test_breakpoint_condition_and_run_command(self):
"""Exercise breakpoint condition with 'breakpoint modify -c <expr> id'."""
self.build()
self.breakpoint_conditions()
- @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ @skipIfWindows
def test_breakpoint_condition_inline_and_run_command(self):
"""Exercise breakpoint condition inline with 'breakpoint set'."""
self.build()
self.breakpoint_conditions(inline=True)
- @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ @skipIfWindows
@add_test_categories(['pyapi'])
def test_breakpoint_condition_and_python_api(self):
"""Use Python APIs to set breakpoint conditions."""
self.build()
self.breakpoint_conditions_python()
- @skipIfWindows # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ # Requires EE to support COFF on Windows (http://llvm.org/pr22232)
+ @skipIfWindows
@add_test_categories(['pyapi'])
def test_breakpoint_invalid_condition_and_python_api(self):
"""Use Python APIs to set breakpoint conditions."""
@@ -47,8 +52,10 @@ class BreakpointConditionsTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to of function 'c'.
- self.line1 = line_number('main.c', '// Find the line number of function "c" here.')
- self.line2 = line_number('main.c', "// Find the line number of c's parent call here.")
+ self.line1 = line_number(
+ 'main.c', '// Find the line number of function "c" here.')
+ self.line2 = line_number(
+ 'main.c', "// Find the line number of c's parent call here.")
def breakpoint_conditions(self, inline=False):
"""Exercise breakpoint condition with 'breakpoint modify -c <expr> id'."""
@@ -57,10 +64,16 @@ class BreakpointConditionsTestCase(TestBase):
if inline:
# Create a breakpoint by function name 'c' and set the condition.
- lldbutil.run_break_set_by_symbol (self, "c", extra_options="-c 'val == 3'", num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self,
+ "c",
+ extra_options="-c 'val == 3'",
+ num_expected_locations=1,
+ sym_exact=True)
else:
# Create a breakpoint by function name 'c'.
- lldbutil.run_break_set_by_symbol (self, "c", num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self, "c", num_expected_locations=1, sym_exact=True)
# And set a condition on the breakpoint to stop on when 'val == 3'.
self.runCmd("breakpoint modify -c 'val == 3' 1")
@@ -70,42 +83,50 @@ class BreakpointConditionsTestCase(TestBase):
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
# 'frame variable --show-types val' should return 3 due to breakpoint condition.
- self.expect("frame variable --show-types val", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(int) val = 3')
+ self.expect(
+ "frame variable --show-types val",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(int) val = 3')
# Also check the hit count, which should be 3, by design.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = ["resolved = 1",
- "Condition: val == 3",
- "hit count = 1"])
+ substrs=["resolved = 1",
+ "Condition: val == 3",
+ "hit count = 1"])
# The frame #0 should correspond to main.c:36, the executable statement
- # in function name 'c'. And the parent frame should point to main.c:24.
+ # in function name 'c'. And the parent frame should point to
+ # main.c:24.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT_CONDITION,
- #substrs = ["stop reason = breakpoint"],
- patterns = ["frame #0.*main.c:%d" % self.line1,
- "frame #1.*main.c:%d" % self.line2])
+ #substrs = ["stop reason = breakpoint"],
+ patterns=["frame #0.*main.c:%d" % self.line1,
+ "frame #1.*main.c:%d" % self.line2])
# Test that "breakpoint modify -c ''" clears the condition for the last
# created breakpoint, so that when the breakpoint hits, val == 1.
self.runCmd("process kill")
self.runCmd("breakpoint modify -c ''")
- self.expect("breakpoint list -f", BREAKPOINT_STATE_CORRECT, matching=False,
- substrs = ["Condition:"])
+ self.expect(
+ "breakpoint list -f",
+ BREAKPOINT_STATE_CORRECT,
+ matching=False,
+ substrs=["Condition:"])
# Now run the program again.
self.runCmd("run", RUN_SUCCEEDED)
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
# 'frame variable --show-types val' should return 1 since it is the first breakpoint hit.
- self.expect("frame variable --show-types val", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(int) val = 1')
+ self.expect(
+ "frame variable --show-types val",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(int) val = 1')
self.runCmd("process kill")
@@ -124,7 +145,8 @@ class BreakpointConditionsTestCase(TestBase):
breakpoint.GetNumLocations() == 1,
VALID_BREAKPOINT)
- # We didn't associate a thread index with the breakpoint, so it should be invalid.
+ # We didn't associate a thread index with the breakpoint, so it should
+ # be invalid.
self.assertTrue(breakpoint.GetThreadIndex() == lldb.UINT32_MAX,
"The thread index should be invalid")
# The thread name should be invalid, too.
@@ -133,7 +155,8 @@ class BreakpointConditionsTestCase(TestBase):
# Let's set the thread index for this breakpoint and verify that it is,
# indeed, being set correctly.
- breakpoint.SetThreadIndex(1) # There's only one thread for the process.
+ # There's only one thread for the process.
+ breakpoint.SetThreadIndex(1)
self.assertTrue(breakpoint.GetThreadIndex() == 1,
"The thread index has been set correctly")
@@ -147,16 +170,19 @@ class BreakpointConditionsTestCase(TestBase):
# Set the condition on the breakpoint location.
location.SetCondition('val == 3')
self.expect(location.GetCondition(), exe=False,
- startstr = 'val == 3')
+ startstr='val == 3')
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ 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")
+ 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 and
@@ -168,7 +194,8 @@ class BreakpointConditionsTestCase(TestBase):
# Test that the condition expression didn't create a result variable:
options = lldb.SBExpressionOptions()
value = frame0.EvaluateExpression("$0", options)
- self.assertTrue(value.GetError().Fail(), "Conditions should not make result variables.")
+ self.assertTrue(value.GetError().Fail(),
+ "Conditions should not make result variables.")
process.Continue()
def breakpoint_invalid_conditions_python(self):
@@ -189,21 +216,22 @@ class BreakpointConditionsTestCase(TestBase):
# 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')
+ 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())
+ 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")
+ 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)
-
-
OpenPOWER on IntegriCloud