summaryrefslogtreecommitdiffstats
path: root/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/packages/Python/lldbsuite/test/functionalities/breakpoint')
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py32
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py27
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py63
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py215
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py52
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py43
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py7
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py100
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py75
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py69
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py24
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py106
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py66
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py64
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py27
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py19
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py65
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py91
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py27
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py21
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py33
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py38
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py95
-rw-r--r--lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py76
24 files changed, 921 insertions, 514 deletions
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
index 9442a076e2a..a48d5645e5f 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestAddressBreakpoints.py
@@ -5,18 +5,19 @@ Test address breakpoints set with shared library of SBAddress work correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
+
class AddressBreakpointTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def test_address_breakpoints (self):
+ def test_address_breakpoints(self):
"""Test address breakpoints set with shared library of SBAddress work correctly."""
self.build()
self.address_breakpoints()
@@ -34,7 +35,8 @@ class AddressBreakpointTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Now create a breakpoint on main.c by name 'c'.
- breakpoint = target.BreakpointCreateBySourceRegex("Set a breakpoint here", lldb.SBFileSpec("main.c"))
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ "Set a breakpoint here", lldb.SBFileSpec("main.c"))
self.assertTrue(breakpoint and
breakpoint.GetNumLocations() == 1,
VALID_BREAKPOINT)
@@ -48,7 +50,7 @@ class AddressBreakpointTestCase(TestBase):
# Next get the address from the location, and create an address breakpoint using
# that address:
-
+
address = location.GetAddress()
target.BreakpointDelete(breakpoint.GetID())
@@ -61,16 +63,18 @@ class AddressBreakpointTestCase(TestBase):
flags = launch_info.GetLaunchFlags()
flags &= ~lldb.eLaunchFlagDisableASLR
launch_info.SetLaunchFlags(flags)
-
+
error = lldb.SBError()
- process = target.Launch (launch_info, error)
+ process = target.Launch(launch_info, error)
self.assertTrue(process, PROCESS_IS_VALID)
# Did we hit our breakpoint?
- from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
- threads = get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue(len(threads) == 1, "There should be a thread stopped at our breakpoint")
+ from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
+ threads = get_threads_stopped_at_breakpoint(process, breakpoint)
+ self.assertTrue(
+ len(threads) == 1,
+ "There should be a thread stopped at our breakpoint")
# The hit count for the breakpoint should be 1.
self.assertTrue(breakpoint.GetHitCount() == 1)
@@ -82,10 +86,12 @@ class AddressBreakpointTestCase(TestBase):
launch_info.SetLaunchFlags(flags)
process = target.Launch(launch_info, error)
- self.assertTrue (process, PROCESS_IS_VALID)
+ self.assertTrue(process, PROCESS_IS_VALID)
- thread = get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue(len(threads) == 1, "There should be a thread stopped at our breakpoint")
+ thread = get_threads_stopped_at_breakpoint(process, breakpoint)
+ self.assertTrue(
+ len(threads) == 1,
+ "There should be a thread stopped at our breakpoint")
# The hit count for the breakpoint should now be 2.
self.assertTrue(breakpoint.GetHitCount() == 2)
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
index 73b3ef5eae2..7876e3b3d90 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
@@ -5,18 +5,19 @@ Test that breakpoints set on a bad address say they are bad.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
+
class BadAddressBreakpointTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def test_bad_address_breakpoints (self):
+ def test_bad_address_breakpoints(self):
"""Test that breakpoints set on a bad address say they are bad."""
self.build()
self.address_breakpoints()
@@ -34,7 +35,8 @@ class BadAddressBreakpointTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Now create a breakpoint on main.c by name 'c'.
- breakpoint = target.BreakpointCreateBySourceRegex("Set a breakpoint here", lldb.SBFileSpec("main.c"))
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ "Set a breakpoint here", lldb.SBFileSpec("main.c"))
self.assertTrue(breakpoint and
breakpoint.GetNumLocations() == 1,
VALID_BREAKPOINT)
@@ -47,16 +49,18 @@ class BadAddressBreakpointTestCase(TestBase):
VALID_BREAKPOINT_LOCATION)
launch_info = lldb.SBLaunchInfo(None)
-
+
error = lldb.SBError()
- process = target.Launch (launch_info, error)
+ process = target.Launch(launch_info, error)
self.assertTrue(process, PROCESS_IS_VALID)
# Did we hit our breakpoint?
- from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
- threads = get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue(len(threads) == 1, "There should be a thread stopped at our breakpoint")
+ from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
+ threads = get_threads_stopped_at_breakpoint(process, breakpoint)
+ self.assertTrue(
+ len(threads) == 1,
+ "There should be a thread stopped at our breakpoint")
# The hit count for the breakpoint should be 1.
self.assertTrue(breakpoint.GetHitCount() == 1)
@@ -72,6 +76,5 @@ class BadAddressBreakpointTestCase(TestBase):
for bp_loc in bkpt:
self.assertTrue(bp_loc.IsResolved() == False)
else:
- self.fail("Could not find an illegal address at which to set a bad breakpoint.")
-
-
+ self.fail(
+ "Could not find an illegal address at which to set a bad breakpoint.")
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
index aa4ee14ffc5..bd5ae0e541d 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_case_sensitivity/TestBreakpointCaseSensitivity.py
@@ -9,6 +9,7 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
from lldbsuite.test import lldbplatform, lldbplatformutil
+
class BreakpointCaseSensitivityTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
BREAKPOINT_TEXT = 'Set a breakpoint here'
@@ -24,8 +25,9 @@ class BreakpointCaseSensitivityTestCase(TestBase):
self.build()
self.case_sensitivity_breakpoint(True)
- @skipIf(oslist=['windows']) # Skip for windows platforms
- @expectedFailureAll() # Failing for unknown reason on non-Windows platforms.
+ @skipIf(oslist=['windows']) # Skip for windows platforms
+ # Failing for unknown reason on non-Windows platforms.
+ @expectedFailureAll()
def test_breakpoint_doesnt_match_file_with_different_case(self):
"""Set breakpoint on file, shouldn't match files with different case on POSIX systems"""
self.build()
@@ -33,19 +35,19 @@ class BreakpointCaseSensitivityTestCase(TestBase):
def case_sensitivity_breakpoint(self, case_insensitive):
"""Set breakpoint on file, should match files with different case if case_insensitive is True"""
-
+
# use different case to check CreateTarget
exe = 'a.out'
if case_insensitive:
exe = exe.upper()
-
+
exe = os.path.join(os.getcwd(), exe)
# Create a target by the debugger.
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
- cwd = self.get_process_working_directory();
-
+ cwd = self.get_process_working_directory()
+
# try both BreakpointCreateByLocation and BreakpointCreateBySourceRegex
for regex in [False, True]:
# should always hit
@@ -68,47 +70,54 @@ class BreakpointCaseSensitivityTestCase(TestBase):
def check_breakpoint(self, file, source_regex, should_hit):
"""
Check breakpoint hit at given file set by given method
-
+
file:
File where insert the breakpoint
-
+
source_regex:
True for testing using BreakpointCreateBySourceRegex,
False for BreakpointCreateByLocation
-
+
should_hit:
True if the breakpoint should hit, False otherwise
"""
-
- desc = ' file %s set by %s' % (file, 'regex' if source_regex else 'location')
+
+ desc = ' file %s set by %s' % (
+ file, 'regex' if source_regex else 'location')
if source_regex:
- breakpoint = self.target.BreakpointCreateBySourceRegex(self.BREAKPOINT_TEXT,
- lldb.SBFileSpec(file))
- else:
- breakpoint = self.target.BreakpointCreateByLocation(file, self.line)
-
+ breakpoint = self.target.BreakpointCreateBySourceRegex(
+ self.BREAKPOINT_TEXT, lldb.SBFileSpec(file))
+ else:
+ breakpoint = self.target.BreakpointCreateByLocation(
+ file, self.line)
+
self.assertEqual(breakpoint and breakpoint.GetNumLocations() == 1,
- should_hit,
- VALID_BREAKPOINT + desc)
+ should_hit,
+ VALID_BREAKPOINT + desc)
# Get the breakpoint location from breakpoint after we verified that,
# indeed, it has one location.
location = breakpoint.GetLocationAtIndex(0)
self.assertEqual(location and location.IsEnabled(),
- should_hit,
- VALID_BREAKPOINT_LOCATION + desc)
-
- process = self.target.LaunchSimple(None, None, self.get_process_working_directory())
+ should_hit,
+ VALID_BREAKPOINT_LOCATION + desc)
+
+ process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID + desc)
if should_hit:
# Did we hit our breakpoint?
- from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
- threads = get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertEqual(len(threads), 1, "There should be a thread stopped at breakpoint" + desc)
+ from lldbsuite.test.lldbutil import get_threads_stopped_at_breakpoint
+ threads = get_threads_stopped_at_breakpoint(process, breakpoint)
+ self.assertEqual(
+ len(threads),
+ 1,
+ "There should be a thread stopped at breakpoint" +
+ desc)
# The hit count for the breakpoint should be 1.
self.assertEqual(breakpoint.GetHitCount(), 1)
-
+
else:
# check the breakpoint was not hit
self.assertEqual(lldb.eStateExited, process.GetState())
@@ -116,6 +125,6 @@ class BreakpointCaseSensitivityTestCase(TestBase):
# let process finish
process.Continue()
-
+
# cleanup
self.target.BreakpointDelete(breakpoint.GetID())
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
index 78d14b7d770..bfc1cdf3a79 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -5,13 +5,14 @@ Test lldb breakpoint command add/list/delete.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BreakpointCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -27,7 +28,7 @@ class BreakpointCommandTestCase(TestBase):
"""Test a sequence of breakpoint command add, list, and delete."""
self.build()
self.breakpoint_command_sequence()
- self.breakpoint_command_script_parameters ()
+ self.breakpoint_command_script_parameters()
def setUp(self):
# Call super's setUp().
@@ -36,7 +37,8 @@ class BreakpointCommandTestCase(TestBase):
self.line = line_number('main.c', '// Set break point at this line.')
# disable "There is a running process, kill it and restart?" prompt
self.runCmd("settings set auto-confirm true")
- self.addTearDownHook(lambda: self.runCmd("settings clear auto-confirm"))
+ self.addTearDownHook(
+ lambda: self.runCmd("settings clear auto-confirm"))
def breakpoint_command_sequence(self):
"""Test a sequence of breakpoint command add, list, and delete."""
@@ -45,45 +47,64 @@ class BreakpointCommandTestCase(TestBase):
# Add three breakpoints on the same line. The first time we don't specify the file,
# since the default file is the one containing main:
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1, loc_exact=True)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
- # Breakpoint 4 - set at the same location as breakpoint 1 to test setting breakpoint commands on two breakpoints at a time
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ # Breakpoint 4 - set at the same location as breakpoint 1 to test
+ # setting breakpoint commands on two breakpoints at a time
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=1, loc_exact=True)
# Now add callbacks for the breakpoints just created.
- self.runCmd("breakpoint command add -s command -o 'frame variable --show-types --scope' 1 4")
- self.runCmd("breakpoint command add -s python -o 'here = open(\"output.txt\", \"w\"); here.write(\"lldb\\n\"); here.close()' 2")
- self.runCmd("breakpoint command add --python-function bktptcmd.function 3")
+ self.runCmd(
+ "breakpoint command add -s command -o 'frame variable --show-types --scope' 1 4")
+ self.runCmd(
+ "breakpoint command add -s python -o 'here = open(\"output.txt\", \"w\"); here.write(\"lldb\\n\"); here.close()' 2")
+ self.runCmd(
+ "breakpoint command add --python-function bktptcmd.function 3")
# Check that the breakpoint commands are correctly set.
# The breakpoint list now only contains breakpoint 1.
- self.expect("breakpoint list", "Breakpoints 1 & 2 created",
- substrs = ["2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line],
- patterns = ["1: file = '.*main.c', line = %d, exact_match = 0, locations = 1" % self.line] )
-
- self.expect("breakpoint list -f", "Breakpoints 1 & 2 created",
- substrs = ["2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line],
- patterns = ["1: file = '.*main.c', line = %d, exact_match = 0, locations = 1" % self.line,
- "1.1: .+at main.c:%d, .+unresolved, hit count = 0" % self.line,
- "2.1: .+at main.c:%d, .+unresolved, hit count = 0" % self.line])
+ self.expect(
+ "breakpoint list", "Breakpoints 1 & 2 created", substrs=[
+ "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" %
+ self.line], patterns=[
+ "1: file = '.*main.c', line = %d, exact_match = 0, locations = 1" %
+ self.line])
+
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoints 1 & 2 created",
+ substrs=[
+ "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" %
+ self.line],
+ patterns=[
+ "1: file = '.*main.c', line = %d, exact_match = 0, locations = 1" %
+ self.line,
+ "1.1: .+at main.c:%d, .+unresolved, hit count = 0" %
+ self.line,
+ "2.1: .+at main.c:%d, .+unresolved, hit count = 0" %
+ self.line])
self.expect("breakpoint command list 1", "Breakpoint 1 command ok",
- substrs = ["Breakpoint commands:",
- "frame variable --show-types --scope"])
+ substrs=["Breakpoint commands:",
+ "frame variable --show-types --scope"])
self.expect("breakpoint command list 2", "Breakpoint 2 command ok",
- substrs = ["Breakpoint commands:",
- "here = open",
- "here.write",
- "here.close()"])
+ substrs=["Breakpoint commands:",
+ "here = open",
+ "here.write",
+ "here.close()"])
self.expect("breakpoint command list 3", "Breakpoint 3 command ok",
- substrs = ["Breakpoint commands:",
- "bktptcmd.function(frame, bp_loc, internal_dict)"])
+ substrs=["Breakpoint commands:",
+ "bktptcmd.function(frame, bp_loc, internal_dict)"])
self.expect("breakpoint command list 4", "Breakpoint 4 command ok",
- substrs = ["Breakpoint commands:",
- "frame variable --show-types --scope"])
+ substrs=["Breakpoint commands:",
+ "frame variable --show-types --scope"])
self.runCmd("breakpoint delete 4")
@@ -93,43 +114,68 @@ class BreakpointCommandTestCase(TestBase):
# and then specify only one file. The first time we should get two locations,
# the second time only one:
- lldbutil.run_break_set_by_regexp (self, r"._MyFunction", num_expected_locations=2)
-
- lldbutil.run_break_set_by_regexp (self, r"._MyFunction", extra_options="-f a.c", num_expected_locations=1)
-
- lldbutil.run_break_set_by_regexp (self, r"._MyFunction", extra_options="-f a.c -f b.c", num_expected_locations=2)
+ lldbutil.run_break_set_by_regexp(
+ self, r"._MyFunction", num_expected_locations=2)
+
+ lldbutil.run_break_set_by_regexp(
+ self,
+ r"._MyFunction",
+ extra_options="-f a.c",
+ num_expected_locations=1)
+
+ lldbutil.run_break_set_by_regexp(
+ self,
+ r"._MyFunction",
+ extra_options="-f a.c -f b.c",
+ num_expected_locations=2)
# Now try a source regex breakpoint:
- lldbutil.run_break_set_by_source_regexp (self, r"is about to return [12]0", extra_options="-f a.c -f b.c", num_expected_locations=2)
-
- lldbutil.run_break_set_by_source_regexp (self, r"is about to return [12]0", extra_options="-f a.c", num_expected_locations=1)
-
+ lldbutil.run_break_set_by_source_regexp(
+ self,
+ r"is about to return [12]0",
+ extra_options="-f a.c -f b.c",
+ num_expected_locations=2)
+
+ lldbutil.run_break_set_by_source_regexp(
+ self,
+ r"is about to return [12]0",
+ extra_options="-f a.c",
+ num_expected_locations=1)
+
# Run the program. Remove 'output.txt' if it exists.
self.RemoveTempFile("output.txt")
self.RemoveTempFile("output2.txt")
self.runCmd("run", RUN_SUCCEEDED)
- # Check that the file 'output.txt' exists and contains the string "lldb".
+ # Check that the file 'output.txt' exists and contains the string
+ # "lldb".
# The 'output.txt' file should now exist.
- self.assertTrue(os.path.isfile("output.txt"),
- "'output.txt' exists due to breakpoint command for breakpoint 2.")
- self.assertTrue(os.path.isfile("output2.txt"),
- "'output2.txt' exists due to breakpoint command for breakpoint 3.")
+ self.assertTrue(
+ os.path.isfile("output.txt"),
+ "'output.txt' exists due to breakpoint command for breakpoint 2.")
+ self.assertTrue(
+ os.path.isfile("output2.txt"),
+ "'output2.txt' exists due to breakpoint command for breakpoint 3.")
# Read the output file produced by running the program.
with open('output.txt', 'r') as f:
output = f.read()
- self.expect(output, "File 'output.txt' and the content matches", exe=False,
- startstr = "lldb")
+ self.expect(
+ output,
+ "File 'output.txt' and the content matches",
+ exe=False,
+ startstr="lldb")
with open('output2.txt', 'r') as f:
output = f.read()
- self.expect(output, "File 'output2.txt' and the content matches", exe=False,
- startstr = "lldb")
-
+ self.expect(
+ output,
+ "File 'output2.txt' and the content matches",
+ exe=False,
+ startstr="lldb")
# Finish the program.
self.runCmd("process continue")
@@ -140,21 +186,31 @@ class BreakpointCommandTestCase(TestBase):
# Remove breakpoint 2.
self.runCmd("breakpoint delete 2")
- self.expect("breakpoint command list 1",
- startstr = "Breakpoint 1 does not have an associated command.")
- self.expect("breakpoint command list 2", error=True,
- startstr = "error: '2' is not a currently valid breakpoint ID.")
+ self.expect(
+ "breakpoint command list 1",
+ startstr="Breakpoint 1 does not have an associated command.")
+ self.expect(
+ "breakpoint command list 2",
+ error=True,
+ startstr="error: '2' is not a currently valid breakpoint ID.")
# The breakpoint list now only contains breakpoint 1.
- self.expect("breakpoint list -f", "Breakpoint 1 exists",
- patterns = ["1: file = '.*main.c', line = %d, exact_match = 0, locations = 1, resolved = 1" %
- self.line,
- "hit count = 1"])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint 1 exists",
+ patterns=[
+ "1: file = '.*main.c', line = %d, exact_match = 0, locations = 1, resolved = 1" %
+ self.line,
+ "hit count = 1"])
# Not breakpoint 2.
- self.expect("breakpoint list -f", "No more breakpoint 2", matching=False,
- substrs = ["2: file = 'main.c', line = %d, exact_match = 0, locations = 1, resolved = 1" %
- self.line])
+ self.expect(
+ "breakpoint list -f",
+ "No more breakpoint 2",
+ matching=False,
+ substrs=[
+ "2: file = 'main.c', line = %d, exact_match = 0, locations = 1, resolved = 1" %
+ self.line])
# Run the program again, with breakpoint 1 remaining.
self.runCmd("run", RUN_SUCCEEDED)
@@ -163,20 +219,21 @@ class BreakpointCommandTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 2.
self.expect("breakpoint list -f", BREAKPOINT_HIT_TWICE,
- substrs = ['resolved, hit count = 2'])
+ substrs=['resolved, hit count = 2'])
- def breakpoint_command_script_parameters (self):
+ def breakpoint_command_script_parameters(self):
"""Test that the frame and breakpoint location are being properly passed to the script breakpoint command function."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
# Now add callbacks for the breakpoints just created.
self.runCmd("breakpoint command add -s python -o 'here = open(\"output-2.txt\", \"w\"); here.write(str(frame) + \"\\n\"); here.write(str(bp_loc) + \"\\n\"); here.close()' 1")
@@ -184,24 +241,30 @@ class BreakpointCommandTestCase(TestBase):
# Remove 'output-2.txt' if it already exists.
if (os.path.exists('output-2.txt')):
- os.remove ('output-2.txt')
+ os.remove('output-2.txt')
- # Run program, hit breakpoint, and hopefully write out new version of 'output-2.txt'
- self.runCmd ("run", RUN_SUCCEEDED)
+ # Run program, hit breakpoint, and hopefully write out new version of
+ # 'output-2.txt'
+ self.runCmd("run", RUN_SUCCEEDED)
- # Check that the file 'output.txt' exists and contains the string "lldb".
+ # Check that the file 'output.txt' exists and contains the string
+ # "lldb".
# The 'output-2.txt' file should now exist.
- self.assertTrue(os.path.isfile("output-2.txt"),
- "'output-2.txt' exists due to breakpoint command for breakpoint 1.")
+ self.assertTrue(
+ os.path.isfile("output-2.txt"),
+ "'output-2.txt' exists due to breakpoint command for breakpoint 1.")
# Read the output file produced by running the program.
with open('output-2.txt', 'r') as f:
output = f.read()
- self.expect (output, "File 'output-2.txt' and the content matches", exe=False,
- startstr = "frame #0:",
- patterns = ["1.* where = .*main .* resolved, hit count = 1" ])
+ self.expect(
+ output,
+ "File 'output-2.txt' and the content matches",
+ exe=False,
+ startstr="frame #0:",
+ patterns=["1.* where = .*main .* resolved, hit count = 1"])
# Now remove 'output-2.txt'
- os.remove ('output-2.txt')
+ os.remove('output-2.txt')
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
index 4f8ab9e115d..01af8369aaf 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommandsFromPython.py
@@ -5,7 +5,6 @@ Test that you can set breakpoint commands successfully with the Python API's:
from __future__ import print_function
-
import os
import re
import sys
@@ -14,6 +13,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class PythonBreakpointCommandSettingTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,36 +23,42 @@ class PythonBreakpointCommandSettingTestCase(TestBase):
def test_step_out_python(self):
"""Test stepping out using avoid-no-debug with dsyms."""
self.build()
- self.do_set_python_command_from_python ()
+ self.do_set_python_command_from_python()
- def setUp (self):
+ def setUp(self):
TestBase.setUp(self)
self.main_source = "main.c"
self.main_source_spec = lldb.SBFileSpec(self.main_source)
-
- def do_set_python_command_from_python (self):
+ def do_set_python_command_from_python(self):
exe = os.path.join(os.getcwd(), "a.out")
error = lldb.SBError()
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
- body_bkpt = self.target.BreakpointCreateBySourceRegex("Set break point at this line.", self.main_source_spec)
+ body_bkpt = self.target.BreakpointCreateBySourceRegex(
+ "Set break point at this line.", self.main_source_spec)
self.assertTrue(body_bkpt, VALID_BREAKPOINT)
- func_bkpt = self.target.BreakpointCreateBySourceRegex("Set break point at this line.", self.main_source_spec)
+ func_bkpt = self.target.BreakpointCreateBySourceRegex(
+ "Set break point at this line.", self.main_source_spec)
self.assertTrue(func_bkpt, VALID_BREAKPOINT)
- # Also test that setting a source regex breakpoint with an empty file spec list sets it on all files:
- no_files_bkpt = self.target.BreakpointCreateBySourceRegex("Set a breakpoint here", lldb.SBFileSpecList(), lldb.SBFileSpecList())
+ # Also test that setting a source regex breakpoint with an empty file
+ # spec list sets it on all files:
+ no_files_bkpt = self.target.BreakpointCreateBySourceRegex(
+ "Set a breakpoint here", lldb.SBFileSpecList(), lldb.SBFileSpecList())
self.assertTrue(no_files_bkpt, VALID_BREAKPOINT)
num_locations = no_files_bkpt.GetNumLocations()
- self.assertTrue(num_locations >= 2, "Got at least two breakpoint locations")
+ self.assertTrue(
+ num_locations >= 2,
+ "Got at least two breakpoint locations")
got_one_in_A = False
got_one_in_B = False
for idx in range(0, num_locations):
- comp_unit = no_files_bkpt.GetLocationAtIndex(idx).GetAddress().GetSymbolContext(lldb.eSymbolContextCompUnit).GetCompileUnit().GetFileSpec()
+ comp_unit = no_files_bkpt.GetLocationAtIndex(idx).GetAddress().GetSymbolContext(
+ lldb.eSymbolContextCompUnit).GetCompileUnit().GetFileSpec()
print("Got comp unit: ", comp_unit.GetFilename())
if comp_unit.GetFilename() == "a.c":
got_one_in_A = True
@@ -69,28 +75,36 @@ class PythonBreakpointCommandSettingTestCase(TestBase):
import TestBreakpointCommandsFromPython\n\
TestBreakpointCommandsFromPython.PythonBreakpointCommandSettingTestCase.my_var = 20\n\
print('Hit breakpoint')")
- self.assertTrue (error.Success(), "Failed to set the script callback body: %s."%(error.GetCString()))
+ self.assertTrue(
+ error.Success(),
+ "Failed to set the script callback body: %s." %
+ (error.GetCString()))
- self.dbg.HandleCommand("command script import --allow-reload ./bktptcmd.py")
+ self.dbg.HandleCommand(
+ "command script import --allow-reload ./bktptcmd.py")
func_bkpt.SetScriptCallbackFunction("bktptcmd.function")
- # We will use the function that touches a text file, so remove it first:
+ # We will use the function that touches a text file, so remove it
+ # first:
self.RemoveTempFile("output2.txt")
# Now launch the process, and do not stop at entry point.
- self.process = self.target.LaunchSimple (None, None, self.get_process_working_directory())
+ self.process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(self.process, PROCESS_IS_VALID)
# Now finish, and make sure the return value is correct.
- threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, body_bkpt)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ self.process, body_bkpt)
self.assertTrue(len(threads) == 1, "Stopped at inner breakpoint.")
self.thread = threads[0]
-
+
self.assertTrue(PythonBreakpointCommandSettingTestCase.my_var == 20)
# Check for the function version as well, which produced this file:
# Remember to clean up after ourselves...
- self.assertTrue(os.path.isfile("output2.txt"),
- "'output2.txt' exists due to breakpoint command for breakpoint function.")
+ self.assertTrue(
+ os.path.isfile("output2.txt"),
+ "'output2.txt' exists due to breakpoint command for breakpoint function.")
self.RemoveTempFile("output2.txt")
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
index 1ea71cbde45..baf237bf076 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
@@ -5,12 +5,13 @@ Test _regexp-break command which uses regular expression matching to dispatch to
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class RegexpBreakCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -25,27 +26,47 @@ class RegexpBreakCommandTestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break inside main().
self.source = 'main.c'
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
def regexp_break_command(self):
"""Test the super consie "b" command, which is analias for _regexp-break."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- break_results = lldbutil.run_break_set_command (self, "b %d" % self.line)
- lldbutil.check_breakpoint_result (self, break_results, file_name='main.c', line_number=self.line, num_locations=1)
+ break_results = lldbutil.run_break_set_command(
+ self, "b %d" %
+ self.line)
+ lldbutil.check_breakpoint_result(
+ self,
+ break_results,
+ file_name='main.c',
+ line_number=self.line,
+ num_locations=1)
- break_results = lldbutil.run_break_set_command (self, "b %s:%d" % (self.source, self.line))
- lldbutil.check_breakpoint_result (self, break_results, file_name='main.c', line_number=self.line, num_locations=1)
+ break_results = lldbutil.run_break_set_command(
+ self, "b %s:%d" % (self.source, self.line))
+ lldbutil.check_breakpoint_result(
+ self,
+ break_results,
+ file_name='main.c',
+ line_number=self.line,
+ num_locations=1)
# Check breakpoint with full file path.
full_path = os.path.join(os.getcwd(), self.source)
- break_results = lldbutil.run_break_set_command (self, "b %s:%d" % (full_path, self.line))
- lldbutil.check_breakpoint_result (self, break_results, file_name='main.c', line_number=self.line, num_locations=1)
+ break_results = lldbutil.run_break_set_command(
+ self, "b %s:%d" % (full_path, self.line))
+ lldbutil.check_breakpoint_result(
+ self,
+ break_results,
+ file_name='main.c',
+ line_number=self.line,
+ num_locations=1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py
index 4bbb0327eac..cf1fc2cf02c 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_command/bktptcmd.py
@@ -1,6 +1,7 @@
from __future__ import print_function
+
def function(frame, bp_loc, dict):
- there = open("output2.txt", "w");
- print("lldb", file=there)
- there.close()
+ there = open("output2.txt", "w")
+ print("lldb", file=there)
+ there.close()
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)
-
-
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
index b7edf2a6e4d..621bd4a55f0 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
@@ -5,47 +5,56 @@ Test lldb breakpoint ids.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class BreakpointIDTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def test (self):
+ def test(self):
self.build()
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
self.expect("file " + exe,
- patterns = [ "Current executable set to .*a.out" ])
-
-
- bpno = lldbutil.run_break_set_by_symbol (self, 'product', num_expected_locations=-1, sym_exact=False)
- self.assertTrue (bpno == 1, "First breakpoint number is 1.")
-
- bpno = lldbutil.run_break_set_by_symbol (self, 'sum', num_expected_locations=-1, sym_exact=False)
- self.assertTrue (bpno == 2, "Second breakpoint number is 2.")
-
- bpno = lldbutil.run_break_set_by_symbol (self, 'junk', num_expected_locations=0, sym_exact=False)
- self.assertTrue (bpno == 3, "Third breakpoint number is 3.")
-
- self.expect ("breakpoint disable 1.1 - 2.2 ",
- COMMAND_FAILED_AS_EXPECTED, error = True,
- startstr = "error: Invalid range: Ranges that specify particular breakpoint locations must be within the same major breakpoint; you specified two different major breakpoints, 1 and 2.")
-
- self.expect ("breakpoint disable 2 - 2.2",
- COMMAND_FAILED_AS_EXPECTED, error = True,
- startstr = "error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.")
-
- self.expect ("breakpoint disable 2.1 - 2",
- COMMAND_FAILED_AS_EXPECTED, error = True,
- startstr = "error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.")
-
- self.expect ("breakpoint disable 2.1 - 2.2",
- startstr = "2 breakpoints disabled.")
-
- self.expect ("breakpoint enable 2.*",
- patterns = [ ".* breakpoints enabled."] )
+ patterns=["Current executable set to .*a.out"])
+
+ bpno = lldbutil.run_break_set_by_symbol(
+ self, 'product', num_expected_locations=-1, sym_exact=False)
+ self.assertTrue(bpno == 1, "First breakpoint number is 1.")
+
+ bpno = lldbutil.run_break_set_by_symbol(
+ self, 'sum', num_expected_locations=-1, sym_exact=False)
+ self.assertTrue(bpno == 2, "Second breakpoint number is 2.")
+
+ bpno = lldbutil.run_break_set_by_symbol(
+ self, 'junk', num_expected_locations=0, sym_exact=False)
+ self.assertTrue(bpno == 3, "Third breakpoint number is 3.")
+
+ self.expect(
+ "breakpoint disable 1.1 - 2.2 ",
+ COMMAND_FAILED_AS_EXPECTED,
+ error=True,
+ startstr="error: Invalid range: Ranges that specify particular breakpoint locations must be within the same major breakpoint; you specified two different major breakpoints, 1 and 2.")
+
+ self.expect(
+ "breakpoint disable 2 - 2.2",
+ COMMAND_FAILED_AS_EXPECTED,
+ error=True,
+ startstr="error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.")
+
+ self.expect(
+ "breakpoint disable 2.1 - 2",
+ COMMAND_FAILED_AS_EXPECTED,
+ error=True,
+ startstr="error: Invalid breakpoint id range: Either both ends of range must specify a breakpoint location, or neither can specify a breakpoint location.")
+
+ self.expect("breakpoint disable 2.1 - 2.2",
+ startstr="2 breakpoints disabled.")
+
+ self.expect("breakpoint enable 2.*",
+ patterns=[".* breakpoints enabled."])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
index 05ef1c6d94c..09e20bc5ac3 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
@@ -5,14 +5,15 @@ Test breakpoint ignore count features.
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 BreakpointIgnoreCountTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -32,11 +33,16 @@ class BreakpointIgnoreCountTestCase(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', '// b(2) -> c(2) Find the call site of b(2).')
- self.line3 = line_number('main.c', '// a(3) -> c(3) Find the call site of c(3).')
- self.line4 = line_number('main.c', '// a(3) -> c(3) Find the call site of a(3).')
- self.line5 = line_number('main.c', '// Find the call site of c in main.')
+ self.line1 = line_number(
+ 'main.c', '// Find the line number of function "c" here.')
+ self.line2 = line_number(
+ 'main.c', '// b(2) -> c(2) Find the call site of b(2).')
+ self.line3 = line_number(
+ 'main.c', '// a(3) -> c(3) Find the call site of c(3).')
+ self.line4 = line_number(
+ 'main.c', '// a(3) -> c(3) Find the call site of a(3).')
+ self.line5 = line_number(
+ 'main.c', '// Find the call site of c in main.')
def breakpoint_ignore_count(self):
"""Exercise breakpoint ignore count with 'breakpoint set -i <count>'."""
@@ -44,26 +50,33 @@ class BreakpointIgnoreCountTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Create a breakpoint in main.c at line1.
- lldbutil.run_break_set_by_file_and_line (self, 'main.c', self.line1, extra_options='-i 1', num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ 'main.c',
+ self.line1,
+ extra_options='-i 1',
+ num_expected_locations=1,
+ loc_exact=True)
# Now run the program.
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'])
- # Also check the hit count, which should be 2, due to ignore count of 1.
+ # Also check the hit count, which should be 2, due to ignore count of
+ # 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_THRICE,
- substrs = ["resolved = 1",
- "hit count = 2"])
+ substrs=["resolved = 1",
+ "hit count = 2"])
# The frame #0 should correspond to main.c:37, the executable statement
# in function name 'c'. And frame #2 should point to main.c:45.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT,
- #substrs = ["stop reason = breakpoint"],
- patterns = ["frame #0.*main.c:%d" % self.line1,
- "frame #2.*main.c:%d" % self.line2])
+ #substrs = ["stop reason = breakpoint"],
+ patterns=["frame #0.*main.c:%d" % self.line1,
+ "frame #2.*main.c:%d" % self.line2])
# continue -i 1 is the same as setting the ignore count to 1 again, try that:
# Now run the program.
@@ -71,21 +84,20 @@ class BreakpointIgnoreCountTestCase(TestBase):
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
- # Also check the hit count, which should be 2, due to ignore count of 1.
+ # Also check the hit count, which should be 2, due to ignore count of
+ # 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_THRICE,
- substrs = ["resolved = 1",
- "hit count = 4"])
+ substrs=["resolved = 1",
+ "hit count = 4"])
# The frame #0 should correspond to main.c:37, the executable statement
# in function name 'c'. And frame #2 should point to main.c:45.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT_IGNORE_COUNT,
- #substrs = ["stop reason = breakpoint"],
- patterns = ["frame #0.*main.c:%d" % self.line1,
- "frame #1.*main.c:%d" % self.line5])
-
-
+ #substrs = ["stop reason = breakpoint"],
+ patterns=["frame #0.*main.c:%d" % self.line1,
+ "frame #1.*main.c:%d" % self.line5])
def breakpoint_ignore_count_python(self):
"""Use Python APIs to set breakpoint ignore count."""
@@ -114,15 +126,18 @@ class BreakpointIgnoreCountTestCase(TestBase):
"SetIgnoreCount() works correctly")
# 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 main.c:37, frame#1 should be on main.c:25, and
# frame#2 should be on main.c:48.
- #lldbutil.print_stacktraces(process)
+ # lldbutil.print_stacktraces(process)
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")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
frame0 = thread.GetFrameAtIndex(0)
frame1 = thread.GetFrameAtIndex(1)
frame2 = thread.GetFrameAtIndex(2)
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py
index b1e0d3deeae..255b6f7fa29 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_in_delayslot/TestAvoidBreakpointInDelaySlot.py
@@ -1,10 +1,11 @@
"""
-Test specific to MIPS
+Test specific to MIPS
"""
from __future__ import print_function
-import os, time
+import os
+import time
import re
import unittest2
import lldb
@@ -12,6 +13,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class AvoidBreakpointInDelaySlotAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,8 +23,8 @@ class AvoidBreakpointInDelaySlotAPITestCase(TestBase):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.expect("file " + exe,
- patterns = [ "Current executable set to .*a.out.*" ])
-
+ patterns=["Current executable set to .*a.out.*"])
+
# Create a target by the debugger.
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
@@ -33,7 +35,8 @@ class AvoidBreakpointInDelaySlotAPITestCase(TestBase):
VALID_BREAKPOINT)
# 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)
list = target.FindFunctions('foo', lldb.eFunctionNameTypeAuto)
@@ -44,7 +47,7 @@ class AvoidBreakpointInDelaySlotAPITestCase(TestBase):
self.assertTrue(function)
self.function(function, target)
- def function (self, function, target):
+ def function(self, function, target):
"""Iterate over instructions in function and place a breakpoint on delay slot instruction"""
# Get the list of all instructions in the function
insts = function.GetInstructions(target)
@@ -56,7 +59,7 @@ class AvoidBreakpointInDelaySlotAPITestCase(TestBase):
branchinstaddress = inst.GetAddress().GetLoadAddress(target)
# Get next instruction i.e delay slot instruction.
- delayinst = insts.GetInstructionAtIndex(i+1)
+ delayinst = insts.GetInstructionAtIndex(i + 1)
delayinstaddr = delayinst.GetAddress().GetLoadAddress(target)
# Set breakpoint on delay slot instruction
@@ -71,9 +74,10 @@ class AvoidBreakpointInDelaySlotAPITestCase(TestBase):
# Get the address where breakpoint is actually set.
bpaddr = location.GetLoadAddress()
-
- # Breakpoint address should be adjusted to the address of branch instruction.
- self.assertTrue(branchinstaddress == bpaddr)
+
+ # Breakpoint address should be adjusted to the address of
+ # branch instruction.
+ self.assertTrue(branchinstaddress == bpaddr)
i += 1
else:
i += 1
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py
index 94fc7bf79f6..214c110afcd 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_language/TestBreakpointLanguage.py
@@ -6,14 +6,15 @@ parser.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
import shutil
import subprocess
+
class TestBreakpointLanguage(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,7 +24,7 @@ class TestBreakpointLanguage(TestBase):
TestBase.setUp(self)
# Find the line number to break inside main().
- def check_location_file (self, bp, loc, test_name):
+ def check_location_file(self, bp, loc, test_name):
bp_loc = bp.GetLocationAtIndex(loc)
addr = bp_loc.GetAddress()
comp_unit = addr.GetCompileUnit()
@@ -37,22 +38,40 @@ class TestBreakpointLanguage(TestBase):
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
error = lldb.SBError()
- # Don't read in dependencies so we don't come across false matches that
+ # Don't read in dependencies so we don't come across false matches that
# add unwanted breakpoint hits.
self.target = self.dbg.CreateTarget(exe, None, None, False, error)
self.assertTrue(self.target, VALID_TARGET)
- cpp_bp = self.target.BreakpointCreateByRegex("func_from", lldb.eLanguageTypeC_plus_plus, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(cpp_bp.GetNumLocations() == 1, "Only one C++ symbol matches")
+ cpp_bp = self.target.BreakpointCreateByRegex(
+ "func_from",
+ lldb.eLanguageTypeC_plus_plus,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ cpp_bp.GetNumLocations() == 1,
+ "Only one C++ symbol matches")
self.assertTrue(self.check_location_file(cpp_bp, 0, "b.cpp"))
- c_bp = self.target.BreakpointCreateByRegex("func_from", lldb.eLanguageTypeC, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(c_bp.GetNumLocations() == 1, "Only one C symbol matches")
+ c_bp = self.target.BreakpointCreateByRegex(
+ "func_from",
+ lldb.eLanguageTypeC,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ c_bp.GetNumLocations() == 1,
+ "Only one C symbol matches")
self.assertTrue(self.check_location_file(c_bp, 0, "a.c"))
-
- objc_bp = self.target.BreakpointCreateByRegex("func_from", lldb.eLanguageTypeObjC, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(objc_bp.GetNumLocations() == 0, "No ObjC symbol matches")
-
+
+ objc_bp = self.target.BreakpointCreateByRegex(
+ "func_from",
+ lldb.eLanguageTypeObjC,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ objc_bp.GetNumLocations() == 0,
+ "No ObjC symbol matches")
+
def test_by_name_breakpoint_language(self):
"""Test that the name regex breakpoint commands obey the language filter."""
@@ -60,26 +79,59 @@ class TestBreakpointLanguage(TestBase):
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
error = lldb.SBError()
- # Don't read in dependencies so we don't come across false matches that
+ # Don't read in dependencies so we don't come across false matches that
# add unwanted breakpoint hits.
self.target = self.dbg.CreateTarget(exe, None, None, False, error)
self.assertTrue(self.target, VALID_TARGET)
- cpp_bp = self.target.BreakpointCreateByName("func_from_cpp", lldb.eFunctionNameTypeAuto, lldb.eLanguageTypeC_plus_plus, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(cpp_bp.GetNumLocations() == 1, "Only one C++ symbol matches")
+ cpp_bp = self.target.BreakpointCreateByName(
+ "func_from_cpp",
+ lldb.eFunctionNameTypeAuto,
+ lldb.eLanguageTypeC_plus_plus,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ cpp_bp.GetNumLocations() == 1,
+ "Only one C++ symbol matches")
self.assertTrue(self.check_location_file(cpp_bp, 0, "b.cpp"))
- no_cpp_bp = self.target.BreakpointCreateByName("func_from_c", lldb.eFunctionNameTypeAuto, lldb.eLanguageTypeC_plus_plus, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(no_cpp_bp.GetNumLocations() == 0, "And the C one doesn't match")
-
- c_bp = self.target.BreakpointCreateByName("func_from_c", lldb.eFunctionNameTypeAuto, lldb.eLanguageTypeC, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(c_bp.GetNumLocations() == 1, "Only one C symbol matches")
+ no_cpp_bp = self.target.BreakpointCreateByName(
+ "func_from_c",
+ lldb.eFunctionNameTypeAuto,
+ lldb.eLanguageTypeC_plus_plus,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ no_cpp_bp.GetNumLocations() == 0,
+ "And the C one doesn't match")
+
+ c_bp = self.target.BreakpointCreateByName(
+ "func_from_c",
+ lldb.eFunctionNameTypeAuto,
+ lldb.eLanguageTypeC,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ c_bp.GetNumLocations() == 1,
+ "Only one C symbol matches")
self.assertTrue(self.check_location_file(c_bp, 0, "a.c"))
-
- no_c_bp = self.target.BreakpointCreateByName("func_from_cpp", lldb.eFunctionNameTypeAuto, lldb.eLanguageTypeC, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(no_c_bp.GetNumLocations() == 0, "And the C++ one doesn't match")
-
- objc_bp = self.target.BreakpointCreateByName("func_from_cpp", lldb.eFunctionNameTypeAuto, lldb.eLanguageTypeObjC, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(objc_bp.GetNumLocations() == 0, "No ObjC symbol matches")
-
+ no_c_bp = self.target.BreakpointCreateByName(
+ "func_from_cpp",
+ lldb.eFunctionNameTypeAuto,
+ lldb.eLanguageTypeC,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ no_c_bp.GetNumLocations() == 0,
+ "And the C++ one doesn't match")
+
+ objc_bp = self.target.BreakpointCreateByName(
+ "func_from_cpp",
+ lldb.eFunctionNameTypeAuto,
+ lldb.eLanguageTypeObjC,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ objc_bp.GetNumLocations() == 0,
+ "No ObjC symbol matches")
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
index 707b6502e91..fdbd622f767 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -5,13 +5,14 @@ Test breakpoint commands for a breakpoint ID with multiple locations.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BreakpointLocationsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -34,55 +35,72 @@ class BreakpointLocationsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint with 3 locations.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=3)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=3)
# The breakpoint list should show 3 locations.
- self.expect("breakpoint list -f", "Breakpoint locations shown correctly",
- substrs = ["1: file = 'main.c', line = %d, exact_match = 0, locations = 3" % self.line],
- patterns = ["where = a.out`func_inlined .+unresolved, hit count = 0",
- "where = a.out`main .+\[inlined\].+unresolved, hit count = 0"])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint locations shown correctly",
+ substrs=[
+ "1: file = 'main.c', line = %d, exact_match = 0, locations = 3" %
+ self.line],
+ patterns=[
+ "where = a.out`func_inlined .+unresolved, hit count = 0",
+ "where = a.out`main .+\[inlined\].+unresolved, hit count = 0"])
# The 'breakpoint disable 3.*' command should fail gracefully.
self.expect("breakpoint disable 3.*",
"Disabling an invalid breakpoint should fail gracefully",
error=True,
- startstr = "error: '3' is not a valid breakpoint ID.")
+ startstr="error: '3' is not a valid breakpoint ID.")
# The 'breakpoint disable 1.*' command should disable all 3 locations.
- self.expect("breakpoint disable 1.*", "All 3 breakpoint locatons disabled correctly",
- startstr = "3 breakpoints disabled.")
+ self.expect(
+ "breakpoint disable 1.*",
+ "All 3 breakpoint locatons disabled correctly",
+ startstr="3 breakpoints disabled.")
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# We should not stopped on any breakpoint at all.
self.expect("process status", "No stopping on any disabled breakpoint",
- patterns = ["^Process [0-9]+ exited with status = 0"])
+ patterns=["^Process [0-9]+ exited with status = 0"])
# The 'breakpoint enable 1.*' command should enable all 3 breakpoints.
- self.expect("breakpoint enable 1.*", "All 3 breakpoint locatons enabled correctly",
- startstr = "3 breakpoints enabled.")
+ self.expect(
+ "breakpoint enable 1.*",
+ "All 3 breakpoint locatons enabled correctly",
+ startstr="3 breakpoints enabled.")
# The 'breakpoint disable 1.1' command should disable 1 location.
- self.expect("breakpoint disable 1.1", "1 breakpoint locatons disabled correctly",
- startstr = "1 breakpoints disabled.")
+ self.expect(
+ "breakpoint disable 1.1",
+ "1 breakpoint locatons disabled correctly",
+ startstr="1 breakpoints disabled.")
- # Run the program againt. We should stop on the two breakpoint locations.
+ # Run the program againt. We should stop on the two breakpoint
+ # locations.
self.runCmd("run", RUN_SUCCEEDED)
# Stopped once.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
+ substrs=["stop reason = breakpoint 1."])
# Continue the program, there should be another stop.
self.runCmd("process continue")
# Stopped again.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
-
- # At this point, 1.1 has a hit count of 0 and the other a hit count of 1".
- self.expect("breakpoint list -f", "The breakpoints should report correct hit counts",
- patterns = ["1\.1: .+ unresolved, hit count = 0 +Options: disabled",
- "1\.2: .+ resolved, hit count = 1",
- "1\.3: .+ resolved, hit count = 1"])
+ substrs=["stop reason = breakpoint 1."])
+
+ # At this point, 1.1 has a hit count of 0 and the other a hit count of
+ # 1".
+ self.expect(
+ "breakpoint list -f",
+ "The breakpoints should report correct hit counts",
+ patterns=[
+ "1\.1: .+ unresolved, hit count = 0 +Options: disabled",
+ "1\.2: .+ resolved, hit count = 1",
+ "1\.3: .+ resolved, hit count = 1"])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
index 29afec20233..c0c2267a836 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_options/TestBreakpointOptions.py
@@ -5,12 +5,12 @@ Test breakpoint command for different options.
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class BreakpointOptionsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -32,38 +32,59 @@ class BreakpointOptionsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint with 1 locations.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, extra_options = "-K 1", num_expected_locations = 1)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, extra_options = "-K 0", num_expected_locations = 1)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "main.cpp",
+ self.line,
+ extra_options="-K 1",
+ num_expected_locations=1)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "main.cpp",
+ self.line,
+ extra_options="-K 0",
+ num_expected_locations=1)
# This should create a breakpoint 0 locations.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, extra_options = "-m 0", num_expected_locations = 0)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "main.cpp",
+ self.line,
+ extra_options="-m 0",
+ num_expected_locations=0)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# Stopped once.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 2."])
+ substrs=["stop reason = breakpoint 2."])
# Check the list of breakpoint.
- self.expect("breakpoint list -f", "Breakpoint locations shown correctly",
- substrs = ["1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.line,
- "2: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" % self.line,
- "3: file = 'main.cpp', line = %d, exact_match = 1, locations = 0" % self.line])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint locations shown correctly",
+ substrs=[
+ "1: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
+ self.line,
+ "2: file = 'main.cpp', line = %d, exact_match = 0, locations = 1" %
+ self.line,
+ "3: file = 'main.cpp', line = %d, exact_match = 1, locations = 0" %
+ self.line])
# Continue the program, there should be another stop.
self.runCmd("process continue")
# Stopped again.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
+ substrs=["stop reason = breakpoint 1."])
# Continue the program, we should exit.
self.runCmd("process continue")
# We should exit.
self.expect("process status", "Process exited successfully",
- patterns = ["^Process [0-9]+ exited with status = 0"])
+ patterns=["^Process [0-9]+ exited with status = 0"])
def breakpoint_options_language_test(self):
"""Test breakpoint command for language option."""
@@ -71,23 +92,34 @@ class BreakpointOptionsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint with 1 locations.
- lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, extra_options = "-L c++", num_expected_locations=1)
+ lldbutil.run_break_set_by_symbol(
+ self,
+ 'ns::func',
+ sym_exact=False,
+ extra_options="-L c++",
+ num_expected_locations=1)
# This should create a breakpoint with 0 locations.
- lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, extra_options = "-L c", num_expected_locations=0)
+ lldbutil.run_break_set_by_symbol(
+ self,
+ 'ns::func',
+ sym_exact=False,
+ extra_options="-L c",
+ num_expected_locations=0)
self.runCmd("settings set target.language c")
- lldbutil.run_break_set_by_symbol (self, 'ns::func', sym_exact=False, num_expected_locations=0)
+ lldbutil.run_break_set_by_symbol(
+ self, 'ns::func', sym_exact=False, num_expected_locations=0)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# Stopped once.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
+ substrs=["stop reason = breakpoint 1."])
# Continue the program, we should exit.
self.runCmd("process continue")
# We should exit.
self.expect("process status", "Process exited successfully",
- patterns = ["^Process [0-9]+ exited with status = 0"])
+ patterns=["^Process [0-9]+ exited with status = 0"])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
index 4ca93765b65..2410f2ee82b 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/breakpoint_set_restart/TestBreakpointSetRestart.py
@@ -6,6 +6,7 @@ import os
import lldb
from lldbsuite.test.lldbtest import *
+
class BreakpointSetRestart(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -16,12 +17,13 @@ class BreakpointSetRestart(TestBase):
cwd = os.getcwd()
exe = os.path.join(cwd, 'a.out')
-
+
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
self.dbg.SetAsync(True)
- 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)
event = lldb.SBEvent()
@@ -29,15 +31,22 @@ class BreakpointSetRestart(TestBase):
while self.dbg.GetListener().WaitForEvent(2, event):
if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateRunning:
break
-
- bp = target.BreakpointCreateBySourceRegex(self.BREAKPOINT_TEXT,
- lldb.SBFileSpec(os.path.join(cwd, 'main.cpp')))
- self.assertTrue(bp.IsValid() and bp.GetNumLocations() == 1, VALID_BREAKPOINT)
+
+ bp = target.BreakpointCreateBySourceRegex(
+ self.BREAKPOINT_TEXT, lldb.SBFileSpec(
+ os.path.join(
+ cwd, 'main.cpp')))
+ self.assertTrue(
+ bp.IsValid() and bp.GetNumLocations() == 1,
+ VALID_BREAKPOINT)
while self.dbg.GetListener().WaitForEvent(2, event):
- if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateStopped and lldb.SBProcess.GetRestartedFromEvent(event):
+ if lldb.SBProcess.GetStateFromEvent(
+ event) == lldb.eStateStopped and lldb.SBProcess.GetRestartedFromEvent(event):
continue
if lldb.SBProcess.GetStateFromEvent(event) == lldb.eStateRunning:
continue
- self.fail("Setting a breakpoint generated an unexpected event: %s" % lldb.SBDebugger.StateAsCString(lldb.SBProcess.GetStateFromEvent(event)))
-
+ self.fail(
+ "Setting a breakpoint generated an unexpected event: %s" %
+ lldb.SBDebugger.StateAsCString(
+ lldb.SBProcess.GetStateFromEvent(event)))
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
index 4933d6d01d4..e4672fbbf1b 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/comp_dir_symlink/TestCompDirSymLink.py
@@ -4,7 +4,6 @@ Test breakpoint command with AT_comp_dir set to symbolic link.
from __future__ import print_function
-
import os
import shutil
import lldb
@@ -17,6 +16,7 @@ _EXE_NAME = 'CompDirSymLink' # Must match Makefile
_SRC_FILE = 'main.cpp'
_COMP_DIR_SYM_LINK_PROP = 'plugin.symbol-file.dwarf.comp-dir-symlink-paths'
+
class CompDirSymLinkTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -32,14 +32,18 @@ class CompDirSymLinkTestCase(TestBase):
def test_symlink_paths_set(self):
pwd_symlink = self.create_src_symlink()
self.doBuild(pwd_symlink)
- self.runCmd("settings set %s %s" % (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
+ self.runCmd(
+ "settings set %s %s" %
+ (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
lldbutil.run_break_set_by_file_and_line(self, self.src_path, self.line)
@skipIf(hostoslist=no_match(["linux"]))
def test_symlink_paths_set_procselfcwd(self):
pwd_symlink = '/proc/self/cwd'
self.doBuild(pwd_symlink)
- self.runCmd("settings set %s %s" % (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
+ self.runCmd(
+ "settings set %s %s" %
+ (_COMP_DIR_SYM_LINK_PROP, pwd_symlink))
lldbutil.run_break_set_by_file_and_line(self, self.src_path, self.line)
@skipIf(hostoslist=["windows"])
@@ -47,12 +51,17 @@ class CompDirSymLinkTestCase(TestBase):
pwd_symlink = self.create_src_symlink()
self.doBuild(pwd_symlink)
self.runCmd('settings clear ' + _COMP_DIR_SYM_LINK_PROP)
- self.assertRaises(AssertionError, lldbutil.run_break_set_by_file_and_line, self, self.src_path, self.line)
+ self.assertRaises(
+ AssertionError,
+ lldbutil.run_break_set_by_file_and_line,
+ self,
+ self.src_path,
+ self.line)
def create_src_symlink(self):
pwd_symlink = os.path.join(os.getcwd(), 'pwd_symlink')
if os.path.exists(pwd_symlink):
- os.unlink(pwd_symlink)
+ os.unlink(pwd_symlink)
os.symlink(os.getcwd(), pwd_symlink)
self.addTearDownHook(lambda: os.remove(pwd_symlink))
return pwd_symlink
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
index 472479391c0..312f2944102 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/consecutive_breakpoints/TestConsecutiveBreakpoints.py
@@ -5,35 +5,42 @@ Test that we handle breakpoints on consecutive instructions correctly.
from __future__ import print_function
-
import unittest2
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ConsecutiveBreakpointsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def prepare_test(self):
self.build()
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
# Create a target by the debugger.
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
- breakpoint1 = self.target.BreakpointCreateBySourceRegex("Set breakpoint here", lldb.SBFileSpec("main.cpp"))
- self.assertTrue(breakpoint1 and breakpoint1.GetNumLocations() == 1, VALID_BREAKPOINT)
+ breakpoint1 = self.target.BreakpointCreateBySourceRegex(
+ "Set breakpoint here", lldb.SBFileSpec("main.cpp"))
+ self.assertTrue(
+ breakpoint1 and breakpoint1.GetNumLocations() == 1,
+ VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- self.process = self.target.LaunchSimple (None, None, self.get_process_working_directory())
+ self.process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertIsNotNone(self.process, PROCESS_IS_VALID)
# We should be stopped at the first breakpoint
- self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, breakpoint1)
- self.assertIsNotNone(self.thread, "Expected one thread to be stopped at breakpoint 1")
+ self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(
+ self.process, breakpoint1)
+ self.assertIsNotNone(
+ self.thread,
+ "Expected one thread to be stopped at breakpoint 1")
# Set breakpoint to the next instruction
frame = self.thread.GetFrameAtIndex(0)
@@ -42,8 +49,11 @@ class ConsecutiveBreakpointsTestCase(TestBase):
instructions = self.target.ReadInstructions(address, 2)
self.assertTrue(len(instructions) == 2)
self.bkpt_address = instructions[1].GetAddress()
- self.breakpoint2 = self.target.BreakpointCreateByAddress(self.bkpt_address.GetLoadAddress(self.target))
- self.assertTrue(self.breakpoint2 and self.breakpoint2.GetNumLocations() == 1, VALID_BREAKPOINT)
+ self.breakpoint2 = self.target.BreakpointCreateByAddress(
+ self.bkpt_address.GetLoadAddress(self.target))
+ self.assertTrue(
+ self.breakpoint2 and self.breakpoint2.GetNumLocations() == 1,
+ VALID_BREAKPOINT)
def finish_test(self):
# Run the process until termination
@@ -58,8 +68,11 @@ class ConsecutiveBreakpointsTestCase(TestBase):
self.process.Continue()
self.assertEquals(self.process.GetState(), lldb.eStateStopped)
# We should be stopped at the second breakpoint
- self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoint2)
- self.assertIsNotNone(self.thread, "Expected one thread to be stopped at breakpoint 2")
+ self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(
+ self.process, self.breakpoint2)
+ self.assertIsNotNone(
+ self.thread,
+ "Expected one thread to be stopped at breakpoint 2")
self.finish_test()
@@ -72,10 +85,15 @@ class ConsecutiveBreakpointsTestCase(TestBase):
self.thread.StepInstruction(step_over)
self.assertEquals(self.process.GetState(), lldb.eStateStopped)
- self.assertEquals(self.thread.GetFrameAtIndex(0).GetPCAddress().GetLoadAddress(self.target),
- self.bkpt_address.GetLoadAddress(self.target))
- self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(self.process, self.breakpoint2)
- self.assertIsNotNone(self.thread, "Expected one thread to be stopped at breakpoint 2")
+ self.assertEquals(
+ self.thread.GetFrameAtIndex(0).GetPCAddress().GetLoadAddress(
+ self.target), self.bkpt_address.GetLoadAddress(
+ self.target))
+ self.thread = lldbutil.get_one_thread_stopped_at_breakpoint(
+ self.process, self.breakpoint2)
+ self.assertIsNotNone(
+ self.thread,
+ "Expected one thread to be stopped at breakpoint 2")
self.finish_test()
@@ -84,8 +102,9 @@ class ConsecutiveBreakpointsTestCase(TestBase):
"""Test that single step stops, even though the second breakpoint is not valid."""
self.prepare_test()
- # Choose a thread other than the current one. A non-existing thread is fine.
- thread_index = self.process.GetNumThreads()+1
+ # Choose a thread other than the current one. A non-existing thread is
+ # fine.
+ thread_index = self.process.GetNumThreads() + 1
self.assertFalse(self.process.GetThreadAtIndex(thread_index).IsValid())
self.breakpoint2.SetThreadIndex(thread_index)
@@ -93,9 +112,13 @@ class ConsecutiveBreakpointsTestCase(TestBase):
self.thread.StepInstruction(step_over)
self.assertEquals(self.process.GetState(), lldb.eStateStopped)
- self.assertEquals(self.thread.GetFrameAtIndex(0).GetPCAddress().GetLoadAddress(self.target),
- self.bkpt_address.GetLoadAddress(self.target))
- self.assertEquals(self.thread.GetStopReason(), lldb.eStopReasonPlanComplete,
- "Stop reason should be 'plan complete'")
+ self.assertEquals(
+ self.thread.GetFrameAtIndex(0).GetPCAddress().GetLoadAddress(
+ self.target), self.bkpt_address.GetLoadAddress(
+ self.target))
+ self.assertEquals(
+ self.thread.GetStopReason(),
+ lldb.eStopReasonPlanComplete,
+ "Stop reason should be 'plan complete'")
self.finish_test()
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
index c2aa597214e..adec9fa5ddd 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp/TestCPPBreakpointLocations.py
@@ -5,60 +5,64 @@ Test lldb breakpoint ids.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestCPPBreakpointLocations(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
- def test (self):
- self.build ()
- self.breakpoint_id_tests ()
+ def test(self):
+ self.build()
+ self.breakpoint_id_tests()
def verify_breakpoint_locations(self, target, bp_dict):
-
+
name = bp_dict['name']
names = bp_dict['loc_names']
- bp = target.BreakpointCreateByName (name)
- self.assertEquals(bp.GetNumLocations(), len(names), "Make sure we find the right number of breakpoint locations")
-
+ bp = target.BreakpointCreateByName(name)
+ self.assertEquals(
+ bp.GetNumLocations(),
+ len(names),
+ "Make sure we find the right number of breakpoint locations")
+
bp_loc_names = list()
for bp_loc in bp:
bp_loc_names.append(bp_loc.GetAddress().GetFunction().GetName())
-
+
for name in names:
found = name in bp_loc_names
if not found:
print("Didn't find '%s' in: %s" % (name, bp_loc_names))
- self.assertTrue (found, "Make sure we find all required locations")
-
- def breakpoint_id_tests (self):
-
+ self.assertTrue(found, "Make sure we find all required locations")
+
+ def breakpoint_id_tests(self):
+
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
bp_dicts = [
- { 'name' : 'func1', 'loc_names' : [ 'a::c::func1()', 'b::c::func1()'] },
- { 'name' : 'func2', 'loc_names' : [ 'a::c::func2()', 'c::d::func2()'] },
- { 'name' : 'func3', 'loc_names' : [ 'a::c::func3()', 'b::c::func3()', 'c::d::func3()'] },
- { 'name' : 'c::func1', 'loc_names' : [ 'a::c::func1()', 'b::c::func1()'] },
- { 'name' : 'c::func2', 'loc_names' : [ 'a::c::func2()'] },
- { 'name' : 'c::func3', 'loc_names' : [ 'a::c::func3()', 'b::c::func3()'] },
- { 'name' : 'a::c::func1', 'loc_names' : [ 'a::c::func1()'] },
- { 'name' : 'b::c::func1', 'loc_names' : [ 'b::c::func1()'] },
- { 'name' : 'c::d::func2', 'loc_names' : [ 'c::d::func2()'] },
- { 'name' : 'a::c::func1()', 'loc_names' : [ 'a::c::func1()'] },
- { 'name' : 'b::c::func1()', 'loc_names' : [ 'b::c::func1()'] },
- { 'name' : 'c::d::func2()', 'loc_names' : [ 'c::d::func2()'] },
+ {'name': 'func1', 'loc_names': ['a::c::func1()', 'b::c::func1()']},
+ {'name': 'func2', 'loc_names': ['a::c::func2()', 'c::d::func2()']},
+ {'name': 'func3', 'loc_names': ['a::c::func3()', 'b::c::func3()', 'c::d::func3()']},
+ {'name': 'c::func1', 'loc_names': ['a::c::func1()', 'b::c::func1()']},
+ {'name': 'c::func2', 'loc_names': ['a::c::func2()']},
+ {'name': 'c::func3', 'loc_names': ['a::c::func3()', 'b::c::func3()']},
+ {'name': 'a::c::func1', 'loc_names': ['a::c::func1()']},
+ {'name': 'b::c::func1', 'loc_names': ['b::c::func1()']},
+ {'name': 'c::d::func2', 'loc_names': ['c::d::func2()']},
+ {'name': 'a::c::func1()', 'loc_names': ['a::c::func1()']},
+ {'name': 'b::c::func1()', 'loc_names': ['b::c::func1()']},
+ {'name': 'c::d::func2()', 'loc_names': ['c::d::func2()']},
]
-
+
for bp_dict in bp_dicts:
self.verify_breakpoint_locations(target, bp_dict)
@@ -68,28 +72,43 @@ class TestCPPBreakpointLocations(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
- # Don't skip prologue, so we can check the breakpoint address more easily
+ # Don't skip prologue, so we can check the breakpoint address more
+ # easily
self.runCmd("settings set target.skip-prologue false")
try:
names = ['~c', 'c::~c', 'c::~c()']
loc_names = {'a::c::~c()', 'b::c::~c()'}
- # TODO: For windows targets we should put windows mangled names here
- symbols = ['_ZN1a1cD1Ev', '_ZN1a1cD2Ev', '_ZN1b1cD1Ev', '_ZN1b1cD2Ev']
+ # TODO: For windows targets we should put windows mangled names
+ # here
+ symbols = [
+ '_ZN1a1cD1Ev',
+ '_ZN1a1cD2Ev',
+ '_ZN1b1cD1Ev',
+ '_ZN1b1cD2Ev']
for name in names:
bp = target.BreakpointCreateByName(name)
- bp_loc_names = { bp_loc.GetAddress().GetFunction().GetName() for bp_loc in bp }
- self.assertEquals(bp_loc_names, loc_names, "Breakpoint set on the correct symbol")
+ bp_loc_names = {bp_loc.GetAddress().GetFunction().GetName()
+ for bp_loc in bp}
+ self.assertEquals(
+ bp_loc_names,
+ loc_names,
+ "Breakpoint set on the correct symbol")
- bp_addresses = { bp_loc.GetLoadAddress() for bp_loc in bp }
+ bp_addresses = {bp_loc.GetLoadAddress() for bp_loc in bp}
symbol_addresses = set()
for symbol in symbols:
sc_list = target.FindSymbols(symbol, lldb.eSymbolTypeCode)
- self.assertEquals(sc_list.GetSize(), 1, "Found symbol " + symbol)
+ self.assertEquals(
+ sc_list.GetSize(), 1, "Found symbol " + symbol)
symbol = sc_list.GetContextAtIndex(0).GetSymbol()
- symbol_addresses.add(symbol.GetStartAddress().GetLoadAddress(target))
+ symbol_addresses.add(
+ symbol.GetStartAddress().GetLoadAddress(target))
- self.assertEquals(symbol_addresses, bp_addresses, "Breakpoint set on correct address")
+ self.assertEquals(
+ symbol_addresses,
+ bp_addresses,
+ "Breakpoint set on correct address")
finally:
self.runCmd("settings clear target.skip-prologue")
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
index 2aac3a9600d..3019e1c1c55 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/cpp_exception/TestCPPExceptionBreakpoint.py
@@ -5,7 +5,6 @@ Test that you can set breakpoint and hit the C++ language exception breakpoint
from __future__ import print_function
-
import os
import re
import sys
@@ -14,6 +13,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestCPPExceptionBreakpoint (TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,26 +24,31 @@ class TestCPPExceptionBreakpoint (TestBase):
def test_cpp_exception_breakpoint(self):
"""Test setting and hitting the C++ exception breakpoint."""
self.build()
- self.do_cpp_exception_bkpt ()
+ self.do_cpp_exception_bkpt()
- def setUp (self):
+ def setUp(self):
TestBase.setUp(self)
self.main_source = "main.c"
self.main_source_spec = lldb.SBFileSpec(self.main_source)
-
- def do_cpp_exception_bkpt (self):
+ def do_cpp_exception_bkpt(self):
exe = os.path.join(os.getcwd(), "a.out")
error = lldb.SBError()
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
- exception_bkpt = self.target.BreakpointCreateForException(lldb.eLanguageTypeC_plus_plus, False, True)
- self.assertTrue (exception_bkpt.IsValid(), "Created exception breakpoint.")
+ exception_bkpt = self.target.BreakpointCreateForException(
+ lldb.eLanguageTypeC_plus_plus, False, True)
+ self.assertTrue(
+ exception_bkpt.IsValid(),
+ "Created exception breakpoint.")
- process = self.target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
-
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, exception_bkpt)
- self.assertTrue (len(thread_list) == 1, "One thread stopped at the exception breakpoint.")
+
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ process, exception_bkpt)
+ self.assertTrue(len(thread_list) == 1,
+ "One thread stopped at the exception breakpoint.")
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
index de61f9e88f1..d044827e008 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/debugbreak/TestDebugBreak.py
@@ -10,6 +10,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DebugBreakTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,19 +24,23 @@ class DebugBreakTestCase(TestBase):
# Run the program.
target = self.dbg.CreateTarget(exe)
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
# We've hit the first stop, so grab the frame.
self.assertEqual(process.GetState(), lldb.eStateStopped)
- stop_reason = lldb.eStopReasonException if (lldbplatformutil.getPlatform()=="windows" or lldbplatformutil.getPlatform()=="macosx") else lldb.eStopReasonSignal
+ stop_reason = lldb.eStopReasonException if (lldbplatformutil.getPlatform(
+ ) == "windows" or lldbplatformutil.getPlatform() == "macosx") else lldb.eStopReasonSignal
thread = lldbutil.get_stopped_thread(process, stop_reason)
- self.assertIsNotNone(thread, "Unable to find thread stopped at the __debugbreak()")
+ self.assertIsNotNone(
+ thread, "Unable to find thread stopped at the __debugbreak()")
frame = thread.GetFrameAtIndex(0)
# We should be in funciton 'bar'.
self.assertTrue(frame.IsValid())
function_name = frame.GetFunctionName()
- self.assertTrue('bar' in function_name, "Unexpected function name {}".format(function_name))
+ self.assertTrue('bar' in function_name,
+ "Unexpected function name {}".format(function_name))
# We should be able to evaluate the parameter foo.
value = frame.EvaluateExpression('*foo')
@@ -45,10 +50,10 @@ class DebugBreakTestCase(TestBase):
# subsequent stop.
counter = 1
while counter < 20:
- value = frame.EvaluateExpression('count')
- self.assertEqual(value.GetValueAsSigned(), counter)
- counter += 2
- process.Continue()
+ value = frame.EvaluateExpression('count')
+ self.assertEqual(value.GetValueAsSigned(), counter)
+ counter += 2
+ process.Continue()
# The inferior should exit after the last iteration.
self.assertEqual(process.GetState(), lldb.eStateExited)
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py
index f2693e6ed59..a934ad356ac 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/dummy_target_breakpoints/TestBreakpointsWithNoTargets.py
@@ -5,12 +5,13 @@ Test breakpoint commands set before we have a target
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class BreakpointInDummyTarget (TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -25,43 +26,49 @@ class BreakpointInDummyTarget (TestBase):
TestBase.setUp(self)
# Find the line number to break inside main().
self.line = line_number('main.c', 'Set a breakpoint on this line.')
- self.line2 = line_number ('main.c', 'Set another on this line.')
+ self.line2 = line_number('main.c', 'Set another on this line.')
def dummy_breakpoint_test(self):
"""Test breakpoint set before we have a target. """
# This should create a breakpoint with 3 locations.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=0)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line2, num_expected_locations=0)
-
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=0)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line2, num_expected_locations=0)
+
# This is the function to remove breakpoints from the dummy target
# to get a clean slate for the next test case.
def cleanup():
self.runCmd('breakpoint delete -D -f', check=False)
self.runCmd('breakpoint list', check=False)
-
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
-
+
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# The breakpoint list should show 3 locations.
- self.expect("breakpoint list -f", "Breakpoint locations shown correctly",
- substrs = ["1: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line,
- "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" % self.line2])
+ self.expect(
+ "breakpoint list -f",
+ "Breakpoint locations shown correctly",
+ substrs=[
+ "1: file = 'main.c', line = %d, exact_match = 0, locations = 1" %
+ self.line,
+ "2: file = 'main.c', line = %d, exact_match = 0, locations = 1" %
+ self.line2])
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
# Stopped once.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 1."])
+ substrs=["stop reason = breakpoint 1."])
# Continue the program, there should be another stop.
self.runCmd("process continue")
# Stopped again.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint 2."])
+ substrs=["stop reason = breakpoint 2."])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
index d04178bda78..fe8f430096d 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
@@ -6,12 +6,13 @@ another source file) works correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class InlinedBreakpointsTestCase(TestBase):
"""Bug fixed: rdar://problem/8464339"""
@@ -26,32 +27,43 @@ class InlinedBreakpointsTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break inside basic_type.cpp.
- self.line = line_number('basic_type.cpp', '// Set break point at this line.')
+ self.line = line_number(
+ 'basic_type.cpp',
+ '// Set break point at this line.')
def inlined_breakpoints(self):
"""Test 'b basic_types.cpp:176' does break (where int.cpp includes basic_type.cpp)."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- # With the inline-breakpoint-strategy, our file+line breakpoint should not resolve to a location.
+ # With the inline-breakpoint-strategy, our file+line breakpoint should
+ # not resolve to a location.
self.runCmd('settings set target.inline-breakpoint-strategy headers')
- # Set a breakpoint and fail because it is in an inlined source implemenation file
- lldbutil.run_break_set_by_file_and_line (self, "basic_type.cpp", self.line, num_expected_locations=0)
+ # Set a breakpoint and fail because it is in an inlined source
+ # implemenation file
+ lldbutil.run_break_set_by_file_and_line(
+ self, "basic_type.cpp", self.line, num_expected_locations=0)
- # Now enable breakpoints in implementation files and see the breakpoint set succeed
+ # Now enable breakpoints in implementation files and see the breakpoint
+ # set succeed
self.runCmd('settings set target.inline-breakpoint-strategy always')
# And add hooks to restore the settings during tearDown().
- self.addTearDownHook(
- lambda: self.runCmd("settings set target.inline-breakpoint-strategy always"))
+ self.addTearDownHook(lambda: self.runCmd(
+ "settings set target.inline-breakpoint-strategy always"))
- lldbutil.run_break_set_by_file_and_line (self, "basic_type.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "basic_type.cpp",
+ self.line,
+ num_expected_locations=1,
+ loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
# And it should break at basic_type.cpp:176.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint',
- 'basic_type.cpp:%d' % self.line])
+ substrs=['stopped',
+ 'stop reason = breakpoint',
+ 'basic_type.cpp:%d' % self.line])
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py
index c48cee1bd2b..f43bbb7515c 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/objc/TestObjCBreakpoints.py
@@ -6,8 +6,8 @@ parser.
from __future__ import print_function
-
-import os, time
+import os
+import time
import shutil
import subprocess
import lldb
@@ -15,6 +15,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class TestObjCBreakpoints(TestBase):
@@ -34,20 +35,37 @@ class TestObjCBreakpoints(TestBase):
self.line = line_number(self.main_source, '// Set breakpoint here')
def check_category_breakpoints(self):
- name_bp = self.target.BreakpointCreateByName ("myCategoryFunction")
- selector_bp = self.target.BreakpointCreateByName ("myCategoryFunction", lldb.eFunctionNameTypeSelector, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(name_bp.GetNumLocations() == selector_bp.GetNumLocations(), 'Make sure setting a breakpoint by name "myCategoryFunction" sets a breakpoint even though it is in a category')
+ name_bp = self.target.BreakpointCreateByName("myCategoryFunction")
+ selector_bp = self.target.BreakpointCreateByName(
+ "myCategoryFunction",
+ lldb.eFunctionNameTypeSelector,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ name_bp.GetNumLocations() == selector_bp.GetNumLocations(),
+ 'Make sure setting a breakpoint by name "myCategoryFunction" sets a breakpoint even though it is in a category')
for bp_loc in selector_bp:
function_name = bp_loc.GetAddress().GetSymbol().GetName()
- self.assertTrue(" myCategoryFunction]" in function_name, 'Make sure all function names have " myCategoryFunction]" in their names')
-
- category_bp = self.target.BreakpointCreateByName ("-[MyClass(MyCategory) myCategoryFunction]")
- stripped_bp = self.target.BreakpointCreateByName ("-[MyClass myCategoryFunction]")
- stripped2_bp = self.target.BreakpointCreateByName ("[MyClass myCategoryFunction]")
- self.assertTrue(category_bp.GetNumLocations() == 1, "Make sure we can set a breakpoint using a full objective C function name with the category included (-[MyClass(MyCategory) myCategoryFunction])")
- self.assertTrue(stripped_bp.GetNumLocations() == 1, "Make sure we can set a breakpoint using a full objective C function name without the category included (-[MyClass myCategoryFunction])")
- self.assertTrue(stripped2_bp.GetNumLocations() == 1, "Make sure we can set a breakpoint using a full objective C function name without the category included ([MyClass myCategoryFunction])")
-
+ self.assertTrue(
+ " myCategoryFunction]" in function_name,
+ 'Make sure all function names have " myCategoryFunction]" in their names')
+
+ category_bp = self.target.BreakpointCreateByName(
+ "-[MyClass(MyCategory) myCategoryFunction]")
+ stripped_bp = self.target.BreakpointCreateByName(
+ "-[MyClass myCategoryFunction]")
+ stripped2_bp = self.target.BreakpointCreateByName(
+ "[MyClass myCategoryFunction]")
+ self.assertTrue(
+ category_bp.GetNumLocations() == 1,
+ "Make sure we can set a breakpoint using a full objective C function name with the category included (-[MyClass(MyCategory) myCategoryFunction])")
+ self.assertTrue(
+ stripped_bp.GetNumLocations() == 1,
+ "Make sure we can set a breakpoint using a full objective C function name without the category included (-[MyClass myCategoryFunction])")
+ self.assertTrue(
+ stripped2_bp.GetNumLocations() == 1,
+ "Make sure we can set a breakpoint using a full objective C function name without the category included ([MyClass myCategoryFunction])")
+
def check_objc_breakpoints(self, have_dsym):
"""Test constant string generation amd comparison by the expression parser."""
@@ -60,36 +78,55 @@ class TestObjCBreakpoints(TestBase):
self.assertTrue(self.target, VALID_TARGET)
#----------------------------------------------------------------------
- # Set breakpoints on all selectors whose name is "count". This should
- # catch breakpoints that are both C functions _and_ anything whose
+ # Set breakpoints on all selectors whose name is "count". This should
+ # catch breakpoints that are both C functions _and_ anything whose
# selector is "count" because just looking at "count" we can't tell
# definitively if the name is a selector or a C function
#----------------------------------------------------------------------
- name_bp = self.target.BreakpointCreateByName ("count")
- selector_bp = self.target.BreakpointCreateByName ("count", lldb.eFunctionNameTypeSelector, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(name_bp.GetNumLocations() >= selector_bp.GetNumLocations(), 'Make sure we get at least the same amount of breakpoints if not more when setting by name "count"')
- self.assertTrue(selector_bp.GetNumLocations() > 50, 'Make sure we find a lot of "count" selectors') # There are 93 on the latest MacOSX
+ name_bp = self.target.BreakpointCreateByName("count")
+ selector_bp = self.target.BreakpointCreateByName(
+ "count",
+ lldb.eFunctionNameTypeSelector,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ name_bp.GetNumLocations() >= selector_bp.GetNumLocations(),
+ 'Make sure we get at least the same amount of breakpoints if not more when setting by name "count"')
+ self.assertTrue(
+ selector_bp.GetNumLocations() > 50,
+ 'Make sure we find a lot of "count" selectors') # There are 93 on the latest MacOSX
for bp_loc in selector_bp:
function_name = bp_loc.GetAddress().GetSymbol().GetName()
- self.assertTrue(" count]" in function_name, 'Make sure all function names have " count]" in their names')
+ self.assertTrue(
+ " count]" in function_name,
+ 'Make sure all function names have " count]" in their names')
#----------------------------------------------------------------------
# Set breakpoints on all selectors whose name is "isEqual:". This should
# catch breakpoints that are only ObjC selectors because no C function
# can end with a :
#----------------------------------------------------------------------
- name_bp = self.target.BreakpointCreateByName ("isEqual:")
- selector_bp = self.target.BreakpointCreateByName ("isEqual:", lldb.eFunctionNameTypeSelector, lldb.SBFileSpecList(), lldb.SBFileSpecList())
- self.assertTrue(name_bp.GetNumLocations() == selector_bp.GetNumLocations(), 'Make sure setting a breakpoint by name "isEqual:" only sets selector breakpoints')
+ name_bp = self.target.BreakpointCreateByName("isEqual:")
+ selector_bp = self.target.BreakpointCreateByName(
+ "isEqual:",
+ lldb.eFunctionNameTypeSelector,
+ lldb.SBFileSpecList(),
+ lldb.SBFileSpecList())
+ self.assertTrue(
+ name_bp.GetNumLocations() == selector_bp.GetNumLocations(),
+ 'Make sure setting a breakpoint by name "isEqual:" only sets selector breakpoints')
for bp_loc in selector_bp:
function_name = bp_loc.GetAddress().GetSymbol().GetName()
- self.assertTrue(" isEqual:]" in function_name, 'Make sure all function names have " isEqual:]" in their names')
-
+ self.assertTrue(
+ " isEqual:]" in function_name,
+ 'Make sure all function names have " isEqual:]" in their names')
+
self.check_category_breakpoints()
-
+
if have_dsym:
shutil.rmtree(exe + ".dSYM")
- self.assertTrue(subprocess.call(['/usr/bin/strip', '-Sx', exe]) == 0, 'stripping dylib succeeded')
-
+ self.assertTrue(subprocess.call(
+ ['/usr/bin/strip', '-Sx', exe]) == 0, 'stripping dylib succeeded')
+
# Check breakpoints again, this time using the symbol table only
self.check_category_breakpoints()
diff --git a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py
index 81cab927d21..791cc70a749 100644
--- a/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py
+++ b/lldb/packages/Python/lldbsuite/test/functionalities/breakpoint/source_regexp/TestSourceRegexBreakpoints.py
@@ -5,26 +5,27 @@ This test just tests the source file & function restrictions.
from __future__ import print_function
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestSourceRegexBreakpoints(TestBase):
mydir = TestBase.compute_mydir(__file__)
- def test_location (self):
+ def test_location(self):
self.build()
self.source_regex_locations()
- def test_restrictions (self):
- self.build ()
- self.source_regex_restrictions ()
-
+ def test_restrictions(self):
+ self.build()
+ self.source_regex_restrictions()
- def source_regex_locations (self):
+ def source_regex_locations(self):
""" Test that restricting source expressions to files & to functions. """
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
@@ -39,24 +40,28 @@ class TestSourceRegexBreakpoints(TestBase):
func_names.AppendString("a_func")
source_regex = "Set . breakpoint here"
- main_break = target.BreakpointCreateBySourceRegex (source_regex,
- lldb.SBFileSpecList(),
- target_files,
- func_names)
+ main_break = target.BreakpointCreateBySourceRegex(
+ source_regex, lldb.SBFileSpecList(), target_files, func_names)
num_locations = main_break.GetNumLocations()
- self.assertTrue(num_locations == 1, "a.c in a_func should give one breakpoint, got %d."%(num_locations))
+ self.assertTrue(
+ num_locations == 1,
+ "a.c in a_func should give one breakpoint, got %d." %
+ (num_locations))
loc = main_break.GetLocationAtIndex(0)
self.assertTrue(loc.IsValid(), "Got a valid location.")
address = loc.GetAddress()
- self.assertTrue(address.IsValid(), "Got a valid address from the location.")
-
+ self.assertTrue(
+ address.IsValid(),
+ "Got a valid address from the location.")
+
a_func_line = line_number("a.c", "Set A breakpoint here")
line_entry = address.GetLineEntry()
self.assertTrue(line_entry.IsValid(), "Got a valid line entry.")
- self.assertTrue(line_entry.line == a_func_line, "Our line number matches the one lldbtest found.")
+ self.assertTrue(line_entry.line == a_func_line,
+ "Our line number matches the one lldbtest found.")
- def source_regex_restrictions (self):
+ def source_regex_restrictions(self):
""" Test that restricting source expressions to files & to functions. """
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
@@ -67,34 +72,35 @@ class TestSourceRegexBreakpoints(TestBase):
target_files = lldb.SBFileSpecList()
target_files.Append(lldb.SBFileSpec("main.c"))
source_regex = "Set . breakpoint here"
- main_break = target.BreakpointCreateBySourceRegex (source_regex,
- lldb.SBFileSpecList(),
- target_files,
- lldb.SBStringList())
+ main_break = target.BreakpointCreateBySourceRegex(
+ source_regex, lldb.SBFileSpecList(), target_files, lldb.SBStringList())
num_locations = main_break.GetNumLocations()
- self.assertTrue(num_locations == 2, "main.c should have 2 matches, got %d."%(num_locations))
+ self.assertTrue(
+ num_locations == 2,
+ "main.c should have 2 matches, got %d." %
+ (num_locations))
# Now look in both files:
target_files.Append(lldb.SBFileSpec("a.c"))
- main_break = target.BreakpointCreateBySourceRegex (source_regex,
- lldb.SBFileSpecList(),
- target_files,
- lldb.SBStringList())
+ main_break = target.BreakpointCreateBySourceRegex(
+ source_regex, lldb.SBFileSpecList(), target_files, lldb.SBStringList())
- num_locations =main_break.GetNumLocations()
- self.assertTrue(num_locations == 4, "main.c and a.c should have 4 matches, got %d."%(num_locations))
+ num_locations = main_break.GetNumLocations()
+ self.assertTrue(
+ num_locations == 4,
+ "main.c and a.c should have 4 matches, got %d." %
+ (num_locations))
# Now restrict it to functions:
func_names = lldb.SBStringList()
func_names.AppendString("main_func")
- main_break = target.BreakpointCreateBySourceRegex (source_regex,
- lldb.SBFileSpecList(),
- target_files,
- func_names)
-
- num_locations =main_break.GetNumLocations()
- self.assertTrue(num_locations == 2, "main_func in main.c and a.c should have 2 matches, got %d."%(num_locations))
-
+ main_break = target.BreakpointCreateBySourceRegex(
+ source_regex, lldb.SBFileSpecList(), target_files, func_names)
+ num_locations = main_break.GetNumLocations()
+ self.assertTrue(
+ num_locations == 2,
+ "main_func in main.c and a.c should have 2 matches, got %d." %
+ (num_locations))
OpenPOWER on IntegriCloud