summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/test/api/check_public_api_headers/TestPublicAPIHeaders.py6
-rw-r--r--lldb/test/expression_command/call-function/TestCallStdStringFunction.py5
-rw-r--r--lldb/test/expression_command/call-function/main.cpp3
-rw-r--r--lldb/test/expression_command/formatters/TestFormatters.py5
-rw-r--r--lldb/test/expression_command/radar_9531204/TestPrintfAfterUp.py5
-rw-r--r--lldb/test/expression_command/radar_9673664/TestExprHelpExamples.py6
-rw-r--r--lldb/test/expression_command/test/TestExprs.py10
-rw-r--r--lldb/test/expression_command/test/TestExprs2.py5
-rw-r--r--lldb/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py6
-rw-r--r--lldb/test/functionalities/abbreviation/TestAbbreviations.py9
-rw-r--r--lldb/test/functionalities/abbreviation/TestCommonShortSpellings.py6
-rw-r--r--lldb/test/functionalities/alias/TestAliases.py14
-rw-r--r--lldb/test/functionalities/archives/TestBSDArchives.py10
-rw-r--r--lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py51
-rw-r--r--lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py12
-rw-r--r--lldb/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py6
-rw-r--r--lldb/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py15
-rw-r--r--lldb/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py6
-rw-r--r--lldb/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py6
-rw-r--r--lldb/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py10
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py6
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py10
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py6
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py6
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py6
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py6
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py34
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-objc/main.m4
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py17
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp5
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py6
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py10
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py6
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py11
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py6
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py11
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py6
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py6
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py6
-rw-r--r--lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py6
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-10449092/Test-rdar-10449092.py6
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py6
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py6
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py6
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py6
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-11773899/TestFormattersBoolRefPtr.py6
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-11988289/TestRdar 11988289.py6
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py6
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py6
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py6
-rw-r--r--lldb/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py6
-rw-r--r--lldb/test/functionalities/dead-strip/TestDeadStrip.py10
-rw-r--r--lldb/test/functionalities/inferior-changed/TestInferiorChanged.py6
-rw-r--r--lldb/test/functionalities/load_unload/TestLoadUnload.py19
-rw-r--r--lldb/test/functionalities/memory/read/TestMemoryRead.py6
-rw-r--r--lldb/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py6
-rw-r--r--lldb/test/functionalities/register/TestRegisters.py9
-rw-r--r--lldb/test/functionalities/signal/TestSendSignal.py6
-rw-r--r--lldb/test/functionalities/stop-hook/TestStopHookCmd.py12
-rw-r--r--lldb/test/functionalities/target_command/TestTargetCommand.py7
-rw-r--r--lldb/test/functionalities/type_completion/TestTypeCompletion.py6
-rw-r--r--lldb/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py5
-rw-r--r--lldb/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py5
-rw-r--r--lldb/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py17
-rw-r--r--lldb/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py4
-rw-r--r--lldb/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py182
-rw-r--r--lldb/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py15
-rw-r--r--lldb/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py8
-rw-r--r--lldb/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py5
-rw-r--r--lldb/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py5
-rw-r--r--lldb/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py5
-rw-r--r--lldb/test/lang/c/anonymous/TestAnonymous.py4
-rw-r--r--lldb/test/lang/c/array_types/TestArrayTypes.py6
-rw-r--r--lldb/test/lang/c/bitfields/TestBitfields.py6
-rw-r--r--lldb/test/lang/c/blocks/TestBlocks.py4
-rw-r--r--lldb/test/lang/c/enum_types/TestEnumTypes.py6
-rw-r--r--lldb/test/lang/c/forward/TestForwardDeclaration.py4
-rw-r--r--lldb/test/lang/c/function_types/TestFunctionTypes.py8
-rw-r--r--lldb/test/lang/c/global_variables/TestGlobalVariables.py6
-rw-r--r--lldb/test/lang/c/set_values/TestSetValues.py34
-rw-r--r--lldb/test/lang/c/shared_lib/TestSharedLib.py4
-rw-r--r--lldb/test/lang/c/shared_lib/main.c4
-rw-r--r--lldb/test/lang/c/stepping/TestThreadStepping.py5
-rw-r--r--lldb/test/lang/c/strings/TestCStrings.py7
-rw-r--r--lldb/test/lang/c/struct_types/TestStructTypes.py6
-rw-r--r--lldb/test/lang/cpp/class_static/TestStaticVariables.py6
-rw-r--r--lldb/test/lang/cpp/class_types/TestClassTypes.py9
-rw-r--r--lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py6
-rw-r--r--lldb/test/lang/cpp/namespace/TestNamespace.py6
-rw-r--r--lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py8
-rw-r--r--lldb/test/lang/cpp/signed_types/TestSignedTypes.py6
-rw-r--r--lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py6
-rw-r--r--lldb/test/lang/cpp/stl/TestSTL.py5
-rw-r--r--lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py6
-rw-r--r--lldb/test/lang/cpp/this/TestCPPThis.py9
-rw-r--r--lldb/test/lang/cpp/unique-types/TestUniqueTypes.py5
-rw-r--r--lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py6
-rw-r--r--lldb/test/lang/cpp/virtual/TestVirtual.py3
-rw-r--r--lldb/test/lang/objc/forward-decl/TestForwardDecl.py4
-rw-r--r--lldb/test/lang/objc/foundation/TestConstStrings.py6
-rw-r--r--lldb/test/lang/objc/foundation/TestFoundationDisassembly.py24
-rw-r--r--lldb/test/lang/objc/foundation/TestObjCMethods.py37
-rw-r--r--lldb/test/lang/objc/foundation/TestObjCMethods2.py53
-rw-r--r--lldb/test/lang/objc/foundation/main.m8
-rw-r--r--lldb/test/lang/objc/hidden-ivars/TestHiddenIvars.py4
-rw-r--r--lldb/test/lang/objc/objc++/TestObjCXX.py4
-rw-r--r--lldb/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py4
-rw-r--r--lldb/test/lang/objc/objc-optimized/TestObjcOptimized.py5
-rw-r--r--lldb/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py6
-rw-r--r--lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py6
-rw-r--r--lldb/test/lang/objc/rdar-10967107/main.m4
-rw-r--r--lldb/test/lang/objc/rdar-11355592/TestRdar11355592.py6
-rw-r--r--lldb/test/lang/objc/rdar-11355592/main.m4
-rw-r--r--lldb/test/lang/objc/real-definition/TestRealDefinition.py10
-rw-r--r--lldb/test/lang/objc/self/TestObjCSelf.py7
-rw-r--r--lldb/test/lldbtest.py43
-rw-r--r--lldb/test/lldbutil.py187
-rw-r--r--lldb/test/macosx/universal/TestUniversal.py11
-rw-r--r--lldb/test/python_api/formatters/TestFormattersSBAPI.py11
-rw-r--r--lldb/test/python_api/sbdata/TestSBData.py6
-rw-r--r--lldb/test/source-manager/TestSourceManager.py6
-rw-r--r--lldb/test/types/AbstractBase.py12
122 files changed, 804 insertions, 623 deletions
diff --git a/lldb/test/api/check_public_api_headers/TestPublicAPIHeaders.py b/lldb/test/api/check_public_api_headers/TestPublicAPIHeaders.py
index 97b46c582dc..2b50c8bf31c 100644
--- a/lldb/test/api/check_public_api_headers/TestPublicAPIHeaders.py
+++ b/lldb/test/api/check_public_api_headers/TestPublicAPIHeaders.py
@@ -6,6 +6,7 @@ should compile and link with the LLDB framework."""
import os, re, StringIO
import unittest2
from lldbtest import *
+import lldbutil
class SBDirCheckerCase(TestBase):
@@ -81,10 +82,7 @@ class SBDirCheckerCase(TestBase):
self.runCmd(env_cmd)
self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars %s" % env_var))
- self.expect('breakpoint set -f %s -l %d' % (self.source, self.line_to_break),
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d" %
- (self.source, self.line_to_break))
+ lldbutil.run_break_set_by_file_and_line (self, self.source, self.line_to_break, num_expected_locations = -1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/expression_command/call-function/TestCallStdStringFunction.py b/lldb/test/expression_command/call-function/TestCallStdStringFunction.py
index e9f23da0a84..05d1c79332e 100644
--- a/lldb/test/expression_command/call-function/TestCallStdStringFunction.py
+++ b/lldb/test/expression_command/call-function/TestCallStdStringFunction.py
@@ -35,10 +35,7 @@ class ExprCommandCallFunctionTestCase(TestBase):
"""Test calling std::String member function."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/expression_command/call-function/main.cpp b/lldb/test/expression_command/call-function/main.cpp
index 5391e09fcb1..09c8633114b 100644
--- a/lldb/test/expression_command/call-function/main.cpp
+++ b/lldb/test/expression_command/call-function/main.cpp
@@ -6,10 +6,9 @@ int main (int argc, char const *argv[])
std::string str = "Hello world";
std::cout << str << std::endl;
std::cout << str.c_str() << std::endl;
- // Please test these expressions while stopped at this line:
#if 0
print str
print str.c_str()
#endif
- return 0;
+ return 0; // Please test these expressions while stopped at this line:
}
diff --git a/lldb/test/expression_command/formatters/TestFormatters.py b/lldb/test/expression_command/formatters/TestFormatters.py
index 780f74ccd35..f5d5a07ee5a 100644
--- a/lldb/test/expression_command/formatters/TestFormatters.py
+++ b/lldb/test/expression_command/formatters/TestFormatters.py
@@ -45,10 +45,7 @@ class ExprFormattersTestCase(TestBase):
"""Test expr + formatters for good interoperability."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
self.runCmd("script import formatters")
diff --git a/lldb/test/expression_command/radar_9531204/TestPrintfAfterUp.py b/lldb/test/expression_command/radar_9531204/TestPrintfAfterUp.py
index 5fdcc46a068..1d9aa605921 100644
--- a/lldb/test/expression_command/radar_9531204/TestPrintfAfterUp.py
+++ b/lldb/test/expression_command/radar_9531204/TestPrintfAfterUp.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class Radar9531204TestCase(TestBase):
@@ -18,9 +19,7 @@ class Radar9531204TestCase(TestBase):
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -n foo",
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: name = 'foo', locations = 1")
+ lldbutil.run_break_set_by_symbol (self, 'foo', sym_exact=True, num_expected_locations=1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/expression_command/radar_9673664/TestExprHelpExamples.py b/lldb/test/expression_command/radar_9673664/TestExprHelpExamples.py
index 145e6c5bcc3..3ae2227f0e7 100644
--- a/lldb/test/expression_command/radar_9673664/TestExprHelpExamples.py
+++ b/lldb/test/expression_command/radar_9673664/TestExprHelpExamples.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class Radar9673644TestCase(TestBase):
@@ -25,10 +26,7 @@ class Radar9673644TestCase(TestBase):
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f %s -l %d" % (self.main_source, self.line),
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.main_source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/expression_command/test/TestExprs.py b/lldb/test/expression_command/test/TestExprs.py
index 0f7dc9e4abd..f63694e59cb 100644
--- a/lldb/test/expression_command/test/TestExprs.py
+++ b/lldb/test/expression_command/test/TestExprs.py
@@ -34,10 +34,7 @@ class BasicExprCommandsTestCase(TestBase):
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=False)
self.runCmd("run", RUN_SUCCEEDED)
@@ -168,10 +165,7 @@ class BasicExprCommandsTestCase(TestBase):
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.line, num_expected_locations=1,loc_exact=False)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/expression_command/test/TestExprs2.py b/lldb/test/expression_command/test/TestExprs2.py
index 4b505214eae..441cb109426 100644
--- a/lldb/test/expression_command/test/TestExprs2.py
+++ b/lldb/test/expression_command/test/TestExprs2.py
@@ -26,10 +26,7 @@ class ExprCommands2TestCase(TestBase):
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.line, num_expected_locations=1,loc_exact=False)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py b/lldb/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py
index 3a516cdf4f1..e618e89fcd8 100644
--- a/lldb/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py
+++ b/lldb/test/expression_command/two-files/TestObjCTypeQueryFromOtherCompileUnit.py
@@ -7,6 +7,7 @@ The expression parser's type search only looks in the current compilation unit f
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class ObjCTypeQueryTestCase(TestBase):
@@ -36,10 +37,7 @@ class ObjCTypeQueryTestCase(TestBase):
"""The expression parser's type search should be wider than the current compilation unit."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.m -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.m', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/abbreviation/TestAbbreviations.py b/lldb/test/functionalities/abbreviation/TestAbbreviations.py
index 26b67e55f3a..9eeeb80b0aa 100644
--- a/lldb/test/functionalities/abbreviation/TestAbbreviations.py
+++ b/lldb/test/functionalities/abbreviation/TestAbbreviations.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class AbbreviationsTestCase(TestBase):
@@ -90,11 +91,11 @@ class AbbreviationsTestCase(TestBase):
self.expect("_regexp-b product", matching=False,
substrs = [ "breakpoint set --name" ])
- self.expect("br s -n sum",
- startstr = "Breakpoint created: 2: name = 'sum', locations = 1")
+ match_object = lldbutil.run_break_set_command (self, "br s -n sum")
+ lldbutil.check_breakpoint_result (self, match_object, symbol_name='sum', symbol_match_exact=False, num_locations=1)
- self.expect("br s -f main.cpp -l 32",
- startstr = "Breakpoint created: 3: file ='main.cpp', line = 32, locations = 1")
+ match_object = lldbutil.run_break_set_command (self, "br s -f main.cpp -l 32")
+ lldbutil.check_breakpoint_result (self, match_object, file_name='main.cpp', line_number=32, num_locations=1)
self.runCmd("br co a -s python 1 -o 'print frame'")
self.expect("br co l 1",
diff --git a/lldb/test/functionalities/abbreviation/TestCommonShortSpellings.py b/lldb/test/functionalities/abbreviation/TestCommonShortSpellings.py
index c4ec8c54851..6782f701d88 100644
--- a/lldb/test/functionalities/abbreviation/TestCommonShortSpellings.py
+++ b/lldb/test/functionalities/abbreviation/TestCommonShortSpellings.py
@@ -7,6 +7,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class CommonShortSpellingsTestCase(TestBase):
@@ -29,8 +30,9 @@ class CommonShortSpellingsTestCase(TestBase):
patterns = [ "Current executable set to .*a.out.*" ])
# br s -> breakpoint set
- self.expect("br s -n sum",
- startstr = "Breakpoint created: 1: name = 'sum', locations = 1")
+
+ match_object = lldbutil.run_break_set_command (self, "br s -n sum")
+ lldbutil.check_breakpoint_result (self, match_object, symbol_name='sum', symbol_match_exact=False, num_locations=1)
self.runCmd("settings set interpreter.expand-regex-aliases true")
self.addTearDownHook(
diff --git a/lldb/test/functionalities/alias/TestAliases.py b/lldb/test/functionalities/alias/TestAliases.py
index 1eca5d19c4b..bf8fc3719fb 100644
--- a/lldb/test/functionalities/alias/TestAliases.py
+++ b/lldb/test/functionalities/alias/TestAliases.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class AliasTestCase(TestBase):
@@ -80,15 +81,16 @@ class AliasTestCase(TestBase):
self.runCmd ("alias bpa bp command add")
self.runCmd ("alias bpi bp list")
- self.expect ("bp set -n foo",
- startstr = "Breakpoint created: 1: name = 'foo', locations = 1")
+ break_results = lldbutil.run_break_set_command (self, "bp set -n foo")
+ lldbutil.check_breakpoint_result (self, break_results, num_locations=1, symbol_name='foo', symbol_match_exact=False)
- self.expect ("bp set -n sum",
- startstr = "Breakpoint created: 2: name = 'sum', locations = 1")
+ break_results = lldbutil.run_break_set_command (self, "bp set -n sum")
+ lldbutil.check_breakpoint_result (self, break_results, num_locations=1, symbol_name='sum', symbol_match_exact=False)
self.runCmd ("alias bfl bp set -f %1 -l %2")
- self.expect ("bfl main.cpp 32",
- startstr = "Breakpoint created: 3: file ='main.cpp', line = 32, locations = 1")
+
+ break_results = lldbutil.run_break_set_command (self, "bfl main.cpp 32")
+ lldbutil.check_breakpoint_result (self, break_results, num_locations=1, file_name='main.cpp', line_number=32)
self.expect ("bpi",
startstr = "Current breakpoints:",
diff --git a/lldb/test/functionalities/archives/TestBSDArchives.py b/lldb/test/functionalities/archives/TestBSDArchives.py
index 1a7499e7213..46871753c93 100644
--- a/lldb/test/functionalities/archives/TestBSDArchives.py
+++ b/lldb/test/functionalities/archives/TestBSDArchives.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class BSDArchivesTestCase(TestBase):
@@ -26,9 +27,8 @@ class BSDArchivesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside a() by file and line first.
- self.expect("breakpoint set -f a.c -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='a.c', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "a.c", self.line, num_expected_locations=1, loc_exact=True)
+
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
@@ -43,9 +43,7 @@ class BSDArchivesTestCase(TestBase):
substrs = ['(int) __a_global = 1'])
# Set breakpoint for b() next.
- self.expect("breakpoint set -n b", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: name = 'b'",
- substrs = ['resolved = 1'])
+ lldbutil.run_break_set_by_symbol (self, "b", num_expected_locations=1, sym_exact=True)
# Continue the program, we should break at b(int) next.
self.runCmd("continue")
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py b/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
index aa8eeaf56c5..82da6ba7b82 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_command/TestBreakpointCommand.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class BreakpointCommandTestCase(TestBase):
@@ -45,18 +46,21 @@ 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:
- self.expect("breakpoint set -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: file ='main.c', line = %d, locations = 1" %
- self.line)
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 3: file ='main.c', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1, loc_exact=True)
+# self.expect("breakpoint set -l %d" % self.line,
+# BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
+# self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+# self.expect("breakpoint set -f main.c -l %d" % self.line,
+# BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 2: file ='main.c', line = %d, locations = 1" %
+# self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+# self.expect("breakpoint set -f main.c -l %d" % self.line,
+# BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 3: file ='main.c', line = %d, locations = 1" %
+# self.line)
# Now add callbacks for the breakpoints just created.
self.runCmd("breakpoint command add -s command -o 'frame variable -T -s' 1")
@@ -93,21 +97,17 @@ class BreakpointCommandTestCase(TestBase):
# Next lets try some other breakpoint kinds. First break with a regular expression
# and then specify only one file. The first time we should get two locations,
# the second time only one:
- self.expect ("break set -r ._MyFunction",
- patterns = ["Breakpoint created: [0-9]+: regex = '\._MyFunction', locations = 2"])
-
- self.expect ("break set -r ._MyFunction -f a.c",
- patterns = ["Breakpoint created: [0-9]+: regex = '\._MyFunction', locations = 1"])
+
+ 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)
- self.expect ("break set -r ._MyFunction -f a.c -f b.c",
- patterns = ["Breakpoint created: [0-9]+: regex = '\._MyFunction', locations = 2"])
+ 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:
- self.expect ("break set -p \"is about to return [12]0\" -f a.c -f b.c",
- patterns = ["Breakpoint created: [0-9]+: source regex = \"is about to return \[12\]0\", locations = 2"])
+ 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)
- self.expect ("break set -p \"is about to return [12]0\" -f a.c",
- patterns = ["Breakpoint created: [0-9]+: source regex = \"is about to return \[12\]0\", locations = 1"])
+ 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")
@@ -181,10 +181,7 @@ class BreakpointCommandTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint.
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
+ 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\"); print >> here, frame; print >> here, bp_loc; here.close()' 1")
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py b/lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
index f3a33428fdf..aa273692b4d 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_command/TestRegexpBreakCommand.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class RegexpBreakCommandTestCase(TestBase):
@@ -36,12 +37,11 @@ class RegexpBreakCommandTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.expect("b %d" % self.line,
- BREAKPOINT_CREATED,
- substrs = ["Breakpoint created: 1: file ='main.c', line = %d, locations = 1" % self.line])
- self.expect("b %s:%d" % (self.source, self.line),
- BREAKPOINT_CREATED,
- substrs = ["Breakpoint created: 2: file ='main.c', line = %d, locations = 1" % self.line])
+ 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)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py b/lldb/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
index bd5df2d5f78..7e401481978 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_conditions/TestBreakpointConditions.py
@@ -67,12 +67,10 @@ class BreakpointConditionsTestCase(TestBase):
if inline:
# Create a breakpoint by function name 'c' and set the condition.
- self.expect("breakpoint set -n c -c 'val == 3'", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: name = 'c', locations = 1")
+ 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'.
- self.expect("breakpoint set -n c", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: name = 'c', locations = 1")
+ 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")
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py b/lldb/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
index 8b1c9f8b402..15e79c25ccf 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_ids/TestBreakpointIDs.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class BreakpointIDTestCase(TestBase):
@@ -27,15 +28,15 @@ class BreakpointIDTestCase(TestBase):
self.expect("file " + exe,
patterns = [ "Current executable set to .*a.out" ])
- self.expect ("breakpoint set -n product",
- startstr = "Breakpoint created: 1: name = 'product', locations =")
+
+ 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.")
- self.expect ("breakpoint set -n sum",
- startstr = "Breakpoint created: 2: name = 'sum', locations =")
+ 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.")
- self.expect ("breakpoint set -n junk",
- startstr = "Breakpoint created: 3: name = 'junk', locations = 0 (pending)",
- substrs = [ "WARNING: Unable to resolve breakpoint to any actual locations." ] )
+ 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,
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py b/lldb/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
index 6a2caec5f58..b3e6619fac6 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_ignore_count/TestBreakpointIgnoreCount.py
@@ -55,10 +55,8 @@ class BreakpointIgnoreCountTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- # Create a breakpoint by function name 'c'.
- self.expect("breakpoint set -i 1 -f main.c -l %d" % self.line1, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line1)
+ # 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)
# Now run the program.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py b/lldb/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
index e71dbb602da..251cc424c75 100644
--- a/lldb/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
+++ b/lldb/test/functionalities/breakpoint/breakpoint_locations/TestBreakpointLocations.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class BreakpointLocationsTestCase(TestBase):
@@ -36,10 +37,7 @@ class BreakpointLocationsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# This should create a breakpoint with 3 locations.
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 3" %
- self.line)
+ 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",
diff --git a/lldb/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py b/lldb/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
index b4eeb02bda2..fc4084124cc 100644
--- a/lldb/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
+++ b/lldb/test/functionalities/breakpoint/inlined_breakpoints/TestInlinedBreakpoints.py
@@ -7,6 +7,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class InlinedBreakpointsTestCase(TestBase):
"""Bug fixed: rdar://problem/8464339"""
@@ -38,9 +39,7 @@ class InlinedBreakpointsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Set a breakpoint and fail because it is in an inlined source implemenation file
- self.expect("breakpoint set -f basic_type.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='basic_type.cpp', line = %d, locations = 0 (pending)" % self.line)
+ 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
self.runCmd('settings set target.inline-breakpoint-strategy always')
@@ -48,10 +47,7 @@ class InlinedBreakpointsTestCase(TestBase):
self.addTearDownHook(
lambda: self.runCmd("settings set target.inline-breakpoint-strategy headers"))
- self.expect("breakpoint set -f basic_type.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: file ='basic_type.cpp', line = %d, locations = 1" %
- self.line)
+ 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)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py b/lldb/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
index 68c066d948b..ce532fc2696 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-advanced/TestDataFormatterAdv.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class AdvDataFormatterTestCase(TestBase):
@@ -34,10 +35,7 @@ class AdvDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py b/lldb/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
index d3f9a36be2e..8291b2d63ff 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-categories/TestDataFormatterCategories.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class CategoriesDataFormatterTestCase(TestBase):
@@ -34,10 +35,11 @@ class CategoriesDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+# self.expect("breakpoint set -f main.cpp -l %d" % self.line,
+# BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
+# self.line)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py b/lldb/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
index 22ebebfb5b1..78dc41086d0 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-cpp/TestDataFormatterCpp.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class CppDataFormatterTestCase(TestBase):
@@ -34,10 +35,7 @@ class CppDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py b/lldb/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py
index 6b355fdc427..cde9a4ec18a 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-disabling/TestDataFormatterDisabling.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class DataFormatterDisablingTestCase(TestBase):
@@ -34,10 +35,7 @@ class DataFormatterDisablingTestCase(TestBase):
"""Check that we can properly disable all data formatter categories."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py b/lldb/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py
index 4908a5a8fa7..47e7f71ef84 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-globals/TestDataFormatterGlobals.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class GlobalsDataFormatterTestCase(TestBase):
@@ -34,10 +35,7 @@ class GlobalsDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py b/lldb/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py
index 47a9d1889db..de4da12a7f2 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-named-summaries/TestDataFormatterNamedSummaries.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class NamedSummariesDataFormatterTestCase(TestBase):
@@ -34,10 +35,7 @@ class NamedSummariesDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py b/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
index 95022b497f1..ab629105062 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/TestDataFormatterObjC.py
@@ -8,6 +8,7 @@ import unittest2
import lldb
from lldbtest import *
import datetime
+import lldbutil
class ObjCDataFormatterTestCase(TestBase):
@@ -111,10 +112,7 @@ class ObjCDataFormatterTestCase(TestBase):
"""Check that Unicode characters come out of CFString summary correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.m -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -145,10 +143,7 @@ class ObjCDataFormatterTestCase(TestBase):
"""Test basic ObjC formatting behavior."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.m -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -202,10 +197,7 @@ class ObjCDataFormatterTestCase(TestBase):
"""Test formatters for AppKit classes."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.m -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -374,10 +366,7 @@ class ObjCDataFormatterTestCase(TestBase):
"""Test common cases of expression parser <--> formatters interaction."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.m -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -420,10 +409,7 @@ class ObjCDataFormatterTestCase(TestBase):
"""Test formatters for Core OSX frameworks."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.m -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -477,10 +463,7 @@ class ObjCDataFormatterTestCase(TestBase):
"""Test the behavior of formatters when KVO is in use."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.m -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -514,7 +497,8 @@ class ObjCDataFormatterTestCase(TestBase):
# check that NSMutableDictionary's formatter is not confused when dealing with a KVO'd dictionary
self.expect('frame variable newMutableDictionary', substrs = ['(NSDictionary *) newMutableDictionary = ',' 21 key/value pairs'])
- self.runCmd("breakpoint set -r setAtoms")
+ lldbutil.run_break_set_by_regexp (self, 'setAtoms')
+
self.runCmd("continue")
self.expect("frame variable _cmd",substrs = ['setAtoms:'])
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m b/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m
index eaf372b6103..aae6479da5f 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m
+++ b/lldb/test/functionalities/data-formatter/data-formatter-objc/main.m
@@ -653,9 +653,7 @@ int main (int argc, const char * argv[])
NSArray *components = @[@"usr", @"blah", @"stuff"];
NSString *path = [NSString pathWithComponents: components];
- // Set break point at this line.
-
- [molecule addObserver:[My_KVO_Observer new] forKeyPath:@"atoms" options:0 context:NULL];
+ [molecule addObserver:[My_KVO_Observer new] forKeyPath:@"atoms" options:0 context:NULL]; // Set break point at this line.
[newMutableDictionary addObserver:[My_KVO_Observer new] forKeyPath:@"weirdKeyToKVO" options:NSKeyValueObservingOptionNew context:NULL];
[molecule setAtoms:nil];
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
index 679323eb620..efe64420dd8 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/TestDataFormatterPythonSynth.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class PythonSynthDataFormatterTestCase(TestBase):
@@ -50,10 +51,7 @@ class PythonSynthDataFormatterTestCase(TestBase):
"""Test using Python synthetic children provider."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -207,14 +205,9 @@ class PythonSynthDataFormatterTestCase(TestBase):
"""Test that synthetic children persist stoppoints."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line2,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line2)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line3,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: file ='main.cpp', line = %d, locations = 1" %
- self.line3)
+ # The second breakpoint is on a multi-line expression, so the comment can't be on the right line...
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line2, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line3, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp
index c09630db158..48b29dcfd6e 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp
+++ b/lldb/test/functionalities/data-formatter/data-formatter-python-synth/main.cpp
@@ -62,6 +62,5 @@ int main()
256*'X' +
256*256*'T'+
256*256*256*'F';
- // Set second cast break point at this line.
- return 0;
-} \ No newline at end of file
+ return 0; // Set second cast break point at this line.
+}
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py b/lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
index de7d2c4722f..2d167ac63bf 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-script/TestDataFormatterScript.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class ScriptDataFormatterTestCase(TestBase):
@@ -34,10 +35,7 @@ class ScriptDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py b/lldb/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
index 119c90f8d14..1ffcdbf13c8 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-skip-summary/TestDataFormatterSkipSummary.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class SkipSummaryDataFormatterTestCase(TestBase):
@@ -34,10 +35,9 @@ class SkipSummaryDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ #import lldbutil
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+
self.runCmd("run", RUN_SUCCEEDED)
@@ -134,7 +134,7 @@ class SkipSummaryDataFormatterTestCase(TestBase):
# Bad debugging info on SnowLeopard gcc (Apple Inc. build 5666).
# Skip the following tests if the condition is met.
if self.getCompiler().endswith('gcc') and not self.getCompiler().endswith('llvm-gcc'):
- import re, lldbutil
+ import re
gcc_version_output = system([lldbutil.which(self.getCompiler()), "-v"])[1]
#print "my output:", gcc_version_output
for line in gcc_version_output.split(os.linesep):
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py b/lldb/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
index 34bee07385a..d5ace003b4b 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-smart-array/TestDataFormatterSmartArray.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class SmartArrayDataFormatterTestCase(TestBase):
@@ -34,10 +35,7 @@ class SmartArrayDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py b/lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
index 3ab313fb10c..837a8f3f933 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/list/TestDataFormatterLibcxxList.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class LibcxxListDataFormatterTestCase(TestBase):
@@ -35,14 +36,8 @@ class LibcxxListDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line2,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: file ='main.cpp', line = %d" %
- self.line2)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line2, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py b/lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
index 7fb03af3214..edc2fe9bc53 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/map/TestDataFormatterLibccMap.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class LibcxxMapDataFormatterTestCase(TestBase):
@@ -34,10 +35,7 @@ class LibcxxMapDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py b/lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
index 5b58abd1577..7a285248dec 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-stl/libcxx/vector/TestDataFormatterLibcxxVector.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class LibcxxVectorDataFormatterTestCase(TestBase):
@@ -35,14 +36,8 @@ class LibcxxVectorDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line2,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: file ='main.cpp', line = %d" %
- self.line2)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line2, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py b/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
index 0cb3148f592..617457d6e5e 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/list/TestDataFormatterStdList.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class StdListDataFormatterTestCase(TestBase):
@@ -34,10 +35,7 @@ class StdListDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py b/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
index 3b765e7a740..82474a8a06a 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/map/TestDataFormatterStdMap.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class StdMapDataFormatterTestCase(TestBase):
@@ -34,10 +35,7 @@ class StdMapDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py b/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
index 3cb5ca0a6bb..2b5af555afb 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-stl/libstdcpp/vector/TestDataFormatterStdVector.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class StdVectorDataFormatterTestCase(TestBase):
@@ -34,10 +35,7 @@ class StdVectorDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py b/lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
index da78518073a..0ffc29af9ff 100644
--- a/lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
+++ b/lldb/test/functionalities/data-formatter/data-formatter-synth/TestDataFormatterSynth.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class SynthDataFormatterTestCase(TestBase):
@@ -34,10 +35,7 @@ class SynthDataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/rdar-10449092/Test-rdar-10449092.py b/lldb/test/functionalities/data-formatter/rdar-10449092/Test-rdar-10449092.py
index 63c0796e512..15e1f7c67c5 100644
--- a/lldb/test/functionalities/data-formatter/rdar-10449092/Test-rdar-10449092.py
+++ b/lldb/test/functionalities/data-formatter/rdar-10449092/Test-rdar-10449092.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class Radar10449092DataFormatterTestCase(TestBase):
@@ -35,10 +36,7 @@ class Radar10449092DataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py b/lldb/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py
index 83080f96480..9f367bda147 100644
--- a/lldb/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py
+++ b/lldb/test/functionalities/data-formatter/rdar-10642615/Test-rdar-10642615.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class Radar10642615DataFormatterTestCase(TestBase):
@@ -35,10 +36,7 @@ class Radar10642615DataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py b/lldb/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py
index ed43e0dfe9b..9c41b9c0765 100644
--- a/lldb/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py
+++ b/lldb/test/functionalities/data-formatter/rdar-10887661/TestRdar10887661.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class Rdar10887661TestCase(TestBase):
@@ -38,10 +39,7 @@ class Rdar10887661TestCase(TestBase):
"""Check for an issue where capping does not work because the Target pointer appears to be changing behind our backs."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py b/lldb/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py
index 2c61943fe72..ac8a44ce046 100644
--- a/lldb/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py
+++ b/lldb/test/functionalities/data-formatter/rdar-11086338/TestRdar11086338.py
@@ -7,6 +7,7 @@ import unittest2
import lldb
from lldbtest import *
import datetime
+import lldbutil
class DataFormatterRdar11086338TestCase(TestBase):
@@ -36,10 +37,7 @@ class DataFormatterRdar11086338TestCase(TestBase):
"""Test that NSArray reports its synthetic children properly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.m -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py b/lldb/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py
index 6f5d29d373e..fb664d48546 100644
--- a/lldb/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py
+++ b/lldb/test/functionalities/data-formatter/rdar-11628688/TestFormattersBoolRefPtr.py
@@ -7,6 +7,7 @@ import unittest2
import lldb
from lldbtest import *
import datetime
+import lldbutil
class DataFormatterOSTypeTestCase(TestBase):
@@ -36,10 +37,7 @@ class DataFormatterOSTypeTestCase(TestBase):
"""Test the formatters we use for OSType."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.mm -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.mm', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.mm", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/rdar-11773899/TestFormattersBoolRefPtr.py b/lldb/test/functionalities/data-formatter/rdar-11773899/TestFormattersBoolRefPtr.py
index 0d8ae6dad30..f2a76f8eff9 100644
--- a/lldb/test/functionalities/data-formatter/rdar-11773899/TestFormattersBoolRefPtr.py
+++ b/lldb/test/functionalities/data-formatter/rdar-11773899/TestFormattersBoolRefPtr.py
@@ -7,6 +7,7 @@ import unittest2
import lldb
from lldbtest import *
import datetime
+import lldbutil
class DataFormatterBoolRefPtr(TestBase):
@@ -36,10 +37,7 @@ class DataFormatterBoolRefPtr(TestBase):
"""Test the formatters we use for BOOL& and BOOL* in Objective-C."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.mm -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.mm', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.mm", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/rdar-11988289/TestRdar 11988289.py b/lldb/test/functionalities/data-formatter/rdar-11988289/TestRdar 11988289.py
index 74b62088c59..93b54a5bee6 100644
--- a/lldb/test/functionalities/data-formatter/rdar-11988289/TestRdar 11988289.py
+++ b/lldb/test/functionalities/data-formatter/rdar-11988289/TestRdar 11988289.py
@@ -7,6 +7,7 @@ import unittest2
import lldb
from lldbtest import *
import datetime
+import lldbutil
class DataFormatterRdar11988289TestCase(TestBase):
@@ -36,10 +37,7 @@ class DataFormatterRdar11988289TestCase(TestBase):
"""Test that NSDictionary reports its synthetic children properly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.m -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py b/lldb/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py
index 69964abcc47..de274331451 100644
--- a/lldb/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py
+++ b/lldb/test/functionalities/data-formatter/rdar-3534688/TestFormattersOneIsSingular.py
@@ -7,6 +7,7 @@ import unittest2
import lldb
from lldbtest import *
import datetime
+import lldbutil
class DataFormatterOneIsSingularTestCase(TestBase):
@@ -36,10 +37,7 @@ class DataFormatterOneIsSingularTestCase(TestBase):
"""Test that 1 item is not as reported as 1 items."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.m -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.m', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py b/lldb/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py
index 892ee63f113..6c0467c6bfe 100644
--- a/lldb/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py
+++ b/lldb/test/functionalities/data-formatter/rdar-9973865/Test-rdar-9973865.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class Radar9973865DataFormatterTestCase(TestBase):
@@ -35,10 +36,7 @@ class Radar9973865DataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py b/lldb/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py
index 8e3abc2aa96..e4142b6bbc0 100644
--- a/lldb/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py
+++ b/lldb/test/functionalities/data-formatter/rdar-9973992/Test-rdar-9973992.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class Radar9973992DataFormatterTestCase(TestBase):
@@ -35,10 +36,7 @@ class Radar9973992DataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py b/lldb/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py
index b8e3938981a..444795354a9 100644
--- a/lldb/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py
+++ b/lldb/test/functionalities/data-formatter/rdar-9974002/Test-rdar-9974002.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class Radar9974002DataFormatterTestCase(TestBase):
@@ -35,10 +36,7 @@ class Radar9974002DataFormatterTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/dead-strip/TestDeadStrip.py b/lldb/test/functionalities/dead-strip/TestDeadStrip.py
index c9c24774c6c..c6d8004282d 100644
--- a/lldb/test/functionalities/dead-strip/TestDeadStrip.py
+++ b/lldb/test/functionalities/dead-strip/TestDeadStrip.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class DeadStripTestCase(TestBase):
@@ -30,16 +31,13 @@ class DeadStripTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break by function name f1 (live code).
- self.expect("breakpoint set -s a.out -n f1", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: name = 'f1', module = a.out, locations = 1")
+ lldbutil.run_break_set_by_symbol (self, "f1", extra_options="-s a.out", num_expected_locations=1, module_name="a.out")
# Break by function name f2 (dead code).
- self.expect("breakpoint set -s a.out -n f2", BREAKPOINT_PENDING_CREATED,
- startstr = "Breakpoint created: 2: name = 'f2', module = a.out, locations = 0 (pending)")
+ lldbutil.run_break_set_by_symbol (self, "f2", extra_options="-s a.out", num_expected_locations=0)
# Break by function name f3 (live code).
- self.expect("breakpoint set -s a.out -n f3", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 3: name = 'f3', module = a.out, locations = 1")
+ lldbutil.run_break_set_by_symbol (self, "f3", extra_options="-s a.out", num_expected_locations=1, module_name="a.out")
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/inferior-changed/TestInferiorChanged.py b/lldb/test/functionalities/inferior-changed/TestInferiorChanged.py
index 40fb54dc287..41e44aac5b5 100644
--- a/lldb/test/functionalities/inferior-changed/TestInferiorChanged.py
+++ b/lldb/test/functionalities/inferior-changed/TestInferiorChanged.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class ChangedInferiorTestCase(TestBase):
@@ -64,10 +65,7 @@ class ChangedInferiorTestCase(TestBase):
self.fail("Inferior changed, but lldb did not perform a reload")
# Break inside the main.
- self.expect("breakpoint set -f main2.c -l %d" % self.line2,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main2.c', line = %d, locations = 1" %
- self.line2)
+ lldbutil.run_break_set_by_file_and_line (self, "main2.c", self.line2, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/load_unload/TestLoadUnload.py b/lldb/test/functionalities/load_unload/TestLoadUnload.py
index 335bcae6e86..62dbd4d6c56 100644
--- a/lldb/test/functionalities/load_unload/TestLoadUnload.py
+++ b/lldb/test/functionalities/load_unload/TestLoadUnload.py
@@ -7,6 +7,7 @@ import re
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class LoadUnloadTestCase(TestBase):
@@ -112,10 +113,8 @@ class LoadUnloadTestCase(TestBase):
remove_dyld_path_cmd = "settings remove target.env-vars " + dylibPath
self.addTearDownHook(lambda: self.runCmd(remove_dyld_path_cmd))
- self.expect("breakpoint set -f d.c -l %d" % self.line_d_function,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='d.c', line = %d" %
- self.line_d_function)
+ lldbutil.run_break_set_by_file_and_line (self, "d.c", self.line_d_function, num_expected_locations=1, loc_exact=True)
+
# For now we don't track DYLD_LIBRARY_PATH, so the old library will be in
# the modules list.
self.expect("target modules list",
@@ -143,10 +142,7 @@ class LoadUnloadTestCase(TestBase):
# Break at main.c before the call to dlopen().
# Use lldb's process load command to load the dylib, instead.
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -190,8 +186,7 @@ class LoadUnloadTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break by function name a_function (not yet loaded).
- self.expect("breakpoint set -n a_function", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: name = 'a_function', locations = 0 (pending)")
+ lldbutil.run_break_set_by_symbol (self, "a_function", num_expected_locations=0)
self.runCmd("run", RUN_SUCCEEDED)
@@ -230,9 +225,7 @@ class LoadUnloadTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break by function name a_function (not yet loaded).
- self.expect("breakpoint set -f main.c -l %d"%(self.line), BREAKPOINT_CREATED,
- substrs = ['Breakpoint created:',
- "file ='main.c', line = %d, locations = 1"%(self.line)])
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/memory/read/TestMemoryRead.py b/lldb/test/functionalities/memory/read/TestMemoryRead.py
index ba94fe7c76c..dbbc9b88793 100644
--- a/lldb/test/functionalities/memory/read/TestMemoryRead.py
+++ b/lldb/test/functionalities/memory/read/TestMemoryRead.py
@@ -7,6 +7,7 @@ import re
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class MemoryReadTestCase(TestBase):
@@ -37,10 +38,7 @@ class MemoryReadTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break in main() aftre the variables are assigned values.
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py b/lldb/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
index 92ff0e6e62c..55c618432c6 100644
--- a/lldb/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
+++ b/lldb/test/functionalities/non-overlapping-index-variable-i/TestIndexVariable.py
@@ -4,6 +4,7 @@ from out of scope to in scope when stopped at the breakpoint."""
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class NonOverlappingIndexVariableCase(TestBase):
@@ -26,10 +27,7 @@ class NonOverlappingIndexVariableCase(TestBase):
exe = os.path.join(os.getcwd(), exe_name)
self.runCmd("file %s" % exe, CURRENT_EXECUTABLE_SET)
- self.expect('breakpoint set -f %s -l %d' % (self.source, self.line_to_break),
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line_to_break))
+ lldbutil.run_break_set_by_file_and_line (self, self.source, self.line_to_break, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/register/TestRegisters.py b/lldb/test/functionalities/register/TestRegisters.py
index b5fd73b1af8..841a26f2e49 100644
--- a/lldb/test/functionalities/register/TestRegisters.py
+++ b/lldb/test/functionalities/register/TestRegisters.py
@@ -7,6 +7,7 @@ import re
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class RegisterCommandsTestCase(TestBase):
@@ -39,9 +40,7 @@ class RegisterCommandsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break in main().
- self.expect("breakpoint set -n main",
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: name = 'main'")
+ lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
@@ -68,9 +67,7 @@ class RegisterCommandsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break in main().
- self.expect("breakpoint set -n main",
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: name = 'main'")
+ lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/signal/TestSendSignal.py b/lldb/test/functionalities/signal/TestSendSignal.py
index 7e97e4c92f2..0c51224ca3d 100644
--- a/lldb/test/functionalities/signal/TestSendSignal.py
+++ b/lldb/test/functionalities/signal/TestSendSignal.py
@@ -4,6 +4,7 @@ import os, time, signal
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class SendSignalTestCase(TestBase):
@@ -35,10 +36,7 @@ class SendSignalTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main() function and immediately send a signal to the inferior after resuming.
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
self.runCmd("thread backtrace")
diff --git a/lldb/test/functionalities/stop-hook/TestStopHookCmd.py b/lldb/test/functionalities/stop-hook/TestStopHookCmd.py
index 7bb32253db3..8ef3bf50a81 100644
--- a/lldb/test/functionalities/stop-hook/TestStopHookCmd.py
+++ b/lldb/test/functionalities/stop-hook/TestStopHookCmd.py
@@ -7,6 +7,7 @@ import unittest2
import StringIO
import lldb
from lldbtest import *
+import lldbutil
class StopHookCmdTestCase(TestBase):
@@ -43,14 +44,9 @@ class StopHookCmdTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.expect('breakpoint set -f main.cpp -l %d' % self.begl,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.begl)
- self.expect('breakpoint set -f main.cpp -l %d' % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.begl, num_expected_locations=1, loc_exact=True)
+
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("target stop-hook add -f main.cpp -l %d -e %d -o 'expr ptr'" % (self.begl, self.endl))
diff --git a/lldb/test/functionalities/target_command/TestTargetCommand.py b/lldb/test/functionalities/target_command/TestTargetCommand.py
index 31c06d416f1..5b656f7fffd 100644
--- a/lldb/test/functionalities/target_command/TestTargetCommand.py
+++ b/lldb/test/functionalities/target_command/TestTargetCommand.py
@@ -6,6 +6,7 @@ import unittest2
import lldb
import sys
from lldbtest import *
+import lldbutil
class targetCommandTestCase(TestBase):
@@ -84,13 +85,11 @@ class targetCommandTestCase(TestBase):
self.runCmd("run", RUN_SUCCEEDED)
self.runCmd("target create " + exe_b, CURRENT_EXECUTABLE_SET)
- self.runCmd("breakpoint set -f %s -l %d" % ('b.c', self.line_b),
- BREAKPOINT_CREATED)
+ lldbutil.run_break_set_by_file_and_line (self, 'b.c', self.line_b, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
self.runCmd("target create " + exe_c, CURRENT_EXECUTABLE_SET)
- self.runCmd("breakpoint set -f %s -l %d" % ('c.c', self.line_c),
- BREAKPOINT_CREATED)
+ lldbutil.run_break_set_by_file_and_line (self, 'c.c', self.line_c, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
self.runCmd("target list")
diff --git a/lldb/test/functionalities/type_completion/TestTypeCompletion.py b/lldb/test/functionalities/type_completion/TestTypeCompletion.py
index 789aeea2a28..d6b89e058c2 100644
--- a/lldb/test/functionalities/type_completion/TestTypeCompletion.py
+++ b/lldb/test/functionalities/type_completion/TestTypeCompletion.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class TypeCompletionTestCase(TestBase):
@@ -34,10 +35,7 @@ class TypeCompletionTestCase(TestBase):
"""Check that types only get completed when necessary."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py b/lldb/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
index b4b8b03f1d2..1e0b93b55a3 100644
--- a/lldb/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
+++ b/lldb/test/functionalities/watchpoint/hello_watchlocation/TestWatchLocation.py
@@ -7,6 +7,7 @@ import re
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class HelloWatchLocationTestCase(TestBase):
@@ -46,9 +47,7 @@ class HelloWatchLocationTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1, loc_exact=False)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py b/lldb/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
index 609bd52dc5d..d0233b3cf45 100644
--- a/lldb/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
+++ b/lldb/test/functionalities/watchpoint/hello_watchpoint/TestMyFirstWatchpoint.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class HelloWatchpointTestCase(TestBase):
@@ -44,9 +45,7 @@ class HelloWatchpointTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py b/lldb/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
index 9f9cc3257ac..2aef5de1753 100644
--- a/lldb/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
+++ b/lldb/test/functionalities/watchpoint/multiple_threads/TestWatchpointMultipleThreads.py
@@ -7,6 +7,7 @@ import unittest2
import re
import lldb
from lldbtest import *
+import lldbutil
class WatchpointForMultipleThreadsTestCase(TestBase):
@@ -60,14 +61,10 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.first_stop, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.first_stop))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.first_stop, num_expected_locations=1)
# Set this breakpoint to allow newly created thread to inherit the global watchpoint state.
- self.expect("breakpoint set -l %d" % self.thread_function, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: file ='%s', line = %d, locations = 1" %
- (self.source, self.thread_function))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.thread_function, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -119,14 +116,10 @@ class WatchpointForMultipleThreadsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.first_stop, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.first_stop))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.first_stop, num_expected_locations=1)
# Set this breakpoint to allow newly created thread to inherit the global watchpoint state.
- self.expect("breakpoint set -l %d" % self.thread_function, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: file ='%s', line = %d, locations = 1" %
- (self.source, self.thread_function))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.thread_function, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py b/lldb/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
index b690432c2cd..9dc5986336b 100644
--- a/lldb/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
+++ b/lldb/test/functionalities/watchpoint/variable_out_of_scope/TestWatchedVarHitWhenInScope.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class WatchedVariableHitWhenInScopeTestCase(TestBase):
@@ -39,8 +40,7 @@ class WatchedVariableHitWhenInScopeTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped in main.
- self.expect("breakpoint set -n main", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: name = 'main'")
+ lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=-1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py b/lldb/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
index dd5ccce7347..a013dd46324 100644
--- a/lldb/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
+++ b/lldb/test/functionalities/watchpoint/watchpoint_commands/TestWatchpointCommands.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class WatchpointCommandsTestCase(TestBase):
@@ -106,9 +107,7 @@ class WatchpointCommandsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -163,9 +162,7 @@ class WatchpointCommandsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -205,9 +202,7 @@ class WatchpointCommandsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -251,9 +246,158 @@ class WatchpointCommandsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, "main.m")
+# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+# (self.source, self.line))#
+
+ # Run the program.
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # We should be stopped again due to the breakpoint.
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ # Now let's set a read_write-type watchpoint for 'global'.
+ # There should be two watchpoint hits (see main.c).
+ self.expect("watchpoint set variable -w read_write global", WATCHPOINT_CREATED,
+ substrs = ['Watchpoint created', 'size = 4', 'type = rw',
+ '%s:%d' % (self.source, self.decl)])
+
+ # Use the '-v' option to do verbose listing of the watchpoint.
+ # The hit count should be 0 initially.
+ self.expect("watchpoint list -v",
+ substrs = ['Number of supported hardware watchpoints:',
+ 'hit_count = 0'])
+
+ self.runCmd("process continue")
+
+ # We should be stopped again due to the watchpoint (read_write type).
+ # The stop reason of the thread should be watchpoint.
+ self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
+ substrs = ['stop reason = watchpoint'])
+
+ self.runCmd("process continue")
+
+ # We should be stopped again due to the watchpoint (read_write type).
+ # The stop reason of the thread should be watchpoint.
+ self.expect("thread backtrace", STOPPED_DUE_TO_WATCHPOINT,
+ substrs = ['stop reason = watchpoint'])
+
+ self.runCmd("process continue")
+
+ # There should be no more watchpoint hit and the process status should
+ # be 'exited'.
+ self.expect("process status",
+ substrs = ['exited'])
+
+ # Use the '-v' option to do verbose listing of the watchpoint.
+ # The hit count should now be 2.
+ self.expect("watchpoint list -v",
+ substrs = ['hit_count = 2'])
+
+ def delete_read_write_watchpoint(self):
+ """Do delete watchpoint immediately and expect not to stop for watchpoint."""
+ exe = os.path.join(os.getcwd(), self.exe_name)
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+# (self.source, self.line))
+
+ # Run the program.
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # We should be stopped again due to the breakpoint.
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ # Now let's set a read_write-type watchpoint for 'global'.
+ # There should be two watchpoint hits (see main.c).
+ self.expect("watchpoint set variable -w read_write global", WATCHPOINT_CREATED,
+ substrs = ['Watchpoint created', 'size = 4', 'type = rw',
+ '%s:%d' % (self.source, self.decl)])
+
+ # Delete the watchpoint immediately, but set auto-confirm to true first.
+ self.runCmd("settings set auto-confirm true")
+ self.expect("watchpoint delete",
+ substrs = ['All watchpoints removed.'])
+ # Restore the original setting of auto-confirm.
+ self.runCmd("settings clear auto-confirm")
+
+ # Use the '-v' option to do verbose listing of the watchpoint.
+ self.runCmd("watchpoint list -v")
+
+ self.runCmd("process continue")
+
+ # There should be no more watchpoint hit and the process status should
+ # be 'exited'.
+ self.expect("process status",
+ substrs = ['exited'])
+
+ def ignore_read_write_watchpoint(self):
+ """Test watchpoint ignore count and expect to not to stop at all."""
+ exe = os.path.join(os.getcwd(), self.exe_name)
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+# (self.source, self.line))
+
+ # Run the program.
+ self.runCmd("run", RUN_SUCCEEDED)
+
+ # We should be stopped again due to the breakpoint.
+ # The stop reason of the thread should be breakpoint.
+ self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
+ substrs = ['stopped',
+ 'stop reason = breakpoint'])
+
+ # Now let's set a read_write-type watchpoint for 'global'.
+ # There should be two watchpoint hits (see main.c).
+ self.expect("watchpoint set variable -w read_write global", WATCHPOINT_CREATED,
+ substrs = ['Watchpoint created', 'size = 4', 'type = rw',
+ '%s:%d' % (self.source, self.decl)])
+
+ # Set the ignore count of the watchpoint immediately.
+ self.expect("watchpoint ignore -i 2",
+ substrs = ['All watchpoints ignored.'])
+
+ # Use the '-v' option to do verbose listing of the watchpoint.
+ # Expect to find an ignore_count of 2.
+ self.expect("watchpoint list -v",
+ substrs = ['hit_count = 0', 'ignore_count = 2'])
+
+ self.runCmd("process continue")
+
+ # There should be no more watchpoint hit and the process status should
+ # be 'exited'.
+ self.expect("process status",
+ substrs = ['exited'])
+
+ # Use the '-v' option to do verbose listing of the watchpoint.
+ # Expect to find a hit_count of 2 as well.
+ self.expect("watchpoint list -v",
+ substrs = ['hit_count = 2', 'ignore_count = 2'])
+
+ def read_write_watchpoint_disable_after_first_stop(self):
+ """Do read_write watchpoint but disable it after the first stop."""
+ exe = os.path.join(os.getcwd(), self.exe_name)
+ self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
+
+ # Add a breakpoint to set a watchpoint when stopped on the breakpoint.
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+# (self.source, self.line))#
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -307,12 +451,14 @@ class WatchpointCommandsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
- self.expect("breakpoint set -l %d" % self.line2, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: file ='%s', line = %d, locations = 1" %
- (self.source, self.line2))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+# (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line2, num_expected_locations=1)
+# self.expect("breakpoint set -l %d" % self.line2, BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 2: file ='%s', line = %d, locations = 1" %
+# (self.source, self.line2))
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py b/lldb/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
index 4a174f95667..57c4569d85c 100644
--- a/lldb/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
+++ b/lldb/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandLLDB.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class WatchpointLLDBCommandTestCase(TestBase):
@@ -60,9 +61,10 @@ class WatchpointLLDBCommandTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+# (self.source, self.line))
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
@@ -111,9 +113,10 @@ class WatchpointLLDBCommandTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+# (self.source, self.line))#
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py b/lldb/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
index 023a4c697ab..0fa6de171d9 100644
--- a/lldb/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
+++ b/lldb/test/functionalities/watchpoint/watchpoint_commands/command/TestWatchpointCommandPython.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class WatchpointPythonCommandTestCase(TestBase):
@@ -45,9 +46,10 @@ class WatchpointPythonCommandTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
+# self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
+# (self.source, self.line))#
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py b/lldb/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
index 6ec3caa42e8..e6544d61330 100644
--- a/lldb/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
+++ b/lldb/test/functionalities/watchpoint/watchpoint_commands/condition/TestWatchpointConditionCmd.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class WatchpointConditionCmdTestCase(TestBase):
@@ -45,9 +46,7 @@ class WatchpointConditionCmdTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py b/lldb/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
index 1f54ecbd694..2172c5fa7c5 100644
--- a/lldb/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
+++ b/lldb/test/functionalities/watchpoint/watchpoint_set_command/TestWatchLocationWithWatchSet.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class WatchLocationUsingWatchpointSetTestCase(TestBase):
@@ -45,9 +46,7 @@ class WatchLocationUsingWatchpointSetTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py b/lldb/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
index 538694b5193..ca90e2b8e0a 100644
--- a/lldb/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
+++ b/lldb/test/functionalities/watchpoint/watchpoint_set_command/TestWatchpointSetErrorCases.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class WatchpointSetErrorTestCase(TestBase):
@@ -34,9 +35,7 @@ class WatchpointSetErrorTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Add a breakpoint to set a watchpoint when stopped on the breakpoint.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=1)
# Run the program.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/c/anonymous/TestAnonymous.py b/lldb/test/lang/c/anonymous/TestAnonymous.py
index 24df5fcf288..72df3506dcc 100644
--- a/lldb/test/lang/c/anonymous/TestAnonymous.py
+++ b/lldb/test/lang/c/anonymous/TestAnonymous.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class AnonymousTestCase(TestBase):
@@ -30,8 +31,7 @@ class AnonymousTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- self.expect("breakpoint set -f main.c -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created")
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/c/array_types/TestArrayTypes.py b/lldb/test/lang/c/array_types/TestArrayTypes.py
index 01822d78618..2adb567a7cd 100644
--- a/lldb/test/lang/c/array_types/TestArrayTypes.py
+++ b/lldb/test/lang/c/array_types/TestArrayTypes.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class ArrayTypesTestCase(TestBase):
@@ -48,10 +49,7 @@ class ArrayTypesTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=False)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/c/bitfields/TestBitfields.py b/lldb/test/lang/c/bitfields/TestBitfields.py
index f9b0ce19f7e..66caa52c1fd 100644
--- a/lldb/test/lang/c/bitfields/TestBitfields.py
+++ b/lldb/test/lang/c/bitfields/TestBitfields.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class BitfieldsTestCase(TestBase):
@@ -49,10 +50,7 @@ class BitfieldsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/c/blocks/TestBlocks.py b/lldb/test/lang/c/blocks/TestBlocks.py
index 17609834a7b..5cd5bd010d6 100644
--- a/lldb/test/lang/c/blocks/TestBlocks.py
+++ b/lldb/test/lang/c/blocks/TestBlocks.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class AnonymousTestCase(TestBase):
@@ -37,8 +38,7 @@ class AnonymousTestCase(TestBase):
# Break inside the foo function which takes a bar_ptr argument.
for line in self.lines:
- self.expect("breakpoint set -f main.c -l %d" % line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created")
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
def wait_for_breakpoint(self):
if self.is_started == False:
diff --git a/lldb/test/lang/c/enum_types/TestEnumTypes.py b/lldb/test/lang/c/enum_types/TestEnumTypes.py
index 21394b0ef54..725a22b328f 100644
--- a/lldb/test/lang/c/enum_types/TestEnumTypes.py
+++ b/lldb/test/lang/c/enum_types/TestEnumTypes.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class EnumTypesTestCase(TestBase):
@@ -36,10 +37,7 @@ class EnumTypesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/c/forward/TestForwardDeclaration.py b/lldb/test/lang/c/forward/TestForwardDeclaration.py
index d4649a66c85..ee37bc07393 100644
--- a/lldb/test/lang/c/forward/TestForwardDeclaration.py
+++ b/lldb/test/lang/c/forward/TestForwardDeclaration.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class ForwardDeclarationTestCase(TestBase):
@@ -32,8 +33,7 @@ class ForwardDeclarationTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- self.expect("breakpoint set -n foo", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: name = 'foo', locations = 1")
+ lldbutil.run_break_set_by_symbol (self, "foo", num_expected_locations=1, sym_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/c/function_types/TestFunctionTypes.py b/lldb/test/lang/c/function_types/TestFunctionTypes.py
index db1a8c9f112..009065a0e2b 100644
--- a/lldb/test/lang/c/function_types/TestFunctionTypes.py
+++ b/lldb/test/lang/c/function_types/TestFunctionTypes.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class FunctionTypesTestCase(TestBase):
@@ -46,10 +47,7 @@ class FunctionTypesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -72,7 +70,7 @@ class FunctionTypesTestCase(TestBase):
startstr = '(int (*)(const char *)) callback =')
# And that we can break on the callback function.
- self.runCmd("breakpoint set -n string_not_empty", BREAKPOINT_CREATED)
+ lldbutil.run_break_set_by_symbol (self, "string_not_empty", num_expected_locations=1, sym_exact=True)
self.runCmd("continue")
# Check that we do indeed stop on the string_not_empty function.
diff --git a/lldb/test/lang/c/global_variables/TestGlobalVariables.py b/lldb/test/lang/c/global_variables/TestGlobalVariables.py
index 6b4d1363c3f..c8f3f134c86 100644
--- a/lldb/test/lang/c/global_variables/TestGlobalVariables.py
+++ b/lldb/test/lang/c/global_variables/TestGlobalVariables.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class GlobalVariablesTestCase(TestBase):
@@ -34,10 +35,7 @@ class GlobalVariablesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/c/set_values/TestSetValues.py b/lldb/test/lang/c/set_values/TestSetValues.py
index 1070690b3ed..1fb6e7b161a 100644
--- a/lldb/test/lang/c/set_values/TestSetValues.py
+++ b/lldb/test/lang/c/set_values/TestSetValues.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class SetValuesTestCase(TestBase):
@@ -38,30 +39,15 @@ class SetValuesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Set breakpoints on several places to set program variables.
- self.expect("breakpoint set -f main.c -l %d" % self.line1,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line1)
-
- self.expect("breakpoint set -f main.c -l %d" % self.line2,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: file ='main.c', line = %d, locations = 1" %
- self.line2)
-
- self.expect("breakpoint set -f main.c -l %d" % self.line3,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 3: file ='main.c', line = %d, locations = 1" %
- self.line3)
-
- self.expect("breakpoint set -f main.c -l %d" % self.line4,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 4: file ='main.c', line = %d, locations = 1" %
- self.line4)
-
- self.expect("breakpoint set -f main.c -l %d" % self.line5,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 5: file ='main.c', line = %d, locations = 1" %
- self.line5)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line1, num_expected_locations=1, loc_exact=True)
+
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line2, num_expected_locations=1, loc_exact=True)
+
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line3, num_expected_locations=1, loc_exact=True)
+
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line4, num_expected_locations=1, loc_exact=True)
+
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line5, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/c/shared_lib/TestSharedLib.py b/lldb/test/lang/c/shared_lib/TestSharedLib.py
index fc972d97255..a1126157eda 100644
--- a/lldb/test/lang/c/shared_lib/TestSharedLib.py
+++ b/lldb/test/lang/c/shared_lib/TestSharedLib.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class SharedLibTestCase(TestBase):
@@ -44,8 +45,7 @@ class SharedLibTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- self.expect("breakpoint set -f main.c -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created")
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/c/shared_lib/main.c b/lldb/test/lang/c/shared_lib/main.c
index dc4dc3189cc..b4377de18c1 100644
--- a/lldb/test/lang/c/shared_lib/main.c
+++ b/lldb/test/lang/c/shared_lib/main.c
@@ -6,8 +6,8 @@ main ()
{
struct foo *my_foo_ptr;
my_foo_ptr = GetMeAFoo();
- // Set breakpoint 0 here.
- printf ("My sub foo has: %d.\n", GetMeASubFoo(my_foo_ptr)->sub_1);
+
+ printf ("My sub foo has: %d.\n", GetMeASubFoo(my_foo_ptr)->sub_1); // Set breakpoint 0 here.
return 0;
}
diff --git a/lldb/test/lang/c/stepping/TestThreadStepping.py b/lldb/test/lang/c/stepping/TestThreadStepping.py
index 42e6932c5c9..8e7952ae8b1 100644
--- a/lldb/test/lang/c/stepping/TestThreadStepping.py
+++ b/lldb/test/lang/c/stepping/TestThreadStepping.py
@@ -7,6 +7,7 @@ import re
import unittest2
import lldb, lldbutil
from lldbtest import *
+import lldbutil
class ThreadSteppingTestCase(TestBase):
@@ -40,9 +41,7 @@ class ThreadSteppingTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Create a breakpoint inside function 'c'.
- self.expect("breakpoint set -f main.c -l %d" % self.line1, BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line1)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line1, num_expected_locations=1, loc_exact=True)
# Now run the program.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/c/strings/TestCStrings.py b/lldb/test/lang/c/strings/TestCStrings.py
index 4614b15fb0f..eab7b671477 100644
--- a/lldb/test/lang/c/strings/TestCStrings.py
+++ b/lldb/test/lang/c/strings/TestCStrings.py
@@ -1,8 +1,9 @@
"""
Tests that C strings work as expected in expressions
"""
-
+import lldb
from lldbtest import *
+import lldbutil
class CStringsTestCase(TestBase):
@@ -25,9 +26,7 @@ class CStringsTestCase(TestBase):
TestBase.setUp(self)
def set_breakpoint(self, line):
- self.expect("breakpoint set -f main.c -l %d" % line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created")
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
def static_method_commands(self):
"""Tests that C strings work as expected in expressions"""
diff --git a/lldb/test/lang/c/struct_types/TestStructTypes.py b/lldb/test/lang/c/struct_types/TestStructTypes.py
index b7d22b99e4e..1c28bbfcf40 100644
--- a/lldb/test/lang/c/struct_types/TestStructTypes.py
+++ b/lldb/test/lang/c/struct_types/TestStructTypes.py
@@ -8,6 +8,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class StructTypesTestCase(TestBase):
@@ -40,10 +41,7 @@ class StructTypesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break on the struct declration statement in main.c.
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=False)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/cpp/class_static/TestStaticVariables.py b/lldb/test/lang/cpp/class_static/TestStaticVariables.py
index e995bf636c3..bf4f6a1d7b9 100644
--- a/lldb/test/lang/cpp/class_static/TestStaticVariables.py
+++ b/lldb/test/lang/cpp/class_static/TestStaticVariables.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class StaticVariableTestCase(TestBase):
@@ -53,10 +54,7 @@ class StaticVariableTestCase(TestBase):
"""Test that that file and class static variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/cpp/class_types/TestClassTypes.py b/lldb/test/lang/cpp/class_types/TestClassTypes.py
index fca19bce6d4..f64e778d290 100644
--- a/lldb/test/lang/cpp/class_types/TestClassTypes.py
+++ b/lldb/test/lang/cpp/class_types/TestClassTypes.py
@@ -5,6 +5,7 @@ import unittest2
import lldb
import lldbutil
from lldbtest import *
+import lldbutil
class ClassTypesTestCase(TestBase):
@@ -70,10 +71,7 @@ class ClassTypesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break on the ctor function of class C.
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
@@ -169,8 +167,7 @@ class ClassTypesTestCase(TestBase):
# startstr = "Breakpoint created: 1: name = 'C'")
# Make the test case more robust by using line number to break, instead.
- self.expect("breakpoint set -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created")
+ lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py b/lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py
index 6fbd2ad8fbd..520c2b568de 100644
--- a/lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py
+++ b/lldb/test/lang/cpp/class_types/TestClassTypesDisassembly.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class IterateFrameAndDisassembleTestCase(TestBase):
@@ -51,10 +52,7 @@ class IterateFrameAndDisassembleTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break on the ctor function of class C.
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/cpp/namespace/TestNamespace.py b/lldb/test/lang/cpp/namespace/TestNamespace.py
index b52bdcb126a..9c2c6d75ce7 100644
--- a/lldb/test/lang/cpp/namespace/TestNamespace.py
+++ b/lldb/test/lang/cpp/namespace/TestNamespace.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class NamespaceTestCase(TestBase):
@@ -42,10 +43,7 @@ class NamespaceTestCase(TestBase):
"""Test that anonymous and named namespace variables display correctly."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line_break,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line_break)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line_break, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py b/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py
index 897df8477ce..d2d188aefca 100644
--- a/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py
+++ b/lldb/test/lang/cpp/rvalue-references/TestRvalueReferences.py
@@ -2,7 +2,9 @@
Tests that rvalue references are supported in C++
"""
+import lldb
from lldbtest import *
+import lldbutil
class CPPThisTestCase(TestBase):
@@ -29,10 +31,8 @@ class CPPThisTestCase(TestBase):
TestBase.setUp(self)
def set_breakpoint(self, line):
- self.expect("breakpoint set -f main.cpp -l %d" % line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created")
-
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=True)
+
def static_method_commands(self):
"""Test that rvalues are supported in the C++ expression parser"""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
diff --git a/lldb/test/lang/cpp/signed_types/TestSignedTypes.py b/lldb/test/lang/cpp/signed_types/TestSignedTypes.py
index e1aa3c6e08e..d015c974b5c 100644
--- a/lldb/test/lang/cpp/signed_types/TestSignedTypes.py
+++ b/lldb/test/lang/cpp/signed_types/TestSignedTypes.py
@@ -7,6 +7,7 @@ import re
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class UnsignedTypesTestCase(TestBase):
@@ -37,10 +38,7 @@ class UnsignedTypesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break on line 22 in main() aftre the variables are assigned values.
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py b/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py
index 027dea28574..357b050eb7b 100644
--- a/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py
+++ b/lldb/test/lang/cpp/static_methods/TestCPPStaticMethods.py
@@ -2,7 +2,9 @@
Tests expressions that distinguish between static and non-static methods.
"""
+import lldb
from lldbtest import *
+import lldbutil
class CPPStaticMethodsTestCase(TestBase):
@@ -29,9 +31,7 @@ class CPPStaticMethodsTestCase(TestBase):
"""Test that static methods are properly distinguished from regular methods"""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" % self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("process launch", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/cpp/stl/TestSTL.py b/lldb/test/lang/cpp/stl/TestSTL.py
index 8b4f55666fb..62f433230f4 100644
--- a/lldb/test/lang/cpp/stl/TestSTL.py
+++ b/lldb/test/lang/cpp/stl/TestSTL.py
@@ -63,10 +63,7 @@ class STLTestCase(TestBase):
# rdar://problem/8543077
# test/stl: clang built binaries results in the breakpoint locations = 3,
# is this a problem with clang generated debug info?
- self.expect("breakpoint set -f %s -l %d" % (self.source, self.line),
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py b/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py
index 80a224e5307..8914e2a78ab 100644
--- a/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py
+++ b/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class StdCXXDisassembleTestCase(TestBase):
@@ -31,10 +32,7 @@ class StdCXXDisassembleTestCase(TestBase):
# is this a problem with clang generated debug info?
#
# Break on line 13 of main.cpp.
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/cpp/this/TestCPPThis.py b/lldb/test/lang/cpp/this/TestCPPThis.py
index 1d1a7e8fb61..5eba4fb47cf 100644
--- a/lldb/test/lang/cpp/this/TestCPPThis.py
+++ b/lldb/test/lang/cpp/this/TestCPPThis.py
@@ -1,8 +1,9 @@
"""
Tests that C++ member and static variables are available where they should be.
"""
-
+import lldb
from lldbtest import *
+import lldbutil
class CPPThisTestCase(TestBase):
@@ -29,10 +30,8 @@ class CPPThisTestCase(TestBase):
TestBase.setUp(self)
def set_breakpoint(self, line):
- self.expect("breakpoint set -f main.cpp -l %d" % line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created")
-
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=False)
+
def static_method_commands(self):
"""Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods"""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
diff --git a/lldb/test/lang/cpp/unique-types/TestUniqueTypes.py b/lldb/test/lang/cpp/unique-types/TestUniqueTypes.py
index 66b871e230f..891d31dd6bc 100644
--- a/lldb/test/lang/cpp/unique-types/TestUniqueTypes.py
+++ b/lldb/test/lang/cpp/unique-types/TestUniqueTypes.py
@@ -36,10 +36,7 @@ class UniqueTypesTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py b/lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
index efa829c60e3..3ddc2510954 100644
--- a/lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
+++ b/lldb/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
@@ -7,6 +7,7 @@ import re
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class UnsignedTypesTestCase(TestBase):
@@ -37,10 +38,7 @@ class UnsignedTypesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break on line 19 in main() aftre the variables are assigned values.
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/cpp/virtual/TestVirtual.py b/lldb/test/lang/cpp/virtual/TestVirtual.py
index 9ba7fd642c1..ccecaebeef4 100644
--- a/lldb/test/lang/cpp/virtual/TestVirtual.py
+++ b/lldb/test/lang/cpp/virtual/TestVirtual.py
@@ -6,6 +6,7 @@ import os, time
import re
import lldb
from lldbtest import *
+import lldbutil
def Msg(expr, val):
return "'expression %s' matches the output (from compiled code): %s" % (expr, val)
@@ -62,7 +63,7 @@ class CppVirtualMadness(TestBase):
# Bring the program to the point where we can issue a series of
# 'expression' command to compare against the golden output.
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.runCmd("breakpoint set -f main.cpp -l %d" % self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=False)
self.runCmd("run", RUN_SUCCEEDED)
# Now iterate through the golden list, comparing against the output from
diff --git a/lldb/test/lang/objc/forward-decl/TestForwardDecl.py b/lldb/test/lang/objc/forward-decl/TestForwardDecl.py
index fbddac4f408..24ede4cc8df 100644
--- a/lldb/test/lang/objc/forward-decl/TestForwardDecl.py
+++ b/lldb/test/lang/objc/forward-decl/TestForwardDecl.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class ForwardDeclTestCase(TestBase):
@@ -32,8 +33,7 @@ class ForwardDeclTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- self.expect("breakpoint set -f main.m -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created")
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/objc/foundation/TestConstStrings.py b/lldb/test/lang/objc/foundation/TestConstStrings.py
index e4f8f4e348a..e19d09ec309 100644
--- a/lldb/test/lang/objc/foundation/TestConstStrings.py
+++ b/lldb/test/lang/objc/foundation/TestConstStrings.py
@@ -7,6 +7,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
class ConstStringTestCase(TestBase):
@@ -40,10 +41,7 @@ class ConstStringTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f %s -l %d" % (self.main_source, self.line),
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.main_source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
diff --git a/lldb/test/lang/objc/foundation/TestFoundationDisassembly.py b/lldb/test/lang/objc/foundation/TestFoundationDisassembly.py
index c54cb18185b..06ec47fc4e0 100644
--- a/lldb/test/lang/objc/foundation/TestFoundationDisassembly.py
+++ b/lldb/test/lang/objc/foundation/TestFoundationDisassembly.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
class FoundationDisassembleTestCase(TestBase):
@@ -72,20 +73,27 @@ class FoundationDisassembleTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Stop at +[NSString stringWithFormat:].
- self.expect("_regexp-break +[NSString stringWithFormat:]", BREAKPOINT_CREATED,
- substrs = ["Breakpoint created: 1: name = '+[NSString stringWithFormat:]', locations = 1"])
+ symbol_name = "+[NSString stringWithFormat:]"
+ break_results = lldbutil.run_break_set_command (self, "_regexp-break %s"%(symbol_name))
+ lldbutil.check_breakpoint_result (self, break_results, symbol_name=symbol_name, num_locations=1)
+# self.expect("_regexp-break +[NSString stringWithFormat:]", BREAKPOINT_CREATED,
+# substrs = ["Breakpoint created: 1: name = '+[NSString stringWithFormat:]', locations = 1"])
# Stop at -[MyString initWithNSString:].
- self.expect("breakpoint set -n '-[MyString initWithNSString:]'", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: name = '-[MyString initWithNSString:]', locations = 1")
+ lldbutil.run_break_set_by_symbol (self, '-[MyString initWithNSString:]', num_expected_locations=1, sym_exact=True)
+# self.expect("breakpoint set -n '-[MyString initWithNSString:]'", BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 2: name = '-[MyString initWithNSString:]', locations = 1")
# Stop at the "description" selector.
- self.expect("breakpoint set -S description", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 3: name = 'description', locations = 1")
+ lldbutil.run_break_set_by_selector (self, 'description', num_expected_locations=1)
+# self.expect("breakpoint set -S description", BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 3: name = 'description', locations = 1")
# Stop at -[NSAutoreleasePool release].
- self.expect("_regexp-break -[NSAutoreleasePool release]", BREAKPOINT_CREATED,
- substrs = ["Breakpoint created: 4: name = '-[NSAutoreleasePool release]', locations = 1"])
+ break_results = lldbutil.run_break_set_command (self, "_regexp-break -[NSAutoreleasePool release]")
+ lldbutil.check_breakpoint_result (self, break_results, symbol_name='-[NSAutoreleasePool release]', num_locations=1)
+# self.expect("_regexp-break -[NSAutoreleasePool release]", BREAKPOINT_CREATED,
+# substrs = ["Breakpoint created: 4: name = '-[NSAutoreleasePool release]', locations = 1"])
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/objc/foundation/TestObjCMethods.py b/lldb/test/lang/objc/foundation/TestObjCMethods.py
index 3b4df971749..9a4d26b0965 100644
--- a/lldb/test/lang/objc/foundation/TestObjCMethods.py
+++ b/lldb/test/lang/objc/foundation/TestObjCMethods.py
@@ -7,6 +7,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
class FoundationTestCase(TestBase):
@@ -61,20 +62,26 @@ class FoundationTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Stop at +[NSString stringWithFormat:].
- self.expect("_regexp-break +[NSString stringWithFormat:]", BREAKPOINT_CREATED,
- substrs = ["Breakpoint created: 1: name = '+[NSString stringWithFormat:]', locations = 1"])
+ break_results = lldbutil.run_break_set_command(self, "_regexp-break +[NSString stringWithFormat:]")
+ lldbutil.check_breakpoint_result (self, break_results, symbol_name='+[NSString stringWithFormat:]', num_locations=1)
+# self.expect("_regexp-break +[NSString stringWithFormat:]", BREAKPOINT_CREATED,
+# substrs = ["Breakpoint created: 1: name = '+[NSString stringWithFormat:]', locations = 1"])
# Stop at -[MyString initWithNSString:].
- self.expect("breakpoint set -n '-[MyString initWithNSString:]'", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: name = '-[MyString initWithNSString:]', locations = 1")
+ lldbutil.run_break_set_by_symbol (self, '-[MyString initWithNSString:]', num_expected_locations=1, sym_exact=True)
+# self.expect("breakpoint set -n '-[MyString initWithNSString:]'", BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 2: name = '-[MyString initWithNSString:]', locations = 1")
# Stop at the "description" selector.
- self.expect("breakpoint set -S description", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 3: name = 'description', locations = 1")
+ lldbutil.run_break_set_by_selector (self, 'description', num_expected_locations=1)
+# self.expect("breakpoint set -S description", BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 3: name = 'description', locations = 1")
# Stop at -[NSAutoreleasePool release].
- self.expect("_regexp-break -[NSAutoreleasePool release]", BREAKPOINT_CREATED,
- substrs = ["Breakpoint created: 4: name = '-[NSAutoreleasePool release]', locations = 1"])
+ break_results = lldbutil.run_break_set_command(self, "_regexp-break -[NSAutoreleasePool release]")
+ lldbutil.check_breakpoint_result (self, break_results, symbol_name='-[NSAutoreleasePool release]', num_locations=1)
+# self.expect("_regexp-break -[NSAutoreleasePool release]", BREAKPOINT_CREATED,
+# substrs = ["Breakpoint created: 4: name = '-[NSAutoreleasePool release]', locations = 1"])
self.runCmd("run", RUN_SUCCEEDED)
@@ -125,8 +132,9 @@ class FoundationTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Stop at -[MyString description].
- self.expect("breakpoint set -n '-[MyString description]", BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: name = '-[MyString description]', locations = 1")
+ lldbutil.run_break_set_by_symbol (self, '-[MyString description]', num_expected_locations=1, sym_exact=True)
+# self.expect("breakpoint set -n '-[MyString description]", BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 1: name = '-[MyString description]', locations = 1")
self.runCmd("run", RUN_SUCCEEDED)
@@ -195,10 +203,11 @@ class FoundationTestCase(TestBase):
#
self.runCmd("breakpoint delete 1")
- self.expect("breakpoint set -f main.m -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 2: file ='main.m', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+# self.expect("breakpoint set -f main.m -l %d" % self.line,
+# BREAKPOINT_CREATED,
+# startstr = "Breakpoint created: 2: file ='main.m', line = %d, locations = 1" %
+# self.line)
self.runCmd("process continue")
# rdar://problem/8542091
diff --git a/lldb/test/lang/objc/foundation/TestObjCMethods2.py b/lldb/test/lang/objc/foundation/TestObjCMethods2.py
index 86478d9d142..71b7bc9ca6c 100644
--- a/lldb/test/lang/objc/foundation/TestObjCMethods2.py
+++ b/lldb/test/lang/objc/foundation/TestObjCMethods2.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
class FoundationTestCase2(TestBase):
@@ -91,10 +92,10 @@ class FoundationTestCase2(TestBase):
TestBase.setUp(self)
# Find the line numbers to break at.
self.lines = []
- self.lines.append(line_number('main.m', '// Expressions to test here for selector:'))
- self.lines.append(line_number('main.m', '// Expressions to test here for NSArray:'))
- self.lines.append(line_number('main.m', '// Expressions to test here for NSString:'))
- self.lines.append(line_number('main.m', "// Set a breakpoint on '-[MyString description]' and test expressions:"))
+ self.lines.append(line_number('main.m', '// Break here for selector: tests'))
+ self.lines.append(line_number('main.m', '// Break here for NSArray tests'))
+ self.lines.append(line_number('main.m', '// Break here for NSString tests'))
+ self.lines.append(line_number('main.m', '// Break here for description test'))
self.lines.append(line_number('main.m', '// Set break point at this line'))
def more_expr_objc(self):
@@ -104,9 +105,10 @@ class FoundationTestCase2(TestBase):
# Create a bunch of breakpoints.
for line in self.lines:
- self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
- substrs = ["Breakpoint created:",
- "file ='main.m', line = %d, locations = 1" % line])
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+# self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
+# substrs = ["Breakpoint created:",
+# "file ='main.m', line = %d, locations = 1" % line])
self.runCmd("run", RUN_SUCCEEDED)
@@ -143,9 +145,10 @@ class FoundationTestCase2(TestBase):
# Break inside Test_NSArray:
line = self.lines[1]
- self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
- substrs = ["Breakpoint created:",
- "file ='main.m', line = %d, locations = 1" % line])
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+# self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
+# substrs = ["Breakpoint created:",
+# "file ='main.m', line = %d, locations = 1" % line])#
self.runCmd("run", RUN_SUCCEEDED)
@@ -172,9 +175,10 @@ class FoundationTestCase2(TestBase):
# Break inside Test_NSString:
line = self.lines[2]
- self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
- substrs = ["Breakpoint created:",
- "file ='main.m', line = %d, locations = 1" % line])
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+# self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
+# substrs = ["Breakpoint created:",
+# "file ='main.m', line = %d, locations = 1" % line])#
self.runCmd("run", RUN_SUCCEEDED)
@@ -201,10 +205,11 @@ class FoundationTestCase2(TestBase):
line = self.lines[4]
- self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
- substrs = ["Breakpoint created:",
- "file ='main.m', line = %d, locations = 1" % line])
-
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+# self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
+# substrs = ["Breakpoint created:",
+# "file ='main.m', line = %d, locations = 1" % line])
+#
self.runCmd("run", RUN_SUCCEEDED)
self.expect("expression *my",
@@ -218,9 +223,10 @@ class FoundationTestCase2(TestBase):
line = self.lines[4]
- self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
- substrs = ["Breakpoint created:",
- "file ='main.m', line = %d, locations = 1" % line])
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+# self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
+# substrs = ["Breakpoint created:",
+# "file ='main.m', line = %d, locations = 1" % line])#
self.runCmd("run", RUN_SUCCEEDED)
@@ -235,9 +241,10 @@ class FoundationTestCase2(TestBase):
line = self.lines[4]
- self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
- substrs = ["Breakpoint created:",
- "file ='main.m', line = %d, locations = 1" % line])
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+# self.expect("breakpoint set -f main.m -l %d" % line, BREAKPOINT_CREATED,
+# substrs = ["Breakpoint created:",
+# "file ='main.m', line = %d, locations = 1" % line])#
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/objc/foundation/main.m b/lldb/test/lang/objc/foundation/main.m
index 8473d65122e..6ae0d71b50b 100644
--- a/lldb/test/lang/objc/foundation/main.m
+++ b/lldb/test/lang/objc/foundation/main.m
@@ -40,7 +40,7 @@
{
// Set a breakpoint on '-[MyString description]' and test expressions:
// expression (char *)sel_getName(_cmd)
- if (self.descriptionPauses)
+ if (self.descriptionPauses) // Break here for description test
{
printf ("\nAbout to sleep.\n");
usleep(100000);
@@ -60,7 +60,7 @@ Test_Selector ()
// The expression above should return "sel" as it should be just
// a uniqued C string pointer. We were seeing the result pointer being
// truncated with recent LLDBs.
- return 0;
+ return 0; // Break here for selector: tests
}
int
@@ -82,7 +82,7 @@ Test_NSString (const char *program)
// expression str.description
// expression str = @"new"
// expression str = [NSString stringWithFormat: @"%cew", 'N']
- return 0;
+ return 0; // Break here for NSString tests
}
NSString *my_global_str = NULL;
@@ -112,7 +112,7 @@ Test_NSArray ()
// expression array2.count
id obj;
// After each object at index call, use expression and validate object
- obj = [array1 objectAtIndex: 0];
+ obj = [array1 objectAtIndex: 0]; // Break here for NSArray tests
obj = [array1 objectAtIndex: 1];
obj = [array1 objectAtIndex: 2];
diff --git a/lldb/test/lang/objc/hidden-ivars/TestHiddenIvars.py b/lldb/test/lang/objc/hidden-ivars/TestHiddenIvars.py
index 943d63b06ba..081009c5282 100644
--- a/lldb/test/lang/objc/hidden-ivars/TestHiddenIvars.py
+++ b/lldb/test/lang/objc/hidden-ivars/TestHiddenIvars.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class HiddenIvarsTestCase(TestBase):
@@ -52,8 +53,7 @@ class HiddenIvarsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- self.expect("breakpoint set -f main.m -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created")
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/objc/objc++/TestObjCXX.py b/lldb/test/lang/objc/objc++/TestObjCXX.py
index 2c1094552ab..8efd5f571f4 100644
--- a/lldb/test/lang/objc/objc++/TestObjCXX.py
+++ b/lldb/test/lang/objc/objc++/TestObjCXX.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class ObjCXXTestCase(TestBase):
@@ -32,8 +33,7 @@ class ObjCXXTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -p 'breakpoint 1'", BREAKPOINT_CREATED,
- startstr = "Breakpoint created")
+ lldbutil.run_break_set_by_source_regexp (self, 'breakpoint 1', num_expected_locations=1)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py b/lldb/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
index 03fc03d1f65..a5cdb6b52d6 100644
--- a/lldb/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
+++ b/lldb/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
import platform
+import lldbutil
from distutils.version import StrictVersion
@@ -44,8 +45,7 @@ class ObjCNewSyntaxTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- self.expect("breakpoint set -f main.m -l %d" % self.line, BREAKPOINT_CREATED,
- startstr = "Breakpoint created")
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/objc/objc-optimized/TestObjcOptimized.py b/lldb/test/lang/objc/objc-optimized/TestObjcOptimized.py
index 27b6d31b56f..59d1f4ea39e 100644
--- a/lldb/test/lang/objc/objc-optimized/TestObjcOptimized.py
+++ b/lldb/test/lang/objc/objc-optimized/TestObjcOptimized.py
@@ -11,6 +11,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
# rdar://problem/9087739
# test failure: objc_optimized does not work for "-C clang -A i386"
@@ -39,9 +40,7 @@ class ObjcOptimizedTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -n '%s'" % self.method_spec,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: name = '%s', locations = 1" % self.method_spec)
+ lldbutil.run_break_set_by_symbol (self, self.method_spec, num_expected_locations=1, sym_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
diff --git a/lldb/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py b/lldb/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
index e87f46b7210..8f48196fb1a 100644
--- a/lldb/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
+++ b/lldb/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
class MethodReturningBOOLTestCase(TestBase):
@@ -42,10 +43,7 @@ class MethodReturningBOOLTestCase(TestBase):
exe = os.path.join(os.getcwd(), exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f %s -l %d" % (self.main_source, self.line),
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.main_source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
diff --git a/lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py b/lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py
index 8b34782e389..15e843b34bf 100644
--- a/lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py
+++ b/lldb/test/lang/objc/rdar-10967107/TestRdar10967107.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
class Rdar10967107TestCase(TestBase):
@@ -42,10 +43,7 @@ class Rdar10967107TestCase(TestBase):
exe = os.path.join(os.getcwd(), exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f %s -l %d" % (self.main_source, self.line),
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.main_source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# check that each type is correctly bound to its list of children
diff --git a/lldb/test/lang/objc/rdar-10967107/main.m b/lldb/test/lang/objc/rdar-10967107/main.m
index eed94e5a41d..386a458950b 100644
--- a/lldb/test/lang/objc/rdar-10967107/main.m
+++ b/lldb/test/lang/objc/rdar-10967107/main.m
@@ -7,7 +7,7 @@ int main (int argc, char const *argv[])
NSDate *date1 = [NSDate date];
CFGregorianDate cf_greg_date = CFAbsoluteTimeGetGregorianDate(CFDateGetAbsoluteTime((CFDateRef)date1), NULL);
CFRange cf_range = {4,4};
-// Set breakpoint here.
- [pool release];
+
+ [pool release]; // Set breakpoint here.
return 0;
}
diff --git a/lldb/test/lang/objc/rdar-11355592/TestRdar11355592.py b/lldb/test/lang/objc/rdar-11355592/TestRdar11355592.py
index 79f0b56767d..ad0df1dd511 100644
--- a/lldb/test/lang/objc/rdar-11355592/TestRdar11355592.py
+++ b/lldb/test/lang/objc/rdar-11355592/TestRdar11355592.py
@@ -6,6 +6,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
@unittest2.skipUnless(sys.platform.startswith("darwin"), "requires Darwin")
class Rdar10967107TestCase(TestBase):
@@ -42,10 +43,7 @@ class Rdar10967107TestCase(TestBase):
exe = os.path.join(os.getcwd(), exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f %s -l %d" % (self.main_source, self.line),
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='%s', line = %d, locations = 1" %
- (self.main_source, self.line))
+ lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# check that we correctly see the const char*, even with dynamic types on
diff --git a/lldb/test/lang/objc/rdar-11355592/main.m b/lldb/test/lang/objc/rdar-11355592/main.m
index 29d1d3ba3b6..09b3b18a787 100644
--- a/lldb/test/lang/objc/rdar-11355592/main.m
+++ b/lldb/test/lang/objc/rdar-11355592/main.m
@@ -29,8 +29,8 @@ int main (int argc, char const *argv[])
FoolMeOnce *my_foolie = [[FoolMeOnce alloc] initWithFirst: 20 andSecond: 55];
const char *my_string = (char *) my_foolie;
-// Set breakpoint here.
- my_string = "Now this is a REAL string...";
+
+ my_string = "Now this is a REAL string..."; // Set breakpoint here.
[pool release];
return 0;
diff --git a/lldb/test/lang/objc/real-definition/TestRealDefinition.py b/lldb/test/lang/objc/real-definition/TestRealDefinition.py
index 13ad34a5eb3..8530f3570cb 100644
--- a/lldb/test/lang/objc/real-definition/TestRealDefinition.py
+++ b/lldb/test/lang/objc/real-definition/TestRealDefinition.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class TestRealDefinition(TestBase):
@@ -54,13 +55,15 @@ class TestRealDefinition(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- self.expect("breakpoint set -f main.m -l %d" % line_number('main.m', '// Set breakpoint in main'), BREAKPOINT_CREATED, startstr = "Breakpoint created")
+ line = line_number('main.m', '// Set breakpoint in main')
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
def stop_at_interface(self):
"""Test that we can find the implementation for an objective C type when we stop in the interface"""
self.common_setup()
- self.expect("breakpoint set -f Foo.m -l %d" % line_number('Foo.m', '// Set breakpoint where Bar is an interface'), BREAKPOINT_CREATED, startstr = "Breakpoint created")
+ line = line_number('Foo.m', '// Set breakpoint where Bar is an interface')
+ lldbutil.run_break_set_by_file_and_line (self, 'Foo.m', line, num_expected_locations=1, loc_exact=True);
self.runCmd("run", RUN_SUCCEEDED)
@@ -87,7 +90,8 @@ class TestRealDefinition(TestBase):
"""Test that we can find the implementation for an objective C type when we stop in the implementation"""
self.common_setup()
- self.expect("breakpoint set -f Bar.m -l %d" % line_number('Bar.m', '// Set breakpoint where Bar is an implementation'), BREAKPOINT_CREATED, startstr = "Breakpoint created")
+ line = line_number('Bar.m', '// Set breakpoint where Bar is an implementation')
+ lldbutil.run_break_set_by_file_and_line (self, 'Bar.m', line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/lang/objc/self/TestObjCSelf.py b/lldb/test/lang/objc/self/TestObjCSelf.py
index 0744a54055b..327c20a8373 100644
--- a/lldb/test/lang/objc/self/TestObjCSelf.py
+++ b/lldb/test/lang/objc/self/TestObjCSelf.py
@@ -1,8 +1,9 @@
"""
Tests that ObjC member variables are available where they should be.
"""
-
+import lldb
from lldbtest import *
+import lldbutil
class ObjCSelfTestCase(TestBase):
@@ -25,9 +26,7 @@ class ObjCSelfTestCase(TestBase):
TestBase.setUp(self)
def set_breakpoint(self, line):
- self.expect("breakpoint set -f main.m -l %d" % line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created")
+ lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
def self_commands(self):
"""Test that the appropriate member variables are available when stopped in Objective-C class and instance methods"""
diff --git a/lldb/test/lldbtest.py b/lldb/test/lldbtest.py
index 4aa3f861cd0..b32ae95c4d1 100644
--- a/lldb/test/lldbtest.py
+++ b/lldb/test/lldbtest.py
@@ -1101,6 +1101,49 @@ class TestBase(Base):
self.assertTrue(self.res.Succeeded(),
msg if msg else CMD_MSG(cmd))
+ def match (self, str, patterns, msg=None, trace=False, error=False, matching=True, exe=True):
+ """run command in str, and match the result against regexp in patterns returning the match object for the first matching pattern
+
+ Otherwise, all the arguments have the same meanings as for the expect function"""
+
+ trace = (True if traceAlways else trace)
+
+ if exe:
+ # First run the command. If we are expecting error, set check=False.
+ # Pass the assert message along since it provides more semantic info.
+ self.runCmd(str, msg=msg, trace = (True if trace else False), check = not error)
+
+ # Then compare the output against expected strings.
+ output = self.res.GetError() if error else self.res.GetOutput()
+
+ # If error is True, the API client expects the command to fail!
+ if error:
+ self.assertFalse(self.res.Succeeded(),
+ "Command '" + str + "' is expected to fail!")
+ else:
+ # No execution required, just compare str against the golden input.
+ output = str
+ with recording(self, trace) as sbuf:
+ print >> sbuf, "looking at:", output
+
+ # The heading says either "Expecting" or "Not expecting".
+ heading = "Expecting" if matching else "Not expecting"
+
+ for pattern in patterns:
+ # Match Objects always have a boolean value of True.
+ match_object = re.search(pattern, output)
+ matched = bool(match_object)
+ with recording(self, trace) as sbuf:
+ print >> sbuf, "%s pattern: %s" % (heading, pattern)
+ print >> sbuf, "Matched" if matched else "Not matched"
+ if matched:
+ break
+
+ self.assertTrue(matched if matching else not matched,
+ msg if msg else EXP_MSG(str, exe))
+
+ return match_object
+
def expect(self, str, msg=None, patterns=None, startstr=None, endstr=None, substrs=None, trace=False, error=False, matching=True, exe=True):
"""
Similar to runCmd; with additional expect style output matching ability.
diff --git a/lldb/test/lldbutil.py b/lldb/test/lldbutil.py
index 5dee35df3b4..b04485fa0f4 100644
--- a/lldb/test/lldbutil.py
+++ b/lldb/test/lldbutil.py
@@ -258,6 +258,193 @@ def value_type_to_str(enum):
# ==================================================
+# Utility functions for setting breakpoints
+# ==================================================
+
+def run_break_set_by_file_and_line (test, file_name, line_number, extra_options = None, num_expected_locations = 1, loc_exact=False, module_name=None):
+ """Set a breakpoint by file and line, returning the breakpoint number.
+
+ If extra_options is not None, then we append it to the breakpoint set command.
+
+ If num_expected_locations is -1 we check that we got AT LEAST one location, otherwise we check that num_expected_locations equals the number of locations.
+
+ If loc_exact is true, we check that there is one location, and that location must be at the input file and line number."""
+
+ if file_name == None:
+ command = 'breakpoint set -l %d'%(line_number)
+ else:
+ command = 'breakpoint set -f "%s" -l %d'%(file_name, line_number)
+
+ if extra_options:
+ command += " " + extra_options
+
+ break_results = run_break_set_command (test, command)
+
+ if num_expected_locations == 1 and loc_exact:
+ check_breakpoint_result (test, break_results, num_locations=num_expected_locations, file_name = file_name, line_number = line_number, module_name=module_name)
+ else:
+ check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
+
+ return get_bpno_from_match (break_results)
+
+def run_break_set_by_symbol (test, symbol, extra_options = None, num_expected_locations = -1, sym_exact = False, module_name=None):
+ """Set a breakpoint by symbol name. Common options are the same as run_break_set_by_file_and_line.
+
+ If sym_exact is true, then the output symbol must match the input exactly, otherwise we do a substring match."""
+ command = 'breakpoint set -n "%s"'%(symbol)
+ if extra_options:
+ command += " " + extra_options
+
+ break_results = run_break_set_command (test, command)
+
+ if num_expected_locations == 1 and sym_exact:
+ check_breakpoint_result (test, break_results, num_locations = num_expected_locations, symbol_name = symbol, module_name=module_name)
+ else:
+ check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
+
+ return get_bpno_from_match (break_results)
+
+def run_break_set_by_selector (test, selector, extra_options = None, num_expected_locations = -1, module_name=None):
+ """Set a breakpoint by selector. Common options are the same as run_break_set_by_file_and_line."""
+
+ command = 'breakpoint set -S "%s"'%(selector)
+ if extra_options:
+ command += " " + extra_options
+
+ break_results = run_break_set_command (test, command)
+
+ if num_expected_locations == 1:
+ check_breakpoint_result (test, break_results, num_locations = num_expected_locations, symbol_name = selector, symbol_match_exact=False, module_name=module_name)
+ else:
+ check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
+
+ return get_bpno_from_match (break_results)
+
+def run_break_set_by_regexp (test, regexp, extra_options=None, num_expected_locations=-1):
+ """Set a breakpoint by regular expression match on symbol name. Common options are the same as run_break_set_by_file_and_line."""
+
+ command = 'breakpoint set -r "%s"'%(regexp)
+ if extra_options:
+ command += " " + extra_options
+
+ break_results = run_break_set_command (test, command)
+
+ check_breakpoint_result (test, break_results, num_locations=num_expected_locations)
+
+ return get_bpno_from_match (break_results)
+
+def run_break_set_by_source_regexp (test, regexp, extra_options=None, num_expected_locations=-1):
+ """Set a breakpoint by source regular expression. Common options are the same as run_break_set_by_file_and_line."""
+ command = 'breakpoint set -p "%s"'%(regexp)
+ if extra_options:
+ command += " " + extra_options
+
+ break_results = run_break_set_command (test, command)
+
+ check_breakpoint_result (test, break_results, num_locations=num_expected_locations)
+
+ return get_bpno_from_match (break_results)
+
+def run_break_set_command (test, command):
+ """Run the command passed in - it must be some break set variant - and analyze the result.
+ Returns a dictionary of information gleaned from the command-line results.
+ Will assert if the breakpoint setting fails altogether.
+
+ Dictionary will contain:
+ bpno - breakpoint of the newly created breakpoint, -1 on error.
+ num_locations - number of locations set for the breakpoint.
+
+ If there is only one location, the dictionary MAY contain:
+ file - source file name
+ line_no - source line number
+ symbol - symbol name
+ inline_symbol - inlined symbol name
+ offset - offset from the original symbol
+ module - module
+ address - address at which the breakpoint was set."""
+
+ patterns = [r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>[0-9]+) locations\.$",
+ r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>no) locations \(pending\)\.",
+ r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>[+\-]{0,1}[^+]+)( \+ (?P<offset>[0-9]+)){0,1}( \[inlined\] (?P<inline_symbol>.*)){0,1} at (?P<file>[^:]+):(?P<line_no>[0-9]+), address = (?P<address>0x[0-9a-fA-F]+)$",
+ r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>.*)( \+ (?P<offset>[0-9]+)){0,1}, address = (?P<address>0x[0-9a-fA-F]+)$"]
+ match_object = test.match (command, patterns)
+ break_results = match_object.groupdict()
+ print "Break results: ", break_results
+
+ # We always insert the breakpoint number, setting it to -1 if we couldn't find it
+ # Also, make sure it gets stored as an integer.
+ if not 'bpno' in break_results:
+ break_results['bpno'] = -1
+ else:
+ break_results['bpno'] = int(break_results['bpno'])
+
+ # We always insert the number of locations
+ # If ONE location is set for the breakpoint, then the output doesn't mention locations, but it has to be 1...
+ # We also make sure it is an integer.
+
+ if not 'num_locations' in break_results:
+ num_locations = 1
+ else:
+ num_locations = break_results['num_locations']
+ if num_locations == 'no':
+ num_locations = 0
+ else:
+ num_locations = int(break_results['num_locations'])
+
+ break_results['num_locations'] = num_locations
+
+ if 'line_no' in break_results:
+ break_results['line_no'] = int(break_results['line_no'])
+
+ return break_results
+
+def get_bpno_from_match (break_results):
+ return int (break_results['bpno'])
+
+def check_breakpoint_result (test, break_results, file_name=None, line_number=-1, symbol_name=None, symbol_match_exact=True, module_name=None, offset=-1, num_locations=-1):
+
+ out_num_locations = break_results['num_locations']
+
+ print "Num locations: ", num_locations, " and out num locations: ", out_num_locations
+ if num_locations == -1:
+ test.assertTrue (out_num_locations > 0, "Expecting one or more locations, got none.")
+ else:
+ test.assertTrue (num_locations == out_num_locations, "Expecting %d locations, got %d."%(num_locations, out_num_locations))
+
+ if file_name:
+ out_file_name = ""
+ if 'file' in break_results:
+ out_file_name = break_results['file']
+ test.assertTrue (file_name == out_file_name, "Breakpoint file name '%s' doesn't match resultant name '%s'."%(file_name, out_file_name))
+
+ if line_number != -1:
+ out_file_line = -1
+ if 'line_no' in break_results:
+ out_line_number = break_results['line_no']
+
+ test.assertTrue (line_number == out_line_number, "Breakpoint line number %s doesn't match resultant line %s."%(line_number, out_line_number))
+
+ if symbol_name:
+ out_symbol_name = ""
+ # Look first for the inlined symbol name, otherwise use the symbol name:
+ if 'inline_symbol' in break_results and break_results['inline_symbol']:
+ out_symbol_name = break_results['inline_symbol']
+ elif 'symbol' in break_results:
+ out_symbol_name = break_results['symbol']
+
+ if symbol_match_exact:
+ test.assertTrue(symbol_name == out_symbol_name, "Symbol name '%s' doesn't match resultant symbol '%s'."%(symbol_name, out_symbol_name))
+ else:
+ test.assertTrue(out_symbol_name.find(symbol_name) != -1, "Symbol name '%s' isn't in resultant symbol '%s'."%(symbol_name, out_symbol_name))
+
+ if module_name:
+ out_nodule_name = None
+ if 'module' in break_results:
+ out_module_name = break_results['module']
+
+ test.assertTrue (module_name.find(out_module_name) != -1, "Symbol module name '%s' isn't in expected module name '%s'."%(out_module_name, module_name))
+
+# ==================================================
# Utility functions related to Threads and Processes
# ==================================================
diff --git a/lldb/test/macosx/universal/TestUniversal.py b/lldb/test/macosx/universal/TestUniversal.py
index 9daf0b9f438..0a5cf9c1d02 100644
--- a/lldb/test/macosx/universal/TestUniversal.py
+++ b/lldb/test/macosx/universal/TestUniversal.py
@@ -4,6 +4,7 @@ import os, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class UniversalTestCase(TestBase):
@@ -53,10 +54,7 @@ class UniversalTestCase(TestBase):
substrs = ["testit' (x86_64)."])
# Break inside the main.
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
# We should be able to launch the x86_64 executable.
self.runCmd("run", RUN_SUCCEEDED)
@@ -81,10 +79,7 @@ class UniversalTestCase(TestBase):
substrs = ["testit' (i386)."])
# Break inside the main.
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
# We should be able to launch the i386 executable as well.
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/python_api/formatters/TestFormattersSBAPI.py b/lldb/test/python_api/formatters/TestFormattersSBAPI.py
index ef9ca16282c..d304a17dcf5 100644
--- a/lldb/test/python_api/formatters/TestFormattersSBAPI.py
+++ b/lldb/test/python_api/formatters/TestFormattersSBAPI.py
@@ -4,6 +4,7 @@ import os, sys, time
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class SBFormattersAPITestCase(TestBase):
@@ -42,10 +43,7 @@ class SBFormattersAPITestCase(TestBase):
"""Test Python APIs for working with formatters"""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
@@ -304,10 +302,7 @@ class SBFormattersAPITestCase(TestBase):
"""Test that one can have the public API return non-synthetic SBValues if desired"""
self.runCmd("file no_synth", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/python_api/sbdata/TestSBData.py b/lldb/test/python_api/sbdata/TestSBData.py
index a93e7bd00de..5e1c0bd520d 100644
--- a/lldb/test/python_api/sbdata/TestSBData.py
+++ b/lldb/test/python_api/sbdata/TestSBData.py
@@ -6,6 +6,7 @@ import lldb
import pexpect
from lldbtest import *
from math import fabs
+import lldbutil
class SBDataAPICase(TestBase):
@@ -36,10 +37,7 @@ class SBDataAPICase(TestBase):
"""Test the SBData APIs."""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.cpp -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.cpp', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/source-manager/TestSourceManager.py b/lldb/test/source-manager/TestSourceManager.py
index 210798add03..9a9157b55c4 100644
--- a/lldb/test/source-manager/TestSourceManager.py
+++ b/lldb/test/source-manager/TestSourceManager.py
@@ -12,6 +12,7 @@ o test_modify_source_file_while_debugging:
import unittest2
import lldb
from lldbtest import *
+import lldbutil
class SourceManagerTestCase(TestBase):
@@ -112,10 +113,7 @@ class SourceManagerTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- self.expect("breakpoint set -f main.c -l %d" % self.line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='main.c', line = %d, locations = 1" %
- self.line)
+ lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
diff --git a/lldb/test/types/AbstractBase.py b/lldb/test/types/AbstractBase.py
index 2580d574c70..5e7810f19ba 100644
--- a/lldb/test/types/AbstractBase.py
+++ b/lldb/test/types/AbstractBase.py
@@ -6,6 +6,7 @@ import os, time
import re
import lldb
from lldbtest import *
+import lldbutil
def Msg(var, val, using_frame_variable):
return "'%s %s' matches the output (from compiled code): %s" % (
@@ -120,10 +121,7 @@ class GenericTester(TestBase):
break_line = line_number ("basic_type.cpp", "// Break here to test block captured variables.")
else:
break_line = line_number ("basic_type.cpp", "// Here is the line we will break on to check variables.")
- self.expect("breakpoint set -f basic_type.cpp -l %d" % break_line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='basic_type.cpp', line = %d, locations = 1" %
- break_line)
+ lldbutil.run_break_set_by_file_and_line (self, "basic_type.cpp", break_line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
@@ -204,10 +202,8 @@ class GenericTester(TestBase):
break_line = line_number ("basic_type.cpp", "// Break here to test block captured variables.")
else:
break_line = line_number ("basic_type.cpp", "// Here is the line we will break on to check variables.")
- self.expect("breakpoint set -f basic_type.cpp -l %d" % break_line,
- BREAKPOINT_CREATED,
- startstr = "Breakpoint created: 1: file ='basic_type.cpp', line = %d, locations = 1" %
- break_line)
+ lldbutil.run_break_set_by_file_and_line (self, "basic_type.cpp", break_line, num_expected_locations=1, loc_exact=True)
+
self.runCmd("run", RUN_SUCCEEDED)
self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
substrs = [" at basic_type.cpp:%d" % break_line,
OpenPOWER on IntegriCloud