aboutsummaryrefslogtreecommitdiff
path: root/lldb/test
diff options
context:
space:
mode:
Diffstat (limited to 'lldb/test')
-rw-r--r--lldb/test/API/commands/expression/call-throws/TestCallThatThrows.py2
-rw-r--r--lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py8
-rw-r--r--lldb/test/API/commands/settings/TestSettings.py15
-rw-r--r--lldb/test/API/commands/statistics/basic/TestStats.py34
-rw-r--r--lldb/test/API/commands/trace/TestTraceSave.py8
-rw-r--r--lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py2
-rw-r--r--lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py12
-rw-r--r--lldb/test/API/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py20
-rw-r--r--lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py2
-rw-r--r--lldb/test/API/functionalities/module_cache/simple_exe/TestModuleCacheSimple.py13
-rw-r--r--lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py3
-rw-r--r--lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py48
-rw-r--r--lldb/test/API/functionalities/thread/backtrace_limit/TestBacktraceLimit.py2
-rw-r--r--lldb/test/API/macosx/arm-corefile-regctx/TestArmMachoCorefileRegctx.py4
-rw-r--r--lldb/test/API/macosx/lc-note/addrable-bits/TestAddrableBitsCorefile.py2
-rw-r--r--lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py14
-rw-r--r--lldb/test/API/macosx/lc-note/kern-ver-str/TestKernVerStrLCNOTE.py2
-rw-r--r--lldb/test/API/macosx/lc-note/multiple-binary-corefile/TestMultipleBinaryCorefile.py2
-rw-r--r--lldb/test/API/macosx/queues/TestQueues.py3
-rw-r--r--lldb/test/API/macosx/safe-to-func-call/TestSafeFuncCalls.py3
-rw-r--r--lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py28
-rw-r--r--lldb/test/API/tools/lldb-dap/databreakpoint/Makefile3
-rw-r--r--lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py131
-rw-r--r--lldb/test/API/tools/lldb-dap/databreakpoint/main.cpp17
24 files changed, 259 insertions, 119 deletions
diff --git a/lldb/test/API/commands/expression/call-throws/TestCallThatThrows.py b/lldb/test/API/commands/expression/call-throws/TestCallThatThrows.py
index 2868ec5..b8cc87c 100644
--- a/lldb/test/API/commands/expression/call-throws/TestCallThatThrows.py
+++ b/lldb/test/API/commands/expression/call-throws/TestCallThatThrows.py
@@ -46,7 +46,7 @@ class ExprCommandWithThrowTestCase(TestBase):
value = frame.EvaluateExpression("[my_class callMeIThrow]", options)
self.assertTrue(value.IsValid())
- self.assertEqual(value.GetError().Success(), False)
+ self.assertFalse(value.GetError().Success())
self.check_after_call()
diff --git a/lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py b/lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py
index 307d452..eb812f1 100644
--- a/lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py
+++ b/lldb/test/API/commands/expression/dont_allow_jit/TestAllowJIT.py
@@ -54,7 +54,7 @@ class TestAllowJIT(TestBase):
# First make sure we can call the function with the default option set.
options = lldb.SBExpressionOptions()
# Check that the default is to allow JIT:
- self.assertEqual(options.GetAllowJIT(), True, "Default is true")
+ self.assertTrue(options.GetAllowJIT(), "Default is true")
# Now use the options:
result = frame.EvaluateExpression("call_me(10)", options)
@@ -64,9 +64,7 @@ class TestAllowJIT(TestBase):
# Now disallow JIT and make sure it fails:
options.SetAllowJIT(False)
# Check that we got the right value:
- self.assertEqual(
- options.GetAllowJIT(), False, "Got False after setting to False"
- )
+ self.assertFalse(options.GetAllowJIT(), "Got False after setting to False")
# Again use it and ensure we fail:
result = frame.EvaluateExpression("call_me(10)", options)
@@ -79,7 +77,7 @@ class TestAllowJIT(TestBase):
# Finally set the allow JIT value back to true and make sure that works:
options.SetAllowJIT(True)
- self.assertEqual(options.GetAllowJIT(), True, "Set back to True correctly")
+ self.assertTrue(options.GetAllowJIT(), "Set back to True correctly")
# And again, make sure this works:
result = frame.EvaluateExpression("call_me(10)", options)
diff --git a/lldb/test/API/commands/settings/TestSettings.py b/lldb/test/API/commands/settings/TestSettings.py
index a2d8454..104a9f0 100644
--- a/lldb/test/API/commands/settings/TestSettings.py
+++ b/lldb/test/API/commands/settings/TestSettings.py
@@ -2,7 +2,6 @@
Test lldb settings command.
"""
-
import json
import os
import re
@@ -151,14 +150,22 @@ class SettingsCommandTestCase(TestBase):
self.expect(
"settings show term-width",
SETTING_MSG("term-width"),
- startstr="term-width (int) = 70",
+ startstr="term-width (unsigned) = 70",
)
# The overall display should also reflect the new setting.
self.expect(
"settings show",
SETTING_MSG("term-width"),
- substrs=["term-width (int) = 70"],
+ substrs=["term-width (unsigned) = 70"],
+ )
+
+ self.dbg.SetTerminalWidth(60)
+
+ self.expect(
+ "settings show",
+ SETTING_MSG("term-width"),
+ substrs=["term-width (unsigned) = 60"],
)
# rdar://problem/10712130
@@ -593,7 +600,7 @@ class SettingsCommandTestCase(TestBase):
self.expect(
"settings show term-width",
SETTING_MSG("term-width"),
- startstr="term-width (int) = 60",
+ startstr="term-width (unsigned) = 60",
)
self.runCmd("settings clear term-width", check=False)
# string
diff --git a/lldb/test/API/commands/statistics/basic/TestStats.py b/lldb/test/API/commands/statistics/basic/TestStats.py
index 6f08322..fb6fc07 100644
--- a/lldb/test/API/commands/statistics/basic/TestStats.py
+++ b/lldb/test/API/commands/statistics/basic/TestStats.py
@@ -35,17 +35,13 @@ class TestCase(TestBase):
)
def verify_key_in_dict(self, key, d, description):
- self.assertEqual(
- key in d,
- True,
- 'make sure key "%s" is in dictionary %s' % (key, description),
+ self.assertIn(
+ key, d, 'make sure key "%s" is in dictionary %s' % (key, description)
)
def verify_key_not_in_dict(self, key, d, description):
- self.assertEqual(
- key in d,
- False,
- 'make sure key "%s" is in dictionary %s' % (key, description),
+ self.assertNotIn(
+ key, d, 'make sure key "%s" is in dictionary %s' % (key, description)
)
def verify_keys(self, dict, description, keys_exist, keys_missing=None):
@@ -120,9 +116,7 @@ class TestCase(TestBase):
self.verify_success_fail_count(stats, "frameVariable", 1, 0)
# Test that "stopCount" is available when the process has run
- self.assertEqual(
- "stopCount" in stats, True, 'ensure "stopCount" is in target JSON'
- )
+ self.assertIn("stopCount", stats, 'ensure "stopCount" is in target JSON')
self.assertGreater(
stats["stopCount"], 0, 'make sure "stopCount" is greater than zero'
)
@@ -484,9 +478,9 @@ class TestCase(TestBase):
exe = self.getBuildArtifact(exe_name)
dsym = self.getBuildArtifact(exe_name + ".dSYM")
# Make sure the executable file exists after building.
- self.assertEqual(os.path.exists(exe), True)
+ self.assertTrue(os.path.exists(exe))
# Make sure the dSYM file exists after building.
- self.assertEqual(os.path.isdir(dsym), True)
+ self.assertTrue(os.path.isdir(dsym))
# Create the target
target = self.createTestTarget(file_path=exe)
@@ -532,9 +526,9 @@ class TestCase(TestBase):
exe = self.getBuildArtifact(exe_name)
dsym = self.getBuildArtifact(exe_name + ".dSYM")
# Make sure the executable file exists after building.
- self.assertEqual(os.path.exists(exe), True)
+ self.assertTrue(os.path.exists(exe))
# Make sure the dSYM file doesn't exist after building.
- self.assertEqual(os.path.isdir(dsym), False)
+ self.assertFalse(os.path.isdir(dsym))
# Create the target
target = self.createTestTarget(file_path=exe)
@@ -585,11 +579,11 @@ class TestCase(TestBase):
dsym = self.getBuildArtifact(exe_name + ".dSYM")
main_obj = self.getBuildArtifact("main.o")
# Make sure the executable file exists after building.
- self.assertEqual(os.path.exists(exe), True)
+ self.assertTrue(os.path.exists(exe))
# Make sure the dSYM file doesn't exist after building.
- self.assertEqual(os.path.isdir(dsym), False)
+ self.assertFalse(os.path.isdir(dsym))
# Make sure the main.o object file exists after building.
- self.assertEqual(os.path.exists(main_obj), True)
+ self.assertTrue(os.path.exists(main_obj))
# Delete the main.o file that contains the debug info so we force an
# error when we run to main and try to get variables
@@ -604,7 +598,7 @@ class TestCase(TestBase):
# Make sure we have "debugInfoHadVariableErrors" variable that is set to
# false before failing to get local variables due to missing .o file.
- self.assertEqual(exe_stats["debugInfoHadVariableErrors"], False)
+ self.assertFalse(exe_stats["debugInfoHadVariableErrors"])
# Verify that the top level statistic that aggregates the number of
# modules with debugInfoHadVariableErrors is zero
@@ -624,7 +618,7 @@ class TestCase(TestBase):
# Make sure we have "hadFrameVariableErrors" variable that is set to
# true after failing to get local variables due to missing .o file.
- self.assertEqual(exe_stats["debugInfoHadVariableErrors"], True)
+ self.assertTrue(exe_stats["debugInfoHadVariableErrors"])
# Verify that the top level statistic that aggregates the number of
# modules with debugInfoHadVariableErrors is greater than zero
diff --git a/lldb/test/API/commands/trace/TestTraceSave.py b/lldb/test/API/commands/trace/TestTraceSave.py
index ef1ab2f..af38669 100644
--- a/lldb/test/API/commands/trace/TestTraceSave.py
+++ b/lldb/test/API/commands/trace/TestTraceSave.py
@@ -179,11 +179,11 @@ class TestTraceSave(TraceIntelPTTestCaseBase):
res = lldb.SBCommandReturnObject()
ci.HandleCommand("thread trace dump instructions -c 10 --forwards", res)
- self.assertEqual(res.Succeeded(), True)
+ self.assertTrue(res.Succeeded())
first_ten_instructions = res.GetOutput()
ci.HandleCommand("thread trace dump instructions -c 10", res)
- self.assertEqual(res.Succeeded(), True)
+ self.assertTrue(res.Succeeded())
last_ten_instructions = res.GetOutput()
# Now, save the trace to <trace_copy_dir>
@@ -203,11 +203,11 @@ class TestTraceSave(TraceIntelPTTestCaseBase):
# Compare with instructions saved at the first time
ci.HandleCommand("thread trace dump instructions -c 10 --forwards", res)
- self.assertEqual(res.Succeeded(), True)
+ self.assertTrue(res.Succeeded())
self.assertEqual(res.GetOutput(), first_ten_instructions)
ci.HandleCommand("thread trace dump instructions -c 10", res)
- self.assertEqual(res.Succeeded(), True)
+ self.assertTrue(res.Succeeded())
self.assertEqual(res.GetOutput(), last_ten_instructions)
def testSaveKernelTrace(self):
diff --git a/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py b/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
index 0ab11a4..d120692 100644
--- a/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
+++ b/lldb/test/API/functionalities/breakpoint/address_breakpoints/TestBadAddressBreakpoints.py
@@ -40,7 +40,7 @@ class BadAddressBreakpointTestCase(TestBase):
bkpt = target.BreakpointCreateByAddress(illegal_address)
# Verify that breakpoint is not resolved.
for bp_loc in bkpt:
- self.assertEqual(bp_loc.IsResolved(), False)
+ self.assertFalse(bp_loc.IsResolved())
else:
self.fail(
"Could not find an illegal address at which to set a bad breakpoint."
diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
index 620f648..ea24295 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -572,9 +572,9 @@ class BreakpointCommandTestCase(TestBase):
res = target.GetStatistics().GetAsJSON(stream)
self.assertTrue(res.Success())
debug_stats = json.loads(stream.GetData())
- self.assertEqual(
- "targets" in debug_stats,
- True,
+ self.assertIn(
+ "targets",
+ debug_stats,
'Make sure the "targets" key in in target.GetStatistics()',
)
target_stats = debug_stats["targets"][0]
@@ -659,9 +659,9 @@ class BreakpointCommandTestCase(TestBase):
res = target.GetStatistics().GetAsJSON(stream)
self.assertTrue(res.Success())
debug_stats = json.loads(stream.GetData())
- self.assertEqual(
- "targets" in debug_stats,
- True,
+ self.assertIn(
+ "targets",
+ debug_stats,
'Make sure the "targets" key in in target.GetStatistics()',
)
target_stats = debug_stats["targets"][0]
diff --git a/lldb/test/API/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py b/lldb/test/API/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
index 330f916..0f9510c 100644
--- a/lldb/test/API/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
+++ b/lldb/test/API/functionalities/breakpoint/breakpoint_names/TestBreakpointNames.py
@@ -389,7 +389,7 @@ class BreakpointNames(TestBase):
)
def check_permission_results(self, bp_name):
- self.assertEqual(bp_name.GetAllowDelete(), False, "Didn't set allow delete.")
+ self.assertFalse(bp_name.GetAllowDelete(), "Didn't set allow delete.")
protected_bkpt = self.target.BreakpointCreateByLocation(self.main_file_spec, 10)
protected_id = protected_bkpt.GetID()
@@ -402,14 +402,11 @@ class BreakpointNames(TestBase):
self.assertSuccess(success, "Couldn't add this name to the breakpoint")
self.target.DisableAllBreakpoints()
- self.assertEqual(
- protected_bkpt.IsEnabled(),
- True,
- "Didnt' keep breakpoint from being disabled",
+ self.assertTrue(
+ protected_bkpt.IsEnabled(), "Didnt' keep breakpoint from being disabled"
)
- self.assertEqual(
+ self.assertFalse(
unprotected_bkpt.IsEnabled(),
- False,
"Protected too many breakpoints from disabling.",
)
@@ -418,14 +415,11 @@ class BreakpointNames(TestBase):
result = lldb.SBCommandReturnObject()
self.dbg.GetCommandInterpreter().HandleCommand("break disable", result)
self.assertTrue(result.Succeeded())
- self.assertEqual(
- protected_bkpt.IsEnabled(),
- True,
- "Didnt' keep breakpoint from being disabled",
+ self.assertTrue(
+ protected_bkpt.IsEnabled(), "Didnt' keep breakpoint from being disabled"
)
- self.assertEqual(
+ self.assertFalse(
unprotected_bkpt.IsEnabled(),
- False,
"Protected too many breakpoints from disabling.",
)
diff --git a/lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py b/lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
index eb7c036..3a42662 100644
--- a/lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
+++ b/lldb/test/API/functionalities/gdb_remote_client/TestJLink6Armv7RegisterDefinition.py
@@ -198,7 +198,7 @@ class TestJLink6Armv7RegisterDefinition(GDBRemoteTestBase):
error = lldb.SBError()
data = lldb.SBData()
data.SetData(error, val, lldb.eByteOrderBig, 4)
- self.assertEqual(r1_valobj.SetData(data, error), True)
+ self.assertTrue(r1_valobj.SetData(data, error))
self.assertSuccess(error)
r1_valobj = process.GetThreadAtIndex(0).GetFrameAtIndex(0).FindRegister("r1")
diff --git a/lldb/test/API/functionalities/module_cache/simple_exe/TestModuleCacheSimple.py b/lldb/test/API/functionalities/module_cache/simple_exe/TestModuleCacheSimple.py
index 4214bd1..abf4cf3 100644
--- a/lldb/test/API/functionalities/module_cache/simple_exe/TestModuleCacheSimple.py
+++ b/lldb/test/API/functionalities/module_cache/simple_exe/TestModuleCacheSimple.py
@@ -66,18 +66,16 @@ class ModuleCacheTestcaseSimple(TestBase):
# get a different creation and modification time for the file since some
# OSs store the modification time in seconds since Jan 1, 1970.
os.remove(exe)
- self.assertEqual(
- os.path.exists(exe),
- False,
- "make sure we were able to remove the executable",
+ self.assertFalse(
+ os.path.exists(exe), "make sure we were able to remove the executable"
)
time.sleep(2)
# Now rebuild the binary so it has a different content which should
# update the UUID to make the cache miss when it tries to load the
# symbol table from the binary at the same path.
self.build(dictionary={"CFLAGS_EXTRAS": "-DEXTRA_FUNCTION"})
- self.assertEqual(
- os.path.exists(exe), True, "make sure executable exists after rebuild"
+ self.assertTrue(
+ os.path.exists(exe), "make sure executable exists after rebuild"
)
# Make sure the modification time has changed or this test will fail.
exe_mtime_2 = os.path.getmtime(exe)
@@ -99,9 +97,8 @@ class ModuleCacheTestcaseSimple(TestBase):
main_module = target.GetModuleAtIndex(0)
self.assertTrue(main_module.IsValid())
main_module.GetNumSymbols()
- self.assertEqual(
+ self.assertTrue(
os.path.exists(symtab_cache_path),
- True,
'make sure "symtab" cache files exists after cache is updated',
)
symtab_mtime_2 = os.path.getmtime(symtab_cache_path)
diff --git a/lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py b/lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py
index 357999b..ee35dbd 100644
--- a/lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py
+++ b/lldb/test/API/functionalities/progress_reporting/TestTrimmedProgressReporting.py
@@ -24,7 +24,8 @@ class TestTrimmedProgressReporting(PExpectTest):
)
self.expect("set set term-width " + str(term_width))
self.expect(
- "set show term-width", substrs=["term-width (int) = " + str(term_width)]
+ "set show term-width",
+ substrs=["term-width (unsigned) = " + str(term_width)],
)
self.child.send("file " + self.getBuildArtifact("a.out") + "\n")
diff --git a/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py b/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py
index eee91bf..851097b 100644
--- a/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py
+++ b/lldb/test/API/functionalities/stats_api/TestStatisticsAPI.py
@@ -33,47 +33,47 @@ class TestStatsAPI(TestBase):
stream = lldb.SBStream()
res = stats.GetAsJSON(stream)
debug_stats = json.loads(stream.GetData())
- self.assertEqual(
- "targets" in debug_stats,
- True,
+ self.assertIn(
+ "targets",
+ debug_stats,
'Make sure the "targets" key in in target.GetStatistics()',
)
- self.assertEqual(
- "modules" in debug_stats,
- True,
+ self.assertIn(
+ "modules",
+ debug_stats,
'Make sure the "modules" key in in target.GetStatistics()',
)
stats_json = debug_stats["targets"][0]
- self.assertEqual(
- "expressionEvaluation" in stats_json,
- True,
+ self.assertIn(
+ "expressionEvaluation",
+ stats_json,
'Make sure the "expressionEvaluation" key in in target.GetStatistics()["targets"][0]',
)
- self.assertEqual(
- "frameVariable" in stats_json,
- True,
+ self.assertIn(
+ "frameVariable",
+ stats_json,
'Make sure the "frameVariable" key in in target.GetStatistics()["targets"][0]',
)
expressionEvaluation = stats_json["expressionEvaluation"]
- self.assertEqual(
- "successes" in expressionEvaluation,
- True,
+ self.assertIn(
+ "successes",
+ expressionEvaluation,
'Make sure the "successes" key in in "expressionEvaluation" dictionary"',
)
- self.assertEqual(
- "failures" in expressionEvaluation,
- True,
+ self.assertIn(
+ "failures",
+ expressionEvaluation,
'Make sure the "failures" key in in "expressionEvaluation" dictionary"',
)
frameVariable = stats_json["frameVariable"]
- self.assertEqual(
- "successes" in frameVariable,
- True,
+ self.assertIn(
+ "successes",
+ frameVariable,
'Make sure the "successes" key in in "frameVariable" dictionary"',
)
- self.assertEqual(
- "failures" in frameVariable,
- True,
+ self.assertIn(
+ "failures",
+ frameVariable,
'Make sure the "failures" key in in "frameVariable" dictionary"',
)
diff --git a/lldb/test/API/functionalities/thread/backtrace_limit/TestBacktraceLimit.py b/lldb/test/API/functionalities/thread/backtrace_limit/TestBacktraceLimit.py
index 98baea4..fded504 100644
--- a/lldb/test/API/functionalities/thread/backtrace_limit/TestBacktraceLimit.py
+++ b/lldb/test/API/functionalities/thread/backtrace_limit/TestBacktraceLimit.py
@@ -23,5 +23,5 @@ class BacktraceLimitSettingTest(TestBase):
interp.HandleCommand(
"settings set target.process.thread.max-backtrace-depth 30", result
)
- self.assertEqual(True, result.Succeeded())
+ self.assertTrue(result.Succeeded())
self.assertEqual(30, thread.GetNumFrames())
diff --git a/lldb/test/API/macosx/arm-corefile-regctx/TestArmMachoCorefileRegctx.py b/lldb/test/API/macosx/arm-corefile-regctx/TestArmMachoCorefileRegctx.py
index 1ecb0f4..4190ea3 100644
--- a/lldb/test/API/macosx/arm-corefile-regctx/TestArmMachoCorefileRegctx.py
+++ b/lldb/test/API/macosx/arm-corefile-regctx/TestArmMachoCorefileRegctx.py
@@ -28,7 +28,7 @@ class TestArmMachoCorefileRegctx(TestBase):
target = self.dbg.CreateTarget("")
err = lldb.SBError()
process = target.LoadCore(self.corefile)
- self.assertEqual(process.IsValid(), True)
+ self.assertTrue(process.IsValid())
thread = process.GetSelectedThread()
frame = thread.GetSelectedFrame()
@@ -51,7 +51,7 @@ class TestArmMachoCorefileRegctx(TestBase):
target = self.dbg.CreateTarget("")
err = lldb.SBError()
process = target.LoadCore(self.corefile)
- self.assertEqual(process.IsValid(), True)
+ self.assertTrue(process.IsValid())
thread = process.GetSelectedThread()
frame = thread.GetSelectedFrame()
diff --git a/lldb/test/API/macosx/lc-note/addrable-bits/TestAddrableBitsCorefile.py b/lldb/test/API/macosx/lc-note/addrable-bits/TestAddrableBitsCorefile.py
index 221fe62..e56ecfc 100644
--- a/lldb/test/API/macosx/lc-note/addrable-bits/TestAddrableBitsCorefile.py
+++ b/lldb/test/API/macosx/lc-note/addrable-bits/TestAddrableBitsCorefile.py
@@ -29,7 +29,7 @@ class TestAddrableBitsCorefile(TestBase):
(target, process, thread, bkpt) = lldbutil.run_to_source_breakpoint(
self, "break here", lldb.SBFileSpec("main.c")
)
- self.assertEqual(process.IsValid(), True)
+ self.assertTrue(process.IsValid())
found_main = False
for f in thread.frames:
diff --git a/lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py b/lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py
index b9d2055..db3074d 100644
--- a/lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py
+++ b/lldb/test/API/macosx/lc-note/firmware-corefile/TestFirmwareCorefiles.py
@@ -73,7 +73,7 @@ class TestFirmwareCorefiles(TestBase):
if self.TraceOn():
self.runCmd("script print('loading corefile %s')" % verstr_corefile)
process = target.LoadCore(verstr_corefile)
- self.assertEqual(process.IsValid(), True)
+ self.assertTrue(process.IsValid())
if self.TraceOn():
self.runCmd("image list")
self.runCmd("target mod dump sections")
@@ -91,7 +91,7 @@ class TestFirmwareCorefiles(TestBase):
"script print('loading corefile %s')" % verstr_corefile_invalid_ident
)
process = target.LoadCore(verstr_corefile_invalid_ident)
- self.assertEqual(process.IsValid(), True)
+ self.assertTrue(process.IsValid())
# Third, try the "kern ver str" corefile where it loads at an address
target = self.dbg.CreateTarget("")
@@ -99,7 +99,7 @@ class TestFirmwareCorefiles(TestBase):
if self.TraceOn():
self.runCmd("script print('loading corefile %s')" % verstr_corefile_addr)
process = target.LoadCore(verstr_corefile_addr)
- self.assertEqual(process.IsValid(), True)
+ self.assertTrue(process.IsValid())
if self.TraceOn():
self.runCmd("image list")
self.runCmd("target mod dump sections")
@@ -178,7 +178,7 @@ class TestFirmwareCorefiles(TestBase):
if self.TraceOn():
self.runCmd("script print('loading corefile %s')" % binspec_corefile)
process = target.LoadCore(binspec_corefile)
- self.assertEqual(process.IsValid(), True)
+ self.assertTrue(process.IsValid())
if self.TraceOn():
self.runCmd("image list")
self.runCmd("target mod dump sections")
@@ -192,7 +192,7 @@ class TestFirmwareCorefiles(TestBase):
if self.TraceOn():
self.runCmd("script print('loading corefile %s')" % binspec_corefile_addr)
process = target.LoadCore(binspec_corefile_addr)
- self.assertEqual(process.IsValid(), True)
+ self.assertTrue(process.IsValid())
if self.TraceOn():
self.runCmd("image list")
self.runCmd("target mod dump sections")
@@ -212,7 +212,7 @@ class TestFirmwareCorefiles(TestBase):
"script print('loading corefile %s')" % binspec_corefile_slideonly
)
process = target.LoadCore(binspec_corefile_slideonly)
- self.assertEqual(process.IsValid(), True)
+ self.assertTrue(process.IsValid())
if self.TraceOn():
self.runCmd("image list")
self.runCmd("target mod dump sections")
@@ -352,7 +352,7 @@ class TestFirmwareCorefiles(TestBase):
)
process = target.LoadCore(binspec_corefile_addr)
- self.assertEqual(process.IsValid(), True)
+ self.assertTrue(process.IsValid())
if self.TraceOn():
self.runCmd("image list")
self.runCmd("target mod dump sections")
diff --git a/lldb/test/API/macosx/lc-note/kern-ver-str/TestKernVerStrLCNOTE.py b/lldb/test/API/macosx/lc-note/kern-ver-str/TestKernVerStrLCNOTE.py
index 9713c4a..d436619 100644
--- a/lldb/test/API/macosx/lc-note/kern-ver-str/TestKernVerStrLCNOTE.py
+++ b/lldb/test/API/macosx/lc-note/kern-ver-str/TestKernVerStrLCNOTE.py
@@ -94,7 +94,7 @@ class TestKernVerStrLCNOTE(TestBase):
self.target = self.dbg.CreateTarget("")
err = lldb.SBError()
self.process = self.target.LoadCore(self.corefile)
- self.assertEqual(self.process.IsValid(), True)
+ self.assertTrue(self.process.IsValid())
if self.TraceOn():
self.runCmd("image list")
self.assertEqual(self.target.GetNumModules(), 1)
diff --git a/lldb/test/API/macosx/lc-note/multiple-binary-corefile/TestMultipleBinaryCorefile.py b/lldb/test/API/macosx/lc-note/multiple-binary-corefile/TestMultipleBinaryCorefile.py
index 0a0bc68..897eab2 100644
--- a/lldb/test/API/macosx/lc-note/multiple-binary-corefile/TestMultipleBinaryCorefile.py
+++ b/lldb/test/API/macosx/lc-note/multiple-binary-corefile/TestMultipleBinaryCorefile.py
@@ -45,7 +45,7 @@ class TestMultipleBinaryCorefile(TestBase):
if self.TraceOn():
print("loading corefile %s" % self.corefile)
process = target.LoadCore(self.corefile)
- self.assertEqual(process.IsValid(), True)
+ self.assertTrue(process.IsValid())
if self.TraceOn():
print("image list after loading corefile:")
self.runCmd("image list")
diff --git a/lldb/test/API/macosx/queues/TestQueues.py b/lldb/test/API/macosx/queues/TestQueues.py
index f2d15bb..45b52af 100644
--- a/lldb/test/API/macosx/queues/TestQueues.py
+++ b/lldb/test/API/macosx/queues/TestQueues.py
@@ -457,9 +457,8 @@ class TestQueues(TestBase):
"doing_the_work_2",
"queue 2's pending item #0 should be doing_the_work_2",
)
- self.assertEqual(
+ self.assertFalse(
queue_performer_2.GetPendingItemAtIndex(9999).IsValid(),
- False,
"queue 2's pending item #9999 is invalid",
)
diff --git a/lldb/test/API/macosx/safe-to-func-call/TestSafeFuncCalls.py b/lldb/test/API/macosx/safe-to-func-call/TestSafeFuncCalls.py
index 6a37b25..551cab1 100644
--- a/lldb/test/API/macosx/safe-to-func-call/TestSafeFuncCalls.py
+++ b/lldb/test/API/macosx/safe-to-func-call/TestSafeFuncCalls.py
@@ -49,8 +49,7 @@ class TestSafeFuncCalls(TestBase):
main_thread.SafeToCallFunctions(),
"It is safe to call functions on the main thread",
)
- self.assertEqual(
+ self.assertFalse(
select_thread.SafeToCallFunctions(),
- False,
"It is not safe to call functions on the select thread",
)
diff --git a/lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py b/lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py
index 64e0770..af97493 100644
--- a/lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py
+++ b/lldb/test/API/python_api/interpreter/TestRunCommandInterpreterAPI.py
@@ -79,13 +79,13 @@ class SBCommandInterpreterRunOptionsCase(TestBase):
opts = lldb.SBCommandInterpreterRunOptions()
# Check getters with default values
- self.assertEqual(opts.GetStopOnContinue(), False)
- self.assertEqual(opts.GetStopOnError(), False)
- self.assertEqual(opts.GetStopOnCrash(), False)
- self.assertEqual(opts.GetEchoCommands(), True)
- self.assertEqual(opts.GetPrintResults(), True)
- self.assertEqual(opts.GetPrintErrors(), True)
- self.assertEqual(opts.GetAddToHistory(), True)
+ self.assertFalse(opts.GetStopOnContinue())
+ self.assertFalse(opts.GetStopOnError())
+ self.assertFalse(opts.GetStopOnCrash())
+ self.assertTrue(opts.GetEchoCommands())
+ self.assertTrue(opts.GetPrintResults())
+ self.assertTrue(opts.GetPrintErrors())
+ self.assertTrue(opts.GetAddToHistory())
# Invert values
opts.SetStopOnContinue(not opts.GetStopOnContinue())
@@ -97,10 +97,10 @@ class SBCommandInterpreterRunOptionsCase(TestBase):
opts.SetAddToHistory(not opts.GetAddToHistory())
# Check the value changed
- self.assertEqual(opts.GetStopOnContinue(), True)
- self.assertEqual(opts.GetStopOnError(), True)
- self.assertEqual(opts.GetStopOnCrash(), True)
- self.assertEqual(opts.GetEchoCommands(), False)
- self.assertEqual(opts.GetPrintResults(), False)
- self.assertEqual(opts.GetPrintErrors(), False)
- self.assertEqual(opts.GetAddToHistory(), False)
+ self.assertTrue(opts.GetStopOnContinue())
+ self.assertTrue(opts.GetStopOnError())
+ self.assertTrue(opts.GetStopOnCrash())
+ self.assertFalse(opts.GetEchoCommands())
+ self.assertFalse(opts.GetPrintResults())
+ self.assertFalse(opts.GetPrintErrors())
+ self.assertFalse(opts.GetAddToHistory())
diff --git a/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile b/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile
new file mode 100644
index 0000000..99998b2
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/databreakpoint/Makefile
@@ -0,0 +1,3 @@
+CXX_SOURCES := main.cpp
+
+include Makefile.rules
diff --git a/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py
new file mode 100644
index 0000000..17cdad8
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/databreakpoint/TestDAP_setDataBreakpoints.py
@@ -0,0 +1,131 @@
+"""
+Test lldb-dap dataBreakpointInfo and setDataBreakpoints requests
+"""
+
+from lldbsuite.test.decorators import *
+from lldbsuite.test.lldbtest import *
+import lldbdap_testcase
+
+
+class TestDAP_setDataBreakpoints(lldbdap_testcase.DAPTestCaseBase):
+ def setUp(self):
+ lldbdap_testcase.DAPTestCaseBase.setUp(self)
+ self.accessTypes = ["read", "write", "readWrite"]
+
+ @skipIfWindows
+ @skipIfRemote
+ def test_expression(self):
+ """Tests setting data breakpoints on expression."""
+ program = self.getBuildArtifact("a.out")
+ self.build_and_launch(program)
+ source = "main.cpp"
+ first_loop_break_line = line_number(source, "// first loop breakpoint")
+ self.set_source_breakpoints(source, [first_loop_break_line])
+ self.continue_to_next_stop()
+ self.dap_server.get_stackFrame()
+ # Test setting write watchpoint using expressions: &x, arr+2
+ response_x = self.dap_server.request_dataBreakpointInfo(0, "&x")
+ response_arr_2 = self.dap_server.request_dataBreakpointInfo(0, "arr+2")
+ # Test response from dataBreakpointInfo request.
+ self.assertEquals(response_x["body"]["dataId"].split("/")[1], "4")
+ self.assertEquals(response_x["body"]["accessTypes"], self.accessTypes)
+ self.assertEquals(response_arr_2["body"]["dataId"].split("/")[1], "4")
+ self.assertEquals(response_arr_2["body"]["accessTypes"], self.accessTypes)
+ dataBreakpoints = [
+ {"dataId": response_x["body"]["dataId"], "accessType": "write"},
+ {"dataId": response_arr_2["body"]["dataId"], "accessType": "write"},
+ ]
+ set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints)
+ self.assertEquals(
+ set_response["body"]["breakpoints"],
+ [{"verified": True}, {"verified": True}],
+ )
+
+ self.continue_to_next_stop()
+ x_val = self.dap_server.get_local_variable_value("x")
+ i_val = self.dap_server.get_local_variable_value("i")
+ self.assertEquals(x_val, "2")
+ self.assertEquals(i_val, "1")
+
+ self.continue_to_next_stop()
+ arr_2 = self.dap_server.get_local_variable_child("arr", "[2]")
+ i_val = self.dap_server.get_local_variable_value("i")
+ self.assertEquals(arr_2["value"], "42")
+ self.assertEquals(i_val, "2")
+
+ @skipIfWindows
+ @skipIfRemote
+ def test_functionality(self):
+ """Tests setting data breakpoints on variable."""
+ program = self.getBuildArtifact("a.out")
+ self.build_and_launch(program)
+ source = "main.cpp"
+ first_loop_break_line = line_number(source, "// first loop breakpoint")
+ self.set_source_breakpoints(source, [first_loop_break_line])
+ self.continue_to_next_stop()
+ self.dap_server.get_local_variables()
+ # Test write watchpoints on x, arr[2]
+ response_x = self.dap_server.request_dataBreakpointInfo(1, "x")
+ arr = self.dap_server.get_local_variable("arr")
+ response_arr_2 = self.dap_server.request_dataBreakpointInfo(
+ arr["variablesReference"], "[2]"
+ )
+
+ # Test response from dataBreakpointInfo request.
+ self.assertEquals(response_x["body"]["dataId"].split("/")[1], "4")
+ self.assertEquals(response_x["body"]["accessTypes"], self.accessTypes)
+ self.assertEquals(response_arr_2["body"]["dataId"].split("/")[1], "4")
+ self.assertEquals(response_arr_2["body"]["accessTypes"], self.accessTypes)
+ dataBreakpoints = [
+ {"dataId": response_x["body"]["dataId"], "accessType": "write"},
+ {"dataId": response_arr_2["body"]["dataId"], "accessType": "write"},
+ ]
+ set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints)
+ self.assertEquals(
+ set_response["body"]["breakpoints"],
+ [{"verified": True}, {"verified": True}],
+ )
+
+ self.continue_to_next_stop()
+ x_val = self.dap_server.get_local_variable_value("x")
+ i_val = self.dap_server.get_local_variable_value("i")
+ self.assertEquals(x_val, "2")
+ self.assertEquals(i_val, "1")
+
+ self.continue_to_next_stop()
+ arr_2 = self.dap_server.get_local_variable_child("arr", "[2]")
+ i_val = self.dap_server.get_local_variable_value("i")
+ self.assertEquals(arr_2["value"], "42")
+ self.assertEquals(i_val, "2")
+ self.dap_server.request_setDataBreakpoint([])
+
+ # Test hit condition
+ second_loop_break_line = line_number(source, "// second loop breakpoint")
+ breakpoint_ids = self.set_source_breakpoints(source, [second_loop_break_line])
+ self.continue_to_breakpoints(breakpoint_ids)
+ dataBreakpoints = [
+ {
+ "dataId": response_x["body"]["dataId"],
+ "accessType": "write",
+ "hitCondition": "2",
+ }
+ ]
+ set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints)
+ self.assertEquals(set_response["body"]["breakpoints"], [{"verified": True}])
+ self.continue_to_next_stop()
+ x_val = self.dap_server.get_local_variable_value("x")
+ self.assertEquals(x_val, "3")
+
+ # Test condition
+ dataBreakpoints = [
+ {
+ "dataId": response_x["body"]["dataId"],
+ "accessType": "write",
+ "condition": "x==10",
+ }
+ ]
+ set_response = self.dap_server.request_setDataBreakpoint(dataBreakpoints)
+ self.assertEquals(set_response["body"]["breakpoints"], [{"verified": True}])
+ self.continue_to_next_stop()
+ x_val = self.dap_server.get_local_variable_value("x")
+ self.assertEquals(x_val, "10")
diff --git a/lldb/test/API/tools/lldb-dap/databreakpoint/main.cpp b/lldb/test/API/tools/lldb-dap/databreakpoint/main.cpp
new file mode 100644
index 0000000..bef09c2
--- /dev/null
+++ b/lldb/test/API/tools/lldb-dap/databreakpoint/main.cpp
@@ -0,0 +1,17 @@
+int main(int argc, char const *argv[]) {
+ // Test for data breakpoint
+ int x = 0;
+ int arr[4] = {1, 2, 3, 4};
+ for (int i = 0; i < 5; ++i) { // first loop breakpoint
+ if (i == 1) {
+ x = i + 1;
+ } else if (i == 2) {
+ arr[i] = 42;
+ }
+ }
+
+ x = 1;
+ for (int i = 0; i < 10; ++i) { // second loop breakpoint
+ ++x;
+ }
+}