aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/lang
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/lang')
-rw-r--r--packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py97
-rw-r--r--packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py130
-rw-r--r--packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py133
-rw-r--r--packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py37
-rw-r--r--packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py35
-rw-r--r--packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py79
-rw-r--r--packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py36
-rw-r--r--packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py48
-rw-r--r--packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py76
-rw-r--r--packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py10
-rw-r--r--packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py58
-rw-r--r--packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py74
-rw-r--r--packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py101
-rw-r--r--packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py43
-rw-r--r--packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py41
-rw-r--r--packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py58
-rw-r--r--packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py205
-rw-r--r--packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py44
-rw-r--r--packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py32
-rw-r--r--packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py5
-rw-r--r--packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py57
-rw-r--r--packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py34
-rw-r--r--packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py24
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py23
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/bool/TestCPPBool.py12
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py114
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/breakpoint-commands/nested.cpp8
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/call-function/TestCallCPPFunction.py18
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py62
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py84
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py59
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py87
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py18
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/const_this/TestConstThis.py2
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py31
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py41
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestDynamicValue.py234
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py80
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py58
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/extern_c/TestExternCSymbols.py2
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py8
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py78
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/global_operators/main.cpp26
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py47
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py39
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/inlines/TestInlines.py30
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py5
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py36
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py160
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py146
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py226
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py40
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py84
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py18
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/printf/TestPrintf.py5
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/rvalue-references/TestRvalueReferences.py32
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py52
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/signed_types/TestSignedTypes.py34
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/static_members/TestCPPStaticMembers.py44
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/static_methods/TestCPPStaticMethods.py14
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/stl/TestSTL.py49
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py24
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py128
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/this/TestCPPThis.py42
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/unicode-literals/TestUnicodeLiterals.py37
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/unique-types/TestUniqueTypes.py36
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/unsigned_types/TestUnsignedTypes.py34
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py38
-rw-r--r--packages/Python/lldbsuite/test/lang/cpp/wchar_t/TestCxxWCharT.py40
-rw-r--r--packages/Python/lldbsuite/test/lang/go/expressions/TestExpressions.py38
-rw-r--r--packages/Python/lldbsuite/test/lang/go/formatters/TestGoFormatters.py30
-rw-r--r--packages/Python/lldbsuite/test/lang/go/goroutines/TestGoroutines.py58
-rw-r--r--packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py44
-rw-r--r--packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py24
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/bitfield_ivars/TestBitfieldIvars.py10
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/blocks/TestObjCIvarsInBlocks.py133
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/forward-decl/TestForwardDecl.py26
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py26
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py69
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py188
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py130
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py22
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py30
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/foundation/TestSymbolTable.py8
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/global_ptrs/TestGlobalObjects.py22
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py164
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py35
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/modules-auto-import/TestModulesAutoImport.py20
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py33
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py25
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py51
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc++/TestObjCXX.py10
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-baseclass-sbtype/TestObjCBaseClassSBType.py33
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py34
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-checker/TestObjCCheckers.py35
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-class-method/TestObjCClassMethod.py39
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py64
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py167
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py67
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py4
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py47
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py173
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-optimized/TestObjcOptimized.py29
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py98
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-runtime-ivars/TestRuntimeIvars.py4
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py51
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-static-method/TestObjCStaticMethod.py47
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py173
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py40
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m8
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-struct-return/TestObjCStructReturn.py34
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/objc-super/TestObjCSuper.py43
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py16
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py12
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py40
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py58
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py31
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/real-definition/TestRealDefinition.py54
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/self/TestObjCSelf.py20
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py40
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/unicode-string/TestUnicodeString.py6
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/unicode-string/main.m5
-rw-r--r--packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py4
-rw-r--r--packages/Python/lldbsuite/test/lang/objcxx/objcxx-ivar-vector/TestIvarVector.py4
124 files changed, 4242 insertions, 2376 deletions
diff --git a/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py b/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
index e6f1092c702a..6d5f61ebb8bb 100644
--- a/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
+++ b/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
@@ -3,28 +3,31 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class AnonymousTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIf(compiler="icc", bugnumber="llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by ICC")
+ @skipIf(
+ compiler="icc",
+ bugnumber="llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by ICC")
def test_expr_nest(self):
self.build()
self.common_setup(self.line0)
# These should display correctly.
self.expect("expression n->foo.d", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 4"])
-
+ substrs=["= 4"])
+
self.expect("expression n->b", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 2"])
+ substrs=["= 2"])
def test_expr_child(self):
self.build()
@@ -32,35 +35,40 @@ class AnonymousTestCase(TestBase):
# These should display correctly.
self.expect("expression c->foo.d", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 4"])
-
- self.expect("expression c->grandchild.b", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 2"])
+ substrs=["= 4"])
- @skipIf(compiler="icc", bugnumber="llvm.org/pr15036: This particular regression was introduced by r181498")
+ self.expect(
+ "expression c->grandchild.b",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["= 2"])
+
+ @skipIf(
+ compiler="icc",
+ bugnumber="llvm.org/pr15036: This particular regression was introduced by r181498")
def test_expr_grandchild(self):
self.build()
self.common_setup(self.line2)
# These should display correctly.
self.expect("expression g.child.foo.d", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 4"])
-
+ substrs=["= 4"])
+
self.expect("expression g.child.b", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 2"])
+ substrs=["= 2"])
def test_expr_parent(self):
self.build()
if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion():
- self.skipTest("llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
+ self.skipTest(
+ "llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
self.common_setup(self.line2)
# These should display correctly.
self.expect("expression pz", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(type_z *) $", " = 0x0000"])
+ substrs=["(type_z *) $", " = 0x0000"])
self.expect("expression z.y", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(type_y) $", "dummy = 2"])
+ substrs=["(type_y) $", "dummy = 2"])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21550")
def test_expr_null(self):
@@ -69,48 +77,52 @@ class AnonymousTestCase(TestBase):
# This should fail because pz is 0, but it succeeds on OS/X.
# This fails on Linux with an upstream error "Couldn't dematerialize struct", as does "p *n" with "int *n = 0".
- # Note that this can also trigger llvm.org/pr15036 when run interactively at the lldb command prompt.
- self.expect("expression *(type_z *)pz", error = True)
+ # Note that this can also trigger llvm.org/pr15036 when run
+ # interactively at the lldb command prompt.
+ self.expect("expression *(type_z *)pz", error=True)
def test_child_by_name(self):
self.build()
-
+
# Set debugger into synchronous mode
self.dbg.SetAsync(False)
# Create a target
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- break_in_main = target.BreakpointCreateBySourceRegex ('// Set breakpoint 2 here.', lldb.SBFileSpec(self.source))
+ break_in_main = target.BreakpointCreateBySourceRegex(
+ '// Set breakpoint 2 here.', lldb.SBFileSpec(self.source))
self.assertTrue(break_in_main, VALID_BREAKPOINT)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue (process, PROCESS_IS_VALID)
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, PROCESS_IS_VALID)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_main)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_in_main)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint in main.")
+ self.fail("Failed to stop at breakpoint in main.")
thread = threads[0]
frame = thread.frames[0]
if not frame.IsValid():
- self.fail ("Failed to get frame 0.")
+ self.fail("Failed to get frame 0.")
var_n = frame.FindVariable("n")
if not var_n.IsValid():
- self.fail ("Failed to get the variable 'n'")
+ self.fail("Failed to get the variable 'n'")
elem_a = var_n.GetChildMemberWithName("a")
if not elem_a.IsValid():
- self.fail ("Failed to get the element a in n")
+ self.fail("Failed to get the element a in n")
error = lldb.SBError()
value = elem_a.GetValueAsSigned(error, 1000)
if not error.Success() or value != 0:
- self.fail ("failed to get the correct value for element a in n")
+ self.fail("failed to get the correct value for element a in n")
def test_nest_flat(self):
self.build()
@@ -118,10 +130,10 @@ class AnonymousTestCase(TestBase):
# These should display correctly.
self.expect('frame variable n --flat',
- substrs = ['n.a = 0',
- 'n.b = 2',
- 'n.foo.c = 0',
- 'n.foo.d = 4'])
+ substrs=['n.a = 0',
+ 'n.b = 2',
+ 'n.foo.c = 0',
+ 'n.foo.d = 4'])
def setUp(self):
# Call super's setUp().
@@ -133,7 +145,7 @@ class AnonymousTestCase(TestBase):
self.line2 = line_number(self.source, '// Set breakpoint 2 here.')
def common_setup(self, line):
-
+
# Set debugger into synchronous mode
self.dbg.SetAsync(False)
@@ -142,18 +154,21 @@ class AnonymousTestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- # Set breakpoints inside and outside methods that take pointers to the containing struct.
- lldbutil.run_break_set_by_file_and_line (self, self.source, line, num_expected_locations=1, loc_exact=True)
+ # Set breakpoints inside and outside methods that take pointers to the
+ # containing struct.
+ lldbutil.run_break_set_by_file_and_line(
+ self, self.source, line, num_expected_locations=1, loc_exact=True)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
diff --git a/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py b/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py
index 5a4907465682..d4716de907c7 100644
--- a/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py
+++ b/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ArrayTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,7 +27,8 @@ class ArrayTypesTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=False)
+ 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)
@@ -39,35 +41,45 @@ class ArrayTypesTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = ['resolved, hit count = 1'])
+ substrs=['resolved, hit count = 1'])
# Issue 'variable list' command on several array-type variables.
- self.expect("frame variable --show-types strings", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(char *[4])',
- substrs = ['(char *) [0]',
- '(char *) [1]',
- '(char *) [2]',
- '(char *) [3]',
- 'Hello',
- 'Hola',
- 'Bonjour',
- 'Guten Tag'])
-
- self.expect("frame variable --show-types --raw -- char_16", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(char) [0]',
- '(char) [15]'])
-
- self.expect("frame variable --show-types ushort_matrix", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(unsigned short [2][3])')
-
- self.expect("frame variable --show-types long_6", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(long [6])')
+ self.expect(
+ "frame variable --show-types strings",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(char *[4])',
+ substrs=[
+ '(char *) [0]',
+ '(char *) [1]',
+ '(char *) [2]',
+ '(char *) [3]',
+ 'Hello',
+ 'Hola',
+ 'Bonjour',
+ 'Guten Tag'])
+
+ self.expect(
+ "frame variable --show-types --raw -- char_16",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(char) [0]',
+ '(char) [15]'])
+
+ self.expect(
+ "frame variable --show-types ushort_matrix",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(unsigned short [2][3])')
+
+ self.expect(
+ "frame variable --show-types long_6",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(long [6])')
@add_test_categories(['pyapi'])
def test_and_python_api(self):
@@ -84,24 +96,30 @@ class ArrayTypesTestCase(TestBase):
# Sanity check the print representation of breakpoint.
bp = str(breakpoint)
self.expect(bp, msg="Breakpoint looks good", exe=False,
- substrs = ["file = 'main.c'",
- "line = %d" % self.line,
- "locations = 1"])
- self.expect(bp, msg="Breakpoint is not resolved as yet", exe=False, matching=False,
- substrs = ["resolved = 1"])
+ substrs=["file = 'main.c'",
+ "line = %d" % self.line,
+ "locations = 1"])
+ self.expect(
+ bp,
+ msg="Breakpoint is not resolved as yet",
+ exe=False,
+ matching=False,
+ substrs=["resolved = 1"])
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Sanity check the print representation of process.
proc = str(process)
self.expect(proc, msg="Process looks good", exe=False,
- substrs = ["state = stopped",
- "executable = a.out"])
+ substrs=["state = stopped",
+ "executable = a.out"])
# The stop reason of the thread should be breakpoint.
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
# Sanity check the print representation of thread.
@@ -114,8 +132,11 @@ class ArrayTypesTestCase(TestBase):
tidstr = "tid = %u" % thread.GetThreadID()
else:
tidstr = "tid = 0x%4.4x" % thread.GetThreadID()
- self.expect(thr, "Thread looks good with stop reason = breakpoint", exe=False,
- substrs = [tidstr])
+ self.expect(
+ thr,
+ "Thread looks good with stop reason = breakpoint",
+ exe=False,
+ substrs=[tidstr])
# The breakpoint should have a hit count of 1.
self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE)
@@ -123,24 +144,33 @@ class ArrayTypesTestCase(TestBase):
# The breakpoint should be resolved by now.
bp = str(breakpoint)
self.expect(bp, "Breakpoint looks good and is resolved", exe=False,
- substrs = ["file = 'main.c'",
- "line = %d" % self.line,
- "locations = 1"])
+ substrs=["file = 'main.c'",
+ "line = %d" % self.line,
+ "locations = 1"])
# Sanity check the print representation of frame.
frame = thread.GetFrameAtIndex(0)
frm = str(frame)
- self.expect(frm,
- "Frame looks good with correct index %d" % frame.GetFrameID(),
- exe=False,
- substrs = ["#%d" % frame.GetFrameID()])
+ self.expect(
+ frm,
+ "Frame looks good with correct index %d" %
+ frame.GetFrameID(),
+ exe=False,
+ substrs=[
+ "#%d" %
+ frame.GetFrameID()])
# Lookup the "strings" string array variable and sanity check its print
# representation.
variable = frame.FindVariable("strings")
var = str(variable)
- self.expect(var, "Variable for 'strings' looks good with correct name", exe=False,
- substrs = ["%s" % variable.GetName()])
+ self.expect(
+ var,
+ "Variable for 'strings' looks good with correct name",
+ exe=False,
+ substrs=[
+ "%s" %
+ variable.GetName()])
self.DebugSBValue(variable)
self.assertTrue(variable.GetNumChildren() == 4,
"Variable 'strings' should have 4 children")
@@ -186,9 +216,11 @@ class ArrayTypesTestCase(TestBase):
# Last, check that "long_6" has a value type of eValueTypeVariableLocal
# and "argc" has eValueTypeVariableArgument.
from lldbsuite.test.lldbutil import value_type_to_str
- self.assertTrue(variable.GetValueType() == lldb.eValueTypeVariableLocal,
- "Variable 'long_6' should have '%s' value type." %
- value_type_to_str(lldb.eValueTypeVariableLocal))
+ self.assertTrue(
+ variable.GetValueType() == lldb.eValueTypeVariableLocal,
+ "Variable 'long_6' should have '%s' value type." %
+ value_type_to_str(
+ lldb.eValueTypeVariableLocal))
argc = frame.FindVariable("argc")
self.DebugSBValue(argc)
self.assertTrue(argc.GetValueType() == lldb.eValueTypeVariableArgument,
diff --git a/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py b/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
index 30175c5e1c15..4d0eb48c3b5b 100644
--- a/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
+++ b/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
@@ -3,24 +3,27 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BitfieldsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
-
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break inside main().
self.line = line_number('main.c', '// Set break point at this line.')
- @skipIfWindows # BitFields exhibit crashes in record layout on Windows (http://llvm.org/pr21800)
+ # BitFields exhibit crashes in record layout on Windows
+ # (http://llvm.org/pr21800)
+ @skipIfWindows
def test_and_run_command(self):
"""Test 'frame variable ...' on a variable with bitfields."""
self.build()
@@ -28,85 +31,95 @@ class BitfieldsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# This should display correctly.
- self.expect("frame variable --show-types bits", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(uint32_t:1) b1 = 1',
- '(uint32_t:2) b2 = 3',
- '(uint32_t:3) b3 = 7',
- '(uint32_t) b4 = 15',
- '(uint32_t:5) b5 = 31',
- '(uint32_t:6) b6 = 63',
- '(uint32_t:7) b7 = 127',
- '(uint32_t:4) four = 15'])
+ self.expect(
+ "frame variable --show-types bits",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(uint32_t:1) b1 = 1',
+ '(uint32_t:2) b2 = 3',
+ '(uint32_t:3) b3 = 7',
+ '(uint32_t) b4 = 15',
+ '(uint32_t:5) b5 = 31',
+ '(uint32_t:6) b6 = 63',
+ '(uint32_t:7) b7 = 127',
+ '(uint32_t:4) four = 15'])
# And so should this.
# rdar://problem/8348251
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(uint32_t:1) b1 = 1',
- '(uint32_t:2) b2 = 3',
- '(uint32_t:3) b3 = 7',
- '(uint32_t) b4 = 15',
- '(uint32_t:5) b5 = 31',
- '(uint32_t:6) b6 = 63',
- '(uint32_t:7) b7 = 127',
- '(uint32_t:4) four = 15'])
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(uint32_t:1) b1 = 1',
+ '(uint32_t:2) b2 = 3',
+ '(uint32_t:3) b3 = 7',
+ '(uint32_t) b4 = 15',
+ '(uint32_t:5) b5 = 31',
+ '(uint32_t:6) b6 = 63',
+ '(uint32_t:7) b7 = 127',
+ '(uint32_t:4) four = 15'])
self.expect("expr (bits.b1)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '1'])
+ substrs=['uint32_t', '1'])
self.expect("expr (bits.b2)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '3'])
+ substrs=['uint32_t', '3'])
self.expect("expr (bits.b3)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '7'])
+ substrs=['uint32_t', '7'])
self.expect("expr (bits.b4)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '15'])
+ substrs=['uint32_t', '15'])
self.expect("expr (bits.b5)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '31'])
+ substrs=['uint32_t', '31'])
self.expect("expr (bits.b6)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '63'])
+ substrs=['uint32_t', '63'])
self.expect("expr (bits.b7)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '127'])
+ substrs=['uint32_t', '127'])
self.expect("expr (bits.four)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '15'])
+ substrs=['uint32_t', '15'])
- self.expect("frame variable --show-types more_bits", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(uint32_t:3) a = 3',
- '(uint8_t:1) b = \'\\0\'',
- '(uint8_t:1) c = \'\\x01\'',
- '(uint8_t:1) d = \'\\0\''])
+ self.expect(
+ "frame variable --show-types more_bits",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(uint32_t:3) a = 3',
+ '(uint8_t:1) b = \'\\0\'',
+ '(uint8_t:1) c = \'\\x01\'',
+ '(uint8_t:1) d = \'\\0\''])
self.expect("expr (more_bits.a)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '3'])
+ substrs=['uint32_t', '3'])
self.expect("expr (more_bits.b)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint8_t', '\\0'])
+ substrs=['uint8_t', '\\0'])
self.expect("expr (more_bits.c)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint8_t', '\\x01'])
+ substrs=['uint8_t', '\\x01'])
self.expect("expr (more_bits.d)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint8_t', '\\0'])
-
- self.expect("expr (packed.a)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['char', "'a'"])
- self.expect("expr (packed.b)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', "10"])
- self.expect("expr/x (packed.c)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', "7112233"])
+ substrs=['uint8_t', '\\0'])
+ self.expect("expr (packed.a)", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['char', "'a'"])
+ self.expect("expr (packed.b)", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['uint32_t', "10"])
+ self.expect("expr/x (packed.c)", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['uint32_t', "7112233"])
@add_test_categories(['pyapi'])
- @skipIfWindows # BitFields exhibit crashes in record layout on Windows (http://llvm.org/pr21800)
- @expectedFailureAll("llvm.org/pr27510", oslist=["linux"], compiler="clang", compiler_version=[">=", "3.9"])
+ # BitFields exhibit crashes in record layout on Windows
+ # (http://llvm.org/pr21800)
+ @skipIfWindows
def test_and_python_api(self):
"""Use Python APIs to inspect a bitfields variable."""
self.build()
@@ -118,11 +131,13 @@ class BitfieldsTestCase(TestBase):
breakpoint = target.BreakpointCreateByLocation("main.c", self.line)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
# The breakpoint should have a hit count of 1.
@@ -132,10 +147,14 @@ class BitfieldsTestCase(TestBase):
frame = thread.GetFrameAtIndex(0)
bits = frame.FindVariable("bits")
self.DebugSBValue(bits)
- self.assertTrue(bits.GetTypeName() == 'Bits', "bits.GetTypeName() == 'Bits'");
- self.assertTrue(bits.GetNumChildren() == 10, "bits.GetNumChildren() == 10");
+ self.assertTrue(
+ bits.GetTypeName() == 'Bits',
+ "bits.GetTypeName() == 'Bits'")
+ self.assertTrue(
+ bits.GetNumChildren() == 10,
+ "bits.GetNumChildren() == 10")
test_compiler = self.getCompiler()
- self.assertTrue(bits.GetByteSize() == 32, "bits.GetByteSize() == 32");
+ self.assertTrue(bits.GetByteSize() == 32, "bits.GetByteSize() == 32")
# Notice the pattern of int(b1.GetValue(), 0). We pass a base of 0
# so that the proper radix is determined based on the contents of the
diff --git a/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py b/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py
index 0cc9456af32e..4025635eec6f 100644
--- a/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py
+++ b/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py
@@ -3,14 +3,15 @@
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
+
class BlocksTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -32,36 +33,46 @@ class BlocksTestCase(TestBase):
# Break inside the foo function which takes a bar_ptr argument.
for line in self.lines:
- lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", line, num_expected_locations=1, loc_exact=True)
self.wait_for_breakpoint()
-
+
@skipUnlessDarwin
def test_expr(self):
self.launch_common()
self.expect("expression a + b", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 7"])
+ substrs=["= 7"])
self.expect("expression c", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 1"])
+ substrs=["= 1"])
self.wait_for_breakpoint()
# This should display correctly.
self.expect("expression (int)neg (-12)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 12"])
+ substrs=["= 12"])
@skipUnlessDarwin
def test_define(self):
self.launch_common()
- self.runCmd("expression int (^$add)(int, int) = ^int(int a, int b) { return a + b; };")
+ self.runCmd(
+ "expression int (^$add)(int, int) = ^int(int a, int b) { return a + b; };")
+ self.expect(
+ "expression $add(2,3)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[" = 5"])
+
+ self.runCmd("expression int $a = 3")
+ self.expect(
+ "expression int (^$addA)(int) = ^int(int b) { return $a + b; };",
+ "Proper error is reported on capture",
+ error=True)
- self.expect("expression $add(2,3)", VARIABLES_DISPLAYED_CORRECTLY, substrs = [" = 5"])
-
def wait_for_breakpoint(self):
- if self.is_started == False:
+ if not self.is_started:
self.is_started = True
self.runCmd("process launch", RUN_SUCCEEDED)
else:
@@ -69,5 +80,5 @@ class BlocksTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
diff --git a/packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py b/packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py
index 99544c7bd80e..d54435a4c677 100644
--- a/packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py
+++ b/packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ConstVariableTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -25,8 +26,15 @@ class ConstVariableTestCase(TestBase):
compiler="clang", compiler_version=["=", "3.8"])
@expectedFailureAll(oslist=["freebsd", "linux"], compiler="icc")
@expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el'])
- @expectedFailureAll(oslist=["linux"], archs=['arm', 'aarch64'], bugnumber="llvm.org/pr27883")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ 'arm',
+ 'aarch64'],
+ bugnumber="llvm.org/pr27883")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
def test_and_run_command(self):
"""Test interpreted and JITted expressions on constant values."""
self.build()
@@ -34,32 +42,35 @@ class ConstVariableTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=1)
+ lldbutil.run_break_set_by_symbol(
+ self, "main", num_expected_locations=1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
self.runCmd("next")
self.runCmd("next")
# Try frame variable.
self.expect("frame variable index", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(int32_t) index = 512'])
+ substrs=['(int32_t) index = 512'])
# Try an interpreted expression.
self.expect("expr (index + 512)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['1024'])
+ substrs=['1024'])
# Try a JITted expression.
- self.expect("expr (int)getpid(); (index - 256)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['256'])
+ self.expect(
+ "expr (int)getpid(); (index - 256)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['256'])
self.runCmd("kill")
diff --git a/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py b/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
index 044accf14f65..b4ea9fae043b 100644
--- a/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
+++ b/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.decorators import *
+
class EnumTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,7 +21,6 @@ class EnumTypesTestCase(TestBase):
# Find the line number to break inside main().
self.line = line_number('main.c', '// Set break point at this line.')
- @expectedFailureAll(oslist=['windows']) # derefing the null pointer "works" on Windows
def test(self):
"""Test 'image lookup -t days' and check for correct display and enum value printing."""
self.build()
@@ -28,23 +28,35 @@ class EnumTypesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- bkpt_id = lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ bkpt_id = 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)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Look up information about the 'days' enum type.
# Check for correct display.
self.expect("image lookup -t days", DATA_TYPES_DISPLAYED_CORRECTLY,
- substrs = ['enum days {',
+ substrs=['enum days {',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday',
+ 'Sunday',
+ 'kNumDays',
+ '}'])
+
+ enum_values = ['-4',
'Monday',
'Tuesday',
'Wednesday',
@@ -53,28 +65,41 @@ class EnumTypesTestCase(TestBase):
'Saturday',
'Sunday',
'kNumDays',
- '}'])
-
- enum_values = [ '-4',
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday',
- 'Sunday',
- 'kNumDays',
- '5'];
+ '5']
# Make sure a pointer to an anonymous enum type does crash LLDB and displays correctly using
# frame variable and expression commands
- self.expect('frame variable f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['ops *', 'f.op'], patterns = ['0x0+$'])
- self.expect('frame variable *f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['ops', '*f.op', '<parent is NULL>'])
- self.expect('expr f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['ops *', '$'], patterns = ['0x0+$'])
- self.expect('expr *f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['error:'], error = True)
+ self.expect(
+ 'frame variable f.op',
+ DATA_TYPES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'ops *',
+ 'f.op'],
+ patterns=['0x0+$'])
+ self.expect(
+ 'frame variable *f.op',
+ DATA_TYPES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'ops',
+ '*f.op',
+ '<parent is NULL>'])
+ self.expect(
+ 'expr f.op',
+ DATA_TYPES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'ops *',
+ '$'],
+ patterns=['0x0+$'])
+ self.expect(
+ 'expr *f.op',
+ DATA_TYPES_DISPLAYED_CORRECTLY,
+ substrs=['error:'],
+ error=True)
bkpt = self.target().FindBreakpointByID(bkpt_id)
for enum_value in enum_values:
- self.expect("frame variable day", 'check for valid enumeration value',
- substrs = [enum_value])
- lldbutil.continue_to_breakpoint (self.process(), bkpt)
+ self.expect(
+ "frame variable day",
+ 'check for valid enumeration value',
+ substrs=[enum_value])
+ lldbutil.continue_to_breakpoint(self.process(), bkpt)
diff --git a/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py b/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
index 33c0de2d72d3..60e7073f146d 100644
--- a/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
+++ b/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
@@ -3,12 +3,13 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class ForwardDeclarationTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,28 +21,35 @@ class ForwardDeclarationTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_symbol (self, "foo", num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self, "foo", num_expected_locations=1, sym_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# This should display correctly.
# Note that the member fields of a = 1 and b = 2 is by design.
- self.expect("frame variable --show-types *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(bar) *bar_ptr = ',
- '(int) a = 1',
- '(int) b = 2'])
+ self.expect(
+ "frame variable --show-types *bar_ptr",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(bar) *bar_ptr = ',
+ '(int) a = 1',
+ '(int) b = 2'])
# And so should this.
- self.expect("expression --show-types -- *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(bar)',
- '(int) a = 1',
- '(int) b = 2'])
+ self.expect(
+ "expression --show-types -- *bar_ptr",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(bar)',
+ '(int) a = 1',
+ '(int) b = 2'])
diff --git a/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py b/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py
index 67ccb1aa3fa4..35e902e5bdcb 100644
--- a/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py
+++ b/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class FunctionTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,18 +27,24 @@ class FunctionTypesTestCase(TestBase):
self.runToBreakpoint()
# Check that the 'callback' variable display properly.
- self.expect("frame variable --show-types callback", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(int (*)(const char *)) callback =')
+ self.expect(
+ "frame variable --show-types callback",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(int (*)(const char *)) callback =')
# And that we can break on the callback function.
- lldbutil.run_break_set_by_symbol (self, "string_not_empty", num_expected_locations=1, sym_exact=True)
+ 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.
self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['a.out`string_not_empty',
- 'stop reason = breakpoint'])
-
+ substrs=['a.out`string_not_empty',
+ 'stop reason = breakpoint'])
+
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
def test_pointers(self):
"""Test that a function pointer to 'printf' works and can be called."""
@@ -45,33 +52,34 @@ class FunctionTypesTestCase(TestBase):
self.runToBreakpoint()
self.expect("expr string_not_empty",
- substrs = ['(int (*)(const char *)) $0 = ', '(a.out`'])
+ substrs=['(int (*)(const char *)) $0 = ', '(a.out`'])
if self.platformIsDarwin():
regexps = ['lib.*\.dylib`printf']
else:
regexps = ['printf']
self.expect("expr (int (*)(const char*, ...))printf",
- substrs = ['(int (*)(const char *, ...)) $1 = '],
- patterns = regexps)
+ substrs=['(int (*)(const char *, ...)) $1 = '],
+ patterns=regexps)
self.expect("expr $1(\"Hello world\\n\")",
- startstr = '(int) $2 = 12')
+ startstr='(int) $2 = 12')
def runToBreakpoint(self):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
+
# Break inside the main.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
-
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+
self.runCmd("run", RUN_SUCCEEDED)
-
+
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
diff --git a/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py b/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
index 87160f5252be..f54202edade3 100644
--- a/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
+++ b/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
@@ -7,6 +7,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class GlobalVariablesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -16,11 +17,17 @@ class GlobalVariablesTestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break inside main().
self.source = 'main.c'
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
self.shlib_names = ["a"]
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
- @expectedFailureAll("llvm.org/pr25872", oslist=["macosx"], debug_info=["dwarf", "gmodules"])
+ @expectedFailureAll(
+ "llvm.org/pr25872, <rdar://problem/28725399>",
+ oslist=["macosx"],
+ debug_info=[
+ "dwarf",
+ "gmodules"])
def test_c_global_variables(self):
"""Test 'frame variable --scope --no-args' which omits args and shows scopes."""
self.build()
@@ -30,48 +37,67 @@ class GlobalVariablesTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Break inside the main.
- lldbutil.run_break_set_by_file_and_line (self, self.source, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, self.source, self.line, num_expected_locations=1, loc_exact=True)
- # Register our shared libraries for remote targets so they get automatically uploaded
- environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
+ environment = self.registerSharedLibrariesWithTarget(
+ target, self.shlib_names)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Check that GLOBAL scopes are indicated for the variables.
- self.expect("frame variable --show-types --scope --show-globals --no-args", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['GLOBAL: (int) g_file_global_int = 42',
- 'STATIC: (const int) g_file_static_int = 2',
- 'GLOBAL: (const char *) g_file_global_cstr',
- '"g_file_global_cstr"',
- 'STATIC: (const char *) g_file_static_cstr',
- '"g_file_static_cstr"',
- 'GLOBAL: (int) g_common_1 = 21'])
+ self.expect(
+ "frame variable --show-types --scope --show-globals --no-args",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'GLOBAL: (int) g_file_global_int = 42',
+ 'STATIC: (const int) g_file_static_int = 2',
+ 'GLOBAL: (const char *) g_file_global_cstr',
+ '"g_file_global_cstr"',
+ 'STATIC: (const char *) g_file_static_cstr',
+ '"g_file_static_cstr"',
+ 'GLOBAL: (int) g_common_1 = 21'])
# 'frame variable' should support address-of operator.
self.runCmd("frame variable &g_file_global_int")
- # Exercise the 'target variable' command to display globals in a.c file.
+ # Exercise the 'target variable' command to display globals in a.c
+ # file.
self.expect("target variable g_a", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['g_a', '123'])
- self.expect("target variable g_marked_spot.x", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['g_marked_spot.x', '20'])
+ substrs=['g_a', '123'])
+ self.expect(
+ "target variable g_marked_spot.x",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'g_marked_spot.x',
+ '20'])
# rdar://problem/9747668
# runCmd: target variable g_marked_spot.y
# output: (int) g_marked_spot.y = <a.o[0x214] can't be resolved, in not currently loaded.
# >
- self.expect("target variable g_marked_spot.y", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['g_marked_spot.y', '21'])
- self.expect("target variable g_marked_spot.y", VARIABLES_DISPLAYED_CORRECTLY, matching=False,
- substrs = ["can't be resolved"])
+ self.expect(
+ "target variable g_marked_spot.y",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'g_marked_spot.y',
+ '21'])
+ self.expect(
+ "target variable g_marked_spot.y",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ matching=False,
+ substrs=["can't be resolved"])
diff --git a/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py b/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
index d6fbf42b7570..576e9ecd52ad 100644
--- a/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
+++ b/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
@@ -1,5 +1,11 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr27845"),
- decorators.expectedFailureAll(compiler="clang", compiler_version=["<", "3.5"], bugnumber="llvm.org/pr27845")])
+lldbinline.MakeInlineTest(__file__,
+ globals(),
+ [decorators.expectedFailureAll(oslist=["windows"],
+ bugnumber="llvm.org/pr27845"),
+ decorators.expectedFailureAll(compiler="clang",
+ compiler_version=["<",
+ "3.5"],
+ bugnumber="llvm.org/pr27845")])
diff --git a/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py b/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py
index 5a940e2e5eff..af6c3a722e40 100644
--- a/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py
+++ b/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py
@@ -3,9 +3,9 @@
from __future__ import print_function
-
from distutils.version import StrictVersion
-import os, time
+import os
+import time
import platform
import lldb
@@ -13,49 +13,65 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CModulesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIfFreeBSD
- @expectedFailureAll(oslist=["linux"], bugnumber="http://llvm.org/pr23456 'fopen' has unknown return type")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="http://llvm.org/pr23456 'fopen' has unknown return type")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+ @skipIf(macos_version=["<", "10.12"])
def test_expr(self):
- if platform.system() == "Darwin" and platform.release() < StrictVersion('12.0.0'):
- self.skipTest()
-
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
-
- self.expect("expr -l objc++ -- @import Darwin; 3", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["int", "3"])
-
- self.expect("expr *fopen(\"/dev/zero\", \"w\")", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["FILE", "_close"])
+ substrs=[' resolved, hit count = 1'])
+
+ self.expect(
+ "expr -l objc++ -- @import Darwin; 3",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "int",
+ "3"])
+
+ self.expect(
+ "expr *fopen(\"/dev/zero\", \"w\")",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "FILE",
+ "_close"])
self.expect("expr *myFile", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["a", "5", "b", "9"])
+ substrs=["a", "5", "b", "9"])
- self.expect("expr MIN((uint64_t)2, (uint64_t)3)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["uint64_t", "2"])
+ self.expect(
+ "expr MIN((uint64_t)2, (uint64_t)3)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "uint64_t",
+ "2"])
self.expect("expr stdin", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(FILE *)", "0x"])
+ substrs=["(FILE *)", "0x"])
def setUp(self):
# Call super's setUp().
diff --git a/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py b/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
index 6b2dc6a9b126..f11491e6d633 100644
--- a/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
+++ b/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
@@ -2,7 +2,8 @@
from __future__ import print_function
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
@@ -15,6 +16,8 @@ from lldbsuite.test import lldbutil
# Return:
# True if the value has a readable value and is in a register
# False otherwise
+
+
def is_variable_in_register(frame, var_name):
# Ensure we can lookup the variable.
var = frame.FindVariable(var_name)
@@ -52,10 +55,12 @@ def is_variable_in_register(frame, var_name):
return True
-def is_struct_pointer_in_register(frame, var_name):
+def is_struct_pointer_in_register(frame, var_name, trace):
# Ensure we can lookup the variable.
var = frame.FindVariable(var_name)
- # print("\nchecking {}...".format(var_name))
+ if trace:
+ print("\nchecking {}...".format(var_name))
+
if var is None or not var.IsValid():
# print("{} cannot be found".format(var_name))
return False
@@ -65,13 +70,16 @@ def is_struct_pointer_in_register(frame, var_name):
value = var.GetValue()
# print("checking value...")
if value is None:
- # print("value is invalid")
+ if trace:
+ print("value is invalid")
return False
- # else:
- # print("value is {}".format(value))
+ else:
+ if trace:
+ print("value is {}".format(value))
var_loc = var.GetLocation()
- # print("checking location: {}".format(var_loc))
+ if trace:
+ print("checking location: {}".format(var_loc))
if var_loc is None or var_loc.startswith("0x"):
# The frame var is not in a register but rather a memory location.
# print("frame var {} is not in a register".format(var_name))
@@ -90,9 +98,9 @@ class RegisterVariableTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
-
@expectedFailureAll(compiler="clang", compiler_version=['<', '3.5'])
- @expectedFailureAll(compiler="gcc", compiler_version=['>=', '4.8.2'], archs=["i386", "x86_64"])
+ @expectedFailureAll(compiler="gcc", compiler_version=[
+ '>=', '4.8.2'], archs=["i386"])
def test_and_run_command(self):
"""Test expressions on register values."""
@@ -108,7 +116,8 @@ class RegisterVariableTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- lldbutil.run_break_set_by_source_regexp(self, "break", num_expected_locations=3)
+ lldbutil.run_break_set_by_source_regexp(
+ self, "break", num_expected_locations=3)
####################
# First breakpoint
@@ -117,24 +126,25 @@ class RegisterVariableTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Try some variables that should be visible
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
+ frame = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame()
if is_variable_in_register(frame, 'a'):
register_variables_count += 1
self.expect("expr a", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [re_expr_equals('int', 2)])
+ patterns=[re_expr_equals('int', 2)])
- if is_struct_pointer_in_register(frame, 'b'):
+ if is_struct_pointer_in_register(frame, 'b', self.TraceOn()):
register_variables_count += 1
self.expect("expr b->m1", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [re_expr_equals('int', 3)])
+ patterns=[re_expr_equals('int', 3)])
#####################
# Second breakpoint
@@ -143,24 +153,25 @@ class RegisterVariableTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Try some variables that should be visible
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
- if is_struct_pointer_in_register(frame, 'b'):
+ frame = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame()
+ if is_struct_pointer_in_register(frame, 'b', self.TraceOn()):
register_variables_count += 1
self.expect("expr b->m2", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [re_expr_equals('int', 5)])
+ patterns=[re_expr_equals('int', 5)])
if is_variable_in_register(frame, 'c'):
register_variables_count += 1
self.expect("expr c", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [re_expr_equals('int', 5)])
+ patterns=[re_expr_equals('int', 5)])
#####################
# Third breakpoint
@@ -169,22 +180,25 @@ class RegisterVariableTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Try some variables that should be visible
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
+ frame = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame()
if is_variable_in_register(frame, 'f'):
register_variables_count += 1
self.expect("expr f", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [re_expr_equals('float', '3.1')])
+ patterns=[re_expr_equals('float', '3.1')])
# Validate that we verified at least one register variable
- self.assertTrue(register_variables_count > 0, "expected to verify at least one variable in a register")
+ self.assertTrue(
+ register_variables_count > 0,
+ "expected to verify at least one variable in a register")
# print("executed {} expressions with values in registers".format(register_variables_count))
self.runCmd("kill")
diff --git a/packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py b/packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py
index 12e20dd42d44..bb94f1c4182b 100644
--- a/packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py
+++ b/packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SetValuesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -31,81 +32,111 @@ class SetValuesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Set breakpoints on several places to set program variables.
- 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.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.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.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.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)
+ 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)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# main.c:15
- # Check that 'frame variable --show-types' displays the correct data type and value.
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(char) i = 'a'")
+ # Check that 'frame variable --show-types' displays the correct data
+ # type and value.
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(char) i = 'a'")
# Now set variable 'i' and check that it is correctly displayed.
self.runCmd("expression i = 'b'")
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(char) i = 'b'")
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(char) i = 'b'")
self.runCmd("continue")
# main.c:36
- # Check that 'frame variable --show-types' displays the correct data type and value.
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\((short unsigned int|unsigned short)\) i = 33"])
+ # Check that 'frame variable --show-types' displays the correct data
+ # type and value.
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ patterns=["\((short unsigned int|unsigned short)\) i = 33"])
# Now set variable 'i' and check that it is correctly displayed.
self.runCmd("expression i = 333")
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\((short unsigned int|unsigned short)\) i = 333"])
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ patterns=["\((short unsigned int|unsigned short)\) i = 333"])
self.runCmd("continue")
# main.c:57
- # Check that 'frame variable --show-types' displays the correct data type and value.
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(long) i = 33")
+ # Check that 'frame variable --show-types' displays the correct data
+ # type and value.
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(long) i = 33")
# Now set variable 'i' and check that it is correctly displayed.
self.runCmd("expression i = 33333")
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(long) i = 33333")
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(long) i = 33333")
self.runCmd("continue")
# main.c:78
- # Check that 'frame variable --show-types' displays the correct data type and value.
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(double) i = 2.25")
+ # Check that 'frame variable --show-types' displays the correct data
+ # type and value.
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(double) i = 2.25")
# Now set variable 'i' and check that it is correctly displayed.
self.runCmd("expression i = 1.5")
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(double) i = 1.5")
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(double) i = 1.5")
self.runCmd("continue")
# main.c:85
- # Check that 'frame variable --show-types' displays the correct data type and value.
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(long double) i = 2.25")
+ # Check that 'frame variable --show-types' displays the correct data
+ # type and value.
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(long double) i = 2.25")
# Now set variable 'i' and check that it is correctly displayed.
self.runCmd("expression i = 1.5")
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(long double) i = 1.5")
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(long double) i = 1.5")
diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py b/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
index 954d1bac6362..61a67dc13987 100644
--- a/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
+++ b/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
@@ -3,12 +3,12 @@
from __future__ import print_function
-
import unittest2
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class SharedLibTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -16,14 +16,20 @@ class SharedLibTestCase(TestBase):
def test_expr(self):
"""Test that types work when defined in a shared library and forward-declared in the main executable"""
if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion():
- self.skipTest("llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
+ self.skipTest(
+ "llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
self.build()
self.common_setup()
# This should display correctly.
- self.expect("expression --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
+ self.expect(
+ "expression --show-types -- *my_foo_ptr",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(foo)",
+ "(sub_foo)",
+ "other_element = 3"])
@unittest2.expectedFailure("rdar://problem/10704639")
def test_frame_variable(self):
@@ -32,8 +38,13 @@ class SharedLibTestCase(TestBase):
self.common_setup()
# This should display correctly.
- self.expect("frame variable --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
+ self.expect(
+ "frame variable --show-types -- *my_foo_ptr",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(foo)",
+ "(sub_foo)",
+ "other_element = 3"])
def setUp(self):
# Call super's setUp().
@@ -42,7 +53,7 @@ class SharedLibTestCase(TestBase):
self.source = 'main.c'
self.line = line_number(self.source, '// Set breakpoint 0 here.')
self.shlib_names = ["foo"]
-
+
def common_setup(self):
# Run in synchronous mode
self.dbg.SetAsync(False)
@@ -52,20 +63,24 @@ class SharedLibTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, self.source, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, self.source, self.line, num_expected_locations=1, loc_exact=True)
- # Register our shared libraries for remote targets so they get automatically uploaded
- environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
+ environment = self.registerSharedLibrariesWithTarget(
+ target, self.shlib_names)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py b/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
index 011e4d1f22a4..7b371a2a9a99 100644
--- a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
+++ b/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
@@ -3,13 +3,13 @@
from __future__ import print_function
-
import unittest2
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SharedLibStrippedTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -18,14 +18,20 @@ class SharedLibStrippedTestCase(TestBase):
def test_expr(self):
"""Test that types work when defined in a shared library and forward-declared in the main executable"""
if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion():
- self.skipTest("llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
+ self.skipTest(
+ "llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
self.build()
self.common_setup()
# This should display correctly.
- self.expect("expression --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
+ self.expect(
+ "expression --show-types -- *my_foo_ptr",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(foo)",
+ "(sub_foo)",
+ "other_element = 3"])
@expectedFailureAll(oslist=["windows"])
@unittest2.expectedFailure("rdar://problem/10381325")
@@ -35,8 +41,13 @@ class SharedLibStrippedTestCase(TestBase):
self.common_setup()
# This should display correctly.
- self.expect("frame variable --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
+ self.expect(
+ "frame variable --show-types -- *my_foo_ptr",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(foo)",
+ "(sub_foo)",
+ "other_element = 3"])
def setUp(self):
# Call super's setUp().
@@ -55,20 +66,24 @@ class SharedLibStrippedTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, self.source, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, self.source, self.line, num_expected_locations=1, loc_exact=True)
- # Register our shared libraries for remote targets so they get automatically uploaded
- environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
+ environment = self.registerSharedLibrariesWithTarget(
+ target, self.shlib_names)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
diff --git a/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py b/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
index 2bd72434d390..b1aa98c50ba4 100644
--- a/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
+++ b/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
@@ -2,12 +2,14 @@
from __future__ import print_function
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestStepTarget(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,30 +25,32 @@ class TestStepTarget(TestBase):
self.end_line = line_number(self.main_source, "All done")
@add_test_categories(['pyapi'])
-
- def get_to_start (self):
+ def get_to_start(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
- break_in_main = target.BreakpointCreateBySourceRegex ('Break here to try targetted stepping', self.main_source_spec)
+ break_in_main = target.BreakpointCreateBySourceRegex(
+ 'Break here to try targetted stepping', self.main_source_spec)
self.assertTrue(break_in_main, VALID_BREAKPOINT)
- self.assertTrue(break_in_main.GetNumLocations() > 0,"Has locations.")
+ self.assertTrue(break_in_main.GetNumLocations() > 0, "Has locations.")
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_main)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_in_main)
if len(threads) != 1:
- self.fail ("Failed to stop at first breakpoint in main.")
+ self.fail("Failed to stop at first breakpoint in main.")
thread = threads[0]
return thread
@@ -60,7 +64,7 @@ class TestStepTarget(TestBase):
thread.StepInto("lotsOfArgs", self.end_line, error)
frame = thread.frames[0]
- self.assertTrue (frame.name == "lotsOfArgs", "Stepped to lotsOfArgs.")
+ self.assertTrue(frame.name == "lotsOfArgs", "Stepped to lotsOfArgs.")
def test_with_end_line_bad_name(self):
"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
@@ -70,7 +74,9 @@ class TestStepTarget(TestBase):
error = lldb.SBError()
thread.StepInto("lotsOfArgssss", self.end_line, error)
frame = thread.frames[0]
- self.assertTrue (frame.line_entry.line == self.end_line, "Stepped to the block end.")
+ self.assertTrue(
+ frame.line_entry.line == self.end_line,
+ "Stepped to the block end.")
def test_with_end_line_deeper(self):
"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
@@ -80,7 +86,7 @@ class TestStepTarget(TestBase):
error = lldb.SBError()
thread.StepInto("modifyInt", self.end_line, error)
frame = thread.frames[0]
- self.assertTrue (frame.name == "modifyInt", "Stepped to modifyInt.")
+ self.assertTrue(frame.name == "modifyInt", "Stepped to modifyInt.")
def test_with_command_and_block(self):
"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
@@ -88,11 +94,14 @@ class TestStepTarget(TestBase):
thread = self.get_to_start()
result = lldb.SBCommandReturnObject()
- self.dbg.GetCommandInterpreter().HandleCommand('thread step-in -t "lotsOfArgs" -e block', result)
- self.assertTrue(result.Succeeded(), "thread step-in command succeeded.")
+ self.dbg.GetCommandInterpreter().HandleCommand(
+ 'thread step-in -t "lotsOfArgs" -e block', result)
+ self.assertTrue(
+ result.Succeeded(),
+ "thread step-in command succeeded.")
frame = thread.frames[0]
- self.assertTrue (frame.name == "lotsOfArgs", "Stepped to lotsOfArgs.")
+ self.assertTrue(frame.name == "lotsOfArgs", "Stepped to lotsOfArgs.")
def test_with_command_and_block_and_bad_name(self):
"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
@@ -100,14 +109,17 @@ class TestStepTarget(TestBase):
thread = self.get_to_start()
result = lldb.SBCommandReturnObject()
- self.dbg.GetCommandInterpreter().HandleCommand('thread step-in -t "lotsOfArgsssss" -e block', result)
- self.assertTrue(result.Succeeded(), "thread step-in command succeeded.")
+ self.dbg.GetCommandInterpreter().HandleCommand(
+ 'thread step-in -t "lotsOfArgsssss" -e block', result)
+ self.assertTrue(
+ result.Succeeded(),
+ "thread step-in command succeeded.")
frame = thread.frames[0]
- self.assertTrue (frame.name == "main", "Stepped back out to main.")
- # end_line is set to the line after the containing block. Check that we got there:
- self.assertTrue(frame.line_entry.line == self.end_line, "Got out of the block")
-
-
-
+ self.assertTrue(frame.name == "main", "Stepped back out to main.")
+ # end_line is set to the line after the containing block. Check that
+ # we got there:
+ self.assertTrue(
+ frame.line_entry.line == self.end_line,
+ "Got out of the block")
diff --git a/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py b/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
index cfaff91daa45..d693e1dada51 100644
--- a/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
+++ b/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestCStepping(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -35,36 +36,43 @@ class TestCStepping(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
breakpoints_to_disable = []
- break_1_in_main = target.BreakpointCreateBySourceRegex ('// frame select 2, thread step-out while stopped at .c.1..', self.main_source_spec)
+ break_1_in_main = target.BreakpointCreateBySourceRegex(
+ '// frame select 2, thread step-out while stopped at .c.1..',
+ self.main_source_spec)
self.assertTrue(break_1_in_main, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break_1_in_main)
+ breakpoints_to_disable.append(break_1_in_main)
- break_in_a = target.BreakpointCreateBySourceRegex ('// break here to stop in a before calling b', self.main_source_spec)
+ break_in_a = target.BreakpointCreateBySourceRegex(
+ '// break here to stop in a before calling b', self.main_source_spec)
self.assertTrue(break_in_a, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break_in_a)
+ breakpoints_to_disable.append(break_in_a)
- break_in_b = target.BreakpointCreateBySourceRegex ('// thread step-out while stopped at .c.2..', self.main_source_spec)
+ break_in_b = target.BreakpointCreateBySourceRegex(
+ '// thread step-out while stopped at .c.2..', self.main_source_spec)
self.assertTrue(break_in_b, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break_in_b)
+ breakpoints_to_disable.append(break_in_b)
- break_in_c = target.BreakpointCreateBySourceRegex ('// Find the line number of function .c. here.', self.main_source_spec)
+ break_in_c = target.BreakpointCreateBySourceRegex(
+ '// Find the line number of function .c. here.', self.main_source_spec)
self.assertTrue(break_in_c, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break_in_c)
+ breakpoints_to_disable.append(break_in_c)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_1_in_main)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_1_in_main)
if len(threads) != 1:
- self.fail ("Failed to stop at first breakpoint in main.")
+ self.fail("Failed to stop at first breakpoint in main.")
thread = threads[0]
@@ -75,22 +83,26 @@ class TestCStepping(TestBase):
thread.StepOver()
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_a)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_in_a)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint in a.")
+ self.fail("Failed to stop at breakpoint in a.")
# Check that the stop ID increases:
new_stop_id = process.GetStopID()
- self.assertTrue(new_stop_id > old_stop_id, "Stop ID increases monotonically.")
+ self.assertTrue(
+ new_stop_id > old_stop_id,
+ "Stop ID increases monotonically.")
thread = threads[0]
# Step over, and we should hit the breakpoint in b:
thread.StepOver()
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_b)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_in_b)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint in b.")
+ self.fail("Failed to stop at breakpoint in b.")
thread = threads[0]
# Now try running some function, and make sure that we still end up in the same place
@@ -105,32 +117,51 @@ class TestCStepping(TestBase):
stop_id_before_expression = process.GetStopID()
stop_id_before_including_expressions = process.GetStopID(True)
- frame.EvaluateExpression ("(int) printf (print_string)")
+ frame.EvaluateExpression("(int) printf (print_string)")
frame = thread.GetFrameAtIndex(0)
- self.assertTrue (current_line == frame.GetLineEntry().GetLine(), "The line stayed the same after expression.")
- self.assertTrue (current_file == frame.GetLineEntry().GetFileSpec(), "The file stayed the same after expression.")
- self.assertTrue (thread.GetStopReason() == lldb.eStopReasonBreakpoint, "We still say we stopped for a breakpoint.")
- self.assertTrue (thread.GetStopReasonDataAtIndex(0) == current_bp[0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.")
-
+ self.assertTrue(
+ current_line == frame.GetLineEntry().GetLine(),
+ "The line stayed the same after expression.")
+ self.assertTrue(
+ current_file == frame.GetLineEntry().GetFileSpec(),
+ "The file stayed the same after expression.")
+ self.assertTrue(
+ thread.GetStopReason() == lldb.eStopReasonBreakpoint,
+ "We still say we stopped for a breakpoint.")
+ self.assertTrue(thread.GetStopReasonDataAtIndex(0) == current_bp[
+ 0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.")
+
# Also make sure running the expression didn't change the public stop id
# but did change if we are asking for expression stops as well.
stop_id_after_expression = process.GetStopID()
stop_id_after_including_expressions = process.GetStopID(True)
- self.assertTrue (stop_id_before_expression == stop_id_after_expression, "Expression calling doesn't change stop ID")
+ self.assertTrue(
+ stop_id_before_expression == stop_id_after_expression,
+ "Expression calling doesn't change stop ID")
- self.assertTrue (stop_id_after_including_expressions > stop_id_before_including_expressions, "Stop ID including expressions increments over expression call.")
+ self.assertTrue(
+ stop_id_after_including_expressions > stop_id_before_including_expressions,
+ "Stop ID including expressions increments over expression call.")
- # Do the same thing with an expression that's going to crash, and make sure we are still unchanged.
+ # Do the same thing with an expression that's going to crash, and make
+ # sure we are still unchanged.
- frame.EvaluateExpression ("((char *) 0)[0] = 'a'")
+ frame.EvaluateExpression("((char *) 0)[0] = 'a'")
frame = thread.GetFrameAtIndex(0)
- self.assertTrue (current_line == frame.GetLineEntry().GetLine(), "The line stayed the same after expression.")
- self.assertTrue (current_file == frame.GetLineEntry().GetFileSpec(), "The file stayed the same after expression.")
- self.assertTrue (thread.GetStopReason() == lldb.eStopReasonBreakpoint, "We still say we stopped for a breakpoint.")
- self.assertTrue (thread.GetStopReasonDataAtIndex(0) == current_bp[0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.")
+ self.assertTrue(
+ current_line == frame.GetLineEntry().GetLine(),
+ "The line stayed the same after expression.")
+ self.assertTrue(
+ current_file == frame.GetLineEntry().GetFileSpec(),
+ "The file stayed the same after expression.")
+ self.assertTrue(
+ thread.GetStopReason() == lldb.eStopReasonBreakpoint,
+ "We still say we stopped for a breakpoint.")
+ self.assertTrue(thread.GetStopReasonDataAtIndex(0) == current_bp[
+ 0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.")
# Now continue and make sure we just complete the step:
# Disable all our breakpoints first - sometimes the compiler puts two line table entries in for the
@@ -140,16 +171,17 @@ class TestCStepping(TestBase):
process.Continue()
- self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "a")
- self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete)
+ self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "a")
+ self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
# And one more time should get us back to main:
process.Continue()
- self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "main")
- self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete)
+ self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "main")
+ self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
- # Now make sure we can call a function, break in the called function, then have "continue" get us back out again:
+ # Now make sure we can call a function, break in the called function,
+ # then have "continue" get us back out again:
frame = thread.GetFrameAtIndex(0)
frame = thread.GetFrameAtIndex(0)
current_line = frame.GetLineEntry().GetLine()
@@ -160,12 +192,13 @@ class TestCStepping(TestBase):
options.SetIgnoreBreakpoints(False)
options.SetFetchDynamicValue(False)
options.SetUnwindOnError(False)
- frame.EvaluateExpression ("b (4)", options)
+ frame.EvaluateExpression("b (4)", options)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_b)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_in_b)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint in b when calling b.")
+ self.fail("Failed to stop at breakpoint in b when calling b.")
thread = threads[0]
# So do a step over here to make sure we can still do that:
@@ -174,75 +207,95 @@ class TestCStepping(TestBase):
# See that we are still in b:
func_name = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue (func_name == "b", "Should be in 'b', were in %s"%(func_name))
+ self.assertTrue(
+ func_name == "b",
+ "Should be in 'b', were in %s" %
+ (func_name))
- # Okay, now if we continue, we will finish off our function call and we should end up back in "a" as if nothing had happened:
- process.Continue ()
+ # Okay, now if we continue, we will finish off our function call and we
+ # should end up back in "a" as if nothing had happened:
+ process.Continue()
- self.assertTrue (thread.GetFrameAtIndex(0).GetLineEntry().GetLine() == current_line)
- self.assertTrue (thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec() == current_file)
+ self.assertTrue(thread.GetFrameAtIndex(
+ 0).GetLineEntry().GetLine() == current_line)
+ self.assertTrue(thread.GetFrameAtIndex(
+ 0).GetLineEntry().GetFileSpec() == current_file)
# Now we are going to test step in targeting a function:
- break_in_b.SetEnabled (False)
+ break_in_b.SetEnabled(False)
- break_before_complex_1 = target.BreakpointCreateBySourceRegex ('// Stop here to try step in targeting b.', self.main_source_spec)
+ break_before_complex_1 = target.BreakpointCreateBySourceRegex(
+ '// Stop here to try step in targeting b.', self.main_source_spec)
self.assertTrue(break_before_complex_1, VALID_BREAKPOINT)
- break_before_complex_2 = target.BreakpointCreateBySourceRegex ('// Stop here to try step in targeting complex.', self.main_source_spec)
+ break_before_complex_2 = target.BreakpointCreateBySourceRegex(
+ '// Stop here to try step in targeting complex.', self.main_source_spec)
self.assertTrue(break_before_complex_2, VALID_BREAKPOINT)
- break_before_complex_3 = target.BreakpointCreateBySourceRegex ('// Stop here to step targeting b and hitting breakpoint.', self.main_source_spec)
+ break_before_complex_3 = target.BreakpointCreateBySourceRegex(
+ '// Stop here to step targeting b and hitting breakpoint.', self.main_source_spec)
self.assertTrue(break_before_complex_3, VALID_BREAKPOINT)
- break_before_complex_4 = target.BreakpointCreateBySourceRegex ('// Stop here to make sure bogus target steps over.', self.main_source_spec)
+ break_before_complex_4 = target.BreakpointCreateBySourceRegex(
+ '// Stop here to make sure bogus target steps over.', self.main_source_spec)
self.assertTrue(break_before_complex_4, VALID_BREAKPOINT)
- threads = lldbutil.continue_to_breakpoint(process, break_before_complex_1)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.continue_to_breakpoint(
+ process, break_before_complex_1)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
break_before_complex_1.SetEnabled(False)
- thread.StepInto ("b")
- self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "b")
+ thread.StepInto("b")
+ self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "b")
- # Now continue out and stop at the next call to complex. This time step all the way into complex:
- threads = lldbutil.continue_to_breakpoint (process, break_before_complex_2)
- self.assertTrue (len(threads) == 1)
+ # Now continue out and stop at the next call to complex. This time
+ # step all the way into complex:
+ threads = lldbutil.continue_to_breakpoint(
+ process, break_before_complex_2)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
break_before_complex_2.SetEnabled(False)
- thread.StepInto ("complex")
- self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "complex")
-
- # Now continue out and stop at the next call to complex. This time enable breakpoints in a and c and then step targeting b:
- threads = lldbutil.continue_to_breakpoint (process, break_before_complex_3)
- self.assertTrue (len(threads) == 1)
+ thread.StepInto("complex")
+ self.assertTrue(thread.GetFrameAtIndex(
+ 0).GetFunctionName() == "complex")
+
+ # Now continue out and stop at the next call to complex. This time
+ # enable breakpoints in a and c and then step targeting b:
+ threads = lldbutil.continue_to_breakpoint(
+ process, break_before_complex_3)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
break_before_complex_3.SetEnabled(False)
- break_at_start_of_a = target.BreakpointCreateByName ('a')
- break_at_start_of_c = target.BreakpointCreateByName ('c')
+ break_at_start_of_a = target.BreakpointCreateByName('a')
+ break_at_start_of_c = target.BreakpointCreateByName('c')
- thread.StepInto ("b")
- threads = lldbutil.get_stopped_threads(process, lldb.eStopReasonBreakpoint);
+ thread.StepInto("b")
+ threads = lldbutil.get_stopped_threads(
+ process, lldb.eStopReasonBreakpoint)
- self.assertTrue (len(threads) == 1)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
stop_break_id = thread.GetStopReasonDataAtIndex(0)
- self.assertTrue(stop_break_id == break_at_start_of_a.GetID() or stop_break_id == break_at_start_of_c.GetID())
+ self.assertTrue(stop_break_id == break_at_start_of_a.GetID()
+ or stop_break_id == break_at_start_of_c.GetID())
break_at_start_of_a.SetEnabled(False)
break_at_start_of_c.SetEnabled(False)
process.Continue()
- self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "b")
-
- # Now continue out and stop at the next call to complex. This time enable breakpoints in a and c and then step targeting b:
- threads = lldbutil.continue_to_breakpoint (process, break_before_complex_4)
- self.assertTrue (len(threads) == 1)
+ self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "b")
+
+ # Now continue out and stop at the next call to complex. This time
+ # enable breakpoints in a and c and then step targeting b:
+ threads = lldbutil.continue_to_breakpoint(
+ process, break_before_complex_4)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
break_before_complex_4.SetEnabled(False)
thread.StepInto("NoSuchFunction")
- self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "main")
+ self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "main")
diff --git a/packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py b/packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py
index c3ed3f933ab0..c436000d882f 100644
--- a/packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py
+++ b/packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py
@@ -5,14 +5,15 @@ Test thread stepping features in combination with frame select.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class ThreadSteppingTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,10 +22,14 @@ class ThreadSteppingTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to of function 'c'.
- self.line1 = line_number('main.c', '// Find the line number of function "c" here.')
- self.line2 = line_number('main.c', '// frame select 2, thread step-out while stopped at "c(1)"')
- self.line3 = line_number('main.c', '// thread step-out while stopped at "c(2)"')
- self.line4 = line_number('main.c', '// frame select 1, thread step-out while stopped at "c(3)"')
+ self.line1 = line_number(
+ 'main.c', '// Find the line number of function "c" here.')
+ self.line2 = line_number(
+ 'main.c', '// frame select 2, thread step-out while stopped at "c(1)"')
+ self.line3 = line_number(
+ 'main.c', '// thread step-out while stopped at "c(2)"')
+ self.line4 = line_number(
+ 'main.c', '// frame select 1, thread step-out while stopped at "c(3)"')
def test_step_out_with_run_command(self):
"""Exercise thread step-out and frame select followed by thread step-out."""
@@ -33,49 +38,50 @@ class ThreadSteppingTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Create a breakpoint inside function 'c'.
- 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.line1, num_expected_locations=1, loc_exact=True)
# Now run the program.
self.runCmd("run", RUN_SUCCEEDED)
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
# The frame #0 should correspond to main.c:32, the executable statement
# in function name 'c'. And frame #3 should point to main.c:37.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint"],
- patterns = ["frame #0.*main.c:%d" % self.line1,
- "frame #3.*main.c:%d" % self.line2])
+ substrs=["stop reason = breakpoint"],
+ patterns=["frame #0.*main.c:%d" % self.line1,
+ "frame #3.*main.c:%d" % self.line2])
# We want to move the pc to frame #3. This can be accomplished by
# 'frame select 2', followed by 'thread step-out'.
self.runCmd("frame select 2")
self.runCmd("thread step-out")
self.expect("thread backtrace", STEP_OUT_SUCCEEDED,
- substrs = ["stop reason = step out"],
- patterns = ["frame #0.*main.c:%d" % self.line2])
+ substrs=["stop reason = step out"],
+ patterns=["frame #0.*main.c:%d" % self.line2])
# Let's move on to a single step-out case.
self.runCmd("process continue")
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
self.runCmd("thread step-out")
self.expect("thread backtrace", STEP_OUT_SUCCEEDED,
- substrs = ["stop reason = step out"],
- patterns = ["frame #0.*main.c:%d" % self.line3])
+ substrs=["stop reason = step out"],
+ patterns=["frame #0.*main.c:%d" % self.line3])
# Do another frame selct, followed by thread step-out.
self.runCmd("process continue")
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
self.runCmd("frame select 1")
self.runCmd("thread step-out")
self.expect("thread backtrace", STEP_OUT_SUCCEEDED,
- substrs = ["stop reason = step out"],
- patterns = ["frame #0.*main.c:%d" % self.line4])
+ substrs=["stop reason = step out"],
+ patterns=["frame #0.*main.c:%d" % self.line4])
diff --git a/packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py b/packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py
index a9f49c30d101..27821845e280 100644
--- a/packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py
+++ b/packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py
@@ -6,10 +6,11 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CStringsTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
+
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
def test_with_run_command(self):
"""Tests that C strings work as expected in expressions"""
@@ -17,39 +18,40 @@ class CStringsTestCase(TestBase):
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
line = line_number('main.c', '// breakpoint 1')
- lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", line, num_expected_locations=1, loc_exact=True)
self.runCmd("process launch", RUN_SUCCEEDED)
self.expect("expression -- a[2]",
- patterns = ["\((const )?char\) \$0 = 'c'"])
+ patterns=["\((const )?char\) \$0 = 'c'"])
self.expect("expression -- z[2]",
- startstr = "(const char) $1 = 'x'")
+ startstr="(const char) $1 = 'x'")
# On Linux, the expression below will test GNU indirect function calls.
self.expect("expression -- (int)strlen(\"hello\")",
- startstr = "(int) $2 = 5")
+ startstr="(int) $2 = 5")
self.expect("expression -- \"world\"[2]",
- startstr = "(const char) $3 = 'r'")
+ startstr="(const char) $3 = 'r'")
self.expect("expression -- \"\"[0]",
- startstr = "(const char) $4 = '\\0'")
+ startstr="(const char) $4 = '\\0'")
self.expect("expr --raw -- \"hello\"",
- substrs = ['[0] = \'h\'',
- '[5] = \'\\0\''])
+ substrs=['[0] = \'h\'',
+ '[5] = \'\\0\''])
self.expect("p \"hello\"",
- substrs = ['[6]) $', 'hello'])
+ substrs=['[6]) $', 'hello'])
self.expect("p (char*)\"hello\"",
- substrs = ['(char *) $', ' = 0x',
- 'hello'])
+ substrs=['(char *) $', ' = 0x',
+ 'hello'])
self.expect("p (int)strlen(\"\")",
- substrs = ['(int) $', ' = 0'])
+ substrs=['(int) $', ' = 0'])
self.expect("expression !z",
- substrs = ['false'])
+ substrs=['false'])
diff --git a/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py b/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py
index 2249a8c9b16a..af362f5be5d7 100644
--- a/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py
+++ b/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py
@@ -1,4 +1,7 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")] )
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.expectedFailureAll(
+ oslist=["windows"], bugnumber="llvm.org/pr24764")])
diff --git a/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py b/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
index 0ca9923c89a6..c6952d4d904a 100644
--- a/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
+++ b/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
@@ -3,14 +3,15 @@
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TlsGlobalTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,15 +20,31 @@ class TlsGlobalTestCase(TestBase):
TestBase.setUp(self)
if self.getPlatform() == "freebsd" or self.getPlatform() == "linux":
- # LD_LIBRARY_PATH must be set so the shared libraries are found on startup
+ # LD_LIBRARY_PATH must be set so the shared libraries are found on
+ # startup
if "LD_LIBRARY_PATH" in os.environ:
- self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.environ["LD_LIBRARY_PATH"] + ":" + os.getcwd())
+ self.runCmd(
+ "settings set target.env-vars " +
+ self.dylibPath +
+ "=" +
+ os.environ["LD_LIBRARY_PATH"] +
+ ":" +
+ os.getcwd())
else:
- self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd())
- self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath))
-
- @skipIfWindows # TLS works differently on Windows, this would need to be implemented separately.
- @expectedFailureAll(bugnumber="llvm.org/pr28392", oslist=no_match(lldbplatformutil.getDarwinOSTriples()))
+ self.runCmd("settings set target.env-vars " +
+ self.dylibPath + "=" + os.getcwd())
+ self.addTearDownHook(
+ lambda: self.runCmd(
+ "settings remove target.env-vars " +
+ self.dylibPath))
+
+ # TLS works differently on Windows, this would need to be implemented
+ # separately.
+ @skipIfWindows
+ @expectedFailureAll(
+ bugnumber="llvm.org/pr28392",
+ oslist=no_match(
+ lldbplatformutil.getDarwinOSTriples()))
def test(self):
"""Test thread-local storage."""
self.build()
@@ -35,14 +52,15 @@ class TlsGlobalTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
line1 = line_number('main.c', '// thread breakpoint')
- lldbutil.run_break_set_by_file_and_line (self, "main.c", line1, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", line1, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.runCmd("process status", "Get process status")
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# BUG: sometimes lldb doesn't change threads to the stopped thread.
# (unrelated to this test).
@@ -50,20 +68,21 @@ class TlsGlobalTestCase(TestBase):
# Check that TLS evaluates correctly within the thread.
self.expect("expr var_static", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\(int\) \$.* = 88"])
+ patterns=["\(int\) \$.* = 88"])
self.expect("expr var_shared", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\(int\) \$.* = 66"])
+ patterns=["\(int\) \$.* = 66"])
# Continue on the main thread
line2 = line_number('main.c', '// main breakpoint')
- lldbutil.run_break_set_by_file_and_line (self, "main.c", line2, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", line2, num_expected_locations=1, loc_exact=True)
self.runCmd("continue", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.runCmd("process status", "Get process status")
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# BUG: sometimes lldb doesn't change threads to the stopped thread.
# (unrelated to this test).
@@ -71,6 +90,6 @@ class TlsGlobalTestCase(TestBase):
# Check that TLS evaluates correctly within the main thread.
self.expect("expr var_static", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\(int\) \$.* = 44"])
+ patterns=["\(int\) \$.* = 44"])
self.expect("expr var_shared", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\(int\) \$.* = 33"])
+ patterns=["\(int\) \$.* = 33"])
diff --git a/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py b/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py
index 232a86a2cde3..71d00c5a9a67 100644
--- a/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py
+++ b/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py
@@ -3,19 +3,22 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TypedefTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(compiler="clang", bugnumber="llvm.org/pr19238")
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr25626 expectedFailureClang fails on FreeBSD")
+ @expectedFailureAll(
+ oslist=["freebsd"],
+ bugnumber="llvm.org/pr25626 expectedFailureClang fails on FreeBSD")
def test_typedef(self):
"""Test 'image lookup -t a' and check for correct display at different scopes."""
self.build()
@@ -25,17 +28,28 @@ class TypedefTestCase(TestBase):
"""Test 'image lookup -t a' at different scopes and check for correct display."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- typearray = ("float", "float", "char", "double *", "float", "int", "double", "float", "float")
- arraylen = len(typearray)+1
- for i in range(1,arraylen):
- loc_line = line_number('main.c', '// Set break point ' + str(i) + '.')
- lldbutil.run_break_set_by_file_and_line (self, "main.c",loc_line, num_expected_locations=1, loc_exact=True)
+ typearray = (
+ "float",
+ "float",
+ "char",
+ "double *",
+ "float",
+ "int",
+ "double",
+ "float",
+ "float")
+ arraylen = len(typearray) + 1
+ for i in range(1, arraylen):
+ loc_line = line_number(
+ 'main.c', '// Set break point ' + str(i) + '.')
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", loc_line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
for t in typearray:
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
self.expect("image lookup -t a", DATA_TYPES_DISPLAYED_CORRECTLY,
- substrs = ['name = "' + t + '"'])
+ substrs=['name = "' + t + '"'])
self.runCmd("continue")
diff --git a/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py b/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
index 114be3ade01a..496398b1d0ac 100644
--- a/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
+++ b/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
@@ -2,6 +2,7 @@ import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class TestUnionMembers(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -10,22 +11,29 @@ class TestUnionMembers(TestBase):
self._load_exe()
# Set breakpoints
- bp = self.target.BreakpointCreateBySourceRegex("Break here", self.src_file_spec)
- self.assertTrue(bp.IsValid() and bp.GetNumLocations() >= 1, VALID_BREAKPOINT)
+ bp = self.target.BreakpointCreateBySourceRegex(
+ "Break here", self.src_file_spec)
+ self.assertTrue(
+ bp.IsValid() and bp.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
# Launch the process
- self.process = self.target.LaunchSimple(None, None, self.get_process_working_directory())
+ self.process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(self.process.IsValid(), PROCESS_IS_VALID)
- self.assertTrue(self.process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+ self.assertTrue(
+ self.process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ self.process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid())
frame = thread.GetSelectedFrame()
self.assertTrue(frame.IsValid())
- val = frame.EvaluateExpression("u");
+ val = frame.EvaluateExpression("u")
self.assertTrue(val.IsValid())
- val = frame.EvaluateExpression("u.s");
+ val = frame.EvaluateExpression("u.s")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetNumChildren(), 2)
@@ -39,7 +47,7 @@ class TestUnionMembers(TestBase):
self.assertTrue(self.src_file_spec.IsValid(), "breakpoint file")
# Get the path of the executable
- exe_path = os.path.join(cwd, 'a.out')
+ exe_path = os.path.join(cwd, 'a.out')
# Load the executable
self.target = self.dbg.CreateTarget(exe_path)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py b/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
index ea210a1e9ea2..1fb7a5217495 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/auto/TestCPPAuto.py
@@ -6,11 +6,14 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CPPAutoTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(compiler="gcc", bugnumber="GCC generates incomplete debug info")
+ @expectedFailureAll(
+ compiler="gcc",
+ bugnumber="GCC generates incomplete debug info")
@expectedFailureAll(oslist=['windows'], bugnumber="llvm.org/pr26339")
def test_with_run_command(self):
"""Test that auto types work in the expression parser"""
@@ -18,10 +21,20 @@ class CPPAutoTestCase(TestBase):
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
line = line_number('main.cpp', '// break here')
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
self.runCmd("process launch", RUN_SUCCEEDED)
self.expect('expr auto f = 123456; f', substrs=['int', '123456'])
- self.expect('expr struct Test { int x; int y; Test() : x(123), y(456) {} }; auto t = Test(); t', substrs=['Test', '123', '456'])
- self.expect('expr auto s = helloworld; s', substrs=['string', 'hello world'])
+ self.expect(
+ 'expr struct Test { int x; int y; Test() : x(123), y(456) {} }; auto t = Test(); t',
+ substrs=[
+ 'Test',
+ '123',
+ '456'])
+ self.expect(
+ 'expr auto s = helloworld; s',
+ substrs=[
+ 'string',
+ 'hello world'])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/bool/TestCPPBool.py b/packages/Python/lldbsuite/test/lang/cpp/bool/TestCPPBool.py
index ef7135cfaa07..01f8cbacc360 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/bool/TestCPPBool.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/bool/TestCPPBool.py
@@ -5,22 +5,24 @@ import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class CPPBoolTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
+
def test_with_run_command(self):
"""Test that bool types work in the expression parser"""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
line = line_number('main.cpp', '// breakpoint 1')
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
self.runCmd("process launch", RUN_SUCCEEDED)
self.expect("expression -- bool second_bool = my_bool; second_bool",
- startstr = "(bool) $0 = false")
+ startstr="(bool) $0 = false")
self.expect("expression -- my_bool = true",
- startstr = "(bool) $1 = true")
+ startstr="(bool) $1 = true")
diff --git a/packages/Python/lldbsuite/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py b/packages/Python/lldbsuite/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py
index 0a1ac11adcea..81787e1e2260 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/breakpoint-commands/TestCPPBreakpointCommands.py
@@ -5,82 +5,82 @@ Test lldb breakpoint command for CPP methods & functions in a namespace.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CPPBreakpointCommandsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["windows"])
- def test(self):
+ def make_breakpoint(self, name, type, expected_num_locations):
+ bkpt = self.target.BreakpointCreateByName(name,
+ type,
+ self.a_out_module,
+ self.nested_comp_unit)
+ num_locations = bkpt.GetNumLocations()
+ self.assertTrue(
+ num_locations == expected_num_locations,
+ "Wrong number of locations for '%s', expected: %d got: %d" %
+ (name,
+ expected_num_locations,
+ num_locations))
+ return bkpt
+
+ def test_cpp_breakpoint_cmds(self):
"""Test a sequence of breakpoint command add, list, and delete."""
self.build()
+
exe = os.path.join(os.getcwd(), "a.out")
# Create a target from the debugger.
- target = self.dbg.CreateTarget (exe)
- self.assertTrue(target, VALID_TARGET)
+ self.target = self.dbg.CreateTarget(exe)
+ self.assertTrue(self.target, VALID_TARGET)
- a_out_module = lldb.SBFileSpecList()
- a_out_module.Append(lldb.SBFileSpec(exe))
+ self.a_out_module = lldb.SBFileSpecList()
+ self.a_out_module.Append(lldb.SBFileSpec(exe))
- nested_comp_unit = lldb.SBFileSpecList()
- nested_comp_unit.Append (lldb.SBFileSpec("nested.cpp"))
+ self.nested_comp_unit = lldb.SBFileSpecList()
+ self.nested_comp_unit.Append(lldb.SBFileSpec("nested.cpp"))
# First provide ONLY the method name. This should get everybody...
- auto_break = target.BreakpointCreateByName ("Function",
- lldb.eFunctionNameTypeAuto,
- a_out_module,
- nested_comp_unit)
- self.assertTrue (auto_break.GetNumLocations() == 5)
+ self.make_breakpoint("Function",
+ lldb.eFunctionNameTypeAuto,
+ 5)
# Now add the Baz class specifier. This should get the version contained in Bar,
# AND the one contained in ::
- auto_break = target.BreakpointCreateByName ("Baz::Function",
- lldb.eFunctionNameTypeAuto,
- a_out_module,
- nested_comp_unit)
- self.assertTrue (auto_break.GetNumLocations() == 2)
-
- # Then add the Bar::Baz specifier. This should get the version contained in Bar only
- auto_break = target.BreakpointCreateByName ("Bar::Baz::Function",
- lldb.eFunctionNameTypeAuto,
- a_out_module,
- nested_comp_unit)
- self.assertTrue (auto_break.GetNumLocations() == 1)
-
- plain_method_break = target.BreakpointCreateByName ("Function",
- lldb.eFunctionNameTypeMethod,
- a_out_module,
- nested_comp_unit)
- self.assertTrue (plain_method_break.GetNumLocations() == 3)
-
- plain_method_break = target.BreakpointCreateByName ("Baz::Function",
- lldb.eFunctionNameTypeMethod,
- a_out_module,
- nested_comp_unit)
- self.assertTrue (plain_method_break.GetNumLocations() == 2)
-
- plain_method_break = target.BreakpointCreateByName ("Bar::Baz::Function",
- lldb.eFunctionNameTypeMethod,
- a_out_module,
- nested_comp_unit)
- self.assertTrue (plain_method_break.GetNumLocations() == 1)
-
- plain_method_break = target.BreakpointCreateByName ("Function",
- lldb.eFunctionNameTypeBase,
- a_out_module,
- nested_comp_unit)
- self.assertTrue (plain_method_break.GetNumLocations() == 2)
-
- plain_method_break = target.BreakpointCreateByName ("Bar::Function",
- lldb.eFunctionNameTypeBase,
- a_out_module,
- nested_comp_unit)
- self.assertTrue (plain_method_break.GetNumLocations() == 1)
+ self.make_breakpoint("Baz::Function",
+ lldb.eFunctionNameTypeAuto,
+ 2)
+
+ # Then add the Bar::Baz specifier. This should get the version
+ # contained in Bar only
+ self.make_breakpoint("Bar::Baz::Function",
+ lldb.eFunctionNameTypeAuto,
+ 1)
+
+ self.make_breakpoint("Function",
+ lldb.eFunctionNameTypeMethod,
+ 3)
+
+ self.make_breakpoint("Baz::Function",
+ lldb.eFunctionNameTypeMethod,
+ 2)
+
+ self.make_breakpoint("Bar::Baz::Function",
+ lldb.eFunctionNameTypeMethod,
+ 1)
+
+ self.make_breakpoint("Function",
+ lldb.eFunctionNameTypeBase,
+ 2)
+
+ self.make_breakpoint("Bar::Function",
+ lldb.eFunctionNameTypeBase,
+ 1)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/breakpoint-commands/nested.cpp b/packages/Python/lldbsuite/test/lang/cpp/breakpoint-commands/nested.cpp
index 29d4b4cb19e7..740649622cab 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/breakpoint-commands/nested.cpp
+++ b/packages/Python/lldbsuite/test/lang/cpp/breakpoint-commands/nested.cpp
@@ -11,7 +11,7 @@ namespace Foo
int Function ()
{
printf ("%s returning: %d.\n", __FUNCTION__, m_value);
- return m_value;
+ return m_value + 1;
}
private:
int m_value;
@@ -24,7 +24,7 @@ namespace Foo
int Function ()
{
printf ("%s returning: %d.\n", __FUNCTION__, m_value);
- return m_value;
+ return m_value + 2;
}
private:
int m_value;
@@ -34,7 +34,7 @@ namespace Foo
int Function ()
{
printf ("%s returning: %d.\n", __FUNCTION__, bar_value);
- return bar_value;
+ return bar_value + 3;
}
}
}
@@ -46,7 +46,7 @@ public:
int Function ()
{
printf ("%s returning: %d.\n", __FUNCTION__, m_value);
- return m_value;
+ return m_value + 4;
}
private:
int m_value;
diff --git a/packages/Python/lldbsuite/test/lang/cpp/call-function/TestCallCPPFunction.py b/packages/Python/lldbsuite/test/lang/cpp/call-function/TestCallCPPFunction.py
index 260dd763c007..b86cd2ac9c77 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/call-function/TestCallCPPFunction.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/call-function/TestCallCPPFunction.py
@@ -7,28 +7,32 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CallCPPFunctionTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
+
def setUp(self):
TestBase.setUp(self)
self.line = line_number('main.cpp', '// breakpoint')
-
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
def test_with_run_command(self):
"""Test calling a function by basename"""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, 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("process launch", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list",
STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
self.expect("expression -- a_function_to_call()",
- startstr = "(int) $0 = 0")
+ startstr="(int) $0 = 0")
diff --git a/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py b/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py
index 140c4a832fd9..0145bee3fc5c 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/chained-calls/TestCppChainedCalls.py
@@ -3,6 +3,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestCppChainedCalls(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -17,58 +18,85 @@ class TestCppChainedCalls(TestBase):
self.assertTrue(src_file_spec.IsValid(), "Main source file")
# Get the path of the executable
- cwd = os.getcwd()
+ cwd = os.getcwd()
exe_file = "a.out"
- exe_path = os.path.join(cwd, exe_file)
+ exe_path = os.path.join(cwd, exe_file)
# Load the executable
target = self.dbg.CreateTarget(exe_path)
self.assertTrue(target.IsValid(), VALID_TARGET)
# Break on main function
- main_breakpoint = target.BreakpointCreateBySourceRegex("break here", src_file_spec)
- self.assertTrue(main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
+ main_breakpoint = target.BreakpointCreateBySourceRegex(
+ "break here", src_file_spec)
+ self.assertTrue(
+ main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
# Launch the process
args = None
env = None
- process = target.LaunchSimple(args, env, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ args, env, self.get_process_working_directory())
self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
# Get the thread of the process
- self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
# Get frame for current thread
frame = thread.GetSelectedFrame()
# Test chained calls
test_result = frame.EvaluateExpression("get(set(true))")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "true", "get(set(true)) = true")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "true",
+ "get(set(true)) = true")
test_result = frame.EvaluateExpression("get(set(false))")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(set(false)) = false")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "false",
+ "get(set(false)) = false")
test_result = frame.EvaluateExpression("get(t & f)")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(t & f) = false")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "false",
+ "get(t & f) = false")
test_result = frame.EvaluateExpression("get(f & t)")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(f & t) = false")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "false",
+ "get(f & t) = false")
test_result = frame.EvaluateExpression("get(t & t)")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "true", "get(t & t) = true")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "true",
+ "get(t & t) = true")
test_result = frame.EvaluateExpression("get(f & f)")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(f & f) = false")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "false",
+ "get(f & f) = false")
test_result = frame.EvaluateExpression("get(t & f)")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(t & f) = false")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "false",
+ "get(t & f) = false")
test_result = frame.EvaluateExpression("get(f) && get(t)")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(f) && get(t) = false")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "false",
+ "get(f) && get(t) = false")
test_result = frame.EvaluateExpression("get(f) && get(f)")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "get(f) && get(t) = false")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "false",
+ "get(f) && get(t) = false")
test_result = frame.EvaluateExpression("get(t) && get(t)")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "true", "get(t) && get(t) = true")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "true",
+ "get(t) && get(t) = true")
diff --git a/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py b/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py
index d4400d3a488d..bf8605106adb 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/char1632_t/TestChar1632T.py
@@ -6,13 +6,14 @@ Test that the C++11 support for char16_t and char32_t works correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class Char1632TestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,10 +23,12 @@ class Char1632TestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break for main.cpp.
self.source = 'main.cpp'
- self.lines = [ line_number(self.source, '// breakpoint1'),
- line_number(self.source, '// breakpoint2') ]
+ self.lines = [line_number(self.source, '// breakpoint1'),
+ line_number(self.source, '// breakpoint2')]
- @expectedFailureAll(compiler="icc", bugnumber="ICC (13.1) does not emit the DW_TAG_base_type for char16_t and char32_t.")
+ @expectedFailureAll(
+ compiler="icc",
+ bugnumber="ICC (13.1) does not emit the DW_TAG_base_type for char16_t and char32_t.")
def test(self):
"""Test that the C++11 support for char16_t and char32_t works correctly."""
self.build()
@@ -37,54 +40,83 @@ class Char1632TestCase(TestBase):
# Set breakpoints
for line in self.lines:
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line)
+ lldbutil.run_break_set_by_file_and_line(self, "main.cpp", line)
- # Now launch the process, and do not stop at entry point and stop at breakpoint1
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ # Now launch the process, and do not stop at entry point and stop at
+ # breakpoint1
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.Launch() failed")
if self.TraceOn():
- self.runCmd("frame variable")
+ self.runCmd("frame variable")
# Check that we correctly report the const types
- self.expect("frame variable cs16 cs32",
- substrs = ['(const char16_t *) cs16 = ','(const char32_t *) cs32 = ','u"hello world ྒྙྐ"','U"hello world ྒྙྐ"'])
+ self.expect(
+ "frame variable cs16 cs32",
+ substrs=[
+ '(const char16_t *) cs16 = ',
+ '(const char32_t *) cs32 = ',
+ 'u"hello world ྒྙྐ"',
+ 'U"hello world ྒྙྐ"'])
# Check that we correctly report the non-const types
- self.expect("frame variable s16 s32",
- substrs = ['(char16_t *) s16 = ','(char32_t *) s32 = ','u"ﺸﺵۻ"','U"ЕЙРГЖО"'])
+ self.expect(
+ "frame variable s16 s32",
+ substrs=[
+ '(char16_t *) s16 = ',
+ '(char32_t *) s32 = ',
+ 'u"ﺸﺵۻ"',
+ 'U"ЕЙРГЖО"'])
# Check that we correctly report the array types
- self.expect("frame variable as16 as32",
- patterns = ['\(char16_t \[[0-9]+\]\) as16 = ', '\(char32_t \[[0-9]+\]\) as32 = '],
- substrs = ['u"ﺸﺵۻ"','U"ЕЙРГЖО"'])
+ self.expect(
+ "frame variable as16 as32",
+ patterns=[
+ '\(char16_t \[[0-9]+\]\) as16 = ',
+ '\(char32_t \[[0-9]+\]\) as32 = '],
+ substrs=[
+ 'u"ﺸﺵۻ"',
+ 'U"ЕЙРГЖО"'])
- self.runCmd("next") # step to after the string is nullified
+ self.runCmd("next") # step to after the string is nullified
# check that we don't crash on NULL
self.expect("frame variable s32",
- substrs = ['(char32_t *) s32 = 0x00000000'])
+ substrs=['(char32_t *) s32 = 0x00000000'])
# continue and hit breakpoint2
self.runCmd("continue")
# check that the new strings show
- self.expect("frame variable s16 s32",
- substrs = ['(char16_t *) s16 = 0x','(char32_t *) s32 = ','"色ハ匂ヘト散リヌルヲ"','"෴"'])
+ self.expect(
+ "frame variable s16 s32",
+ substrs=[
+ '(char16_t *) s16 = 0x',
+ '(char32_t *) s32 = ',
+ '"色ハ匂ヘト散リヌルヲ"',
+ '"෴"'])
# check the same as above for arrays
- self.expect("frame variable as16 as32",
- patterns = ['\(char16_t \[[0-9]+\]\) as16 = ', '\(char32_t \[[0-9]+\]\) as32 = '],
- substrs = ['"色ハ匂ヘト散リヌルヲ"','"෴"'])
+ self.expect(
+ "frame variable as16 as32",
+ patterns=[
+ '\(char16_t \[[0-9]+\]\) as16 = ',
+ '\(char32_t \[[0-9]+\]\) as32 = '],
+ substrs=[
+ '"色ハ匂ヘト散リヌルヲ"',
+ '"෴"'])
# check that zero values are properly handles
self.expect('frame variable cs16_zero', substrs=["U+0000 u'\\0'"])
- self.expect('frame variable cs32_zero', substrs=["U+0x00000000 U'\\0'"])
+ self.expect(
+ 'frame variable cs32_zero',
+ substrs=["U+0x00000000 U'\\0'"])
self.expect('expression cs16_zero', substrs=["U+0000 u'\\0'"])
self.expect('expression cs32_zero', substrs=["U+0x00000000 U'\\0'"])
# Check that we can run expressions that return charN_t
- self.expect("expression u'a'",substrs = ['(char16_t) $',"61 u'a'"])
- self.expect("expression U'a'",substrs = ['(char32_t) $',"61 U'a'"])
+ self.expect("expression u'a'", substrs=['(char16_t) $', "61 u'a'"])
+ self.expect("expression U'a'", substrs=['(char32_t) $', "61 U'a'"])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py b/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py
index acce769bf949..10e29e9899dc 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/class_static/TestStaticVariables.py
@@ -5,13 +5,14 @@ Test display and Python APIs on file and class static variables.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class StaticVariableTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -28,30 +29,44 @@ class StaticVariableTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, 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("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- # global variables are no longer displayed with the "frame variable" command.
- self.expect('target variable A::g_points', VARIABLES_DISPLAYED_CORRECTLY,
- patterns=['\(PointType \[[1-9]*\]\) A::g_points = {.*}'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+ # global variables are no longer displayed with the "frame variable"
+ # command.
+ self.expect(
+ 'target variable A::g_points',
+ VARIABLES_DISPLAYED_CORRECTLY,
+ patterns=['\(PointType \[[1-9]*\]\) A::g_points = {'])
self.expect('target variable g_points', VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(PointType [2]) g_points'])
+ substrs=['(PointType [2]) g_points'])
# On Mac OS X, gcc 4.2 emits the wrong debug info for A::g_points.
# A::g_points is an array of two elements.
if self.platformIsDarwin() or self.getPlatform() == "linux":
- self.expect("target variable A::g_points[1].x", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(int) A::g_points[1].x = 11")
-
- @expectedFailureDarwin(9980907)
- @expectedFailureAll(compiler=["clang", "gcc"], bugnumber="Compiler emits incomplete debug info")
- @expectedFailureAll(oslist=['freebsd'], bugnumber='llvm.org/pr20550 failing on FreeBSD-11')
+ self.expect(
+ "target variable A::g_points[1].x",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(int) A::g_points[1].x = 11")
+
+ @expectedFailureAll(
+ oslist=lldbplatformutil.getDarwinOSTriples(),
+ bugnumber="<rdar://problem/28706946>")
+ @expectedFailureAll(
+ compiler=[
+ "clang",
+ "gcc"],
+ bugnumber="Compiler emits incomplete debug info")
+ @expectedFailureAll(
+ oslist=['freebsd'],
+ bugnumber='llvm.org/pr20550 failing on FreeBSD-11')
@add_test_categories(['pyapi'])
def test_with_python_api(self):
"""Test Python APIs on file and class static variables."""
@@ -65,11 +80,13 @@ class StaticVariableTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
# Get the SBValue of 'A::g_points' and 'g_points'.
@@ -86,10 +103,12 @@ class StaticVariableTestCase(TestBase):
name = val.GetName()
self.assertTrue(name in ['g_points', 'A::g_points'])
if name == 'g_points':
- self.assertTrue(val.GetValueType() == lldb.eValueTypeVariableStatic)
+ self.assertTrue(
+ val.GetValueType() == lldb.eValueTypeVariableStatic)
self.assertTrue(val.GetNumChildren() == 2)
elif name == 'A::g_points':
- self.assertTrue(val.GetValueType() == lldb.eValueTypeVariableGlobal)
+ self.assertTrue(
+ val.GetValueType() == lldb.eValueTypeVariableGlobal)
self.assertTrue(val.GetNumChildren() == 2)
child1 = val.GetChildAtIndex(1)
self.DebugSBValue(child1)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py b/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py
index fe10120d497e..c915e4b32fad 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypes.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ClassTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -27,7 +28,8 @@ class ClassTypesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break on the ctor function of class C.
- 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.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
@@ -40,17 +42,20 @@ class ClassTypesTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# We should be stopped on the ctor function of class C.
- self.expect("frame variable --show-types this", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['C *',
- ' this = '])
+ self.expect(
+ "frame variable --show-types this",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'C *',
+ ' this = '])
@add_test_categories(['pyapi'])
def test_with_python_api(self):
@@ -77,11 +82,12 @@ class ClassTypesTestCase(TestBase):
# Verify the breakpoint just created.
self.expect(str(breakpoint), BREAKPOINT_CREATED, exe=False,
- substrs = ['main.cpp',
- str(self.line)])
+ substrs=['main.cpp',
+ str(self.line)])
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.Launch() failed")
@@ -92,7 +98,8 @@ class ClassTypesTestCase(TestBase):
lldbutil.state_type_to_str(process.GetState()))
# The stop reason of the thread should be breakpoint.
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
# The filename of frame #0 should be 'main.cpp' and the line number
@@ -100,9 +107,9 @@ class ClassTypesTestCase(TestBase):
self.expect("%s:%d" % (lldbutil.get_filenames(thread)[0],
lldbutil.get_line_numbers(thread)[0]),
"Break correctly at main.cpp:%d" % self.line, exe=False,
- startstr = "main.cpp:")
- ### clang compiled code reported main.cpp:94?
- ### startstr = "main.cpp:93")
+ startstr="main.cpp:")
+ # clang compiled code reported main.cpp:94?
+ # startstr = "main.cpp:93")
# We should be stopped on the breakpoint with a hit count of 1.
self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE)
@@ -119,49 +126,54 @@ class ClassTypesTestCase(TestBase):
# Is this a case of clang (116.1) generating bad debug info?
#
# Break on the ctor function of class C.
- #self.expect("breakpoint set -M C", BREAKPOINT_CREATED,
+ # self.expect("breakpoint set -M C", BREAKPOINT_CREATED,
# startstr = "Breakpoint created: 1: name = 'C'")
- # Make the test case more robust by using line number to break, instead.
- lldbutil.run_break_set_by_file_and_line (self, None, self.line, num_expected_locations=-1)
+ # Make the test case more robust by using line number to break,
+ # instead.
+ lldbutil.run_break_set_by_file_and_line(
+ self, None, self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Continue on inside the ctor() body...
self.runCmd("register read pc")
self.runCmd("thread step-over")
# Verify that 'frame variable this' gets the data type correct.
- self.expect("frame variable this",VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['C *'])
+ self.expect("frame variable this", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['C *'])
- # Verify that frame variable --show-types this->m_c_int behaves correctly.
+ # Verify that frame variable --show-types this->m_c_int behaves
+ # correctly.
self.runCmd("register read pc")
self.runCmd("expr m_c_int")
- self.expect("frame variable --show-types this->m_c_int", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(int) this->m_c_int = 66')
+ self.expect(
+ "frame variable --show-types this->m_c_int",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(int) this->m_c_int = 66')
# Verify that 'expression this' gets the data type correct.
self.expect("expression this", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['C *'])
+ substrs=['C *'])
# rdar://problem/8430916
# expr this->m_c_int returns an incorrect value
#
# Verify that expr this->m_c_int behaves correctly.
self.expect("expression this->m_c_int", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ['\(int\) \$[0-9]+ = 66'])
+ patterns=['\(int\) \$[0-9]+ = 66'])
- def test_with_constructor_name (self):
+ def test_with_constructor_name(self):
"""Test 'frame variable this' and 'expr this' when stopped inside a constructor."""
self.build()
exe = os.path.join(os.getcwd(), "a.out")
@@ -185,11 +197,12 @@ class ClassTypesTestCase(TestBase):
# Verify the breakpoint just created.
self.expect(str(breakpoint), BREAKPOINT_CREATED, exe=False,
- substrs = ['main.cpp',
- str(self.line)])
+ substrs=['main.cpp',
+ str(self.line)])
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.Launch() failed")
@@ -200,10 +213,12 @@ class ClassTypesTestCase(TestBase):
lldbutil.state_type_to_str(process.GetState()))
# The stop reason of the thread should be breakpoint.
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
frame = thread.frames[0]
- self.assertTrue (frame.IsValid(), "Got a valid frame.")
+ self.assertTrue(frame.IsValid(), "Got a valid frame.")
- self.assertTrue ("C::C" in frame.name, "Constructor name includes class name.")
+ self.assertTrue("C::C" in frame.name,
+ "Constructor name includes class name.")
diff --git a/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py b/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py
index 6413b3e056ff..bc85ba5181e5 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/class_types/TestClassTypesDisassembly.py
@@ -5,13 +5,14 @@ Test the lldb disassemble command on each call frame when stopped on C's ctor.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class IterateFrameAndDisassembleTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -47,7 +48,8 @@ class IterateFrameAndDisassembleTestCase(TestBase):
# disassemble it.
target = self.dbg.GetSelectedTarget()
process = target.GetProcess()
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
depth = thread.GetNumFrames()
for i in range(depth - 1):
@@ -62,7 +64,8 @@ class IterateFrameAndDisassembleTestCase(TestBase):
insts = function.GetInstructions(target)
for inst in insts:
# We could simply do 'print inst' to print out the disassembly.
- # But we want to print to stdout only if self.TraceOn() is True.
+ # But we want to print to stdout only if self.TraceOn() is
+ # True.
disasm = str(inst)
if self.TraceOn():
print(disasm)
@@ -79,14 +82,15 @@ class IterateFrameAndDisassembleTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break on the ctor function of class C.
- bpno = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1)
+ bpno = lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=-1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint %d.'%(bpno)])
+ substrs=['stopped',
+ 'stop reason = breakpoint %d.' % (bpno)])
# This test was failing because we fail to put the C:: in front of constructore.
# We should maybe make another testcase to cover that specifically, but we shouldn't
diff --git a/packages/Python/lldbsuite/test/lang/cpp/const_this/TestConstThis.py b/packages/Python/lldbsuite/test/lang/cpp/const_this/TestConstThis.py
index a08af5d091e1..f08c0dcbda98 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/const_this/TestConstThis.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/const_this/TestConstThis.py
@@ -1,4 +1,4 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [] )
+lldbinline.MakeInlineTest(__file__, globals(), [])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py b/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py
index d525e12b31ee..c6f9d85cd2c8 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/diamond/TestDiamond.py
@@ -5,22 +5,25 @@ import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class CPPTestDiamondInheritance(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
+
def test_with_run_command(self):
"""Test that virtual base classes work in when SBValue objects are used to explore the variable value"""
self.build()
exe = os.path.join(os.getcwd(), "a.out")
-
+
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
self.set_breakpoint(line_number('main.cpp', '// breakpoint 1'))
self.set_breakpoint(line_number('main.cpp', '// breakpoint 2'))
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
frame = thread.GetFrameAtIndex(0)
j1 = frame.FindVariable("j1")
@@ -30,13 +33,19 @@ class CPPTestDiamondInheritance(TestBase):
j1_Derived2_VBase = j1_Derived2.GetChildAtIndex(0)
j1_Derived1_VBase_m_value = j1_Derived1_VBase.GetChildAtIndex(0)
j1_Derived2_VBase_m_value = j1_Derived2_VBase.GetChildAtIndex(0)
- self.assertTrue(j1_Derived1_VBase.GetLoadAddress() == j1_Derived2_VBase.GetLoadAddress(), "ensure virtual base class is the same between Derived1 and Derived2")
- self.assertTrue(j1_Derived1_VBase_m_value.GetValueAsUnsigned(1) == j1_Derived2_VBase_m_value.GetValueAsUnsigned(2), "ensure m_value in VBase is the same")
- self.assertTrue(frame.FindVariable("d").GetChildAtIndex(0).GetChildAtIndex(0).GetValueAsUnsigned(0) == 12345, "ensure Derived2 from j1 is correct");
+ self.assertTrue(
+ j1_Derived1_VBase.GetLoadAddress() == j1_Derived2_VBase.GetLoadAddress(),
+ "ensure virtual base class is the same between Derived1 and Derived2")
+ self.assertTrue(j1_Derived1_VBase_m_value.GetValueAsUnsigned(
+ 1) == j1_Derived2_VBase_m_value.GetValueAsUnsigned(2), "ensure m_value in VBase is the same")
+ self.assertTrue(frame.FindVariable("d").GetChildAtIndex(0).GetChildAtIndex(
+ 0).GetValueAsUnsigned(0) == 12345, "ensure Derived2 from j1 is correct")
thread.StepOver()
- self.assertTrue(frame.FindVariable("d").GetChildAtIndex(0).GetChildAtIndex(0).GetValueAsUnsigned(0) == 12346, "ensure Derived2 from j2 is correct");
-
+ self.assertTrue(frame.FindVariable("d").GetChildAtIndex(0).GetChildAtIndex(
+ 0).GetValueAsUnsigned(0) == 12346, "ensure Derived2 from j2 is correct")
+
def set_breakpoint(self, line):
# Some compilers (for example GCC 4.4.7 and 4.6.1) emit multiple locations for the statement with the ternary
# operator in the test program, while others emit only 1.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py b/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py
index b456de450a82..74b94517fa0f 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestCppValueCast.py
@@ -5,20 +5,22 @@ Test lldb Python API SBValue::Cast(SBType) for C++ types.
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CppValueCastTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @unittest2.expectedFailure("rdar://problem/10808472 SBValue::Cast test case is failing (virtual inheritance)")
+ @unittest2.expectedFailure(
+ "rdar://problem/10808472 SBValue::Cast test case is failing (virtual inheritance)")
@add_test_categories(['pyapi'])
def test_value_cast_with_virtual_inheritance(self):
"""Test SBValue::Cast(SBType) API for C++ types with virtual inheritance."""
@@ -34,23 +36,26 @@ class CppValueCastTestCase(TestBase):
self.do_sbvalue_cast(self.exe_name)
def setUp(self):
- # Call super's setUp().
+ # Call super's setUp().
TestBase.setUp(self)
- # Find the line number to break for main.c.
- self.source = 'sbvalue-cast.cpp';
+ # Find the line number to break for main.c.
+ self.source = 'sbvalue-cast.cpp'
self.line = line_number(self.source, '// Set breakpoint here.')
self.exe_name = self.testMethodName
- self.d_virtual = {'CXX_SOURCES': self.source, 'EXE': self.exe_name, 'CFLAGS_EXTRAS': '-DDO_VIRTUAL_INHERITANCE'}
+ self.d_virtual = {
+ 'CXX_SOURCES': self.source,
+ 'EXE': self.exe_name,
+ 'CFLAGS_EXTRAS': '-DDO_VIRTUAL_INHERITANCE'}
self.d_regular = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- def do_sbvalue_cast (self, exe_name):
+ def do_sbvalue_cast(self, exe_name):
"""Test SBValue::Cast(SBType) API for C++ types."""
exe = os.path.join(os.getcwd(), exe_name)
# Create a target from the debugger.
- target = self.dbg.CreateTarget (exe)
+ target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Set up our breakpoints:
@@ -59,7 +64,8 @@ class CppValueCastTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
@@ -74,14 +80,16 @@ class CppValueCastTestCase(TestBase):
error = lldb.SBError()
# First stop is for DerivedA instance.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
frame0 = thread.GetFrameAtIndex(0)
tellerA = frame0.FindVariable('teller', lldb.eNoDynamicValues)
self.DebugSBValue(tellerA)
- self.assertTrue(tellerA.GetChildMemberWithName('m_base_val').GetValueAsUnsigned(error, 0) == 20)
+ self.assertTrue(tellerA.GetChildMemberWithName(
+ 'm_base_val').GetValueAsUnsigned(error, 0) == 20)
if self.TraceOn():
for child in tellerA:
@@ -102,14 +110,15 @@ class CppValueCastTestCase(TestBase):
self.assertTrue(a_member_val.GetValueAsUnsigned(error, 0) == 10)
# Second stop is for DerivedB instance.
- threads = lldbutil.continue_to_breakpoint (process, breakpoint)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.continue_to_breakpoint(process, breakpoint)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
frame0 = thread.GetFrameAtIndex(0)
tellerB = frame0.FindVariable('teller', lldb.eNoDynamicValues)
self.DebugSBValue(tellerB)
- self.assertTrue(tellerB.GetChildMemberWithName('m_base_val').GetValueAsUnsigned(error, 0) == 12)
+ self.assertTrue(tellerB.GetChildMemberWithName(
+ 'm_base_val').GetValueAsUnsigned(error, 0) == 12)
if self.TraceOn():
for child in tellerB:
diff --git a/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestDynamicValue.py b/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestDynamicValue.py
index 98e6ef92665d..42db14f21e0c 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestDynamicValue.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/dynamic-value/TestDynamicValue.py
@@ -5,29 +5,32 @@ Use lldb Python API to test dynamic values in C++
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DynamicValueTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
- # Call super's setUp().
+ # Call super's setUp().
TestBase.setUp(self)
- # Find the line number to break for main.c.
+ # Find the line number to break for main.c.
- self.do_something_line = line_number('pass-to-base.cpp', '// Break here in doSomething.')
- self.main_first_call_line = line_number('pass-to-base.cpp',
- '// Break here and get real addresses of myB and otherB.')
- self.main_second_call_line = line_number('pass-to-base.cpp',
- '// Break here and get real address of reallyA.')
+ self.do_something_line = line_number(
+ 'pass-to-base.cpp', '// Break here in doSomething.')
+ self.main_first_call_line = line_number(
+ 'pass-to-base.cpp',
+ '// Break here and get real addresses of myB and otherB.')
+ self.main_second_call_line = line_number(
+ 'pass-to-base.cpp', '// Break here and get real address of reallyA.')
@add_test_categories(['pyapi'])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24663")
@@ -38,31 +41,36 @@ class DynamicValueTestCase(TestBase):
# Create a target from the debugger.
- target = self.dbg.CreateTarget (exe)
+ target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Set up our breakpoints:
- do_something_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.do_something_line)
+ do_something_bpt = target.BreakpointCreateByLocation(
+ 'pass-to-base.cpp', self.do_something_line)
self.assertTrue(do_something_bpt,
VALID_BREAKPOINT)
- first_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_first_call_line)
+ first_call_bpt = target.BreakpointCreateByLocation(
+ 'pass-to-base.cpp', self.main_first_call_line)
self.assertTrue(first_call_bpt,
VALID_BREAKPOINT)
- second_call_bpt = target.BreakpointCreateByLocation('pass-to-base.cpp', self.main_second_call_line)
+ second_call_bpt = target.BreakpointCreateByLocation(
+ 'pass-to-base.cpp', self.main_second_call_line)
self.assertTrue(second_call_bpt,
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, first_call_bpt)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, first_call_bpt)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
@@ -71,153 +79,175 @@ class DynamicValueTestCase(TestBase):
# with the dynamic values we get in doSomething:
use_dynamic = lldb.eDynamicCanRunTarget
- no_dynamic = lldb.eNoDynamicValues
+ no_dynamic = lldb.eNoDynamicValues
- myB = frame.FindVariable ('myB', no_dynamic);
- self.assertTrue (myB)
- myB_loc = int (myB.GetLocation(), 16)
+ myB = frame.FindVariable('myB', no_dynamic)
+ self.assertTrue(myB)
+ myB_loc = int(myB.GetLocation(), 16)
otherB = frame.FindVariable('otherB', no_dynamic)
- self.assertTrue (otherB)
- otherB_loc = int (otherB.GetLocation(), 16)
+ self.assertTrue(otherB)
+ otherB_loc = int(otherB.GetLocation(), 16)
# Okay now run to doSomething:
- threads = lldbutil.continue_to_breakpoint (process, do_something_bpt)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.continue_to_breakpoint(process, do_something_bpt)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
# Get "this" using FindVariable:
- this_static = frame.FindVariable ('this', no_dynamic)
- this_dynamic = frame.FindVariable ('this', use_dynamic)
- self.examine_value_object_of_this_ptr (this_static, this_dynamic, myB_loc)
-
+ this_static = frame.FindVariable('this', no_dynamic)
+ this_dynamic = frame.FindVariable('this', use_dynamic)
+ self.examine_value_object_of_this_ptr(
+ this_static, this_dynamic, myB_loc)
+
# Now make sure that the "GetDynamicValue" works:
- # This doesn't work currently because we can't get dynamic values from ConstResult objects.
+ # This doesn't work currently because we can't get dynamic values from
+ # ConstResult objects.
fetched_dynamic_value = this_static.GetDynamicValue(use_dynamic)
- self.examine_value_object_of_this_ptr (this_static, fetched_dynamic_value, myB_loc)
+ self.examine_value_object_of_this_ptr(
+ this_static, fetched_dynamic_value, myB_loc)
# And conversely that the GetDynamicValue() interface also works:
fetched_static_value = this_dynamic.GetStaticValue()
- self.examine_value_object_of_this_ptr (fetched_static_value, this_dynamic, myB_loc)
+ self.examine_value_object_of_this_ptr(
+ fetched_static_value, this_dynamic, myB_loc)
# Get "this" using FindValue, make sure that works too:
- this_static = frame.FindValue ('this', lldb.eValueTypeVariableArgument, no_dynamic)
- this_dynamic = frame.FindValue ('this', lldb.eValueTypeVariableArgument, use_dynamic)
- self.examine_value_object_of_this_ptr (this_static, this_dynamic, myB_loc)
+ this_static = frame.FindValue(
+ 'this', lldb.eValueTypeVariableArgument, no_dynamic)
+ this_dynamic = frame.FindValue(
+ 'this', lldb.eValueTypeVariableArgument, use_dynamic)
+ self.examine_value_object_of_this_ptr(
+ this_static, this_dynamic, myB_loc)
# Get "this" using the EvaluateExpression:
- this_static = frame.EvaluateExpression ('this', False)
- this_dynamic = frame.EvaluateExpression ('this', True)
- self.examine_value_object_of_this_ptr (this_static, this_dynamic, myB_loc)
-
+ this_static = frame.EvaluateExpression('this', False)
+ this_dynamic = frame.EvaluateExpression('this', True)
+ self.examine_value_object_of_this_ptr(
+ this_static, this_dynamic, myB_loc)
+
# The "frame var" code uses another path to get into children, so let's
# make sure that works as well:
- self.expect('frame var -d run-target --ptr-depth=2 --show-types anotherA.m_client_A', 'frame var finds its way into a child member',
- patterns = ['\(B \*\)'])
+ self.expect(
+ 'frame var -d run-target --ptr-depth=2 --show-types anotherA.m_client_A',
+ 'frame var finds its way into a child member',
+ patterns=['\(B \*\)'])
# Now make sure we also get it right for a reference as well:
- anotherA_static = frame.FindVariable ('anotherA', False)
- self.assertTrue (anotherA_static)
- anotherA_static_addr = int (anotherA_static.GetValue(), 16)
+ anotherA_static = frame.FindVariable('anotherA', False)
+ self.assertTrue(anotherA_static)
+ anotherA_static_addr = int(anotherA_static.GetValue(), 16)
- anotherA_dynamic = frame.FindVariable ('anotherA', True)
- self.assertTrue (anotherA_dynamic)
- anotherA_dynamic_addr = int (anotherA_dynamic.GetValue(), 16)
+ anotherA_dynamic = frame.FindVariable('anotherA', True)
+ self.assertTrue(anotherA_dynamic)
+ anotherA_dynamic_addr = int(anotherA_dynamic.GetValue(), 16)
anotherA_dynamic_typename = anotherA_dynamic.GetTypeName()
- self.assertTrue (anotherA_dynamic_typename.find('B') != -1)
+ self.assertTrue(anotherA_dynamic_typename.find('B') != -1)
self.assertTrue(anotherA_dynamic_addr < anotherA_static_addr)
- anotherA_m_b_value_dynamic = anotherA_dynamic.GetChildMemberWithName('m_b_value', True)
- self.assertTrue (anotherA_m_b_value_dynamic)
- anotherA_m_b_val = int (anotherA_m_b_value_dynamic.GetValue(), 10)
- self.assertTrue (anotherA_m_b_val == 300)
+ anotherA_m_b_value_dynamic = anotherA_dynamic.GetChildMemberWithName(
+ 'm_b_value', True)
+ self.assertTrue(anotherA_m_b_value_dynamic)
+ anotherA_m_b_val = int(anotherA_m_b_value_dynamic.GetValue(), 10)
+ self.assertTrue(anotherA_m_b_val == 300)
- anotherA_m_b_value_static = anotherA_static.GetChildMemberWithName('m_b_value', True)
- self.assertFalse (anotherA_m_b_value_static)
+ anotherA_m_b_value_static = anotherA_static.GetChildMemberWithName(
+ 'm_b_value', True)
+ self.assertFalse(anotherA_m_b_value_static)
- # Okay, now continue again, and when we hit the second breakpoint in main
+ # Okay, now continue again, and when we hit the second breakpoint in
+ # main
- threads = lldbutil.continue_to_breakpoint (process, second_call_bpt)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.continue_to_breakpoint(process, second_call_bpt)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
- reallyA_value = frame.FindVariable ('reallyA', False)
+ reallyA_value = frame.FindVariable('reallyA', False)
self.assertTrue(reallyA_value)
- reallyA_loc = int (reallyA_value.GetLocation(), 16)
-
+ reallyA_loc = int(reallyA_value.GetLocation(), 16)
+
# Finally continue to doSomething again, and make sure we get the right value for anotherA,
# which this time around is just an "A".
- threads = lldbutil.continue_to_breakpoint (process, do_something_bpt)
+ threads = lldbutil.continue_to_breakpoint(process, do_something_bpt)
self.assertTrue(len(threads) == 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
- anotherA_value = frame.FindVariable ('anotherA', True)
+ anotherA_value = frame.FindVariable('anotherA', True)
self.assertTrue(anotherA_value)
- anotherA_loc = int (anotherA_value.GetValue(), 16)
- self.assertTrue (anotherA_loc == reallyA_loc)
- self.assertTrue (anotherA_value.GetTypeName().find ('B') == -1)
+ anotherA_loc = int(anotherA_value.GetValue(), 16)
+ self.assertTrue(anotherA_loc == reallyA_loc)
+ self.assertTrue(anotherA_value.GetTypeName().find('B') == -1)
- def examine_value_object_of_this_ptr (self, this_static, this_dynamic, dynamic_location):
+ def examine_value_object_of_this_ptr(
+ self, this_static, this_dynamic, dynamic_location):
# Get "this" as its static value
- self.assertTrue (this_static)
- this_static_loc = int (this_static.GetValue(), 16)
-
+ self.assertTrue(this_static)
+ this_static_loc = int(this_static.GetValue(), 16)
+
# Get "this" as its dynamic value
-
- self.assertTrue (this_dynamic)
+
+ self.assertTrue(this_dynamic)
this_dynamic_typename = this_dynamic.GetTypeName()
- self.assertTrue (this_dynamic_typename.find('B') != -1)
- this_dynamic_loc = int (this_dynamic.GetValue(), 16)
-
+ self.assertTrue(this_dynamic_typename.find('B') != -1)
+ this_dynamic_loc = int(this_dynamic.GetValue(), 16)
+
# Make sure we got the right address for "this"
-
- self.assertTrue (this_dynamic_loc == dynamic_location)
+
+ self.assertTrue(this_dynamic_loc == dynamic_location)
# And that the static address is greater than the dynamic one
- self.assertTrue (this_static_loc > this_dynamic_loc)
-
+ self.assertTrue(this_static_loc > this_dynamic_loc)
+
# Now read m_b_value which is only in the dynamic value:
use_dynamic = lldb.eDynamicCanRunTarget
- no_dynamic = lldb.eNoDynamicValues
-
- this_dynamic_m_b_value = this_dynamic.GetChildMemberWithName('m_b_value', use_dynamic)
- self.assertTrue (this_dynamic_m_b_value)
-
- m_b_value = int (this_dynamic_m_b_value.GetValue(), 0)
- self.assertTrue (m_b_value == 10)
-
+ no_dynamic = lldb.eNoDynamicValues
+
+ this_dynamic_m_b_value = this_dynamic.GetChildMemberWithName(
+ 'm_b_value', use_dynamic)
+ self.assertTrue(this_dynamic_m_b_value)
+
+ m_b_value = int(this_dynamic_m_b_value.GetValue(), 0)
+ self.assertTrue(m_b_value == 10)
+
# Make sure it is not in the static version
- this_static_m_b_value = this_static.GetChildMemberWithName('m_b_value', no_dynamic)
- self.assertFalse (this_static_m_b_value)
+ this_static_m_b_value = this_static.GetChildMemberWithName(
+ 'm_b_value', no_dynamic)
+ self.assertFalse(this_static_m_b_value)
- # Okay, now let's make sure that we can get the dynamic type of a child element:
+ # Okay, now let's make sure that we can get the dynamic type of a child
+ # element:
- contained_auto_ptr = this_dynamic.GetChildMemberWithName ('m_client_A', use_dynamic)
- self.assertTrue (contained_auto_ptr)
- contained_b = contained_auto_ptr.GetChildMemberWithName ('_M_ptr', use_dynamic)
+ contained_auto_ptr = this_dynamic.GetChildMemberWithName(
+ 'm_client_A', use_dynamic)
+ self.assertTrue(contained_auto_ptr)
+ contained_b = contained_auto_ptr.GetChildMemberWithName(
+ '_M_ptr', use_dynamic)
if not contained_b:
- contained_b = contained_auto_ptr.GetChildMemberWithName ('__ptr_', use_dynamic)
- self.assertTrue (contained_b)
-
- contained_b_static = contained_auto_ptr.GetChildMemberWithName ('_M_ptr', no_dynamic)
+ contained_b = contained_auto_ptr.GetChildMemberWithName(
+ '__ptr_', use_dynamic)
+ self.assertTrue(contained_b)
+
+ contained_b_static = contained_auto_ptr.GetChildMemberWithName(
+ '_M_ptr', no_dynamic)
if not contained_b_static:
- contained_b_static = contained_auto_ptr.GetChildMemberWithName ('__ptr_', no_dynamic)
- self.assertTrue (contained_b_static)
-
- contained_b_addr = int (contained_b.GetValue(), 16)
- contained_b_static_addr = int (contained_b_static.GetValue(), 16)
-
- self.assertTrue (contained_b_addr < contained_b_static_addr)
+ contained_b_static = contained_auto_ptr.GetChildMemberWithName(
+ '__ptr_', no_dynamic)
+ self.assertTrue(contained_b_static)
+
+ contained_b_addr = int(contained_b.GetValue(), 16)
+ contained_b_static_addr = int(contained_b_static.GetValue(), 16)
+
+ self.assertTrue(contained_b_addr < contained_b_static_addr)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py b/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
index 51c145c7b7cd..e8d3284f6098 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/enum_types/TestCPP11EnumTypes.py
@@ -3,54 +3,71 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class CPP11EnumTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def test_int8_t(self):
"""Test C++11 enumeration class types as int8_t types."""
- self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int8_t"'})
+ self.build(
+ dictionary={
+ 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int8_t"'})
self.image_lookup_for_enum_type()
def test_int16_t(self):
"""Test C++11 enumeration class types as int16_t types."""
- self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int16_t"'})
+ self.build(
+ dictionary={
+ 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int16_t"'})
self.image_lookup_for_enum_type()
def test_int32_t(self):
"""Test C++11 enumeration class types as int32_t types."""
- self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int32_t"'})
+ self.build(
+ dictionary={
+ 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int32_t"'})
self.image_lookup_for_enum_type()
def test_int64_t(self):
"""Test C++11 enumeration class types as int64_t types."""
- self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int64_t"'})
+ self.build(
+ dictionary={
+ 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=int64_t"'})
self.image_lookup_for_enum_type()
def test_uint8_t(self):
"""Test C++11 enumeration class types as uint8_t types."""
- self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint8_t"'})
+ self.build(
+ dictionary={
+ 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint8_t"'})
self.image_lookup_for_enum_type()
def test_uint16_t(self):
"""Test C++11 enumeration class types as uint16_t types."""
- self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint16_t"'})
+ self.build(
+ dictionary={
+ 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint16_t"'})
self.image_lookup_for_enum_type()
def test_uint32_t(self):
"""Test C++11 enumeration class types as uint32_t types."""
- self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint32_t"'})
+ self.build(
+ dictionary={
+ 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint32_t"'})
self.image_lookup_for_enum_type()
def test_uint64_t(self):
"""Test C++11 enumeration class types as uint64_t types."""
- self.build(dictionary={'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint64_t"'})
+ self.build(
+ dictionary={
+ 'CFLAGS_EXTRAS': '"-DTEST_BLOCK_CAPTURED_VARS=uint64_t"'})
self.image_lookup_for_enum_type()
def setUp(self):
@@ -65,23 +82,35 @@ class CPP11EnumTypesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- bkpt_id = lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ bkpt_id = 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)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Look up information about the 'DayType' enum type.
# Check for correct display.
self.expect("image lookup -t DayType", DATA_TYPES_DISPLAYED_CORRECTLY,
- substrs = ['enum DayType {',
+ substrs=['enum DayType {',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday',
+ 'Sunday',
+ 'kNumDays',
+ '}'])
+
+ enum_values = ['-4',
'Monday',
'Tuesday',
'Wednesday',
@@ -90,21 +119,12 @@ class CPP11EnumTypesTestCase(TestBase):
'Saturday',
'Sunday',
'kNumDays',
- '}'])
-
- enum_values = [ '-4',
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday',
- 'Sunday',
- 'kNumDays',
- '5'];
+ '5']
bkpt = self.target().FindBreakpointByID(bkpt_id)
for enum_value in enum_values:
- self.expect("frame variable day", 'check for valid enumeration value',
- substrs = [enum_value])
- lldbutil.continue_to_breakpoint (self.process(), bkpt)
+ self.expect(
+ "frame variable day",
+ 'check for valid enumeration value',
+ substrs=[enum_value])
+ lldbutil.continue_to_breakpoint(self.process(), bkpt)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py b/packages/Python/lldbsuite/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py
index 4ca4cb8b79ef..4bc33205319c 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/exceptions/TestCPPExceptionBreakpoints.py
@@ -5,13 +5,14 @@ Test lldb exception breakpoint command for CPP.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CPPBreakpointTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,9 +21,12 @@ class CPPBreakpointTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
self.source = 'exceptions.cpp'
- self.catch_line = line_number(self.source, '// This is the line you should stop at for catch')
+ self.catch_line = line_number(
+ self.source, '// This is the line you should stop at for catch')
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24538, clang-cl does not support throw or catch")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24538, clang-cl does not support throw or catch")
def test(self):
"""Test lldb exception breakpoint command for CPP."""
self.build()
@@ -30,37 +34,51 @@ class CPPBreakpointTestCase(TestBase):
# Create a target from the debugger.
- target = self.dbg.CreateTarget (exe)
+ target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- exception_bkpt = target.BreakpointCreateForException (lldb.eLanguageTypeC_plus_plus, True, True)
- self.assertTrue (exception_bkpt, "Made an exception breakpoint")
+ exception_bkpt = target.BreakpointCreateForException(
+ lldb.eLanguageTypeC_plus_plus, True, True)
+ self.assertTrue(exception_bkpt, "Made an exception breakpoint")
# Now run, and make sure we hit our breakpoint:
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue (process, "Got a valid process")
-
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, "Got a valid process")
+
stopped_threads = []
- stopped_threads = lldbutil.get_threads_stopped_at_breakpoint (process, exception_bkpt)
- self.assertTrue (len(stopped_threads) == 1, "Stopped at our exception breakpoint.")
+ stopped_threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, exception_bkpt)
+ self.assertTrue(
+ len(stopped_threads) == 1,
+ "Stopped at our exception breakpoint.")
thread = stopped_threads[0]
# Make sure our throw function is still above us on the stack:
frame_functions = lldbutil.get_function_names(thread)
- self.assertTrue (frame_functions.count ("throws_exception_on_even(int)") == 1, "Our throw function is still on the stack.")
+ self.assertTrue(
+ frame_functions.count("throws_exception_on_even(int)") == 1,
+ "Our throw function is still on the stack.")
# Okay we hit our exception throw breakpoint, now make sure we get our catch breakpoint.
# One potential complication is that we might hit a couple of the exception breakpoints in getting out of the throw.
# so loop till we don't see the throws function on the stack. We should stop one more time for our exception breakpoint
# and that should be the catch...
- while frame_functions.count ("throws_exception_on_even(int)") == 1:
- stopped_threads = lldbutil.continue_to_breakpoint (process, exception_bkpt)
- self.assertTrue (len(stopped_threads) == 1)
-
+ while frame_functions.count("throws_exception_on_even(int)") == 1:
+ stopped_threads = lldbutil.continue_to_breakpoint(
+ process, exception_bkpt)
+ self.assertTrue(len(stopped_threads) == 1)
+
thread = stopped_threads[0]
frame_functions = lldbutil.get_function_names(thread)
- self.assertTrue (frame_functions.count ("throws_exception_on_even(int)") == 0, "At catch our throw function is off the stack")
- self.assertTrue (frame_functions.count ("intervening_function(int)") == 0, "At catch our intervening function is off the stack")
- self.assertTrue (frame_functions.count ("catches_exception(int)") == 1, "At catch our catch function is on the stack")
+ self.assertTrue(
+ frame_functions.count("throws_exception_on_even(int)") == 0,
+ "At catch our throw function is off the stack")
+ self.assertTrue(
+ frame_functions.count("intervening_function(int)") == 0,
+ "At catch our intervening function is off the stack")
+ self.assertTrue(
+ frame_functions.count("catches_exception(int)") == 1,
+ "At catch our catch function is on the stack")
diff --git a/packages/Python/lldbsuite/test/lang/cpp/extern_c/TestExternCSymbols.py b/packages/Python/lldbsuite/test/lang/cpp/extern_c/TestExternCSymbols.py
index f08c0dcbda98..b1b7e1744f1f 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/extern_c/TestExternCSymbols.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/extern_c/TestExternCSymbols.py
@@ -1,4 +1,4 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [])
+lldbinline.MakeInlineTest(__file__, globals(), lldbinline.expectedFailureAll(oslist=["windows"]))
diff --git a/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py b/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
index d5d536388222..c37107e898c2 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/frame-var-anon-unions/TestFrameVariableAnonymousUnions.py
@@ -5,17 +5,19 @@ import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class FrameVariableAnonymousUnionsTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
+
def test_with_run_command(self):
"""Tests that frame variable looks into anonymous unions"""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
line = line_number('main.cpp', '// break here')
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", line, num_expected_locations=-1, loc_exact=False)
self.runCmd("process launch", RUN_SUCCEEDED)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py b/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py
index eac78cd29951..21d86f973a35 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/global_operators/TestCppGlobalOperators.py
@@ -6,50 +6,92 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestCppGlobalOperators(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
- def test_with_run_command(self):
+
+ def prepare_executable_and_get_frame(self):
self.build()
# Get main source file
src_file = "main.cpp"
src_file_spec = lldb.SBFileSpec(src_file)
self.assertTrue(src_file_spec.IsValid(), "Main source file")
-
+
# Get the path of the executable
cwd = os.getcwd()
exe_file = "a.out"
- exe_path = os.path.join(cwd, exe_file)
-
+ exe_path = os.path.join(cwd, exe_file)
+
# Load the executable
target = self.dbg.CreateTarget(exe_path)
self.assertTrue(target.IsValid(), VALID_TARGET)
# Break on main function
- main_breakpoint = target.BreakpointCreateBySourceRegex("// break here", src_file_spec)
- self.assertTrue(main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
+ main_breakpoint = target.BreakpointCreateBySourceRegex(
+ "// break here", src_file_spec)
+ self.assertTrue(
+ main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
# Launch the process
args = None
env = None
- process = target.LaunchSimple(args, env, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ args, env, self.get_process_working_directory())
self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
# Get the thread of the process
- self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
- # Check if global operators are evaluated
- frame = thread.GetSelectedFrame()
+ return thread.GetSelectedFrame()
+
+ @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
+ def test_equals_operator(self):
+ frame = self.prepare_executable_and_get_frame()
test_result = frame.EvaluateExpression("operator==(s1, s2)")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "operator==(s1, s2) = false")
-
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "false",
+ "operator==(s1, s2) = false")
+
test_result = frame.EvaluateExpression("operator==(s1, s3)")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "true", "operator==(s1, s3) = true")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "true",
+ "operator==(s1, s3) = true")
test_result = frame.EvaluateExpression("operator==(s2, s3)")
- self.assertTrue(test_result.IsValid() and test_result.GetValue() == "false", "operator==(s2, s3) = false")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValue() == "false",
+ "operator==(s2, s3) = false")
+
+ def do_new_test(self, frame, expr, expected_value_name):
+ """Evaluate a new expression, and check its result"""
+
+ expected_value = frame.FindValue(
+ expected_value_name, lldb.eValueTypeVariableGlobal)
+ self.assertTrue(expected_value.IsValid())
+
+ expected_value_addr = expected_value.AddressOf()
+ self.assertTrue(expected_value_addr.IsValid())
+
+ got = frame.EvaluateExpression(expr)
+ self.assertTrue(got.IsValid())
+ self.assertEqual(
+ got.GetValueAsUnsigned(),
+ expected_value_addr.GetValueAsUnsigned())
+ got_type = got.GetType()
+ self.assertTrue(got_type.IsPointerType())
+ self.assertEqual(got_type.GetPointeeType().GetName(), "Struct")
+
+ @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
+ def test_operator_new(self):
+ frame = self.prepare_executable_and_get_frame()
+
+ self.do_new_test(frame, "new Struct()", "global_new_buf")
+ self.do_new_test(frame, "new(new_tag) Struct()", "tagged_new_buf")
diff --git a/packages/Python/lldbsuite/test/lang/cpp/global_operators/main.cpp b/packages/Python/lldbsuite/test/lang/cpp/global_operators/main.cpp
index a0dd0787fa32..c6dafd295865 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/global_operators/main.cpp
+++ b/packages/Python/lldbsuite/test/lang/cpp/global_operators/main.cpp
@@ -1,3 +1,10 @@
+#include <new>
+
+struct new_tag_t
+{
+};
+new_tag_t new_tag;
+
struct Struct {
int value;
};
@@ -6,6 +13,25 @@ bool operator==(const Struct &a, const Struct &b) {
return a.value == b.value;
}
+typedef char buf_t[sizeof(Struct)];
+buf_t global_new_buf, tagged_new_buf;
+
+// This overrides global operator new
+// This function and the following does not actually allocate memory. We are merely
+// trying to make sure it is getting called.
+void *
+operator new(std::size_t count)
+{
+ return &global_new_buf;
+}
+
+// A custom allocator
+void *
+operator new(std::size_t count, const new_tag_t &)
+{
+ return &tagged_new_buf;
+}
+
int main() {
Struct s1, s2, s3;
s1.value = 3;
diff --git a/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py b/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
index 942149f6173b..dcc9206867b3 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/gmodules/TestWithModuleDebugging.py
@@ -1,14 +1,15 @@
-import lldb, os
+import lldb
+import os
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestWithGmodulesDebugInfo(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(["gmodules"])
- @expectedFailureAll(oslist=["macosx"], bugnumber="llvm.org/pr28156")
def test_specialized_typedef_from_pch(self):
self.build()
cwd = os.getcwd()
@@ -18,33 +19,53 @@ class TestWithGmodulesDebugInfo(TestBase):
self.assertTrue(src_file_spec.IsValid(), "breakpoint file")
# Get the path of the executable
- exe_path = os.path.join(cwd, 'a.out')
+ exe_path = os.path.join(cwd, 'a.out')
# Load the executable
target = self.dbg.CreateTarget(exe_path)
self.assertTrue(target.IsValid(), VALID_TARGET)
# Break on interesting line
- breakpoint = target.BreakpointCreateBySourceRegex("break here", src_file_spec)
- self.assertTrue(breakpoint.IsValid() and breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ "break here", src_file_spec)
+ self.assertTrue(
+ breakpoint.IsValid() and breakpoint.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
# Launch the process
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
# Get the thread of the process
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
# Get frame for current thread
frame = thread.frames[0]
testValue = frame.EvaluateExpression("test")
- self.assertTrue(testValue.GetError().Success(), "Test expression value invalid: %s" % (testValue.GetError().GetCString()))
- self.assertTrue(testValue.GetTypeName() == "IntContainer", "Test expression type incorrect")
+ self.assertTrue(
+ testValue.GetError().Success(),
+ "Test expression value invalid: %s" %
+ (testValue.GetError().GetCString()))
+ self.assertTrue(
+ testValue.GetTypeName() == "IntContainer",
+ "Test expression type incorrect")
memberValue = testValue.GetChildMemberWithName("storage")
- self.assertTrue(memberValue.GetError().Success(), "Member value missing or invalid: %s" % (testValue.GetError().GetCString()))
- self.assertTrue(memberValue.GetTypeName() == "int", "Member type incorrect")
- self.assertEqual(42, memberValue.GetValueAsSigned(), "Member value incorrect")
+ self.assertTrue(
+ memberValue.GetError().Success(),
+ "Member value missing or invalid: %s" %
+ (testValue.GetError().GetCString()))
+ self.assertTrue(
+ memberValue.GetTypeName() == "int",
+ "Member type incorrect")
+ self.assertEqual(
+ 42,
+ memberValue.GetValueAsSigned(),
+ "Member value incorrect")
diff --git a/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py b/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
index 1e3359ecde49..505a27a0a67a 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/incomplete-types/TestCppIncompleteTypes.py
@@ -3,6 +3,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestCppIncompleteTypes(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -13,25 +14,34 @@ class TestCppIncompleteTypes(TestBase):
frame = self.get_test_frame('limit')
value_f = frame.EvaluateExpression("f")
- self.assertTrue(value_f.IsValid(), "'expr f' results in a valid SBValue object")
+ self.assertTrue(
+ value_f.IsValid(),
+ "'expr f' results in a valid SBValue object")
self.assertTrue(value_f.GetError().Success(), "'expr f' is successful")
value_a = frame.EvaluateExpression("a")
- self.assertTrue(value_a.IsValid(), "'expr a' results in a valid SBValue object")
+ self.assertTrue(
+ value_a.IsValid(),
+ "'expr a' results in a valid SBValue object")
self.assertTrue(value_a.GetError().Success(), "'expr a' is successful")
@skipIf(compiler="gcc")
- @skipIfWindows # Clang on Windows asserts in external record layout in this case.
+ # Clang on Windows asserts in external record layout in this case.
+ @skipIfWindows
def test_partial_limit_debug_info(self):
self.build()
frame = self.get_test_frame('nolimit')
value_f = frame.EvaluateExpression("f")
- self.assertTrue(value_f.IsValid(), "'expr f' results in a valid SBValue object")
+ self.assertTrue(
+ value_f.IsValid(),
+ "'expr f' results in a valid SBValue object")
self.assertTrue(value_f.GetError().Success(), "'expr f' is successful")
value_a = frame.EvaluateExpression("a")
- self.assertTrue(value_a.IsValid(), "'expr a' results in a valid SBValue object")
+ self.assertTrue(
+ value_a.IsValid(),
+ "'expr a' results in a valid SBValue object")
self.assertTrue(value_a.GetError().Success(), "'expr a' is successful")
def get_test_frame(self, exe):
@@ -42,25 +52,32 @@ class TestCppIncompleteTypes(TestBase):
# Get the path of the executable
cwd = os.getcwd()
- exe_path = os.path.join(cwd, exe)
+ exe_path = os.path.join(cwd, exe)
# Load the executable
target = self.dbg.CreateTarget(exe_path)
self.assertTrue(target.IsValid(), VALID_TARGET)
# Break on main function
- main_breakpoint = target.BreakpointCreateBySourceRegex("break here", src_file_spec)
- self.assertTrue(main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
+ main_breakpoint = target.BreakpointCreateBySourceRegex(
+ "break here", src_file_spec)
+ self.assertTrue(
+ main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
# Launch the process
args = None
env = None
- process = target.LaunchSimple(args, env, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ args, env, self.get_process_working_directory())
self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
# Get the thread of the process
- self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
# Get frame for current thread
return thread.GetSelectedFrame()
diff --git a/packages/Python/lldbsuite/test/lang/cpp/inlines/TestInlines.py b/packages/Python/lldbsuite/test/lang/cpp/inlines/TestInlines.py
index 284057de9dcd..2dc72981c14f 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/inlines/TestInlines.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/inlines/TestInlines.py
@@ -2,12 +2,14 @@
from __future__ import print_function
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class InlinesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -16,7 +18,9 @@ class InlinesTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break inside main().
- self.line = line_number('inlines.cpp', '// Set break point at this line.')
+ self.line = line_number(
+ 'inlines.cpp',
+ '// Set break point at this line.')
@expectedFailureAll("llvm.org/pr26710", oslist=["linux"], compiler="gcc")
def test(self):
@@ -25,28 +29,34 @@ class InlinesTestCase(TestBase):
self.runToBreakpoint()
# Check that 'frame variable' finds a variable
- self.expect("frame variable inner_input", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(int) inner_input =')
+ self.expect(
+ "frame variable inner_input",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(int) inner_input =')
# Check that 'expr' finds a variable
self.expect("expr inner_input", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(int) $0 =')
+ startstr='(int) $0 =')
def runToBreakpoint(self):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- lldbutil.run_break_set_by_file_and_line(self, "inlines.cpp", self.line, num_expected_locations=2,
- loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "inlines.cpp",
+ self.line,
+ num_expected_locations=2,
+ loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py b/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py
index 97cc177aab70..284caabbc17b 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/lambdas/TestLambdas.py
@@ -1,4 +1,7 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [lldbinline.expectedFailureAll(oslist=["windows"])])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ lldbinline.expectedFailureAll(
+ oslist=["windows"])])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py b/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
index 9d4d1b54a9d3..89086e7a64bc 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/limit-debug-info/TestWithLimitDebugInfo.py
@@ -3,6 +3,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestWithLimitDebugInfo(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -18,32 +19,47 @@ class TestWithLimitDebugInfo(TestBase):
self.assertTrue(src_file_spec.IsValid(), "breakpoint file")
# Get the path of the executable
- exe_path = os.path.join(cwd, 'a.out')
+ exe_path = os.path.join(cwd, 'a.out')
# Load the executable
target = self.dbg.CreateTarget(exe_path)
self.assertTrue(target.IsValid(), VALID_TARGET)
# Break on main function
- breakpoint = target.BreakpointCreateBySourceRegex("break here", src_file_spec)
- self.assertTrue(breakpoint.IsValid() and breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ "break here", src_file_spec)
+ self.assertTrue(
+ breakpoint.IsValid() and breakpoint.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
# Launch the process
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
# Get the thread of the process
- self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
thread.StepInto()
# Get frame for current thread
frame = thread.GetSelectedFrame()
v1 = frame.EvaluateExpression("1")
- self.assertTrue(v1.IsValid(), "'expr 1' results in a valid SBValue object")
- self.assertTrue(v1.GetError().Success(), "'expr 1' succeeds without an error.")
+ self.assertTrue(
+ v1.IsValid(),
+ "'expr 1' results in a valid SBValue object")
+ self.assertTrue(
+ v1.GetError().Success(),
+ "'expr 1' succeeds without an error.")
v2 = frame.EvaluateExpression("this")
- self.assertTrue(v2.IsValid(), "'expr this' results in a valid SBValue object")
- self.assertTrue(v2.GetError().Success(), "'expr this' succeeds without an error.")
+ self.assertTrue(
+ v2.IsValid(),
+ "'expr this' results in a valid SBValue object")
+ self.assertTrue(
+ v2.GetError().Success(),
+ "'expr this' succeeds without an error.")
diff --git a/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py b/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
index 12fc4c236376..977ad7ddea11 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/member-and-local-vars-with-same-name/TestMembersAndLocalsWithSameName.py
@@ -2,6 +2,7 @@ import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class TestMembersAndLocalsWithSameName(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -10,77 +11,101 @@ class TestMembersAndLocalsWithSameName(TestBase):
self._load_exe()
# Set breakpoints
- bp1 = self.target.BreakpointCreateBySourceRegex("Break 1", self.src_file_spec)
- self.assertTrue(bp1.IsValid() and bp1.GetNumLocations() >= 1, VALID_BREAKPOINT)
- bp2 = self.target.BreakpointCreateBySourceRegex("Break 2", self.src_file_spec)
- self.assertTrue(bp2.IsValid() and bp2.GetNumLocations() >= 1, VALID_BREAKPOINT)
- bp3 = self.target.BreakpointCreateBySourceRegex("Break 3", self.src_file_spec)
- self.assertTrue(bp3.IsValid() and bp3.GetNumLocations() >= 1, VALID_BREAKPOINT)
- bp4 = self.target.BreakpointCreateBySourceRegex("Break 4", self.src_file_spec)
- self.assertTrue(bp4.IsValid() and bp4.GetNumLocations() >= 1, VALID_BREAKPOINT)
+ bp1 = self.target.BreakpointCreateBySourceRegex(
+ "Break 1", self.src_file_spec)
+ self.assertTrue(
+ bp1.IsValid() and bp1.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
+ bp2 = self.target.BreakpointCreateBySourceRegex(
+ "Break 2", self.src_file_spec)
+ self.assertTrue(
+ bp2.IsValid() and bp2.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
+ bp3 = self.target.BreakpointCreateBySourceRegex(
+ "Break 3", self.src_file_spec)
+ self.assertTrue(
+ bp3.IsValid() and bp3.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
+ bp4 = self.target.BreakpointCreateBySourceRegex(
+ "Break 4", self.src_file_spec)
+ self.assertTrue(
+ bp4.IsValid() and bp4.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
# Launch the process
- self.process = self.target.LaunchSimple(None, None, self.get_process_working_directory())
+ self.process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(self.process.IsValid(), PROCESS_IS_VALID)
- self.assertTrue(self.process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+ self.assertTrue(
+ self.process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
self._test_globals()
self.process.Continue()
- self.assertTrue(self.process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ self.process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ self.process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid())
frame = thread.GetSelectedFrame()
self.assertTrue(frame.IsValid())
- val = frame.EvaluateExpression("a");
+ val = frame.EvaluateExpression("a")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 12345)
- val = frame.EvaluateExpression("b");
+ val = frame.EvaluateExpression("b")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 54321)
- val = frame.EvaluateExpression("c");
+ val = frame.EvaluateExpression("c")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 34567)
self.process.Continue()
- self.assertTrue(self.process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ self.process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ self.process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid())
frame = thread.GetSelectedFrame()
self.assertTrue(frame.IsValid())
- val = frame.EvaluateExpression("a");
+ val = frame.EvaluateExpression("a")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 10001)
- val = frame.EvaluateExpression("b");
+ val = frame.EvaluateExpression("b")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 10002)
- val = frame.EvaluateExpression("c");
+ val = frame.EvaluateExpression("c")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 10003)
self.process.Continue()
- self.assertTrue(self.process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ self.process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ self.process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid())
frame = thread.GetSelectedFrame()
self.assertTrue(frame.IsValid())
- val = frame.EvaluateExpression("a");
+ val = frame.EvaluateExpression("a")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 1)
- val = frame.EvaluateExpression("b");
+ val = frame.EvaluateExpression("b")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 2)
- val = frame.EvaluateExpression("c");
+ val = frame.EvaluateExpression("c")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 778899)
@@ -88,77 +113,101 @@ class TestMembersAndLocalsWithSameName(TestBase):
self._load_exe()
# Set breakpoints
- bp1 = self.target.BreakpointCreateBySourceRegex("Break 1", self.src_file_spec)
- self.assertTrue(bp1.IsValid() and bp1.GetNumLocations() >= 1, VALID_BREAKPOINT)
- bp5 = self.target.BreakpointCreateBySourceRegex("Break 5", self.src_file_spec)
- self.assertTrue(bp5.IsValid() and bp5.GetNumLocations() >= 1, VALID_BREAKPOINT)
- bp6 = self.target.BreakpointCreateBySourceRegex("Break 6", self.src_file_spec)
- self.assertTrue(bp6.IsValid() and bp6.GetNumLocations() >= 1, VALID_BREAKPOINT)
- bp7 = self.target.BreakpointCreateBySourceRegex("Break 7", self.src_file_spec)
- self.assertTrue(bp7.IsValid() and bp7.GetNumLocations() >= 1, VALID_BREAKPOINT)
+ bp1 = self.target.BreakpointCreateBySourceRegex(
+ "Break 1", self.src_file_spec)
+ self.assertTrue(
+ bp1.IsValid() and bp1.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
+ bp5 = self.target.BreakpointCreateBySourceRegex(
+ "Break 5", self.src_file_spec)
+ self.assertTrue(
+ bp5.IsValid() and bp5.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
+ bp6 = self.target.BreakpointCreateBySourceRegex(
+ "Break 6", self.src_file_spec)
+ self.assertTrue(
+ bp6.IsValid() and bp6.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
+ bp7 = self.target.BreakpointCreateBySourceRegex(
+ "Break 7", self.src_file_spec)
+ self.assertTrue(
+ bp7.IsValid() and bp7.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
# Launch the process
- self.process = self.target.LaunchSimple(None, None, self.get_process_working_directory())
+ self.process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(self.process.IsValid(), PROCESS_IS_VALID)
- self.assertTrue(self.process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+ self.assertTrue(
+ self.process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
self._test_globals()
self.process.Continue()
- self.assertTrue(self.process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ self.process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ self.process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid())
frame = thread.GetSelectedFrame()
self.assertTrue(frame.IsValid())
- val = frame.EvaluateExpression("a");
+ val = frame.EvaluateExpression("a")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 12345)
- val = frame.EvaluateExpression("b");
+ val = frame.EvaluateExpression("b")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 54321)
- val = frame.EvaluateExpression("c");
+ val = frame.EvaluateExpression("c")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 34567)
self.process.Continue()
- self.assertTrue(self.process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ self.process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ self.process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid())
frame = thread.GetSelectedFrame()
self.assertTrue(frame.IsValid())
- val = frame.EvaluateExpression("a");
+ val = frame.EvaluateExpression("a")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 10001)
- val = frame.EvaluateExpression("b");
+ val = frame.EvaluateExpression("b")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 10002)
- val = frame.EvaluateExpression("c");
+ val = frame.EvaluateExpression("c")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 10003)
self.process.Continue()
- self.assertTrue(self.process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ self.process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ self.process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid())
frame = thread.GetSelectedFrame()
self.assertTrue(frame.IsValid())
- val = frame.EvaluateExpression("a");
+ val = frame.EvaluateExpression("a")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 1)
- val = frame.EvaluateExpression("b");
+ val = frame.EvaluateExpression("b")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 2)
- val = frame.EvaluateExpression("c");
+ val = frame.EvaluateExpression("c")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 778899)
@@ -172,26 +221,27 @@ class TestMembersAndLocalsWithSameName(TestBase):
self.assertTrue(self.src_file_spec.IsValid(), "breakpoint file")
# Get the path of the executable
- exe_path = os.path.join(cwd, 'a.out')
+ exe_path = os.path.join(cwd, 'a.out')
# Load the executable
self.target = self.dbg.CreateTarget(exe_path)
self.assertTrue(self.target.IsValid(), VALID_TARGET)
def _test_globals(self):
- thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ self.process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid())
frame = thread.GetSelectedFrame()
self.assertTrue(frame.IsValid())
- val = frame.EvaluateExpression("a");
+ val = frame.EvaluateExpression("a")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 112233)
- val = frame.EvaluateExpression("b");
+ val = frame.EvaluateExpression("b")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 445566)
- val = frame.EvaluateExpression("c");
+ val = frame.EvaluateExpression("c")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetValueAsUnsigned(), 778899)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py b/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py
index 93d53c7de712..f0bc12ce9832 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespace.py
@@ -5,23 +5,30 @@ Test the printing of anonymous and named namespace variables.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class NamespaceBreakpointTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(bugnumber="llvm.org/pr28548", compiler="gcc")
+ @expectedFailureAll(oslist=["windows"])
def test_breakpoints_func_auto(self):
"""Test that we can set breakpoints correctly by basename to find all functions whose basename is "func"."""
self.build()
- names = [ "func()", "func(int)", "A::B::func()", "A::func()", "A::func(int)"]
+ names = [
+ "func()",
+ "func(int)",
+ "A::B::func()",
+ "A::func()",
+ "A::func(int)"]
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
@@ -30,11 +37,15 @@ class NamespaceBreakpointTestCase(TestBase):
module_list = lldb.SBFileSpecList()
module_list.Append(lldb.SBFileSpec(exe, False))
cu_list = lldb.SBFileSpecList()
- # Set a breakpoint by name "func" which should pick up all functions whose basename is "func"
- bp = target.BreakpointCreateByName ("func", lldb.eFunctionNameTypeAuto, module_list, cu_list);
+ # Set a breakpoint by name "func" which should pick up all functions
+ # whose basename is "func"
+ bp = target.BreakpointCreateByName(
+ "func", lldb.eFunctionNameTypeAuto, module_list, cu_list)
for bp_loc in bp:
name = bp_loc.GetAddress().GetFunction().GetName()
- self.assertTrue(name in names, "make sure breakpoint locations are correct for 'func' with eFunctionNameTypeAuto")
+ self.assertTrue(
+ name in names,
+ "make sure breakpoint locations are correct for 'func' with eFunctionNameTypeAuto")
@expectedFailureAll(bugnumber="llvm.org/pr28548", compiler="gcc")
def test_breakpoints_func_full(self):
@@ -42,7 +53,7 @@ class NamespaceBreakpointTestCase(TestBase):
(no namespaces)."""
self.build()
- names = [ "func()", "func(int)"]
+ names = ["func()", "func(int)"]
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
@@ -52,18 +63,22 @@ class NamespaceBreakpointTestCase(TestBase):
module_list.Append(lldb.SBFileSpec(exe, False))
cu_list = lldb.SBFileSpecList()
- # Set a breakpoint by name "func" whose fullly qualified named matches "func" which
- # should pick up only functions whose basename is "func" and has no containing context
- bp = target.BreakpointCreateByName ("func", lldb.eFunctionNameTypeFull, module_list, cu_list);
+ # Set a breakpoint by name "func" whose fullly qualified named matches "func" which
+ # should pick up only functions whose basename is "func" and has no
+ # containing context
+ bp = target.BreakpointCreateByName(
+ "func", lldb.eFunctionNameTypeFull, module_list, cu_list)
for bp_loc in bp:
name = bp_loc.GetAddress().GetFunction().GetName()
- self.assertTrue(name in names, "make sure breakpoint locations are correct for 'func' with eFunctionNameTypeFull")
+ self.assertTrue(
+ name in names,
+ "make sure breakpoint locations are correct for 'func' with eFunctionNameTypeFull")
def test_breakpoints_a_func_full(self):
"""Test that we can set breakpoints correctly by fullname to find all functions whose fully qualified name is "A::func"."""
self.build()
- names = [ "A::func()", "A::func(int)"]
+ names = ["A::func()", "A::func(int)"]
# Create a target by the debugger.
exe = os.path.join(os.getcwd(), "a.out")
@@ -73,12 +88,16 @@ class NamespaceBreakpointTestCase(TestBase):
module_list.Append(lldb.SBFileSpec(exe, False))
cu_list = lldb.SBFileSpecList()
- # Set a breakpoint by name "A::func" whose fullly qualified named matches "A::func" which
- # should pick up only functions whose basename is "func" and is contained in the "A" namespace
- bp = target.BreakpointCreateByName ("A::func", lldb.eFunctionNameTypeFull, module_list, cu_list);
+ # Set a breakpoint by name "A::func" whose fullly qualified named matches "A::func" which
+ # should pick up only functions whose basename is "func" and is
+ # contained in the "A" namespace
+ bp = target.BreakpointCreateByName(
+ "A::func", lldb.eFunctionNameTypeFull, module_list, cu_list)
for bp_loc in bp:
name = bp_loc.GetAddress().GetFunction().GetName()
- self.assertTrue(name in names, "make sure breakpoint locations are correct for 'A::func' with eFunctionNameTypeFull")
+ self.assertTrue(
+ name in names,
+ "make sure breakpoint locations are correct for 'A::func' with eFunctionNameTypeFull")
class NamespaceTestCase(TestBase):
@@ -88,14 +107,15 @@ class NamespaceTestCase(TestBase):
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
- # Find the line numbers for declarations of namespace variables i and j.
- self.line_var_i = line_number('main.cpp',
- '// Find the line number for anonymous namespace variable i.')
- self.line_var_j = line_number('main.cpp',
- '// Find the line number for named namespace variable j.')
+ # Find the line numbers for declarations of namespace variables i and
+ # j.
+ self.line_var_i = line_number(
+ 'main.cpp', '// Find the line number for anonymous namespace variable i.')
+ self.line_var_j = line_number(
+ 'main.cpp', '// Find the line number for named namespace variable j.')
# And the line number to break at.
self.line_break = line_number('main.cpp',
- '// Set break point at this line.')
+ '// Set break point at this line.')
# Break inside do {} while and evaluate value
self.line_break_ns1 = line_number('main.cpp', '// Evaluate ns1::value')
self.line_break_ns2 = line_number('main.cpp', '// Evaluate ns2::value')
@@ -104,8 +124,8 @@ class NamespaceTestCase(TestBase):
self.runCmd(command, RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# rdar://problem/8668674
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
@@ -114,22 +134,39 @@ class NamespaceTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line_break_ns1, num_expected_locations=1, loc_exact=True)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line_break_ns2, num_expected_locations=1, loc_exact=True)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line_break, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "main.cpp",
+ self.line_break_ns1,
+ num_expected_locations=1,
+ loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "main.cpp",
+ self.line_break_ns2,
+ num_expected_locations=1,
+ loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "main.cpp",
+ self.line_break,
+ num_expected_locations=1,
+ loc_exact=True)
self.runToBkpt("run")
# Evaluate ns1::value
- self.expect("expression -- value", startstr = "(int) $0 = 100")
+ self.expect("expression -- value", startstr="(int) $0 = 100")
self.runToBkpt("continue")
# Evaluate ns2::value
- self.expect("expression -- value", startstr = "(int) $1 = 200")
-
+ self.expect("expression -- value", startstr="(int) $1 = 200")
+
self.runToBkpt("continue")
- # On Mac OS X, gcc 4.2 emits the wrong debug info with respect to types.
+ # On Mac OS X, gcc 4.2 emits the wrong debug info with respect to
+ # types.
slist = ['(int) a = 12', 'anon_uint', 'a_uint', 'b_uint', 'y_uint']
- if self.platformIsDarwin() and self.getCompiler() in ['clang', 'llvm-gcc']:
+ if self.platformIsDarwin() and self.getCompiler() in [
+ 'clang', 'llvm-gcc']:
slist = ['(int) a = 12',
'::my_uint_t', 'anon_uint = 0',
'(A::uint_t) a_uint = 1',
@@ -138,16 +175,20 @@ class NamespaceTestCase(TestBase):
# 'frame variable' displays the local variables with type information.
self.expect('frame variable', VARIABLES_DISPLAYED_CORRECTLY,
- substrs = slist)
+ substrs=slist)
# 'frame variable' with basename 'i' should work.
- self.expect("frame variable --show-declaration --show-globals i",
- startstr = "main.cpp:%d: (int) (anonymous namespace)::i = 3" % self.line_var_i)
+ self.expect(
+ "frame variable --show-declaration --show-globals i",
+ startstr="main.cpp:%d: (int) (anonymous namespace)::i = 3" %
+ self.line_var_i)
# main.cpp:12: (int) (anonymous namespace)::i = 3
# 'frame variable' with basename 'j' should work, too.
- self.expect("frame variable --show-declaration --show-globals j",
- startstr = "main.cpp:%d: (int) A::B::j = 4" % self.line_var_j)
+ self.expect(
+ "frame variable --show-declaration --show-globals j",
+ startstr="main.cpp:%d: (int) A::B::j = 4" %
+ self.line_var_j)
# main.cpp:19: (int) A::B::j = 4
# 'frame variable' should support address-of operator.
@@ -155,41 +196,44 @@ class NamespaceTestCase(TestBase):
# 'frame variable' with fully qualified name 'A::B::j' should work.
self.expect("frame variable A::B::j", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(int) A::B::j = 4',
- patterns = [' = 4'])
+ startstr='(int) A::B::j = 4',
+ patterns=[' = 4'])
# So should the anonymous namespace case.
- self.expect("frame variable '(anonymous namespace)::i'", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(int) (anonymous namespace)::i = 3',
- patterns = [' = 3'])
+ self.expect(
+ "frame variable '(anonymous namespace)::i'",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(int) (anonymous namespace)::i = 3',
+ patterns=[' = 3'])
# rdar://problem/8660275
# test/namespace: 'expression -- i+j' not working
# This has been fixed.
self.expect("expression -- i + j",
- startstr = "(int) $2 = 7")
+ startstr="(int) $2 = 7")
# (int) $2 = 7
self.runCmd("expression -- i")
self.runCmd("expression -- j")
# rdar://problem/8668674
- # expression command with fully qualified namespace for a variable does not work
+ # expression command with fully qualified namespace for a variable does
+ # not work
self.expect("expression -- ::i", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [' = 3'])
+ patterns=[' = 3'])
self.expect("expression -- A::B::j", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [' = 4'])
+ patterns=[' = 4'])
# expression command with function in anonymous namespace
self.expect("expression -- myanonfunc(3)",
- patterns = [' = 6'])
+ patterns=[' = 6'])
# global namespace qualification with function in anonymous namespace
self.expect("expression -- ::myanonfunc(4)",
- patterns = [' = 8'])
+ patterns=[' = 8'])
self.expect("p myanonfunc",
- patterns = ['\(anonymous namespace\)::myanonfunc\(int\)'])
+ patterns=['\(anonymous namespace\)::myanonfunc\(int\)'])
- self.expect("p variadic_sum",
- patterns = ['\(anonymous namespace\)::variadic_sum\(int, ...\)'])
+ self.expect("p variadic_sum", patterns=[
+ '\(anonymous namespace\)::variadic_sum\(int, ...\)'])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py b/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py
index 12e8eef40cf3..18e45d9798ae 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/namespace/TestNamespaceLookup.py
@@ -5,12 +5,14 @@ Test the printing of anonymous and named namespace variables.
from __future__ import print_function
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class NamespaceLookupTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,88 +21,131 @@ class NamespaceLookupTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Break inside different scopes and evaluate value
- self.line_break_global_scope = line_number('ns.cpp', '// BP_global_scope')
+ self.line_break_global_scope = line_number(
+ 'ns.cpp', '// BP_global_scope')
self.line_break_file_scope = line_number('ns2.cpp', '// BP_file_scope')
self.line_break_ns_scope = line_number('ns2.cpp', '// BP_ns_scope')
- self.line_break_nested_ns_scope = line_number('ns2.cpp', '// BP_nested_ns_scope')
- self.line_break_nested_ns_scope_after_using = line_number('ns2.cpp', '// BP_nested_ns_scope_after_using')
- self.line_break_before_using_directive = line_number('ns3.cpp', '// BP_before_using_directive')
- self.line_break_after_using_directive = line_number('ns3.cpp', '// BP_after_using_directive')
+ self.line_break_nested_ns_scope = line_number(
+ 'ns2.cpp', '// BP_nested_ns_scope')
+ self.line_break_nested_ns_scope_after_using = line_number(
+ 'ns2.cpp', '// BP_nested_ns_scope_after_using')
+ self.line_break_before_using_directive = line_number(
+ 'ns3.cpp', '// BP_before_using_directive')
+ self.line_break_after_using_directive = line_number(
+ 'ns3.cpp', '// BP_after_using_directive')
def runToBkpt(self, command):
self.runCmd(command, RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
- @expectedFailureAll(oslist=["windows", "linux", "freebsd"], bugnumber="llvm.org/pr25819")
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
+ @expectedFailureAll(
+ oslist=[
+ "windows",
+ "linux",
+ "freebsd"],
+ bugnumber="llvm.org/pr25819")
def test_scope_lookup_with_run_command(self):
"""Test scope lookup of functions in lldb."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "ns.cpp", self.line_break_global_scope, num_expected_locations=1, loc_exact=False)
- lldbutil.run_break_set_by_file_and_line (self, "ns2.cpp", self.line_break_ns_scope, num_expected_locations=1, loc_exact=False)
- lldbutil.run_break_set_by_file_and_line (self, "ns2.cpp", self.line_break_nested_ns_scope, num_expected_locations=1, loc_exact=False)
- lldbutil.run_break_set_by_file_and_line (self, "ns2.cpp", self.line_break_nested_ns_scope_after_using, num_expected_locations=1, loc_exact=False)
- lldbutil.run_break_set_by_file_and_line (self, "ns3.cpp", self.line_break_before_using_directive, num_expected_locations=1, loc_exact=False)
- lldbutil.run_break_set_by_file_and_line (self, "ns3.cpp", self.line_break_after_using_directive, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns.cpp",
+ self.line_break_global_scope,
+ num_expected_locations=1,
+ loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns2.cpp",
+ self.line_break_ns_scope,
+ num_expected_locations=1,
+ loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns2.cpp",
+ self.line_break_nested_ns_scope,
+ num_expected_locations=1,
+ loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns2.cpp",
+ self.line_break_nested_ns_scope_after_using,
+ num_expected_locations=1,
+ loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns3.cpp",
+ self.line_break_before_using_directive,
+ num_expected_locations=1,
+ loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns3.cpp",
+ self.line_break_after_using_directive,
+ num_expected_locations=1,
+ loc_exact=False)
# Run to BP_global_scope at global scope
self.runToBkpt("run")
# Evaluate func() - should call ::func()
- self.expect("expr -- func()", startstr = "(int) $0 = 1")
+ self.expect("expr -- func()", startstr="(int) $0 = 1")
# Evaluate A::B::func() - should call A::B::func()
- self.expect("expr -- A::B::func()", startstr = "(int) $1 = 4")
+ self.expect("expr -- A::B::func()", startstr="(int) $1 = 4")
# Evaluate func(10) - should call ::func(int)
- self.expect("expr -- func(10)", startstr = "(int) $2 = 11")
+ self.expect("expr -- func(10)", startstr="(int) $2 = 11")
# Evaluate ::func() - should call A::func()
- self.expect("expr -- ::func()", startstr = "(int) $3 = 1")
+ self.expect("expr -- ::func()", startstr="(int) $3 = 1")
# Evaluate A::foo() - should call A::foo()
- self.expect("expr -- A::foo()", startstr = "(int) $4 = 42")
+ self.expect("expr -- A::foo()", startstr="(int) $4 = 42")
# Continue to BP_ns_scope at ns scope
self.runToBkpt("continue")
# Evaluate func(10) - should call A::func(int)
- self.expect("expr -- func(10)", startstr = "(int) $5 = 13")
+ self.expect("expr -- func(10)", startstr="(int) $5 = 13")
# Evaluate B::func() - should call B::func()
- self.expect("expr -- B::func()", startstr = "(int) $6 = 4")
+ self.expect("expr -- B::func()", startstr="(int) $6 = 4")
# Evaluate func() - should call A::func()
- self.expect("expr -- func()", startstr = "(int) $7 = 3")
+ self.expect("expr -- func()", startstr="(int) $7 = 3")
# Continue to BP_nested_ns_scope at nested ns scope
self.runToBkpt("continue")
# Evaluate func() - should call A::B::func()
- self.expect("expr -- func()", startstr = "(int) $8 = 4")
+ self.expect("expr -- func()", startstr="(int) $8 = 4")
# Evaluate A::func() - should call A::func()
- self.expect("expr -- A::func()", startstr = "(int) $9 = 3")
+ self.expect("expr -- A::func()", startstr="(int) $9 = 3")
# Evaluate func(10) - should call A::func(10)
# NOTE: Under the rules of C++, this test would normally get an error
# because A::B::func() hides A::func(), but lldb intentionally
# disobeys these rules so that the intended overload can be found
# by only removing duplicates if they have the same type.
- self.expect("expr -- func(10)", startstr = "(int) $10 = 13")
+ self.expect("expr -- func(10)", startstr="(int) $10 = 13")
- # Continue to BP_nested_ns_scope_after_using at nested ns scope after using declaration
+ # Continue to BP_nested_ns_scope_after_using at nested ns scope after
+ # using declaration
self.runToBkpt("continue")
# Evaluate A::func(10) - should call A::func(int)
- self.expect("expr -- A::func(10)", startstr = "(int) $11 = 13")
+ self.expect("expr -- A::func(10)", startstr="(int) $11 = 13")
- # Continue to BP_before_using_directive at global scope before using declaration
+ # Continue to BP_before_using_directive at global scope before using
+ # declaration
self.runToBkpt("continue")
# Evaluate ::func() - should call ::func()
- self.expect("expr -- ::func()", startstr = "(int) $12 = 1")
+ self.expect("expr -- ::func()", startstr="(int) $12 = 1")
# Evaluate B::func() - should call B::func()
- self.expect("expr -- B::func()", startstr = "(int) $13 = 4")
+ self.expect("expr -- B::func()", startstr="(int) $13 = 4")
- # Continue to BP_after_using_directive at global scope after using declaration
+ # Continue to BP_after_using_directive at global scope after using
+ # declaration
self.runToBkpt("continue")
# Evaluate ::func() - should call ::func()
- self.expect("expr -- ::func()", startstr = "(int) $14 = 1")
+ self.expect("expr -- ::func()", startstr="(int) $14 = 1")
# Evaluate B::func() - should call B::func()
- self.expect("expr -- B::func()", startstr = "(int) $15 = 4")
+ self.expect("expr -- B::func()", startstr="(int) $15 = 4")
@unittest2.expectedFailure("lldb scope lookup of functions bugs")
def test_function_scope_lookup_with_run_command(self):
@@ -108,26 +153,36 @@ class NamespaceLookupTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "ns.cpp", self.line_break_global_scope, num_expected_locations=1, loc_exact=False)
- lldbutil.run_break_set_by_file_and_line (self, "ns2.cpp", self.line_break_ns_scope, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns.cpp",
+ self.line_break_global_scope,
+ num_expected_locations=1,
+ loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns2.cpp",
+ self.line_break_ns_scope,
+ num_expected_locations=1,
+ loc_exact=False)
# Run to BP_global_scope at global scope
self.runToBkpt("run")
# Evaluate foo() - should call ::foo()
# FIXME: lldb finds Y::foo because lookup for variables is done
# before functions.
- self.expect("expr -- foo()", startstr = "(int) $0 = 42")
+ self.expect("expr -- foo()", startstr="(int) $0 = 42")
# Evaluate ::foo() - should call ::foo()
# FIXME: lldb finds Y::foo because lookup for variables is done
# before functions and :: is ignored.
- self.expect("expr -- ::foo()", startstr = "(int) $1 = 42")
+ self.expect("expr -- ::foo()", startstr="(int) $1 = 42")
# Continue to BP_ns_scope at ns scope
self.runToBkpt("continue")
# Evaluate foo() - should call A::foo()
# FIXME: lldb finds Y::foo because lookup for variables is done
# before functions.
- self.expect("expr -- foo()", startstr = "(int) $2 = 42")
+ self.expect("expr -- foo()", startstr="(int) $2 = 42")
@unittest2.expectedFailure("lldb file scope lookup bugs")
def test_file_scope_lookup_with_run_command(self):
@@ -135,14 +190,19 @@ class NamespaceLookupTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "ns2.cpp", self.line_break_file_scope, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns2.cpp",
+ self.line_break_file_scope,
+ num_expected_locations=1,
+ loc_exact=False)
# Run to BP_file_scope at file scope
self.runToBkpt("run")
# Evaluate func() - should call static ns2.cpp:func()
# FIXME: This test fails because lldb doesn't know about file scopes so
# finds the global ::func().
- self.expect("expr -- func()", startstr = "(int) $0 = 2")
+ self.expect("expr -- func()", startstr="(int) $0 = 2")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr25819")
def test_scope_lookup_before_using_with_run_command(self):
@@ -150,30 +210,51 @@ class NamespaceLookupTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "ns3.cpp", self.line_break_before_using_directive, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns3.cpp",
+ self.line_break_before_using_directive,
+ num_expected_locations=1,
+ loc_exact=False)
- # Run to BP_before_using_directive at global scope before using declaration
+ # Run to BP_before_using_directive at global scope before using
+ # declaration
self.runToBkpt("run")
# Evaluate func() - should call ::func()
- self.expect("expr -- func()", startstr = "(int) $0 = 1")
+ self.expect("expr -- func()", startstr="(int) $0 = 1")
# NOTE: this test may fail on older systems that don't emit import
# entries in DWARF - may need to add checks for compiler versions here.
- @skipIf(compiler="gcc", oslist=["linux"], debug_info=["dwo"]) # Skip to avoid crash
- @expectedFailureAll(oslist=["windows", "linux", "freebsd"], bugnumber="llvm.org/pr25819")
+ @skipIf(
+ compiler="gcc",
+ oslist=["linux"],
+ debug_info=["dwo"]) # Skip to avoid crash
+ @expectedFailureAll(
+ oslist=[
+ "windows",
+ "linux",
+ "freebsd"],
+ bugnumber="llvm.org/pr25819")
def test_scope_after_using_directive_lookup_with_run_command(self):
"""Test scope lookup after using directive in lldb."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "ns3.cpp", self.line_break_after_using_directive, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns3.cpp",
+ self.line_break_after_using_directive,
+ num_expected_locations=1,
+ loc_exact=False)
- # Run to BP_after_using_directive at global scope after using declaration
+ # Run to BP_after_using_directive at global scope after using
+ # declaration
self.runToBkpt("run")
# Evaluate func2() - should call A::func2()
- self.expect("expr -- func2()", startstr = "(int) $0 = 3")
+ self.expect("expr -- func2()", startstr="(int) $0 = 3")
- @unittest2.expectedFailure("lldb scope lookup after using declaration bugs")
+ @unittest2.expectedFailure(
+ "lldb scope lookup after using declaration bugs")
# NOTE: this test may fail on older systems that don't emit import
# emtries in DWARF - may need to add checks for compiler versions here.
def test_scope_after_using_declaration_lookup_with_run_command(self):
@@ -181,12 +262,18 @@ class NamespaceLookupTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "ns2.cpp", self.line_break_nested_ns_scope_after_using, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns2.cpp",
+ self.line_break_nested_ns_scope_after_using,
+ num_expected_locations=1,
+ loc_exact=False)
- # Run to BP_nested_ns_scope_after_using at nested ns scope after using declaration
+ # Run to BP_nested_ns_scope_after_using at nested ns scope after using
+ # declaration
self.runToBkpt("run")
# Evaluate func() - should call A::func()
- self.expect("expr -- func()", startstr = "(int) $0 = 3")
+ self.expect("expr -- func()", startstr="(int) $0 = 3")
@unittest2.expectedFailure("lldb scope lookup ambiguity after using bugs")
def test_scope_ambiguity_after_using_lookup_with_run_command(self):
@@ -194,22 +281,38 @@ class NamespaceLookupTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "ns3.cpp", self.line_break_after_using_directive, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns3.cpp",
+ self.line_break_after_using_directive,
+ num_expected_locations=1,
+ loc_exact=False)
- # Run to BP_after_using_directive at global scope after using declaration
+ # Run to BP_after_using_directive at global scope after using
+ # declaration
self.runToBkpt("run")
# Evaluate func() - should get error: ambiguous
# FIXME: This test fails because lldb removes duplicates if they have
# the same type.
- self.expect("expr -- func()", startstr = "error")
-
- @expectedFailureAll(oslist=["windows", "linux", "freebsd"], bugnumber="llvm.org/pr25819")
+ self.expect("expr -- func()", startstr="error")
+
+ @expectedFailureAll(
+ oslist=[
+ "windows",
+ "linux",
+ "freebsd"],
+ bugnumber="llvm.org/pr25819")
def test_scope_lookup_shadowed_by_using_with_run_command(self):
"""Test scope lookup shadowed by using in lldb."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "ns2.cpp", self.line_break_nested_ns_scope, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "ns2.cpp",
+ self.line_break_nested_ns_scope,
+ num_expected_locations=1,
+ loc_exact=False)
# Run to BP_nested_ns_scope at nested ns scope
self.runToBkpt("run")
@@ -218,5 +321,4 @@ class NamespaceLookupTestCase(TestBase):
# because A::B::func() shadows A::func(), but lldb intentionally
# disobeys these rules so that the intended overload can be found
# by only removing duplicates if they have the same type.
- self.expect("expr -- func(10)", startstr = "(int) $0 = 13")
-
+ self.expect("expr -- func(10)", startstr="(int) $0 = 13")
diff --git a/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py b/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py
index f45969429004..7160dddf4548 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/namespace_definitions/TestNamespaceDefinitions.py
@@ -3,22 +3,35 @@
from __future__ import print_function
-
import unittest2
import lldb
from lldbsuite.test.lldbtest import *
+from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
+
class NamespaceDefinitionsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
+ @expectedFailureAll(
+ bugnumber="llvm.org/pr28948",
+ compiler="gcc",
+ compiler_version=[
+ "<",
+ "4.9"])
+ @expectedFailureAll(
+ bugnumber="llvm.org/pr28948",
+ oslist=['linux'], compiler="gcc", archs=['arm','aarch64'])
+ @expectedFailureAll(oslist=["windows"])
def test_expr(self):
self.build()
self.common_setup()
- self.expect("expression -- Foo::MyClass()", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['thing = '])
+ self.expect(
+ "expression -- Foo::MyClass()",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['thing = '])
def setUp(self):
# Call super's setUp().
@@ -27,7 +40,7 @@ class NamespaceDefinitionsTestCase(TestBase):
self.source = 'main.cpp'
self.line = line_number(self.source, '// Set breakpoint here')
self.shlib_names = ["a", "b"]
-
+
def common_setup(self):
# Run in synchronous mode
self.dbg.SetAsync(False)
@@ -37,21 +50,24 @@ class NamespaceDefinitionsTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, self.source, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, self.source, self.line, num_expected_locations=1, loc_exact=True)
- # Register our shared libraries for remote targets so they get automatically uploaded
- environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
+ environment = self.registerSharedLibrariesWithTarget(
+ target, self.shlib_names)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
-
+ substrs=[' resolved, hit count = 1'])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py b/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py
index d66d2ac530e5..878cc4fd4f76 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/nsimport/TestCppNsImport.py
@@ -6,6 +6,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestCppNsImport(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,79 +24,116 @@ class TestCppNsImport(TestBase):
# Get the path of the executable
cwd = os.getcwd()
exe_file = "a.out"
- exe_path = os.path.join(cwd, exe_file)
+ exe_path = os.path.join(cwd, exe_file)
# Load the executable
target = self.dbg.CreateTarget(exe_path)
self.assertTrue(target.IsValid(), VALID_TARGET)
# Break on main function
- break_0 = target.BreakpointCreateBySourceRegex("// break 0", src_file_spec)
- self.assertTrue(break_0.IsValid() and break_0.GetNumLocations() >= 1, VALID_BREAKPOINT)
- break_1 = target.BreakpointCreateBySourceRegex("// break 1", src_file_spec)
- self.assertTrue(break_1.IsValid() and break_1.GetNumLocations() >= 1, VALID_BREAKPOINT)
+ break_0 = target.BreakpointCreateBySourceRegex(
+ "// break 0", src_file_spec)
+ self.assertTrue(
+ break_0.IsValid() and break_0.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
+ break_1 = target.BreakpointCreateBySourceRegex(
+ "// break 1", src_file_spec)
+ self.assertTrue(
+ break_1.IsValid() and break_1.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
# Launch the process
args = None
env = None
- process = target.LaunchSimple(args, env, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ args, env, self.get_process_working_directory())
self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
# Get the thread of the process
- self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
# Get current fream of the thread at the breakpoint
frame = thread.GetSelectedFrame()
# Test imported namespaces
test_result = frame.EvaluateExpression("n")
- self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 1, "n = 1")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValueAsSigned() == 1,
+ "n = 1")
test_result = frame.EvaluateExpression("N::n")
- self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 1, "N::n = 1")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValueAsSigned() == 1,
+ "N::n = 1")
test_result = frame.EvaluateExpression("nested")
- self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 3, "nested = 3")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValueAsSigned() == 3,
+ "nested = 3")
test_result = frame.EvaluateExpression("anon")
- self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 2, "anon = 2")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValueAsSigned() == 2,
+ "anon = 2")
test_result = frame.EvaluateExpression("global")
- self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 4, "global = 4")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValueAsSigned() == 4,
+ "global = 4")
test_result = frame.EvaluateExpression("fun_var")
- self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 9, "fun_var = 9")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValueAsSigned() == 9,
+ "fun_var = 9")
test_result = frame.EvaluateExpression("Fun::fun_var")
- self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 0, "Fun::fun_var = 0")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValueAsSigned() == 0,
+ "Fun::fun_var = 0")
test_result = frame.EvaluateExpression("not_imported")
- self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 35, "not_imported = 35")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValueAsSigned() == 35,
+ "not_imported = 35")
# Currently there is no way to distinguish between "::imported" and "imported" in ClangExpressionDeclMap so this fails
#test_result = frame.EvaluateExpression("::imported")
#self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 89, "::imported = 89")
test_result = frame.EvaluateExpression("Imported::imported")
- self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 99, "Imported::imported = 99")
-
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValueAsSigned() == 99,
+ "Imported::imported = 99")
+
test_result = frame.EvaluateExpression("imported")
- self.assertTrue(test_result.IsValid() and test_result.GetError().Fail(), "imported is ambiguous")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetError().Fail(),
+ "imported is ambiguous")
test_result = frame.EvaluateExpression("single")
- self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 3, "single = 3")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValueAsSigned() == 3,
+ "single = 3")
# Continue to second breakpoint
process.Continue()
# Get the thread of the process
- self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
# Get current fream of the thread at the breakpoint
frame = thread.GetSelectedFrame()
# Test function inside namespace
test_result = frame.EvaluateExpression("fun_var")
- self.assertTrue(test_result.IsValid() and test_result.GetValueAsSigned() == 5, "fun_var = 5")
+ self.assertTrue(
+ test_result.IsValid() and test_result.GetValueAsSigned() == 5,
+ "fun_var = 5")
diff --git a/packages/Python/lldbsuite/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py b/packages/Python/lldbsuite/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py
index ff00d99d7763..3d8788fa7907 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/overloaded-functions/TestOverloadedFunctions.py
@@ -7,31 +7,35 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CPPStaticMethodsTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
+
def setUp(self):
TestBase.setUp(self)
self.line = line_number('main.cpp', '// breakpoint')
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
def test_with_run_command(self):
"""Test that functions with the same name are resolved correctly"""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, 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("process launch", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list",
STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
self.expect("expression -- Dump(myB)",
- startstr = "(int) $0 = 2")
+ startstr="(int) $0 = 2")
self.expect("expression -- Static()",
- startstr = "(int) $1 = 1")
+ startstr="(int) $1 = 1")
diff --git a/packages/Python/lldbsuite/test/lang/cpp/printf/TestPrintf.py b/packages/Python/lldbsuite/test/lang/cpp/printf/TestPrintf.py
index 2a2c673f8675..38ebe1a9a9c4 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/printf/TestPrintf.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/printf/TestPrintf.py
@@ -1,4 +1,7 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.expectedFailureAll(bugnumber="rdar://problem/24599697")] )
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.expectedFailureAll(
+ bugnumber="rdar://problem/24599697")])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/rvalue-references/TestRvalueReferences.py b/packages/Python/lldbsuite/test/lang/cpp/rvalue-references/TestRvalueReferences.py
index 78a2727094a7..11d221e171a9 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/rvalue-references/TestRvalueReferences.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/rvalue-references/TestRvalueReferences.py
@@ -7,13 +7,18 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class RvalueReferencesTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
- #rdar://problem/11479676
- @expectedFailureAll(compiler="icc", bugnumber="ICC (13.1, 14-beta) do not emit DW_TAG_rvalue_reference_type.")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+
+ # rdar://problem/11479676
+ @expectedFailureAll(
+ compiler="icc",
+ bugnumber="ICC (13.1, 14-beta) do not emit DW_TAG_rvalue_reference_type.")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
def test_with_run_command(self):
"""Test that rvalues are supported in the C++ expression parser"""
self.build()
@@ -27,24 +32,25 @@ class RvalueReferencesTestCase(TestBase):
# Note that clang as of r187480 doesn't emit DW_TAG_const_type, unlike gcc 4.8.1
# With gcc 4.8.1, lldb reports the type as (int &&const)
self.expect("frame variable i",
- startstr = "(int &&",
- substrs = ["i = 0x", "&i = 3"])
+ startstr="(int &&",
+ substrs=["i = 0x", "&i = 3"])
self.expect("expression -- i",
- startstr = "(int) ",
- substrs = ["3"])
+ startstr="(int) ",
+ substrs=["3"])
self.expect("breakpoint delete 1")
self.runCmd("process continue")
-
+
self.expect("expression -- foo(2)")
self.expect("expression -- int &&j = 3; foo(j)",
- error = True)
+ error=True)
self.expect("expression -- int &&k = 6; k",
- startstr = "(int) $1 = 6")
+ startstr="(int) $1 = 6")
def set_breakpoint(self, line):
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", line, num_expected_locations=1, loc_exact=True)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py b/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
index d075eb65b848..ce270b1ea391 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/scope/TestCppScope.py
@@ -6,13 +6,25 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestCppScopes(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureDarwin
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
- def test_with_run_command(self):
+ def test_all_but_c(self):
+ self.do_test(False)
+
+ # There's a global symbol in libsystem on Darwin that messes up
+ # the lookup of class C. Breaking that test out from the others
+ # since that is a odd failure, and I don't want it to mask the
+ # real purpose of this test.
+ @expectedFailureDarwin(bugnumber="<rdar://problem/28623427>")
+ @expectedFailureAll(oslist=["windows"])
+ def test_c(self):
+ self.do_test(True)
+
+ def do_test(self, test_c):
self.build()
# Get main source file
@@ -23,25 +35,32 @@ class TestCppScopes(TestBase):
# Get the path of the executable
cwd = os.getcwd()
exe_file = "a.out"
- exe_path = os.path.join(cwd, exe_file)
+ exe_path = os.path.join(cwd, exe_file)
# Load the executable
target = self.dbg.CreateTarget(exe_path)
self.assertTrue(target.IsValid(), VALID_TARGET)
# Break on main function
- main_breakpoint = target.BreakpointCreateBySourceRegex("// break here", src_file_spec)
- self.assertTrue(main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1, VALID_BREAKPOINT)
+ main_breakpoint = target.BreakpointCreateBySourceRegex(
+ "// break here", src_file_spec)
+ self.assertTrue(
+ main_breakpoint.IsValid() and main_breakpoint.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
# Launch the process
args = None
env = None
- process = target.LaunchSimple(args, env, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ args, env, self.get_process_working_directory())
self.assertTrue(process.IsValid(), PROCESS_IS_VALID)
# Get the thread of the process
- self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
# Get current fream of the thread at the breakpoint
frame = thread.GetSelectedFrame()
@@ -57,12 +76,23 @@ class TestCppScopes(TestBase):
'a': 4444
}
- self.assertTrue(global_variables.GetSize() == 4, "target variable returns all variables")
+ self.assertTrue(
+ global_variables.GetSize() == 4,
+ "target variable returns all variables")
for variable in global_variables:
name = variable.GetName()
- self.assertTrue(name in global_variables_assert, "target variable returns wrong variable " + name)
+ self.assertTrue(
+ name in global_variables_assert,
+ "target variable returns wrong variable " + name)
for name in global_variables_assert:
+ if name is "C::a" and not test_c:
+ continue
+ if name is not "C::a" and test_c:
+ continue
+
value = frame.EvaluateExpression(name)
assert_value = global_variables_assert[name]
- self.assertTrue(value.IsValid() and value.GetValueAsSigned() == assert_value, name + " = " + str(assert_value))
+ self.assertTrue(
+ value.IsValid() and value.GetValueAsSigned() == assert_value,
+ name + " = " + str(assert_value))
diff --git a/packages/Python/lldbsuite/test/lang/cpp/signed_types/TestSignedTypes.py b/packages/Python/lldbsuite/test/lang/cpp/signed_types/TestSignedTypes.py
index 3158c4c5bcf0..5925b10143e0 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/signed_types/TestSignedTypes.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/signed_types/TestSignedTypes.py
@@ -5,13 +5,14 @@ Test that variables with signed types display correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class SignedTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,7 +22,8 @@ class SignedTypesTestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break inside main().
self.source = 'main.cpp'
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
def test(self):
"""Test that variables with signed types display correctly."""
@@ -34,27 +36,33 @@ class SignedTypesTestCase(TestBase):
target = self.dbg.CreateTarget("a.out")
self.assertTrue(target, VALID_TARGET)
- lldbutil.run_break_set_by_file_and_line (self, self.source, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, self.source, self.line, num_expected_locations=1, loc_exact=True)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Execute the puts().
self.runCmd("thread step-over")
# Test that signed types display correctly.
- self.expect("frame variable --show-types --no-args", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\((short int|short)\) the_signed_short = 99",
- "\((signed char|char)\) the_signed_char = 'c'"],
- substrs = ["(int) the_signed_int = 99",
- "(long) the_signed_long = 99",
- "(long long) the_signed_long_long = 99"])
+ self.expect(
+ "frame variable --show-types --no-args",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ patterns=[
+ "\((short int|short)\) the_signed_short = 99",
+ "\((signed char|char)\) the_signed_char = 'c'"],
+ substrs=[
+ "(int) the_signed_int = 99",
+ "(long) the_signed_long = 99",
+ "(long long) the_signed_long_long = 99"])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/static_members/TestCPPStaticMembers.py b/packages/Python/lldbsuite/test/lang/cpp/static_members/TestCPPStaticMembers.py
index dd220d905278..16b567588161 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/static_members/TestCPPStaticMembers.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/static_members/TestCPPStaticMembers.py
@@ -5,18 +5,18 @@ Tests that C++ member and static variables have correct layout and scope.
from __future__ import print_function
-
import unittest2
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CPPStaticMembersTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
- @unittest2.expectedFailure # llvm.org/pr15401
+
+ @unittest2.expectedFailure # llvm.org/pr15401
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
def test_with_run_command(self):
"""Test that member variables have the correct layout, scope and qualifiers when stopped inside and outside C++ methods"""
@@ -28,33 +28,35 @@ class CPPStaticMembersTestCase(TestBase):
self.runCmd("process launch", RUN_SUCCEEDED)
self.expect("expression my_a.access()",
- startstr = "(long) $0 = 10")
-
+ startstr="(long) $0 = 10")
+
self.expect("expression my_a.m_a",
- startstr = "(short) $1 = 1")
-
- # Note: SymbolFileDWARF::ParseChildMembers doesn't call AddFieldToRecordType, consistent with clang's AST layout.
+ startstr="(short) $1 = 1")
+
+ # Note: SymbolFileDWARF::ParseChildMembers doesn't call
+ # AddFieldToRecordType, consistent with clang's AST layout.
self.expect("expression my_a.s_d",
- startstr = "(int) $2 = 4")
-
+ startstr="(int) $2 = 4")
+
self.expect("expression my_a.s_b",
- startstr = "(long) $3 = 2")
-
+ startstr="(long) $3 = 2")
+
self.expect("expression A::s_b",
- startstr = "(long) $4 = 2")
+ startstr="(long) $4 = 2")
- # should not be available in global scope
+ # should not be available in global scope
self.expect("expression s_d",
- startstr = "error: use of undeclared identifier 's_d'")
-
+ startstr="error: use of undeclared identifier 's_d'")
+
self.runCmd("process continue")
self.expect("expression m_c",
- startstr = "(char) $5 = \'\\x03\'")
-
+ startstr="(char) $5 = \'\\x03\'")
+
self.expect("expression s_b",
- startstr = "(long) $6 = 2")
+ startstr="(long) $6 = 2")
self.runCmd("process continue")
def set_breakpoint(self, line):
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", line, num_expected_locations=1, loc_exact=False)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/static_methods/TestCPPStaticMethods.py b/packages/Python/lldbsuite/test/lang/cpp/static_methods/TestCPPStaticMethods.py
index 9784be189cb4..9c263053879e 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/static_methods/TestCPPStaticMethods.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/static_methods/TestCPPStaticMethods.py
@@ -7,10 +7,11 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CPPStaticMethodsTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
+
def setUp(self):
TestBase.setUp(self)
self.line = line_number('main.cpp', '// Break at this line')
@@ -21,17 +22,18 @@ class CPPStaticMethodsTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, 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("process launch", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list",
STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
self.expect("expression -- A::getStaticValue()",
- startstr = "(int) $0 = 5")
+ startstr="(int) $0 = 5")
self.expect("expression -- my_a.getMemberValue()",
- startstr = "(int) $1 = 3")
+ startstr="(int) $1 = 3")
diff --git a/packages/Python/lldbsuite/test/lang/cpp/stl/TestSTL.py b/packages/Python/lldbsuite/test/lang/cpp/stl/TestSTL.py
index e25820857025..ce5869742f47 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/stl/TestSTL.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/stl/TestSTL.py
@@ -5,14 +5,15 @@ Test some expressions involving STL data types.
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class STLTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,7 +23,8 @@ class STLTestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break inside main().
self.source = 'main.cpp'
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
@expectedFailureAll(bugnumber="rdar://problem/10400981")
def test(self):
@@ -32,42 +34,46 @@ class STLTestCase(TestBase):
# The following two lines, if uncommented, will enable loggings.
#self.ci.HandleCommand("log enable -f /tmp/lldb.log lldb default", res)
- #self.assertTrue(res.Succeeded())
+ # self.assertTrue(res.Succeeded())
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# rdar://problem/8543077
# test/stl: clang built binaries results in the breakpoint locations = 3,
# is this a problem with clang generated debug info?
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, 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("run", RUN_SUCCEEDED)
# Stop at 'std::string hello_world ("Hello World!");'.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['main.cpp:%d' % self.line,
- 'stop reason = breakpoint'])
+ substrs=['main.cpp:%d' % self.line,
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Now try some expressions....
- self.runCmd('expr for (int i = 0; i < hello_world.length(); ++i) { (void)printf("%c\\n", hello_world[i]); }')
+ self.runCmd(
+ 'expr for (int i = 0; i < hello_world.length(); ++i) { (void)printf("%c\\n", hello_world[i]); }')
# rdar://problem/10373783
# rdar://problem/10400981
self.expect('expr associative_array.size()',
- substrs = [' = 3'])
+ substrs=[' = 3'])
self.expect('expr associative_array.count(hello_world)',
- substrs = [' = 1'])
+ substrs=[' = 1'])
self.expect('expr associative_array[hello_world]',
- substrs = [' = 1'])
+ substrs=[' = 1'])
self.expect('expr associative_array["hello"]',
- substrs = [' = 2'])
+ substrs=[' = 2'])
- @expectedFailureAll(compiler="icc", bugnumber="ICC (13.1, 14-beta) do not emit DW_TAG_template_type_parameter.")
+ @expectedFailureAll(
+ compiler="icc",
+ bugnumber="ICC (13.1, 14-beta) do not emit DW_TAG_template_type_parameter.")
@add_test_categories(['pyapi'])
def test_SBType_template_aspects(self):
"""Test APIs for getting template arguments from an SBType."""
@@ -83,13 +89,17 @@ class STLTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
# Get the type for variable 'associative_array'.
@@ -102,8 +112,9 @@ class STLTestCase(TestBase):
num_template_args = map_type.GetNumberOfTemplateArguments()
self.assertTrue(num_template_args > 0)
- # We expect the template arguments to contain at least 'string' and 'int'.
- expected_types = { 'string': False, 'int': False }
+ # We expect the template arguments to contain at least 'string' and
+ # 'int'.
+ expected_types = {'string': False, 'int': False}
for i in range(num_template_args):
t = map_type.GetTemplateArgumentType(i)
self.DebugSBType(t)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py b/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py
index 865516de4edc..47fdf59a27ee 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/stl/TestStdCXXDisassembly.py
@@ -5,13 +5,14 @@ Test the lldb disassemble command on lib stdc++.
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class StdCXXDisassembleTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,7 +25,9 @@ class StdCXXDisassembleTestCase(TestBase):
# rdar://problem/8504895
# Crash while doing 'disassemble -n "-[NSNumber descriptionWithLocale:]"
- @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test")
+ @unittest2.skipIf(
+ TestBase.skipLongRunningTest(),
+ "Skip this long running test")
def test_stdcxx_disasm(self):
"""Do 'disassemble' on each and every 'Code' symbol entry from the std c++ lib."""
self.build()
@@ -36,7 +39,8 @@ class StdCXXDisassembleTestCase(TestBase):
# is this a problem with clang generated debug info?
#
# Break on line 13 of main.cpp.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, 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("run", RUN_SUCCEEDED)
@@ -46,12 +50,13 @@ class StdCXXDisassembleTestCase(TestBase):
# The process should be in a 'stopped' state.
self.expect(str(process), STOPPED_DUE_TO_BREAKPOINT, exe=False,
- substrs = ["a.out",
- "stopped"])
+ substrs=["a.out",
+ "stopped"])
# Disassemble the functions on the call stack.
self.runCmd("thread backtrace")
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
depth = thread.GetNumFrames()
for i in range(depth - 1):
@@ -65,7 +70,8 @@ class StdCXXDisassembleTestCase(TestBase):
for i in range(target.GetNumModules()):
module = target.GetModuleAtIndex(i)
fs = module.GetFileSpec()
- if (fs.GetFilename().startswith("libstdc++") or fs.GetFilename().startswith("libc++")):
+ if (fs.GetFilename().startswith("libstdc++")
+ or fs.GetFilename().startswith("libc++")):
lib_stdcxx = str(fs)
break
@@ -73,7 +79,7 @@ class StdCXXDisassembleTestCase(TestBase):
# module is the corresponding SBModule.
self.expect(lib_stdcxx, "Libraray StdC++ is located", exe=False,
- substrs = ["lib"])
+ substrs=["lib"])
self.runCmd("image dump symtab '%s'" % lib_stdcxx)
raw_output = self.res.GetOutput()
diff --git a/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py b/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py
index e08d3a10786c..b59f966236bb 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/template/TestTemplateArgs.py
@@ -1,7 +1,7 @@
"""
Test that C++ template classes that have integer parameters work correctly.
-We must reconstruct the types correctly so the template types are correct
+We must reconstruct the types correctly so the template types are correct
and display correctly, and also make sure the expression parser works and
is able the find all needed functions when evaluating expressions
"""
@@ -10,10 +10,11 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TemplateArgsTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
+
def prepareProcess(self):
self.build()
@@ -22,66 +23,109 @@ class TemplateArgsTestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- # Set breakpoints inside and outside methods that take pointers to the containing struct.
+ # Set breakpoints inside and outside methods that take pointers to the
+ # containing struct.
line = line_number('main.cpp', '// Breakpoint 1')
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", line, num_expected_locations=1, loc_exact=True)
arguments = None
- environment = None
+ environment = None
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (arguments, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ arguments, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
-
+
# Get the thread of the process
- self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
# Get frame for current thread
return thread.GetSelectedFrame()
+ @expectedFailureAll(oslist=["windows"])
def test_integer_args(self):
frame = self.prepareProcess()
-
- testpos = frame.FindVariable('testpos')
- self.assertTrue(testpos.IsValid(), 'make sure we find a local variabble named "testpos"')
+
+ testpos = frame.FindVariable('testpos')
+ self.assertTrue(
+ testpos.IsValid(),
+ 'make sure we find a local variabble named "testpos"')
self.assertTrue(testpos.GetType().GetName() == 'TestObj<1>')
-
+
expr_result = frame.EvaluateExpression("testpos.getArg()")
- self.assertTrue(expr_result.IsValid(), 'got a valid expression result from expression "testpos.getArg()"');
+ self.assertTrue(
+ expr_result.IsValid(),
+ 'got a valid expression result from expression "testpos.getArg()"')
self.assertTrue(expr_result.GetValue() == "1", "testpos.getArg() == 1")
- self.assertTrue(expr_result.GetType().GetName() == "int", 'expr_result.GetType().GetName() == "int"')
-
- testneg = frame.FindVariable('testneg')
- self.assertTrue(testneg.IsValid(), 'make sure we find a local variabble named "testneg"')
- self.assertTrue(testneg.GetType().GetName() == 'TestObj<-1>')
-
+ self.assertTrue(
+ expr_result.GetType().GetName() == "int",
+ 'expr_result.GetType().GetName() == "int"')
+
+ testneg = frame.FindVariable('testneg')
+ self.assertTrue(
+ testneg.IsValid(),
+ 'make sure we find a local variabble named "testneg"')
+ self.assertTrue(testneg.GetType().GetName() == 'TestObj<-1>')
+
expr_result = frame.EvaluateExpression("testneg.getArg()")
- self.assertTrue(expr_result.IsValid(), 'got a valid expression result from expression "testneg.getArg()"');
- self.assertTrue(expr_result.GetValue() == "-1", "testneg.getArg() == -1")
- self.assertTrue(expr_result.GetType().GetName() == "int", 'expr_result.GetType().GetName() == "int"')
+ self.assertTrue(
+ expr_result.IsValid(),
+ 'got a valid expression result from expression "testneg.getArg()"')
+ self.assertTrue(
+ expr_result.GetValue() == "-1",
+ "testneg.getArg() == -1")
+ self.assertTrue(
+ expr_result.GetType().GetName() == "int",
+ 'expr_result.GetType().GetName() == "int"')
- # Gcc does not generate the necessary DWARF attribute for enum template parameters.
+ # Gcc does not generate the necessary DWARF attribute for enum template
+ # parameters.
@expectedFailureAll(bugnumber="llvm.org/pr28354", compiler="gcc")
+ @expectedFailureAll(oslist=["windows"])
def test_enum_args(self):
frame = self.prepareProcess()
- # Make sure "member" can be displayed and also used in an expression correctly
- member = frame.FindVariable('member')
- self.assertTrue(member.IsValid(), 'make sure we find a local variabble named "member"')
- self.assertTrue(member.GetType().GetName() == 'EnumTemplate<EnumType::Member>')
-
+ # Make sure "member" can be displayed and also used in an expression
+ # correctly
+ member = frame.FindVariable('member')
+ self.assertTrue(
+ member.IsValid(),
+ 'make sure we find a local variabble named "member"')
+ self.assertTrue(member.GetType().GetName() ==
+ 'EnumTemplate<EnumType::Member>')
+
expr_result = frame.EvaluateExpression("member.getMember()")
- self.assertTrue(expr_result.IsValid(), 'got a valid expression result from expression "member.getMember()"');
- self.assertTrue(expr_result.GetValue() == "123", "member.getMember() == 123")
- self.assertTrue(expr_result.GetType().GetName() == "int", 'expr_result.GetType().GetName() == "int"')
-
- # Make sure "subclass" can be displayed and also used in an expression correctly
- subclass = frame.FindVariable('subclass')
- self.assertTrue(subclass.IsValid(), 'make sure we find a local variabble named "subclass"')
- self.assertTrue(subclass.GetType().GetName() == 'EnumTemplate<EnumType::Subclass>')
-
+ self.assertTrue(
+ expr_result.IsValid(),
+ 'got a valid expression result from expression "member.getMember()"')
+ self.assertTrue(
+ expr_result.GetValue() == "123",
+ "member.getMember() == 123")
+ self.assertTrue(
+ expr_result.GetType().GetName() == "int",
+ 'expr_result.GetType().GetName() == "int"')
+
+ # Make sure "subclass" can be displayed and also used in an expression
+ # correctly
+ subclass = frame.FindVariable('subclass')
+ self.assertTrue(
+ subclass.IsValid(),
+ 'make sure we find a local variabble named "subclass"')
+ self.assertTrue(subclass.GetType().GetName() ==
+ 'EnumTemplate<EnumType::Subclass>')
+
expr_result = frame.EvaluateExpression("subclass.getMember()")
- self.assertTrue(expr_result.IsValid(), 'got a valid expression result from expression "subclass.getMember()"');
- self.assertTrue(expr_result.GetValue() == "246", "subclass.getMember() == 246")
- self.assertTrue(expr_result.GetType().GetName() == "int", 'expr_result.GetType().GetName() == "int"')
+ self.assertTrue(
+ expr_result.IsValid(),
+ 'got a valid expression result from expression "subclass.getMember()"')
+ self.assertTrue(
+ expr_result.GetValue() == "246",
+ "subclass.getMember() == 246")
+ self.assertTrue(
+ expr_result.GetType().GetName() == "int",
+ 'expr_result.GetType().GetName() == "int"')
diff --git a/packages/Python/lldbsuite/test/lang/cpp/this/TestCPPThis.py b/packages/Python/lldbsuite/test/lang/cpp/this/TestCPPThis.py
index 5f89371aa85b..ed2e257dc310 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/this/TestCPPThis.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/this/TestCPPThis.py
@@ -6,14 +6,21 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CPPThisTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
- #rdar://problem/9962849
- @expectedFailureAll(compiler="gcc", bugnumber="llvm.org/pr15439 The 'this' pointer isn't available during expression evaluation when stopped in an inlined member function")
- @expectedFailureAll(compiler="icc", bugnumber="ICC doesn't emit correct DWARF inline debug info for inlined member functions.")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+
+ # rdar://problem/9962849
+ @expectedFailureAll(
+ compiler="gcc",
+ bugnumber="llvm.org/pr15439 The 'this' pointer isn't available during expression evaluation when stopped in an inlined member function")
+ @expectedFailureAll(
+ compiler="icc",
+ bugnumber="ICC doesn't emit correct DWARF inline debug info for inlined member functions.")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
def test_with_run_command(self):
"""Test that the appropriate member variables are available when stopped in C++ static, inline, and const methods"""
self.build()
@@ -27,26 +34,27 @@ class CPPThisTestCase(TestBase):
self.runCmd("process launch", RUN_SUCCEEDED)
self.expect("expression -- m_a = 2",
- startstr = "(int) $0 = 2")
-
+ startstr="(int) $0 = 2")
+
self.runCmd("process continue")
-
+
# This would be disallowed if we enforced const. But we don't.
self.expect("expression -- m_a = 2",
- startstr = "(int) $1 = 2")
-
- self.expect("expression -- (int)getpid(); m_a",
- startstr = "(int) $2 = 2")
+ startstr="(int) $1 = 2")
+
+ self.expect("expression -- (int)getpid(); m_a",
+ startstr="(int) $2 = 2")
self.runCmd("process continue")
self.expect("expression -- s_a",
- startstr = "(int) $3 = 5")
+ startstr="(int) $3 = 5")
self.runCmd("process continue")
self.expect("expression -- m_a",
- startstr = "(int) $4 = 2")
-
+ startstr="(int) $4 = 2")
+
def set_breakpoint(self, line):
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", line, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", line, num_expected_locations=1, loc_exact=False)
diff --git a/packages/Python/lldbsuite/test/lang/cpp/unicode-literals/TestUnicodeLiterals.py b/packages/Python/lldbsuite/test/lang/cpp/unicode-literals/TestUnicodeLiterals.py
index 1ae133f0b078..842d03ae5197 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/unicode-literals/TestUnicodeLiterals.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/unicode-literals/TestUnicodeLiterals.py
@@ -6,8 +6,8 @@ Test that the expression parser returns proper Unicode strings.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
@@ -26,23 +26,30 @@ from lldbsuite.test import lldbutil
# [5] = e\0\0\0
#}
+
class UnicodeLiteralsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
def test_expr1(self):
"""Test that the expression parser returns proper Unicode strings."""
self.build()
self.rdar12991846(expr=1)
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
def test_expr2(self):
"""Test that the expression parser returns proper Unicode strings."""
self.build()
self.rdar12991846(expr=2)
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
def test_expr3(self):
"""Test that the expression parser returns proper Unicode strings."""
self.build()
@@ -53,12 +60,14 @@ class UnicodeLiteralsTestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break for main.cpp.
self.source = 'main.cpp'
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
def rdar12991846(self, expr=None):
"""Test that the expression parser returns proper Unicode strings."""
if self.getArchitecture() in ['i386']:
- self.skipTest("Skipping because this test is known to crash on i386")
+ self.skipTest(
+ "Skipping because this test is known to crash on i386")
exe = os.path.join(os.getcwd(), "a.out")
@@ -67,16 +76,20 @@ class UnicodeLiteralsTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Break on the struct declration statement in main.cpp.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line)
+ lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.line)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.Launch() failed")
- if expr == 1: self.expect('expression L"hello"', substrs = ['hello'])
+ if expr == 1:
+ self.expect('expression L"hello"', substrs=['hello'])
- if expr == 2: self.expect('expression u"hello"', substrs = ['hello'])
+ if expr == 2:
+ self.expect('expression u"hello"', substrs=['hello'])
- if expr == 3: self.expect('expression U"hello"', substrs = ['hello'])
+ if expr == 3:
+ self.expect('expression U"hello"', substrs=['hello'])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/unique-types/TestUniqueTypes.py b/packages/Python/lldbsuite/test/lang/cpp/unique-types/TestUniqueTypes.py
index 2cbb1a191e68..3afac33ab39f 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/unique-types/TestUniqueTypes.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/unique-types/TestUniqueTypes.py
@@ -5,11 +5,11 @@ Test that template instaniations of std::vector<long> and <short> in the same mo
from __future__ import print_function
-
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
+
class UniqueTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -18,8 +18,9 @@ class UniqueTypesTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number inside main.cpp.
- self.line = line_number("main.cpp",
- "// Set breakpoint here to verify that std::vector 'longs' and 'shorts' have unique types.")
+ self.line = line_number(
+ "main.cpp",
+ "// Set breakpoint here to verify that std::vector 'longs' and 'shorts' have unique types.")
def test(self):
"""Test for unique types of std::vector<long> and std::vector<short>."""
@@ -27,36 +28,43 @@ class UniqueTypesTestCase(TestBase):
compiler = self.getCompiler()
compiler_basename = os.path.basename(compiler)
- if "clang" in compiler_basename and int(self.getCompilerVersion().split('.')[0]) < 3:
- self.skipTest("rdar://problem/9173060 lldb hangs while running unique-types for clang version < 3")
+ if "clang" in compiler_basename and int(
+ self.getCompilerVersion().split('.')[0]) < 3:
+ self.skipTest(
+ "rdar://problem/9173060 lldb hangs while running unique-types for clang version < 3")
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, 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("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
- # Do a "frame variable --show-types longs" and verify "long" is in each line of output.
+ # Do a "frame variable --show-types longs" and verify "long" is in each
+ # line of output.
self.runCmd("frame variable --show-types longs")
output = self.res.GetOutput()
for x in [line.strip() for line in output.split(os.linesep)]:
- # Skip empty line, closing brace, and messages about more variables than can be displayed.
+ # Skip empty line, closing brace, and messages about more variables
+ # than can be displayed.
if not x or x == '}' or x == '...' or "Some of your variables have more members than the debugger will show by default" in x:
continue
self.expect(x, "Expect type 'long'", exe=False,
- substrs = ['long'])
+ substrs=['long'])
- # Do a "frame variable --show-types shorts" and verify "short" is in each line of output.
+ # Do a "frame variable --show-types shorts" and verify "short" is in
+ # each line of output.
self.runCmd("frame variable --show-types shorts")
output = self.res.GetOutput()
for x in [line.strip() for line in output.split(os.linesep)]:
- # Skip empty line, closing brace, and messages about more variables than can be displayed.
+ # Skip empty line, closing brace, and messages about more variables
+ # than can be displayed.
if not x or x == '}' or x == '...' or "Some of your variables have more members than the debugger will show by default" in x:
continue
self.expect(x, "Expect type 'short'", exe=False,
- substrs = ['short'])
+ substrs=['short'])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/unsigned_types/TestUnsignedTypes.py b/packages/Python/lldbsuite/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
index 30aadb389680..0189a65bec39 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/unsigned_types/TestUnsignedTypes.py
@@ -5,14 +5,15 @@ Test that variables with unsigned types display correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class UnsignedTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,7 +24,6 @@ class UnsignedTypesTestCase(TestBase):
# Find the line number to break inside main().
self.line = line_number('main.cpp', '// Set break point at this line.')
- @expectedFailureAll(oslist=["windows"])
def test(self):
"""Test that variables with unsigned types display correctly."""
self.build()
@@ -34,23 +34,31 @@ class UnsignedTypesTestCase(TestBase):
# if GCC is the target compiler, we cannot rely on an exact line match.
need_exact = "gcc" not in self.getCompiler()
# Break on line 19 in main() aftre the variables are assigned values.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=-1, loc_exact=need_exact)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ "main.cpp",
+ self.line,
+ num_expected_locations=-1,
+ loc_exact=need_exact)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Test that unsigned types display correctly.
- self.expect("frame variable --show-types --no-args", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(unsigned char) the_unsigned_char = 'c'",
- patterns = ["\((short unsigned int|unsigned short)\) the_unsigned_short = 99"],
- substrs = ["(unsigned int) the_unsigned_int = 99",
- "(unsigned long) the_unsigned_long = 99",
- "(unsigned long long) the_unsigned_long_long = 99",
- "(uint32_t) the_uint32 = 99"])
+ self.expect(
+ "frame variable --show-types --no-args",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ patterns=["\((short unsigned int|unsigned short)\) the_unsigned_short = 99"],
+ substrs=[
+ "(unsigned char) the_unsigned_char = 'c'",
+ "(unsigned int) the_unsigned_int = 99",
+ "(unsigned long) the_unsigned_long = 99",
+ "(unsigned long long) the_unsigned_long_long = 99",
+ "(uint32_t) the_uint32 = 99"])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py b/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
index bee148773f03..7356484e69a4 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/virtual/TestVirtual.py
@@ -4,15 +4,19 @@ Test C++ virtual function and virtual inheritance.
from __future__ import print_function
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
def Msg(expr, val):
- return "'expression %s' matches the output (from compiled code): %s" % (expr, val)
+ return "'expression %s' matches the output (from compiled code): %s" % (
+ expr, val)
+
class CppVirtualMadness(TestBase):
@@ -29,8 +33,9 @@ class CppVirtualMadness(TestBase):
self.source = 'main.cpp'
self.line = line_number(self.source, '// Set first breakpoint here.')
- @expectedFailureAll(compiler="icc", bugnumber="llvm.org/pr16808 lldb does not call the correct virtual function with icc.")
- @expectedFailureAll(oslist=['windows'])
+ @expectedFailureAll(
+ compiler="icc",
+ bugnumber="llvm.org/pr16808 lldb does not call the correct virtual function with icc.")
def test_virtual_madness(self):
"""Test that expression works correctly with virtual inheritance as well as virtual function."""
self.build()
@@ -38,7 +43,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.dbg.SetAsync(False)
-
+
# Create a target by the debugger.
target = self.dbg.CreateTarget("a.out")
self.assertTrue(target, VALID_TARGET)
@@ -48,18 +53,25 @@ class CppVirtualMadness(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
-
+
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
# First, capture the golden output from the program itself.
golden = thread.GetFrameAtIndex(0).FindVariable("golden")
- self.assertTrue(golden.IsValid(), "Encountered an error reading the process's golden variable")
+ self.assertTrue(
+ golden.IsValid(),
+ "Encountered an error reading the process's golden variable")
error = lldb.SBError()
- golden_str = process.ReadCStringFromMemory(golden.AddressOf().GetValueAsUnsigned(), 4096, error);
+ golden_str = process.ReadCStringFromMemory(
+ golden.AddressOf().GetValueAsUnsigned(), 4096, error)
self.assertTrue(error.Success())
self.assertTrue("c_as_C" in golden_str)
@@ -84,7 +96,7 @@ class CppVirtualMadness(TestBase):
self.runCmd("expression %s" % my_expr)
output = self.res.GetOutput()
-
+
# The expression output must match the oracle.
self.expect(output, Msg(my_expr, val), exe=False,
- substrs = [val])
+ substrs=[val])
diff --git a/packages/Python/lldbsuite/test/lang/cpp/wchar_t/TestCxxWCharT.py b/packages/Python/lldbsuite/test/lang/cpp/wchar_t/TestCxxWCharT.py
index f9cdbca16e55..f17ba6f4a229 100644
--- a/packages/Python/lldbsuite/test/lang/cpp/wchar_t/TestCxxWCharT.py
+++ b/packages/Python/lldbsuite/test/lang/cpp/wchar_t/TestCxxWCharT.py
@@ -1,4 +1,4 @@
-#coding=utf8
+# coding=utf8
"""
Test that C++ supports wchar_t correctly.
"""
@@ -6,12 +6,13 @@ Test that C++ supports wchar_t correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class CxxWCharTTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,7 +22,8 @@ class CxxWCharTTestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break for main.cpp.
self.source = 'main.cpp'
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
def test(self):
"""Test that C++ supports wchar_t correctly."""
@@ -33,42 +35,46 @@ class CxxWCharTTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Break on the struct declration statement in main.cpp.
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line)
+ lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.line)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.Launch() failed")
# Check that we correctly report templates on wchar_t
self.expect("frame variable foo_y",
- substrs = ['(Foo<wchar_t>) foo_y = '])
+ substrs=['(Foo<wchar_t>) foo_y = '])
# Check that we correctly report templates on int
self.expect("frame variable foo_x",
- substrs = ['(Foo<int>) foo_x = '])
+ substrs=['(Foo<int>) foo_x = '])
# Check that we correctly report wchar_t
self.expect("frame variable foo_y.object",
- substrs = ['(wchar_t) foo_y.object = '])
+ substrs=['(wchar_t) foo_y.object = '])
# Check that we correctly report int
self.expect("frame variable foo_x.object",
- substrs = ['(int) foo_x.object = '])
+ substrs=['(int) foo_x.object = '])
# Check that we can run expressions that return wchar_t
- self.expect("expression L'a'",substrs = ['(wchar_t) $',"L'a'"])
+ self.expect("expression L'a'", substrs=['(wchar_t) $', "L'a'"])
# Mazel Tov if this works!
self.expect("frame variable mazeltov",
- substrs = ['(const wchar_t *) mazeltov = ','L"מזל טוב"'])
+ substrs=['(const wchar_t *) mazeltov = ', 'L"מזל טוב"'])
+
+ self.expect(
+ "frame variable ws_NULL",
+ substrs=['(wchar_t *) ws_NULL = 0x0'])
+ self.expect("frame variable ws_empty", substrs=[' L""'])
- self.expect("frame variable ws_NULL",substrs = ['(wchar_t *) ws_NULL = 0x0'])
- self.expect("frame variable ws_empty",substrs = [' L""'])
+ self.expect("frame variable array", substrs=[
+ 'L"Hey, I\'m a super wchar_t string'])
+ self.expect("frame variable array", substrs=['[0]'], matching=False)
- self.expect("frame variable array",substrs = ['L"Hey, I\'m a super wchar_t string'])
- self.expect("frame variable array",substrs = ['[0]'], matching=False)
-
self.expect('frame variable wchar_zero', substrs=["L'\\0'"])
self.expect('expression wchar_zero', substrs=["L'\\0'"])
diff --git a/packages/Python/lldbsuite/test/lang/go/expressions/TestExpressions.py b/packages/Python/lldbsuite/test/lang/go/expressions/TestExpressions.py
index f2e5613ffd61..306b00840dfd 100644
--- a/packages/Python/lldbsuite/test/lang/go/expressions/TestExpressions.py
+++ b/packages/Python/lldbsuite/test/lang/go/expressions/TestExpressions.py
@@ -1,18 +1,20 @@
"""Test the go expression parser/interpreter."""
-import os, time
+import os
+import time
import unittest2
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestGoUserExpression(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(['pyapi'])
- @skipIfRemote # Not remote test suit ready
+ @skipIfRemote # Not remote test suit ready
@skipUnlessGoInstalled
def test_with_dsym_and_python_api(self):
"""Test GoASTUserExpress."""
@@ -25,7 +27,8 @@ class TestGoUserExpression(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "main.go"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
def check_builtin(self, name, size=0, typeclass=lldb.eTypeClassBuiltin):
tl = self.target().FindTypes(name)
@@ -42,23 +45,28 @@ class TestGoUserExpression(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
def go_expressions(self):
frame = self.frame()
@@ -66,7 +74,7 @@ class TestGoUserExpression(TestBase):
self.assertEqual(1, v.GetValueAsSigned())
x = frame.EvaluateExpression("x")
self.assertEqual(22, x.GetValueAsSigned())
-
+
a = frame.EvaluateExpression("a")
self.assertEqual(3, a.GetNumChildren())
a0 = a.GetChildAtIndex(0)
@@ -75,23 +83,23 @@ class TestGoUserExpression(TestBase):
# Array indexing
a0 = frame.EvaluateExpression("a[0]")
self.assertEqual(8, a0.GetValueAsSigned())
-
+
# Slice indexing
b1 = frame.EvaluateExpression("b[1]")
self.assertEqual(9, b1.GetValueAsSigned())
-
+
# Test global in this package
g = frame.EvaluateExpression("myGlobal")
self.assertEqual(17, g.GetValueAsSigned(), str(g))
-
+
# Global with package name
g = frame.EvaluateExpression("main.myGlobal")
self.assertEqual(17, g.GetValueAsSigned(), str(g))
-
+
# Global with quoted package name
g = frame.EvaluateExpression('"main".myGlobal')
self.assertEqual(17, g.GetValueAsSigned(), str(g))
-
+
# Casting with package local type
s = frame.EvaluateExpression("*(*myStruct)(i.data)")
sb = s.GetChildMemberWithName("a")
diff --git a/packages/Python/lldbsuite/test/lang/go/formatters/TestGoFormatters.py b/packages/Python/lldbsuite/test/lang/go/formatters/TestGoFormatters.py
index 2578742467d9..c48cd1f6af08 100644
--- a/packages/Python/lldbsuite/test/lang/go/formatters/TestGoFormatters.py
+++ b/packages/Python/lldbsuite/test/lang/go/formatters/TestGoFormatters.py
@@ -1,18 +1,20 @@
"""Test the Go Data Formatter Plugin."""
-import os, time
+import os
+import time
import unittest2
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestGoLanguage(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfFreeBSD # llvm.org/pr24895 triggers assertion failure
- @skipIfRemote # Not remote test suite ready
+ @skipIfFreeBSD # llvm.org/pr24895 triggers assertion failure
+ @skipIfRemote # Not remote test suite ready
@no_debug_info_test
@skipUnlessGoInstalled
def test_go_formatter_plugin(self):
@@ -34,29 +36,37 @@ class TestGoLanguage(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- self.bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ self.bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(self.bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, self.bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ process, self.bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
def check_formatters(self):
a = self.frame().FindVariable('a')
self.assertEqual('(string) a = "my string"', str(a))
b = self.frame().FindVariable('b')
- self.assertEqual("([]int) b = (len 2, cap 7) {\n [0] = 0\n [1] = 0\n}", str(b))
+ self.assertEqual(
+ "([]int) b = (len 2, cap 7) {\n [0] = 0\n [1] = 0\n}",
+ str(b))
if __name__ == '__main__':
diff --git a/packages/Python/lldbsuite/test/lang/go/goroutines/TestGoroutines.py b/packages/Python/lldbsuite/test/lang/go/goroutines/TestGoroutines.py
index 8aff2e514bb9..e0cf9e8d7759 100644
--- a/packages/Python/lldbsuite/test/lang/go/goroutines/TestGoroutines.py
+++ b/packages/Python/lldbsuite/test/lang/go/goroutines/TestGoroutines.py
@@ -3,20 +3,21 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestGoASTContext(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(['pyapi'])
- @skipIfFreeBSD # llvm.org/pr24895 triggers assertion failure
- @skipIfRemote # Not remote test suite ready
+ @skipIfFreeBSD # llvm.org/pr24895 triggers assertion failure
+ @skipIfRemote # Not remote test suite ready
@no_debug_info_test
@skipUnlessGoInstalled
def test_goroutine_plugin(self):
@@ -40,47 +41,64 @@ class TestGoASTContext(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- self.bpt1 = target.BreakpointCreateByLocation(self.main_source, self.break_line1)
+ self.bpt1 = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line1)
self.assertTrue(self.bpt1, VALID_BREAKPOINT)
- self.bpt2 = target.BreakpointCreateByLocation(self.main_source, self.break_line2)
+ self.bpt2 = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line2)
self.assertTrue(self.bpt2, VALID_BREAKPOINT)
- self.bpt3 = target.BreakpointCreateByLocation(self.main_source, self.break_line3)
+ self.bpt3 = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line3)
self.assertTrue(self.bpt3, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, self.bpt1)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ process, self.bpt1)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
def check_goroutines(self):
self.assertLess(len(self.process().threads), 20)
self.process().Continue()
# Make sure we stopped at the 2nd breakpoint
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (self.process(), self.bpt2)
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ self.process(), self.bpt2)
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
+
# There's (at least) 21 goroutines.
self.assertGreater(len(self.process().threads), 20)
# self.dbg.HandleCommand("log enable lldb os")
- # Now test that stepping works if the memory thread moves to a different backing thread.
+ # Now test that stepping works if the memory thread moves to a
+ # different backing thread.
for i in list(range(11)):
self.thread().StepOver()
- self.assertEqual(lldb.eStopReasonPlanComplete, self.thread().GetStopReason(), self.thread().GetStopDescription(100))
-
+ self.assertEqual(
+ lldb.eStopReasonPlanComplete,
+ self.thread().GetStopReason(),
+ self.thread().GetStopDescription(100))
+
# Disable the plugin and make sure the goroutines disappear
- self.dbg.HandleCommand("settings set plugin.os.goroutines.enable false")
+ self.dbg.HandleCommand(
+ "settings set plugin.os.goroutines.enable false")
self.thread().StepInstruction(False)
self.assertLess(len(self.process().threads), 20)
diff --git a/packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py b/packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py
index bf7bc93a44b4..8e158c3e82d4 100644
--- a/packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py
+++ b/packages/Python/lldbsuite/test/lang/go/types/TestGoASTContext.py
@@ -3,20 +3,21 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestGoASTContext(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(['pyapi'])
- @skipIfFreeBSD # llvm.org/pr24895 triggers assertion failure
- @skipIfRemote # Not remote test suit ready
+ @skipIfFreeBSD # llvm.org/pr24895 triggers assertion failure
+ @skipIfRemote # Not remote test suit ready
@no_debug_info_test
@skipUnlessGoInstalled
def test_with_dsym_and_python_api(self):
@@ -31,7 +32,8 @@ class TestGoASTContext(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "main.go"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
def check_builtin(self, name, size=0, typeclass=lldb.eTypeClassBuiltin):
tl = self.target().FindTypes(name)
@@ -48,23 +50,28 @@ class TestGoASTContext(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
def go_builtin_types(self):
address_size = self.target().GetAddressByteSize()
@@ -93,19 +100,19 @@ class TestGoASTContext(TestBase):
def check_main_vars(self):
v = self.var('theBool')
self.assertEqual('true', v.value)
-
+
v = self.var('theInt')
self.assertEqual('-7', v.value)
-
+
v = self.var('theComplex')
self.assertEqual('1 + 2i', v.value)
-
+
v = self.var('thePointer')
self.assertTrue(v.TypeIsPointerType())
self.assertEqual('-10', v.Dereference().value)
self.assertEqual(1, v.GetNumChildren())
self.assertEqual('-10', v.GetChildAtIndex(0).value)
-
+
# print()
# print(os.getpid())
# time.sleep(60)
@@ -115,8 +122,11 @@ class TestGoASTContext(TestBase):
self.assertEqual(2, v.GetNumChildren())
self.assertEqual('7', v.GetChildAtIndex(0).value)
self.assertEqual('7', v.GetChildMemberWithName('myInt').value)
- self.assertEqual(v.load_addr, v.GetChildAtIndex(1).GetValueAsUnsigned())
- self.assertEqual(v.load_addr, v.GetChildMemberWithName('myPointer').GetValueAsUnsigned())
+ self.assertEqual(
+ v.load_addr,
+ v.GetChildAtIndex(1).GetValueAsUnsigned())
+ self.assertEqual(v.load_addr, v.GetChildMemberWithName(
+ 'myPointer').GetValueAsUnsigned())
# Test accessing struct fields through pointers.
v = v.GetChildMemberWithName('myPointer')
diff --git a/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py b/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py
index d11f03b878ae..e7615c8e9d8f 100644
--- a/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py
+++ b/packages/Python/lldbsuite/test/lang/mixed/TestMixedLanguages.py
@@ -3,11 +3,13 @@
from __future__ import print_function
-
-import os, time, re
+import os
+import time
+import re
import lldb
from lldbsuite.test.lldbtest import *
+
class MixedLanguagesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,12 +23,14 @@ class MixedLanguagesTestCase(TestBase):
# Execute the cleanup function during test case tear down
# to restore the frame format.
def cleanup():
- self.runCmd("settings set frame-format %s" % self.format_string, check=False)
+ self.runCmd(
+ "settings set frame-format %s" %
+ self.format_string, check=False)
self.addTearDownHook(cleanup)
self.runCmd("settings show frame-format")
m = re.match(
- '^frame-format \(format-string\) = "(.*)\"$',
- self.res.GetOutput())
+ '^frame-format \(format-string\) = "(.*)\"$',
+ self.res.GetOutput())
self.assertTrue(m, "Bad settings string")
self.format_string = m.group(1)
@@ -34,23 +38,23 @@ class MixedLanguagesTestCase(TestBase):
format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}`${function.name}{${function.pc-offset}}}{, lang=${language}}\n"
self.runCmd("settings set frame-format %s" % format_string)
self.expect("settings show frame-format", SETTING_MSG("frame-format"),
- substrs = [format_string])
+ substrs=[format_string])
# Run to BP at main (in main.c) and test that the language is C.
self.runCmd("breakpoint set -n main")
self.runCmd("run")
self.expect("thread backtrace",
- substrs = ["`main", "lang=c"])
+ substrs=["`main", "lang=c"])
# Make sure evaluation of C++11 fails.
self.expect("expr foo != nullptr", error=True,
- startstr = "error")
+ startstr="error")
# Run to BP at foo (in foo.cpp) and test that the language is C++.
self.runCmd("breakpoint set -n foo")
self.runCmd("continue")
self.expect("thread backtrace",
- substrs = ["`::foo()", "lang=c++"])
+ substrs=["`::foo()", "lang=c++"])
# Make sure we can evaluate an expression requiring C++11
# (note: C++11 is enabled by default for C++).
self.expect("expr foo != nullptr",
- patterns = ["true"])
+ patterns=["true"])
diff --git a/packages/Python/lldbsuite/test/lang/objc/bitfield_ivars/TestBitfieldIvars.py b/packages/Python/lldbsuite/test/lang/objc/bitfield_ivars/TestBitfieldIvars.py
index 01bf241b0381..4a3311fb5f6d 100644
--- a/packages/Python/lldbsuite/test/lang/objc/bitfield_ivars/TestBitfieldIvars.py
+++ b/packages/Python/lldbsuite/test/lang/objc/bitfield_ivars/TestBitfieldIvars.py
@@ -1,4 +1,12 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows, decorators.expectedFailureAll(bugnumber="rdar://problem/17990991")])
+lldbinline.MakeInlineTest(
+ __file__,
+ globals(),
+ [
+ decorators.skipIfFreeBSD,
+ decorators.skipIfLinux,
+ decorators.skipIfWindows,
+ decorators.expectedFailureAll(
+ bugnumber="rdar://problem/17990991")])
diff --git a/packages/Python/lldbsuite/test/lang/objc/blocks/TestObjCIvarsInBlocks.py b/packages/Python/lldbsuite/test/lang/objc/blocks/TestObjCIvarsInBlocks.py
index 9fa03071c598..74e4f3bc880d 100644
--- a/packages/Python/lldbsuite/test/lang/objc/blocks/TestObjCIvarsInBlocks.py
+++ b/packages/Python/lldbsuite/test/lang/objc/blocks/TestObjCIvarsInBlocks.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCIvarsInBlocks(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,7 +25,9 @@ class TestObjCIvarsInBlocks(TestBase):
@skipUnlessDarwin
@add_test_categories(['pyapi'])
- @expectedFailureAll(archs=["i[3-6]86"], bugnumber="This test requires the 2.0 runtime, so it will fail on i386")
+ @expectedFailureAll(
+ archs=["i[3-6]86"],
+ bugnumber="This test requires the 2.0 runtime, so it will fail on i386")
def test_with_python_api(self):
"""Test printing the ivars of the self when captured in blocks"""
self.build()
@@ -33,72 +36,100 @@ class TestObjCIvarsInBlocks(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- breakpoint = target.BreakpointCreateBySourceRegex ('// Break here inside the block.', self.class_source_file_spec)
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ '// Break here inside the block.', self.class_source_file_spec)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
- breakpoint_two = target.BreakpointCreateBySourceRegex ('// Break here inside the class method block.', self.class_source_file_spec)
+ breakpoint_two = target.BreakpointCreateBySourceRegex(
+ '// Break here inside the class method block.', self.class_source_file_spec)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue (process, "Created a process.")
- self.assertTrue (process.GetState() == lldb.eStateStopped, "Stopped it too.")
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, "Created a process.")
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ "Stopped it too.")
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue (len(thread_list) == 1)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint)
+ self.assertTrue(len(thread_list) == 1)
thread = thread_list[0]
-
+
frame = thread.GetFrameAtIndex(0)
- self.assertTrue (frame, "frame 0 is valid")
-
- # First use the FindVariable API to see if we can find the ivar by undecorated name:
- direct_blocky = frame.GetValueForVariablePath ("blocky_ivar")
+ self.assertTrue(frame, "frame 0 is valid")
+
+ # First use the FindVariable API to see if we can find the ivar by
+ # undecorated name:
+ direct_blocky = frame.GetValueForVariablePath("blocky_ivar")
self.assertTrue(direct_blocky, "Found direct access to blocky_ivar.")
-
- # Now get it as a member of "self" and make sure the two values are equal:
- self_var = frame.GetValueForVariablePath ("self")
- self.assertTrue (self_var, "Found self in block.")
- indirect_blocky = self_var.GetChildMemberWithName ("blocky_ivar")
- self.assertTrue (indirect_blocky, "Found blocky_ivar through self")
-
+
+ # Now get it as a member of "self" and make sure the two values are
+ # equal:
+ self_var = frame.GetValueForVariablePath("self")
+ self.assertTrue(self_var, "Found self in block.")
+ indirect_blocky = self_var.GetChildMemberWithName("blocky_ivar")
+ self.assertTrue(indirect_blocky, "Found blocky_ivar through self")
+
error = lldb.SBError()
direct_value = direct_blocky.GetValueAsSigned(error)
- self.assertTrue (error.Success(), "Got direct value for blocky_ivar")
+ self.assertTrue(error.Success(), "Got direct value for blocky_ivar")
+
+ indirect_value = indirect_blocky.GetValueAsSigned(error)
+ self.assertTrue(error.Success(), "Got indirect value for blocky_ivar")
- indirect_value = indirect_blocky.GetValueAsSigned (error)
- self.assertTrue (error.Success(), "Got indirect value for blocky_ivar")
-
- self.assertTrue (direct_value == indirect_value, "Direct and indirect values are equal.")
+ self.assertTrue(
+ direct_value == indirect_value,
+ "Direct and indirect values are equal.")
# Now make sure that we can get at the captured ivar through the expression parser.
- # Doing a little trivial math will force this into the real expression parser:
- direct_expr = frame.EvaluateExpression ("blocky_ivar + 10")
- self.assertTrue (direct_expr, "Got blocky_ivar through the expression parser")
-
- # Again, get the value through self directly and make sure they are the same:
- indirect_expr = frame.EvaluateExpression ("self->blocky_ivar + 10")
- self.assertTrue (indirect_expr, "Got blocky ivar through expression parser using self.")
-
- direct_value = direct_expr.GetValueAsSigned (error)
- self.assertTrue (error.Success(), "Got value from direct use of expression parser")
-
- indirect_value = indirect_expr.GetValueAsSigned (error)
- self.assertTrue (error.Success(), "Got value from indirect access using the expression parser")
-
- self.assertTrue (direct_value == indirect_value, "Direct ivar access and indirect through expression parser produce same value.")
+ # Doing a little trivial math will force this into the real expression
+ # parser:
+ direct_expr = frame.EvaluateExpression("blocky_ivar + 10")
+ self.assertTrue(
+ direct_expr,
+ "Got blocky_ivar through the expression parser")
+
+ # Again, get the value through self directly and make sure they are the
+ # same:
+ indirect_expr = frame.EvaluateExpression("self->blocky_ivar + 10")
+ self.assertTrue(
+ indirect_expr,
+ "Got blocky ivar through expression parser using self.")
+
+ direct_value = direct_expr.GetValueAsSigned(error)
+ self.assertTrue(
+ error.Success(),
+ "Got value from direct use of expression parser")
+
+ indirect_value = indirect_expr.GetValueAsSigned(error)
+ self.assertTrue(
+ error.Success(),
+ "Got value from indirect access using the expression parser")
+
+ self.assertTrue(
+ direct_value == indirect_value,
+ "Direct ivar access and indirect through expression parser produce same value.")
process.Continue()
- self.assertTrue (process.GetState() == lldb.eStateStopped, "Stopped at the second breakpoint.")
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ "Stopped at the second breakpoint.")
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint_two)
- self.assertTrue (len(thread_list) == 1)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint_two)
+ self.assertTrue(len(thread_list) == 1)
thread = thread_list[0]
-
+
frame = thread.GetFrameAtIndex(0)
- self.assertTrue (frame, "frame 0 is valid")
-
+ self.assertTrue(frame, "frame 0 is valid")
+
expr = frame.EvaluateExpression("(ret)")
- self.assertTrue (expr, "Successfully got a local variable in a block in a class method.")
+ self.assertTrue(
+ expr, "Successfully got a local variable in a block in a class method.")
- ret_value_signed = expr.GetValueAsSigned (error)
+ ret_value_signed = expr.GetValueAsSigned(error)
# print('ret_value_signed = %i' % (ret_value_signed))
- self.assertTrue (ret_value_signed == 5, "The local variable in the block was what we expected.")
+ self.assertTrue(
+ ret_value_signed == 5,
+ "The local variable in the block was what we expected.")
diff --git a/packages/Python/lldbsuite/test/lang/objc/forward-decl/TestForwardDecl.py b/packages/Python/lldbsuite/test/lang/objc/forward-decl/TestForwardDecl.py
index c153f9856603..aa2b659b84b3 100644
--- a/packages/Python/lldbsuite/test/lang/objc/forward-decl/TestForwardDecl.py
+++ b/packages/Python/lldbsuite/test/lang/objc/forward-decl/TestForwardDecl.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ForwardDeclTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -25,7 +26,7 @@ class ForwardDeclTestCase(TestBase):
@skipUnlessDarwin
def test_expr(self):
self.build()
-
+
# Create a target by the debugger.
target = self.dbg.CreateTarget("a.out")
self.assertTrue(target, VALID_TARGET)
@@ -33,23 +34,26 @@ class ForwardDeclTestCase(TestBase):
# Create the breakpoint inside function 'main'.
breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Register our shared libraries for remote targets so they get automatically uploaded
- environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
+
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
+ environment = self.registerSharedLibrariesWithTarget(
+ target, self.shlib_names)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# This should display correctly.
self.expect("expression [j getMember]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 0x"])
+ substrs=["= 0x"])
diff --git a/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py b/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py
index 4a62d6240d98..2a81c42eb503 100644
--- a/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py
+++ b/packages/Python/lldbsuite/test/lang/objc/foundation/TestConstStrings.py
@@ -6,13 +6,14 @@ parser.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ConstStringTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -30,25 +31,30 @@ class ConstStringTestCase(TestBase):
"""Test constant string generation amd comparison by the expression parser."""
self.build(dictionary=self.d)
self.setTearDownCleanup(self.d)
-
+
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
+ 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,
- substrs = [" at %s:%d" % (self.main_source, self.line),
- "stop reason = breakpoint"])
+ substrs=[" at %s:%d" % (self.main_source, self.line),
+ "stop reason = breakpoint"])
self.expect('expression (int)[str compare:@"hello"]',
- startstr = "(int) $0 = 0")
+ startstr="(int) $0 = 0")
self.expect('expression (int)[str compare:@"world"]',
- startstr = "(int) $1 = -1")
+ startstr="(int) $1 = -1")
# Test empty strings, too.
self.expect('expression (int)[@"" length]',
- startstr = "(int) $2 = 0")
+ startstr="(int) $2 = 0")
self.expect('expression (int)[@"123" length]',
- startstr = "(int) $3 = 3")
+ startstr="(int) $3 = 3")
diff --git a/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py b/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py
index 0867eec62ebe..51d9d22bf44a 100644
--- a/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py
+++ b/packages/Python/lldbsuite/test/lang/objc/foundation/TestFoundationDisassembly.py
@@ -5,14 +5,15 @@ Test the lldb disassemble command on foundation framework.
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class FoundationDisassembleTestCase(TestBase):
@@ -20,20 +21,23 @@ class FoundationDisassembleTestCase(TestBase):
# rdar://problem/8504895
# Crash while doing 'disassemble -n "-[NSNumber descriptionWithLocale:]"
- @unittest2.skipIf(TestBase.skipLongRunningTest(), "Skip this long running test")
+ @unittest2.skipIf(
+ TestBase.skipLongRunningTest(),
+ "Skip this long running test")
def test_foundation_disasm(self):
"""Do 'disassemble -n func' on each and every 'Code' symbol entry from the Foundation.framework."""
self.build()
-
+
# Enable synchronous mode
self.dbg.SetAsync(False)
-
+
# Create a target by the debugger.
target = self.dbg.CreateTarget("a.out")
self.assertTrue(target, VALID_TARGET)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
foundation_framework = None
@@ -43,7 +47,9 @@ class FoundationDisassembleTestCase(TestBase):
foundation_framework = module.file.fullpath
break
- self.assertTrue(foundation_framework != None, "Foundation.framework path located")
+ self.assertTrue(
+ foundation_framework is not None,
+ "Foundation.framework path located")
self.runCmd("image dump symtab '%s'" % foundation_framework)
raw_output = self.res.GetOutput()
# Now, grab every 'Code' symbol and feed it into the command:
@@ -64,7 +70,6 @@ class FoundationDisassembleTestCase(TestBase):
#print("line:", line)
#print("func:", func)
self.runCmd('disassemble -n "%s"' % func)
-
def test_simple_disasm(self):
"""Test the lldb 'disassemble' command"""
@@ -80,25 +85,45 @@ class FoundationDisassembleTestCase(TestBase):
# Stop at +[NSString stringWithFormat:].
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)
+ 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)
# Stop at -[MyString initWithNSString:].
- lldbutil.run_break_set_by_symbol (self, '-[MyString initWithNSString:]', num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self,
+ '-[MyString initWithNSString:]',
+ num_expected_locations=1,
+ sym_exact=True)
# Stop at the "description" selector.
- lldbutil.run_break_set_by_selector (self, 'description', num_expected_locations=1, module_name='a.out')
+ lldbutil.run_break_set_by_selector(
+ self,
+ 'description',
+ num_expected_locations=1,
+ module_name='a.out')
# Stop at -[NSAutoreleasePool release].
- 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)
+ 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.runCmd("run", RUN_SUCCEEDED)
# First stop is +[NSString stringWithFormat:].
- self.expect("thread backtrace", "Stop at +[NSString stringWithFormat:]",
- substrs = ["Foundation`+[NSString stringWithFormat:]"])
+ self.expect(
+ "thread backtrace",
+ "Stop at +[NSString stringWithFormat:]",
+ substrs=["Foundation`+[NSString stringWithFormat:]"])
# Do the disassemble for the currently stopped function.
self.runCmd("disassemble -f")
@@ -108,8 +133,10 @@ class FoundationDisassembleTestCase(TestBase):
self.runCmd("process continue")
# Followed by a.out`-[MyString initWithNSString:].
- self.expect("thread backtrace", "Stop at a.out`-[MyString initWithNSString:]",
- substrs = ["a.out`-[MyString initWithNSString:]"])
+ self.expect(
+ "thread backtrace",
+ "Stop at a.out`-[MyString initWithNSString:]",
+ substrs=["a.out`-[MyString initWithNSString:]"])
# Do the disassemble for the currently stopped function.
self.runCmd("disassemble -f")
@@ -118,7 +145,7 @@ class FoundationDisassembleTestCase(TestBase):
# Followed by -[MyString description].
self.expect("thread backtrace", "Stop at -[MyString description]",
- substrs = ["a.out`-[MyString description]"])
+ substrs=["a.out`-[MyString description]"])
# Do the disassemble for the currently stopped function.
self.runCmd("disassemble -f")
@@ -129,7 +156,7 @@ class FoundationDisassembleTestCase(TestBase):
# Followed by -[NSAutoreleasePool release].
self.expect("thread backtrace", "Stop at -[NSAutoreleasePool release]",
- substrs = ["Foundation`-[NSAutoreleasePool release]"])
+ substrs=["Foundation`-[NSAutoreleasePool release]"])
# Do the disassemble for the currently stopped function.
self.runCmd("disassemble -f")
diff --git a/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py b/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
index 2a8e80f6d76e..d636458ce1aa 100644
--- a/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
+++ b/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods.py
@@ -6,8 +6,9 @@ Also lookup objective-c data types and evaluate expressions.
from __future__ import print_function
-
-import os, os.path, time
+import os
+import os.path
+import time
import lldb
import string
from lldbsuite.test.decorators import *
@@ -15,6 +16,8 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
file_index = 0
+
+
@skipUnlessDarwin
class FoundationTestCase(TestBase):
@@ -25,7 +28,9 @@ class FoundationTestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break inside main().
self.main_source = "main.m"
- self.line = line_number(self.main_source, '// Set break point at this line.')
+ self.line = line_number(
+ self.main_source,
+ '// Set break point at this line.')
def test_break(self):
"""Test setting objc breakpoints using '_regexp-break' and 'breakpoint set'."""
@@ -34,54 +39,78 @@ class FoundationTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Stop at +[NSString stringWithFormat:].
- 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)
+ 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)
# Stop at -[MyString initWithNSString:].
- lldbutil.run_break_set_by_symbol (self, '-[MyString initWithNSString:]', num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self,
+ '-[MyString initWithNSString:]',
+ num_expected_locations=1,
+ sym_exact=True)
# Stop at the "description" selector.
- lldbutil.run_break_set_by_selector (self, 'description', num_expected_locations=1, module_name='a.out')
+ lldbutil.run_break_set_by_selector(
+ self,
+ 'description',
+ num_expected_locations=1,
+ module_name='a.out')
# Stop at -[NSAutoreleasePool release].
- 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)
+ 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.runCmd("run", RUN_SUCCEEDED)
# First stop is +[NSString stringWithFormat:].
- self.expect("thread backtrace", "Stop at +[NSString stringWithFormat:]",
- substrs = ["Foundation`+[NSString stringWithFormat:]"])
+ self.expect(
+ "thread backtrace",
+ "Stop at +[NSString stringWithFormat:]",
+ substrs=["Foundation`+[NSString stringWithFormat:]"])
self.runCmd("process continue")
# Second stop is still +[NSString stringWithFormat:].
- self.expect("thread backtrace", "Stop at +[NSString stringWithFormat:]",
- substrs = ["Foundation`+[NSString stringWithFormat:]"])
+ self.expect(
+ "thread backtrace",
+ "Stop at +[NSString stringWithFormat:]",
+ substrs=["Foundation`+[NSString stringWithFormat:]"])
self.runCmd("process continue")
# Followed by a.out`-[MyString initWithNSString:].
- self.expect("thread backtrace", "Stop at a.out`-[MyString initWithNSString:]",
- substrs = ["a.out`-[MyString initWithNSString:]"])
+ self.expect(
+ "thread backtrace",
+ "Stop at a.out`-[MyString initWithNSString:]",
+ substrs=["a.out`-[MyString initWithNSString:]"])
self.runCmd("process continue")
# Followed by -[MyString description].
self.expect("thread backtrace", "Stop at -[MyString description]",
- substrs = ["a.out`-[MyString description]"])
+ substrs=["a.out`-[MyString description]"])
self.runCmd("process continue")
# Followed by the same -[MyString description].
self.expect("thread backtrace", "Stop at -[MyString description]",
- substrs = ["a.out`-[MyString description]"])
+ substrs=["a.out`-[MyString description]"])
self.runCmd("process continue")
# Followed by -[NSAutoreleasePool release].
self.expect("thread backtrace", "Stop at -[NSAutoreleasePool release]",
- substrs = ["Foundation`-[NSAutoreleasePool release]"])
+ substrs=["Foundation`-[NSAutoreleasePool release]"])
# rdar://problem/8542091
# rdar://problem/8492646
@@ -92,32 +121,40 @@ class FoundationTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Stop at -[MyString description].
- lldbutil.run_break_set_by_symbol (self, '-[MyString description]', num_expected_locations=1, sym_exact=True)
+ 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")
+# startstr = "Breakpoint created: 1: name = '-[MyString description]',
+# locations = 1")
self.runCmd("run", RUN_SUCCEEDED)
# The backtrace should show we stop at -[MyString description].
self.expect("thread backtrace", "Stop at -[MyString description]",
- substrs = ["a.out`-[MyString description]"])
+ substrs=["a.out`-[MyString description]"])
# Lookup objc data type MyString and evaluate some expressions.
self.expect("image lookup -t NSString", DATA_TYPES_DISPLAYED_CORRECTLY,
- substrs = ['name = "NSString"',
- 'compiler_type = "@interface NSString'])
+ substrs=['name = "NSString"',
+ 'compiler_type = "@interface NSString'])
self.expect("image lookup -t MyString", DATA_TYPES_DISPLAYED_CORRECTLY,
- substrs = ['name = "MyString"',
- 'compiler_type = "@interface MyString',
- 'NSString * str;',
- 'NSDate * date;'])
-
- self.expect("frame variable --show-types --scope", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["ARG: (MyString *) self"],
- patterns = ["ARG: \(.*\) _cmd",
- "(objc_selector *)|(SEL)"])
+ substrs=['name = "MyString"',
+ 'compiler_type = "@interface MyString',
+ 'NSString * str;',
+ 'NSDate * date;'])
+
+ self.expect(
+ "frame variable --show-types --scope",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["ARG: (MyString *) self"],
+ patterns=[
+ "ARG: \(.*\) _cmd",
+ "(objc_selector *)|(SEL)"])
# rdar://problem/8651752
# don't crash trying to ask clang how many children an empty record has
@@ -126,28 +163,37 @@ class FoundationTestCase(TestBase):
# rdar://problem/8492646
# test/foundation fails after updating to tot r115023
# self->str displays nothing as output
- self.expect("frame variable --show-types self->str", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(NSString *) self->str")
+ self.expect(
+ "frame variable --show-types self->str",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(NSString *) self->str")
# rdar://problem/8447030
# 'frame variable self->date' displays the wrong data member
- self.expect("frame variable --show-types self->date", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(NSDate *) self->date")
+ self.expect(
+ "frame variable --show-types self->date",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(NSDate *) self->date")
# This should display the str and date member fields as well.
- self.expect("frame variable --show-types *self", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(MyString) *self",
- "(NSString *) str",
- "(NSDate *) date"])
-
+ self.expect(
+ "frame variable --show-types *self",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(MyString) *self",
+ "(NSString *) str",
+ "(NSDate *) date"])
+
# isa should be accessible.
self.expect("expression self->isa", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(Class)"])
+ substrs=["(Class)"])
# This should fail expectedly.
- self.expect("expression self->non_existent_member",
- COMMAND_FAILED_AS_EXPECTED, error=True,
- startstr = "error: 'MyString' does not have a member named 'non_existent_member'")
+ self.expect(
+ "expression self->non_existent_member",
+ COMMAND_FAILED_AS_EXPECTED,
+ error=True,
+ startstr="error: 'MyString' does not have a member named 'non_existent_member'")
# Use expression parser.
self.runCmd("expression self->str")
@@ -163,7 +209,8 @@ class FoundationTestCase(TestBase):
#
self.runCmd("breakpoint delete 1")
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("process continue")
@@ -171,12 +218,15 @@ class FoundationTestCase(TestBase):
# test/foundation: expr -o -- my not working?
#
# Test new feature with r115115:
- # Add "-o" option to "expression" which prints the object description if available.
- self.expect("expression --object-description -- my", "Object description displayed correctly",
- patterns = ["Hello from.*a.out.*with timestamp: "])
+ # Add "-o" option to "expression" which prints the object description
+ # if available.
+ self.expect(
+ "expression --object-description -- my",
+ "Object description displayed correctly",
+ patterns=["Hello from.*a.out.*with timestamp: "])
@add_test_categories(['pyapi'])
- def test_print_ivars_correctly (self):
+ def test_print_ivars_correctly(self):
self.build()
# See: <rdar://problem/8717050> lldb needs to use the ObjC runtime symbols for ivar offsets
# Only fails for the ObjC 2.0 runtime.
@@ -189,7 +239,8 @@ class FoundationTestCase(TestBase):
self.assertTrue(break1, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
@@ -205,7 +256,7 @@ class FoundationTestCase(TestBase):
cur_frame = thread.GetFrameAtIndex(0)
line_number = cur_frame.GetLineEntry().GetLine()
- self.assertTrue (line_number == self.line, "Hit the first breakpoint.")
+ self.assertTrue(line_number == self.line, "Hit the first breakpoint.")
my_var = cur_frame.FindVariable("my")
self.assertTrue(my_var, "Made a variable object for my")
@@ -222,7 +273,9 @@ class FoundationTestCase(TestBase):
my_str_value = int(my_str_var.GetValue(), 0)
- self.assertTrue(str_value == my_str_value, "Got the correct value for my->str")
+ self.assertTrue(
+ str_value == my_str_value,
+ "Got the correct value for my->str")
def test_expression_lookups_objc(self):
"""Test running an expression detect spurious debug info lookups (DWARF)."""
@@ -231,32 +284,43 @@ class FoundationTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Stop at -[MyString initWithNSString:].
- lldbutil.run_break_set_by_symbol (self, '-[MyString initWithNSString:]', num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self,
+ '-[MyString initWithNSString:]',
+ num_expected_locations=1,
+ sym_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
global file_index
# Log any DWARF lookups
++file_index
- logfile = os.path.join(os.getcwd(), "dwarf-lookups-" + self.getArchitecture() + "-" + str(file_index) + ".txt")
+ logfile = os.path.join(
+ os.getcwd(),
+ "dwarf-lookups-" +
+ self.getArchitecture() +
+ "-" +
+ str(file_index) +
+ ".txt")
self.runCmd("log enable -f %s dwarf lookups" % (logfile))
self.runCmd("expr self")
self.runCmd("log disable dwarf lookups")
-
+
def cleanup():
- if os.path.exists (logfile):
- os.unlink (logfile)
-
+ if os.path.exists(logfile):
+ os.unlink(logfile)
+
self.addTearDownHook(cleanup)
-
- if os.path.exists (logfile):
+
+ if os.path.exists(logfile):
f = open(logfile)
lines = f.readlines()
num_errors = 0
for line in lines:
if string.find(line, "$__lldb") != -1:
if num_errors == 0:
- print("error: found spurious name lookups when evaluating an expression:")
+ print(
+ "error: found spurious name lookups when evaluating an expression:")
num_errors += 1
print(line, end='')
self.assertTrue(num_errors == 0, "Spurious lookups detected")
diff --git a/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py b/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py
index 1ee01f7f35f6..ce7e7742bfe8 100644
--- a/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py
+++ b/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjCMethods2.py
@@ -5,28 +5,44 @@ Test more expression command sequences with objective-c.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class FoundationTestCase2(TestBase):
mydir = TestBase.compute_mydir(__file__)
-
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line numbers to break at.
self.lines = []
- 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'))
+ 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 test_more_expr_commands(self):
"""More expression commands for objective-c."""
@@ -36,15 +52,16 @@ class FoundationTestCase2(TestBase):
# Create a bunch of breakpoints.
for line in self.lines:
- lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# Test_Selector:
self.runCmd("thread backtrace")
self.expect("expression (char *)sel_getName(sel)",
- substrs = ["(char *)",
- "length"])
+ substrs=["(char *)",
+ "length"])
self.runCmd("process continue")
@@ -59,8 +76,8 @@ class FoundationTestCase2(TestBase):
# Test_MyString:
self.runCmd("thread backtrace")
self.expect("expression (char *)sel_getName(_cmd)",
- substrs = ["(char *)",
- "description"])
+ substrs=["(char *)",
+ "description"])
self.runCmd("process continue")
@@ -72,25 +89,25 @@ class FoundationTestCase2(TestBase):
# Break inside Test_NSArray:
line = self.lines[1]
- lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# Test_NSArray:
self.runCmd("thread backtrace")
self.expect("expression (int)[nil_mutable_array count]",
- patterns = ["\(int\) \$.* = 0"])
+ patterns=["\(int\) \$.* = 0"])
self.expect("expression (int)[array1 count]",
- patterns = ["\(int\) \$.* = 3"])
+ patterns=["\(int\) \$.* = 3"])
self.expect("expression (int)[array2 count]",
- patterns = ["\(int\) \$.* = 3"])
+ patterns=["\(int\) \$.* = 3"])
self.expect("expression (int)array1.count",
- patterns = ["\(int\) \$.* = 3"])
+ patterns=["\(int\) \$.* = 3"])
self.expect("expression (int)array2.count",
- patterns = ["\(int\) \$.* = 3"])
+ patterns=["\(int\) \$.* = 3"])
self.runCmd("process continue")
- @expectedFailureAll(oslist=["macosx"], debug_info="gmodules", bugnumber="llvm.org/pr27861")
def test_NSString_expr_commands(self):
"""Test expression commands for NSString."""
self.build()
@@ -99,73 +116,90 @@ class FoundationTestCase2(TestBase):
# Break inside Test_NSString:
line = self.lines[2]
- lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# Test_NSString:
self.runCmd("thread backtrace")
self.expect("expression (int)[str length]",
- patterns = ["\(int\) \$.* ="])
+ patterns=["\(int\) \$.* ="])
self.expect("expression (int)[str_id length]",
- patterns = ["\(int\) \$.* ="])
- self.expect("expression [str description]",
- patterns = ["\(id\) \$.* = 0x"])
+ patterns=["\(int\) \$.* ="])
+ self.expect("expression (id)[str description]",
+ patterns=["\(id\) \$.* = 0x"])
self.expect("expression (id)[str_id description]",
- patterns = ["\(id\) \$.* = 0x"])
+ patterns=["\(id\) \$.* = 0x"])
self.expect("expression str.length")
- self.expect("expression str.description")
self.expect('expression str = @"new"')
self.runCmd("image lookup -t NSString")
- self.expect('expression str = [NSString stringWithCString: "new"]')
+ self.expect('expression str = (id)[NSString stringWithCString: "new"]')
self.runCmd("process continue")
- def test_MyString_dump(self):
+ @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>")
+ def test_MyString_dump_with_runtime(self):
"""Test dump of a known Objective-C object by dereferencing it."""
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
+
line = self.lines[4]
- lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
-
- self.expect("expression --show-types -- *my",
- patterns = ["\(MyString\) \$.* = ", "\(MyBase\)", "\(NSObject\)", "\(Class\)"])
+
+ self.expect(
+ "expression --show-types -- *my",
+ patterns=[
+ "\(MyString\) \$.* = ",
+ "\(MyBase\)"])
self.runCmd("process continue")
- @expectedFailureAll(archs=["i[3-6]86"])
- def test_NSError_po(self):
- """Test that po of the result of an unknown method doesn't require a cast."""
+ @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>")
+ def test_runtime_types(self):
+ """Test commands that require runtime types"""
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
- line = self.lines[4]
- lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+ # Break inside Test_NSString:
+ line = self.lines[2]
+ lldbutil.run_break_set_by_source_regexp(
+ self, "NSString tests")
self.runCmd("run", RUN_SUCCEEDED)
- self.expect('po [NSError errorWithDomain:@"Hello" code:35 userInfo:@{@"NSDescription" : @"be completed."}]',
- substrs = ["Error Domain=Hello", "Code=35", "be completed."])
+ # Test_NSString:
+ self.runCmd("thread backtrace")
+ self.expect("expression [str length]",
+ patterns=["\(NSUInteger\) \$.* ="])
+ self.expect("expression str.length")
+ self.expect('expression str = [NSString stringWithCString: "new"]')
+ self.expect(
+ 'po [NSError errorWithDomain:@"Hello" code:35 userInfo:@{@"NSDescription" : @"be completed."}]',
+ substrs=[
+ "Error Domain=Hello",
+ "Code=35",
+ "be completed."])
self.runCmd("process continue")
-
+
+ @expectedFailureAll(archs=["i[3-6]86"], bugnumber="<rdar://problem/28814052>")
def test_NSError_p(self):
"""Test that p of the result of an unknown method does require a cast."""
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
+
line = self.lines[4]
- lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
- self.expect("p [NSError thisMethodIsntImplemented:0]",
- error = True,
- patterns = ["no known method", "cast the message send to the method's return type"])
+ self.expect("p [NSError thisMethodIsntImplemented:0]", error=True, patterns=[
+ "no known method", "cast the message send to the method's return type"])
self.runCmd("process continue")
diff --git a/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py b/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py
index 13ef44f195bb..8ef9f39434e3 100644
--- a/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py
+++ b/packages/Python/lldbsuite/test/lang/objc/foundation/TestObjectDescriptionAPI.py
@@ -5,14 +5,15 @@ Test SBValue.GetObjectDescription() with the value from SBTarget.FindGlobalVaria
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjectDescriptionAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,7 +23,8 @@ class ObjectDescriptionAPITestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break at.
self.source = 'main.m'
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# rdar://problem/10857337
@skipUnlessDarwin
@@ -42,11 +44,13 @@ class ObjectDescriptionAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Make sure we hit our breakpoint:
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue (len(thread_list) == 1)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint)
+ self.assertTrue(len(thread_list) == 1)
thread = thread_list[0]
frame0 = thread.GetFrameAtIndex(0)
@@ -59,7 +63,8 @@ class ObjectDescriptionAPITestCase(TestBase):
print("val:", v)
print("object description:", v.GetObjectDescription())
if v.GetName() == 'my_global_str':
- self.assertTrue(v.GetObjectDescription() == 'This is a global string')
+ self.assertTrue(v.GetObjectDescription() ==
+ 'This is a global string')
# But not here!
value_list2 = target.FindGlobalVariables('my_global_str', 3)
@@ -69,4 +74,5 @@ class ObjectDescriptionAPITestCase(TestBase):
print("val:", v)
print("object description:", v.GetObjectDescription())
if v.GetName() == 'my_global_str':
- self.assertTrue(v.GetObjectDescription() == 'This is a global string')
+ self.assertTrue(v.GetObjectDescription() ==
+ 'This is a global string')
diff --git a/packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py b/packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py
index 8b37f9309ac6..334ebba8e642 100644
--- a/packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py
+++ b/packages/Python/lldbsuite/test/lang/objc/foundation/TestRuntimeTypes.py
@@ -5,19 +5,23 @@ Test that Objective-C methods from the runtime work correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class RuntimeTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["macosx"], debug_info="gmodules", bugnumber="llvm.org/pr27862")
+ @expectedFailureAll(
+ oslist=["macosx"],
+ debug_info="gmodules",
+ bugnumber="llvm.org/pr27862")
def test_break(self):
"""Test setting objc breakpoints using '_regexp-break' and 'breakpoint set'."""
if self.getArchitecture() != 'x86_64':
@@ -28,23 +32,31 @@ class RuntimeTypesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Stop at -[MyString description].
- lldbutil.run_break_set_by_symbol (self, '-[MyString description]', num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self,
+ '-[MyString description]',
+ num_expected_locations=1,
+ sym_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The backtrace should show we stop at -[MyString description].
self.expect("thread backtrace", "Stop at -[MyString description]",
- substrs = ["a.out`-[MyString description]"])
+ substrs=["a.out`-[MyString description]"])
# Use runtime information about NSString.
# The length property should be usable.
self.expect("expression str.length", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [r"(\(unsigned long long\))|\(NSUInteger\)"])
+ patterns=[r"(\(unsigned long long\))|\(NSUInteger\)"])
# Static methods on NSString should work.
- self.expect("expr [NSString stringWithCString:\"foo\" encoding:1]", VALID_TYPE,
- substrs = ["(id)", "$1"])
+ self.expect(
+ "expr [NSString stringWithCString:\"foo\" encoding:1]",
+ VALID_TYPE,
+ substrs=[
+ "(id)",
+ "$1"])
self.expect("po $1", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo"])
+ substrs=["foo"])
diff --git a/packages/Python/lldbsuite/test/lang/objc/foundation/TestSymbolTable.py b/packages/Python/lldbsuite/test/lang/objc/foundation/TestSymbolTable.py
index b75a874c8145..6e5bc4d9fb0f 100644
--- a/packages/Python/lldbsuite/test/lang/objc/foundation/TestSymbolTable.py
+++ b/packages/Python/lldbsuite/test/lang/objc/foundation/TestSymbolTable.py
@@ -5,7 +5,6 @@ Test symbol table access for main.m.
from __future__ import print_function
-
import os
import time
@@ -14,6 +13,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class FoundationSymtabTestCase(TestBase):
@@ -23,7 +23,8 @@ class FoundationSymtabTestCase(TestBase):
'-[MyString dealloc]',
'-[MyString description]',
'-[MyString descriptionPauses]', # synthesized property
- '-[MyString setDescriptionPauses:]', # synthesized property
+ # synthesized property
+ '-[MyString setDescriptionPauses:]',
'Test_Selector',
'Test_NSString',
'Test_MyString',
@@ -42,7 +43,8 @@ class FoundationSymtabTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
#
# Exercise Python APIs to access the symbol table entries.
diff --git a/packages/Python/lldbsuite/test/lang/objc/global_ptrs/TestGlobalObjects.py b/packages/Python/lldbsuite/test/lang/objc/global_ptrs/TestGlobalObjects.py
index 24ae1a8852b1..bcd4a41e0df3 100644
--- a/packages/Python/lldbsuite/test/lang/objc/global_ptrs/TestGlobalObjects.py
+++ b/packages/Python/lldbsuite/test/lang/objc/global_ptrs/TestGlobalObjects.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCGlobalVar(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,26 +30,31 @@ class TestObjCGlobalVar(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bkpt = target.BreakpointCreateBySourceRegex ('NSLog', self.main_source)
+ bkpt = target.BreakpointCreateBySourceRegex('NSLog', self.main_source)
self.assertTrue(bkpt, VALID_BREAKPOINT)
# Before we launch, make an SBValue for our global object pointer:
g_obj_ptr = target.FindFirstGlobalVariable("g_obj_ptr")
self.assertTrue(g_obj_ptr.GetError().Success(), "Made the g_obj_ptr")
- self.assertTrue(g_obj_ptr.GetValueAsUnsigned(10) == 0, "g_obj_ptr is initially null")
+ self.assertTrue(
+ g_obj_ptr.GetValueAsUnsigned(10) == 0,
+ "g_obj_ptr is initially null")
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, bkpt)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(process, bkpt)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint 1.")
+ self.fail("Failed to stop at breakpoint 1.")
thread = threads[0]
dyn_value = g_obj_ptr.GetDynamicValue(lldb.eDynamicCanRunTarget)
- self.assertTrue(dyn_value.GetError().Success(), "Dynamic value is valid")
+ self.assertTrue(
+ dyn_value.GetError().Success(),
+ "Dynamic value is valid")
self.assertTrue(dyn_value.GetObjectDescription() == "Some NSString")
diff --git a/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py b/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py
index ee5589cb96cb..ee21189ab7c0 100644
--- a/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py
+++ b/packages/Python/lldbsuite/test/lang/objc/hidden-ivars/TestHiddenIvars.py
@@ -3,7 +3,6 @@
from __future__ import print_function
-
import unittest2
import os
import subprocess
@@ -14,6 +13,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class HiddenIvarsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -25,11 +25,14 @@ class HiddenIvarsTestCase(TestBase):
self.source = 'main.m'
self.line = line_number(self.source, '// breakpoint1')
# The makefile names of the shared libraries as they appear in DYLIB_NAME.
- # The names should have no loading "lib" or extension as they will be localized
+ # The names should have no loading "lib" or extension as they will be
+ # localized
self.shlib_names = ["InternalDefiner"]
@skipUnlessDarwin
- @skipIf(debug_info=no_match("dsym"), bugnumber="This test requires a stripped binary and a dSYM")
+ @skipIf(
+ debug_info=no_match("dsym"),
+ bugnumber="This test requires a stripped binary and a dSYM")
def test_expr_stripped(self):
if self.getArchitecture() == 'i386':
self.skipTest("requires modern objc runtime")
@@ -46,7 +49,9 @@ class HiddenIvarsTestCase(TestBase):
self.expr(False)
@skipUnlessDarwin
- @skipIf(debug_info=no_match("dsym"), bugnumber="This test requires a stripped binary and a dSYM")
+ @skipIf(
+ debug_info=no_match("dsym"),
+ bugnumber="This test requires a stripped binary and a dSYM")
def test_frame_variable_stripped(self):
if self.getArchitecture() == 'i386':
self.skipTest("requires modern objc runtime")
@@ -70,14 +75,22 @@ class HiddenIvarsTestCase(TestBase):
else:
self.build()
self.common_setup(False)
- self.expect("frame variable k->bar", VARIABLES_DISPLAYED_CORRECTLY, substrs = ["= 3"])
-
+ self.expect(
+ "frame variable k->bar",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["= 3"])
+
def common_setup(self, strip):
-
+
if strip:
- self.assertTrue(subprocess.call(['/usr/bin/strip', '-Sx', 'libInternalDefiner.dylib']) == 0, 'stripping dylib succeeded')
- self.assertTrue(subprocess.call(['/bin/rm', '-rf', 'libInternalDefiner.dylib.dSYM']) == 0, 'remove dylib dSYM file succeeded')
- self.assertTrue(subprocess.call(['/usr/bin/strip', '-Sx', 'a.out']) == 0, 'stripping a.out succeeded')
+ self.assertTrue(subprocess.call(
+ ['/usr/bin/strip', '-Sx', 'libInternalDefiner.dylib']) == 0, 'stripping dylib succeeded')
+ self.assertTrue(subprocess.call(['/bin/rm',
+ '-rf',
+ 'libInternalDefiner.dylib.dSYM']) == 0,
+ 'remove dylib dSYM file succeeded')
+ self.assertTrue(subprocess.call(
+ ['/usr/bin/strip', '-Sx', 'a.out']) == 0, 'stripping a.out succeeded')
# Create a target by the debugger.
target = self.dbg.CreateTarget("a.out")
self.assertTrue(target, VALID_TARGET)
@@ -85,91 +98,140 @@ class HiddenIvarsTestCase(TestBase):
# Create the breakpoint inside function 'main'.
breakpoint = target.BreakpointCreateByLocation(self.source, self.line)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
-
- # Register our shared libraries for remote targets so they get automatically uploaded
- environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
+
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
+ environment = self.registerSharedLibrariesWithTarget(
+ target, self.shlib_names)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
-
+
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ 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)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
def expr(self, strip):
self.common_setup(strip)
# This should display correctly.
- self.expect("expression (j->_definer->foo)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 4"])
+ self.expect(
+ "expression (j->_definer->foo)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["= 4"])
- self.expect("expression (j->_definer->bar)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 5"])
+ self.expect(
+ "expression (j->_definer->bar)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["= 5"])
if strip:
- self.expect("expression *(j->_definer)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo = 4"])
+ self.expect(
+ "expression *(j->_definer)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["foo = 4"])
else:
- self.expect("expression *(j->_definer)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo = 4", "bar = 5"])
+ self.expect(
+ "expression *(j->_definer)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "foo = 4",
+ "bar = 5"])
self.expect("expression (k->foo)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 2"])
+ substrs=["= 2"])
self.expect("expression (k->bar)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 3"])
+ substrs=["= 3"])
- self.expect("expression k.filteredDataSource", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = [' = 0x', '"2 elements"'])
+ self.expect(
+ "expression k.filteredDataSource",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ ' = 0x',
+ '"2 elements"'])
if strip:
self.expect("expression *(k)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo = 2", ' = 0x', '"2 elements"'])
- else:
- self.expect("expression *(k)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo = 2", "bar = 3", '_filteredDataSource = 0x', '"2 elements"'])
+ substrs=["foo = 2", ' = 0x', '"2 elements"'])
+ else:
+ self.expect(
+ "expression *(k)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "foo = 2",
+ "bar = 3",
+ '_filteredDataSource = 0x',
+ '"2 elements"'])
def frame_var(self, strip):
self.common_setup(strip)
# This should display correctly.
- self.expect("frame variable j->_definer->foo", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 4"])
+ self.expect(
+ "frame variable j->_definer->foo",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["= 4"])
if not strip:
- self.expect("frame variable j->_definer->bar", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 5"])
-
+ self.expect(
+ "frame variable j->_definer->bar",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["= 5"])
+
if strip:
- self.expect("frame variable *j->_definer", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo = 4"])
+ self.expect(
+ "frame variable *j->_definer",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["foo = 4"])
else:
- self.expect("frame variable *j->_definer", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo = 4", "bar = 5"])
+ self.expect(
+ "frame variable *j->_definer",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "foo = 4",
+ "bar = 5"])
self.expect("frame variable k->foo", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 2"])
+ substrs=["= 2"])
- self.expect("frame variable k->_filteredDataSource", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = [' = 0x', '"2 elements"'])
+ self.expect(
+ "frame variable k->_filteredDataSource",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ ' = 0x',
+ '"2 elements"'])
if strip:
- self.expect("frame variable *k", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo = 2", '_filteredDataSource = 0x', '"2 elements"'])
+ self.expect(
+ "frame variable *k",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "foo = 2",
+ '_filteredDataSource = 0x',
+ '"2 elements"'])
else:
- self.expect("frame variable *k", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo = 2", "bar = 3", '_filteredDataSource = 0x', '"2 elements"'])
+ self.expect(
+ "frame variable *k",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "foo = 2",
+ "bar = 3",
+ '_filteredDataSource = 0x',
+ '"2 elements"'])
diff --git a/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py b/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py
index b91725d57c60..79b7ee5dbfb0 100644
--- a/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py
+++ b/packages/Python/lldbsuite/test/lang/objc/ivar-IMP/TestObjCiVarIMP.py
@@ -5,8 +5,8 @@ Test that dynamically discovered ivars of type IMP do not crash LLDB
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
@@ -15,7 +15,8 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-def execute_command (command):
+
+def execute_command(command):
# print('%% %s' % (command))
(exit_status, output) = seven.get_command_status_output(command)
# if output:
@@ -23,6 +24,7 @@ def execute_command (command):
# print('status = %u' % (exit_status))
return exit_status
+
class ObjCiVarIMPTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -31,11 +33,8 @@ class ObjCiVarIMPTestCase(TestBase):
@no_debug_info_test
def test_imp_ivar_type(self):
"""Test that dynamically discovered ivars of type IMP do not crash LLDB"""
- if self.getArchitecture() == 'i386':
- # rdar://problem/9946499
- self.skipTest("Dynamic types for ObjC V1 runtime not implemented")
-
execute_command("make repro")
+
def cleanup():
execute_command("make cleanup")
self.addTearDownHook(cleanup)
@@ -43,23 +42,25 @@ class ObjCiVarIMPTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
# Create a target from the debugger.
- target = self.dbg.CreateTarget (exe)
+ target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Set up our breakpoint
- bkpt = lldbutil.run_break_set_by_source_regexp (self, "break here")
+ bkpt = lldbutil.run_break_set_by_source_regexp(self, "break here")
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- self.expect('frame variable --ptr-depth=1 --show-types -d run -- object', substrs=[
- '(MyClass *) object = 0x',
- '(void *) myImp = 0x'
- ])
- self.expect('disassemble --start-address `((MyClass*)object)->myImp`', substrs=[
- '-[MyClass init]'
- ])
+ self.expect(
+ 'frame variable --ptr-depth=1 --show-types -d run -- object',
+ substrs=[
+ '(MyClass *) object = 0x',
+ '(void *) myImp = 0x'])
+ self.expect(
+ 'disassemble --start-address `((MyClass*)object)->myImp`',
+ substrs=['-[MyClass init]'])
diff --git a/packages/Python/lldbsuite/test/lang/objc/modules-auto-import/TestModulesAutoImport.py b/packages/Python/lldbsuite/test/lang/objc/modules-auto-import/TestModulesAutoImport.py
index fece47625a84..f01cc12bb4a6 100644
--- a/packages/Python/lldbsuite/test/lang/objc/modules-auto-import/TestModulesAutoImport.py
+++ b/packages/Python/lldbsuite/test/lang/objc/modules-auto-import/TestModulesAutoImport.py
@@ -3,10 +3,10 @@
from __future__ import print_function
-
from distutils.version import StrictVersion
import unittest2
-import os, time
+import os
+import time
import lldb
import platform
@@ -14,6 +14,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCModulesAutoImportTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -25,29 +26,28 @@ class ObjCModulesAutoImportTestCase(TestBase):
self.line = line_number('main.m', '// Set breakpoint 0 here.')
@skipUnlessDarwin
- @unittest2.expectedFailure("rdar://problem/19991953")
- @expectedFailureDarwin # clang: error: unknown argument: '-gmodules'
- @unittest2.skipIf(platform.system() != "Darwin" or StrictVersion('12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
+ @skipIf(macos_version=["<", "10.12"])
def test_expr(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ 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)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
self.runCmd("settings set target.auto-import-clang-modules true")
self.expect("p getpid()", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["pid_t"])
+ substrs=["pid_t"])
diff --git a/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py b/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py
index 56fcaa050782..367eeb2638d1 100644
--- a/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py
+++ b/packages/Python/lldbsuite/test/lang/objc/modules-incomplete/TestIncompleteModules.py
@@ -3,7 +3,6 @@
from __future__ import print_function
-
import unittest2
import platform
from distutils.version import StrictVersion
@@ -12,6 +11,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class IncompleteModulesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,37 +24,44 @@ class IncompleteModulesTestCase(TestBase):
@skipUnlessDarwin
@unittest2.expectedFailure("rdar://20416388")
- @unittest2.skipIf(platform.system() != "Darwin" or StrictVersion('12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
- @skipIfDarwin # llvm.org/pr26267
+ @skipIf(macos_version=["<", "10.12"])
def test_expr(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ 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)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
- self.runCmd("settings set target.clang-module-search-paths \"" + os.getcwd() + "\"")
+ self.runCmd(
+ "settings set target.clang-module-search-paths \"" +
+ os.getcwd() +
+ "\"")
self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["int", "3"])
+ substrs=["int", "3"])
- self.expect("expr [myObject privateMethod]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["int", "5"])
+ self.expect(
+ "expr [myObject privateMethod]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "int",
+ "5"])
self.expect("expr MIN(2,3)", "#defined macro was found",
- substrs = ["int", "2"])
+ substrs=["int", "2"])
self.expect("expr MAX(2,3)", "#undefd macro was correcltly not found",
- error=True)
+ error=True)
diff --git a/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py b/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
index 6a9d9b518e1c..2904621a416c 100644
--- a/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
+++ b/packages/Python/lldbsuite/test/lang/objc/modules-inline-functions/TestModulesInlineFunctions.py
@@ -3,11 +3,11 @@
from __future__ import print_function
-
from distutils.version import StrictVersion
import unittest2
-import os, time
+import os
+import time
import platform
import lldb
@@ -15,6 +15,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ModulesInlineFunctionsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,7 +27,7 @@ class ModulesInlineFunctionsTestCase(TestBase):
self.line = line_number('main.m', '// Set breakpoint here.')
@skipUnlessDarwin
- @unittest2.skipIf(platform.system() != "Darwin" or StrictVersion('12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
+ @skipIf(macos_version=["<", "10.12"])
@expectedFailureDarwin("llvm.org/pr25743")
def test_expr(self):
self.build()
@@ -34,23 +35,27 @@ class ModulesInlineFunctionsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ 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)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
- self.runCmd("settings set target.clang-module-search-paths \"" + os.getcwd() + "\"")
+ self.runCmd(
+ "settings set target.clang-module-search-paths \"" +
+ os.getcwd() +
+ "\"")
self.expect("expr @import myModule; 3", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["int", "3"])
+ substrs=["int", "3"])
self.expect("expr isInline(2)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["4"])
+ substrs=["4"])
diff --git a/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py b/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py
index 0efdb305584b..526b4a70e60c 100644
--- a/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py
+++ b/packages/Python/lldbsuite/test/lang/objc/modules/TestObjCModules.py
@@ -3,9 +3,9 @@
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import platform
from distutils.version import StrictVersion
@@ -14,6 +14,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCModulesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,7 +27,7 @@ class ObjCModulesTestCase(TestBase):
@skipUnlessDarwin
@unittest2.expectedFailure("rdar://20416388")
- @unittest2.skipIf(platform.system() != "Darwin" or StrictVersion('12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
+ @skipIf(macos_version=["<", "10.12"])
def test_expr(self):
if not self.applies():
return
@@ -36,36 +37,48 @@ class ObjCModulesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ 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)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
self.expect("expr @import Darwin; 3", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["int", "3"])
+ substrs=["int", "3"])
self.expect("expr getpid()", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["pid_t"])
+ substrs=["pid_t"])
- self.expect("expr @import Foundation; 4", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["int", "4"])
+ self.expect(
+ "expr @import Foundation; 4",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "int",
+ "4"])
self.expect("expr string.length", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["NSUInteger", "5"])
+ substrs=["NSUInteger", "5"])
self.expect("expr array.count", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["NSUInteger", "3"])
-
- self.expect("p *[NSURL URLWithString:@\"http://lldb.llvm.org\"]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["NSURL", "isa", "_urlString"])
-
- self.expect("p [NSURL URLWithString:@\"http://lldb.llvm.org\"].scheme", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["http"])
+ substrs=["NSUInteger", "3"])
+
+ self.expect(
+ "p *[NSURL URLWithString:@\"http://lldb.llvm.org\"]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "NSURL",
+ "isa",
+ "_urlString"])
+
+ self.expect(
+ "p [NSURL URLWithString:@\"http://lldb.llvm.org\"].scheme",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["http"])
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc++/TestObjCXX.py b/packages/Python/lldbsuite/test/lang/objc/objc++/TestObjCXX.py
index c702eafa1f22..5b91f9848a92 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc++/TestObjCXX.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc++/TestObjCXX.py
@@ -5,13 +5,14 @@ Make sure that ivars of Objective-C++ classes are visible in LLDB.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCXXTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,9 +27,10 @@ class ObjCXXTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_source_regexp (self, 'breakpoint 1', num_expected_locations=1)
+ lldbutil.run_break_set_by_source_regexp(
+ self, 'breakpoint 1', num_expected_locations=1)
self.runCmd("run", RUN_SUCCEEDED)
self.expect("expr f->f", "Found ivar in class",
- substrs = ["= 3"])
+ substrs=["= 3"])
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-baseclass-sbtype/TestObjCBaseClassSBType.py b/packages/Python/lldbsuite/test/lang/objc/objc-baseclass-sbtype/TestObjCBaseClassSBType.py
index fa390cb0ad73..0f82cc68df85 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-baseclass-sbtype/TestObjCBaseClassSBType.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-baseclass-sbtype/TestObjCBaseClassSBType.py
@@ -5,20 +5,21 @@ Use lldb Python API to test base class resolution for ObjC classes
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCDynamicValueTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
- # Call super's setUp().
+ # Call super's setUp().
TestBase.setUp(self)
self.line = line_number('main.m', '// Set breakpoint here.')
@@ -36,13 +37,14 @@ class ObjCDynamicValueTestCase(TestBase):
# Create a target from the debugger.
- target = self.dbg.CreateTarget (exe)
+ target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Set up our breakpoints:
target.BreakpointCreateByLocation('main.m', self.line)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
@@ -50,10 +52,17 @@ class ObjCDynamicValueTestCase(TestBase):
var = self.frame().FindVariable("foo")
var_ptr_type = var.GetType()
var_pte_type = var_ptr_type.GetPointeeType()
- self.assertTrue(var_ptr_type.GetNumberOfDirectBaseClasses() == 1, "Foo * has one base class")
- self.assertTrue(var_pte_type.GetNumberOfDirectBaseClasses() == 1, "Foo has one base class")
-
- self.assertTrue(var_ptr_type.GetDirectBaseClassAtIndex(0).IsValid(), "Foo * has a valid base class")
- self.assertTrue(var_pte_type.GetDirectBaseClassAtIndex(0).IsValid(), "Foo * has a valid base class")
-
- self.assertTrue(var_ptr_type.GetDirectBaseClassAtIndex(0).GetName() == var_pte_type.GetDirectBaseClassAtIndex(0).GetName(), "Foo and its pointer type don't agree on their base class")
+ self.assertTrue(
+ var_ptr_type.GetNumberOfDirectBaseClasses() == 1,
+ "Foo * has one base class")
+ self.assertTrue(
+ var_pte_type.GetNumberOfDirectBaseClasses() == 1,
+ "Foo has one base class")
+
+ self.assertTrue(var_ptr_type.GetDirectBaseClassAtIndex(
+ 0).IsValid(), "Foo * has a valid base class")
+ self.assertTrue(var_pte_type.GetDirectBaseClassAtIndex(
+ 0).IsValid(), "Foo * has a valid base class")
+
+ self.assertTrue(var_ptr_type.GetDirectBaseClassAtIndex(0).GetName() == var_pte_type.GetDirectBaseClassAtIndex(
+ 0).GetName(), "Foo and its pointer type don't agree on their base class")
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py b/packages/Python/lldbsuite/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py
index 3ff76d4194d2..d92daab80351 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-builtin-types/TestObjCBuiltinTypes.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCBuiltinTypes(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,7 +20,8 @@ class TestObjCBuiltinTypes(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "main.cpp"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
@@ -32,25 +34,31 @@ class TestObjCBuiltinTypes(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
- # Now make sure we can call a function in the class method we've stopped in.
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
+
+ # Now make sure we can call a function in the class method we've
+ # stopped in.
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
- self.expect("expr (foo)", patterns = ["\(ns::id\) \$.* = 0"])
+ self.expect("expr (foo)", patterns=["\(ns::id\) \$.* = 0"])
- self.expect("expr id my_id = 0; my_id", patterns = ["\(id\) \$.* = nil"])
+ self.expect("expr id my_id = 0; my_id", patterns=["\(id\) \$.* = nil"])
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-checker/TestObjCCheckers.py b/packages/Python/lldbsuite/test/lang/objc/objc-checker/TestObjCCheckers.py
index 901d84fb96d9..1bd8f1af2300 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-checker/TestObjCCheckers.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-checker/TestObjCCheckers.py
@@ -5,23 +5,24 @@ Use lldb Python API to make sure the dynamic checkers are doing their jobs.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCCheckerTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
- # Call super's setUp().
+ # Call super's setUp().
TestBase.setUp(self)
- # Find the line number to break for main.c.
+ # Find the line number to break for main.c.
self.source_name = 'main.m'
@skipUnlessDarwin
@@ -36,41 +37,43 @@ class ObjCCheckerTestCase(TestBase):
# Create a target from the debugger.
- target = self.dbg.CreateTarget (exe)
+ target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Set up our breakpoints:
-
- main_bkpt = target.BreakpointCreateBySourceRegex ("Set a breakpoint here.", lldb.SBFileSpec (self.source_name))
+ main_bkpt = target.BreakpointCreateBySourceRegex(
+ "Set a breakpoint here.", lldb.SBFileSpec(self.source_name))
self.assertTrue(main_bkpt and
main_bkpt.GetNumLocations() == 1,
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, main_bkpt)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, main_bkpt)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
#
- # The class Simple doesn't have a count method. Make sure that we don't
+ # The class Simple doesn't have a count method. Make sure that we don't
# actually try to send count but catch it as an unrecognized selector.
frame = thread.GetFrameAtIndex(0)
expr_value = frame.EvaluateExpression("(int) [my_simple count]", False)
expr_error = expr_value.GetError()
- self.assertTrue (expr_error.Fail())
-
+ self.assertTrue(expr_error.Fail())
+
# Make sure the call produced no NSLog stdout.
stdout = process.GetSTDOUT(100)
- self.assertTrue (stdout is None or (len(stdout) == 0))
-
+ self.assertTrue(stdout is None or (len(stdout) == 0))
+
# Make sure the error is helpful:
err_string = expr_error.GetCString()
- self.assertTrue ("selector" in err_string)
+ self.assertTrue("selector" in err_string)
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-class-method/TestObjCClassMethod.py b/packages/Python/lldbsuite/test/lang/objc/objc-class-method/TestObjCClassMethod.py
index a5767562c077..50ed2992ee79 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-class-method/TestObjCClassMethod.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-class-method/TestObjCClassMethod.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCClassMethod(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,12 +20,11 @@ class TestObjCClassMethod(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "class.m"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
- @expectedFailureAll(archs=["i[3-6]86"])
@add_test_categories(['pyapi'])
- #rdar://problem/9745789 "expression" can't call functions in class methods
def test_with_python_api(self):
"""Test calling functions in class methods."""
self.build()
@@ -33,25 +33,32 @@ class TestObjCClassMethod(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
- # Now make sure we can call a function in the class method we've stopped in.
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
+
+ # Now make sure we can call a function in the class method we've
+ # stopped in.
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
- cmd_value = frame.EvaluateExpression ("(int)[Foo doSomethingWithString:@\"Hello\"]")
- self.assertTrue (cmd_value.IsValid())
- self.assertTrue (cmd_value.GetValueAsUnsigned() == 5)
+ cmd_value = frame.EvaluateExpression(
+ "(int)[Foo doSomethingWithString:@\"Hello\"]")
+ self.assertTrue(cmd_value.IsValid())
+ self.assertTrue(cmd_value.GetValueAsUnsigned() == 5)
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py b/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py
index fc8a8129fa3c..8b3f444b27af 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-dyn-sbtype/TestObjCDynamicSBType.py
@@ -5,13 +5,14 @@ Test that we are able to properly report a usable dynamic type
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class ObjCDynamicSBTypeTestCase(TestBase):
@@ -36,28 +37,57 @@ class ObjCDynamicSBTypeTestCase(TestBase):
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
+ 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)
- v_object = self.frame().FindVariable("object").GetDynamicValue(lldb.eDynamicCanRunTarget)
- v_base = self.frame().FindVariable("base").GetDynamicValue(lldb.eDynamicCanRunTarget)
- self.assertTrue(v_object.GetTypeName() == "MyDerivedClass *", "The NSObject is properly type-named")
- self.assertTrue(v_base.GetTypeName() == "MyDerivedClass *", "The Base is properly type-named")
+ v_object = self.frame().FindVariable(
+ "object").GetDynamicValue(lldb.eDynamicCanRunTarget)
+ v_base = self.frame().FindVariable(
+ "base").GetDynamicValue(lldb.eDynamicCanRunTarget)
+ self.assertTrue(
+ v_object.GetTypeName() == "MyDerivedClass *",
+ "The NSObject is properly type-named")
+ self.assertTrue(
+ v_base.GetTypeName() == "MyDerivedClass *",
+ "The Base is properly type-named")
object_type = v_object.GetType()
base_type = v_base.GetType()
- self.assertTrue(object_type.GetName() == "MyDerivedClass *", "The dynamic SBType for NSObject is for the correct type")
- self.assertTrue(base_type.GetName() == "MyDerivedClass *", "The dynamic SBType for Base is for the correct type")
+ self.assertTrue(
+ object_type.GetName() == "MyDerivedClass *",
+ "The dynamic SBType for NSObject is for the correct type")
+ self.assertTrue(
+ base_type.GetName() == "MyDerivedClass *",
+ "The dynamic SBType for Base is for the correct type")
object_pointee_type = object_type.GetPointeeType()
base_pointee_type = base_type.GetPointeeType()
- self.assertTrue(object_pointee_type.GetName() == "MyDerivedClass", "The dynamic type for NSObject figures out its pointee type just fine")
- self.assertTrue(base_pointee_type.GetName() == "MyDerivedClass", "The dynamic type for Base figures out its pointee type just fine")
+ self.assertTrue(
+ object_pointee_type.GetName() == "MyDerivedClass",
+ "The dynamic type for NSObject figures out its pointee type just fine")
+ self.assertTrue(
+ base_pointee_type.GetName() == "MyDerivedClass",
+ "The dynamic type for Base figures out its pointee type just fine")
- self.assertTrue(object_pointee_type.GetDirectBaseClassAtIndex(0).GetName() == "MyBaseClass", "The dynamic type for NSObject can go back to its base class")
- self.assertTrue(base_pointee_type.GetDirectBaseClassAtIndex(0).GetName() == "MyBaseClass", "The dynamic type for Base can go back to its base class")
+ self.assertTrue(
+ object_pointee_type.GetDirectBaseClassAtIndex(0).GetName() == "MyBaseClass",
+ "The dynamic type for NSObject can go back to its base class")
+ self.assertTrue(
+ base_pointee_type.GetDirectBaseClassAtIndex(0).GetName() == "MyBaseClass",
+ "The dynamic type for Base can go back to its base class")
- self.assertTrue(object_pointee_type.GetDirectBaseClassAtIndex(0).GetType().GetDirectBaseClassAtIndex(0).GetName() == "NSObject", "The dynamic type for NSObject can go up the hierarchy")
- self.assertTrue(base_pointee_type.GetDirectBaseClassAtIndex(0).GetType().GetDirectBaseClassAtIndex(0).GetName() == "NSObject", "The dynamic type for Base can go up the hierarchy")
+ self.assertTrue(object_pointee_type.GetDirectBaseClassAtIndex(0).GetType().GetDirectBaseClassAtIndex(
+ 0).GetName() == "NSObject", "The dynamic type for NSObject can go up the hierarchy")
+ self.assertTrue(base_pointee_type.GetDirectBaseClassAtIndex(0).GetType().GetDirectBaseClassAtIndex(
+ 0).GetName() == "NSObject", "The dynamic type for Base can go up the hierarchy")
- self.assertTrue(object_pointee_type.GetNumberOfFields() == 2, "The dynamic type for NSObject has 2 fields")
- self.assertTrue(base_pointee_type.GetNumberOfFields() == 2, "The dynamic type for Base has 2 fields")
+ self.assertTrue(
+ object_pointee_type.GetNumberOfFields() == 2,
+ "The dynamic type for NSObject has 2 fields")
+ self.assertTrue(
+ base_pointee_type.GetNumberOfFields() == 2,
+ "The dynamic type for Base has 2 fields")
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py b/packages/Python/lldbsuite/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
index 8720ede04cbf..a115d4f15733 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-dynamic-value/TestObjCDynamicValue.py
@@ -5,30 +5,33 @@ Use lldb Python API to test dynamic values in ObjC
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCDynamicValueTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
- # Call super's setUp().
+ # Call super's setUp().
TestBase.setUp(self)
- # Find the line number to break for main.c.
+ # Find the line number to break for main.c.
self.source_name = 'dynamic-value.m'
- self.set_property_line = line_number(self.source_name, '// This is the line in setProperty, make sure we step to here.')
- self.handle_SourceBase = line_number(self.source_name,
- '// Break here to check dynamic values.')
- self.main_before_setProperty_line = line_number(self.source_name,
- '// Break here to see if we can step into real method.')
+ self.set_property_line = line_number(
+ self.source_name,
+ '// This is the line in setProperty, make sure we step to here.')
+ self.handle_SourceBase = line_number(
+ self.source_name, '// Break here to check dynamic values.')
+ self.main_before_setProperty_line = line_number(
+ self.source_name, '// Break here to see if we can step into real method.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
@@ -44,29 +47,33 @@ class ObjCDynamicValueTestCase(TestBase):
# Create a target from the debugger.
- target = self.dbg.CreateTarget (exe)
+ target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Set up our breakpoints:
- handle_SourceBase_bkpt = target.BreakpointCreateByLocation(self.source_name, self.handle_SourceBase)
+ handle_SourceBase_bkpt = target.BreakpointCreateByLocation(
+ self.source_name, self.handle_SourceBase)
self.assertTrue(handle_SourceBase_bkpt and
handle_SourceBase_bkpt.GetNumLocations() == 1,
VALID_BREAKPOINT)
- main_before_setProperty_bkpt = target.BreakpointCreateByLocation(self.source_name, self.main_before_setProperty_line)
+ main_before_setProperty_bkpt = target.BreakpointCreateByLocation(
+ self.source_name, self.main_before_setProperty_line)
self.assertTrue(main_before_setProperty_bkpt and
main_before_setProperty_bkpt.GetNumLocations() == 1,
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, main_before_setProperty_bkpt)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, main_before_setProperty_bkpt)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
#
@@ -74,53 +81,73 @@ class ObjCDynamicValueTestCase(TestBase):
# make sure we can get that properly:
frame = thread.GetFrameAtIndex(0)
- myObserver = frame.FindVariable('myObserver', lldb.eDynamicCanRunTarget)
- self.assertTrue (myObserver)
- myObserver_source = myObserver.GetChildMemberWithName ('_source', lldb.eDynamicCanRunTarget)
- self.examine_SourceDerived_ptr (myObserver_source)
+ myObserver = frame.FindVariable(
+ 'myObserver', lldb.eDynamicCanRunTarget)
+ self.assertTrue(myObserver)
+ myObserver_source = myObserver.GetChildMemberWithName(
+ '_source', lldb.eDynamicCanRunTarget)
+ self.examine_SourceDerived_ptr(myObserver_source)
#
- # Make sure a static value can be correctly turned into a dynamic value.
+ # Make sure a static value can be correctly turned into a dynamic
+ # value.
frame = thread.GetFrameAtIndex(0)
- myObserver_static = frame.FindVariable('myObserver', lldb.eNoDynamicValues)
- self.assertTrue (myObserver_static)
- myObserver = myObserver_static.GetDynamicValue (lldb.eDynamicCanRunTarget)
- myObserver_source = myObserver.GetChildMemberWithName ('_source', lldb.eDynamicCanRunTarget)
- self.examine_SourceDerived_ptr (myObserver_source)
+ myObserver_static = frame.FindVariable(
+ 'myObserver', lldb.eNoDynamicValues)
+ self.assertTrue(myObserver_static)
+ myObserver = myObserver_static.GetDynamicValue(
+ lldb.eDynamicCanRunTarget)
+ myObserver_source = myObserver.GetChildMemberWithName(
+ '_source', lldb.eDynamicCanRunTarget)
+ self.examine_SourceDerived_ptr(myObserver_source)
# The "frame var" code uses another path to get into children, so let's
# make sure that works as well:
result = lldb.SBCommandReturnObject()
- self.expect('frame var -d run-target myObserver->_source', 'frame var finds its way into a child member',
- patterns = ['\(SourceDerived \*\)'])
-
- # check that our ObjC GetISA() does a good job at hiding KVO swizzled classes
-
- self.expect('frame var -d run-target myObserver->_source -T', 'the KVO-ed class is hidden',
- substrs = ['SourceDerived'])
+ self.expect(
+ 'frame var -d run-target myObserver->_source',
+ 'frame var finds its way into a child member',
+ patterns=['\(SourceDerived \*\)'])
+
+ # check that our ObjC GetISA() does a good job at hiding KVO swizzled
+ # classes
- self.expect('frame var -d run-target myObserver->_source -T', 'the KVO-ed class is hidden', matching = False,
- substrs = ['NSKVONotify'])
+ self.expect(
+ 'frame var -d run-target myObserver->_source -T',
+ 'the KVO-ed class is hidden',
+ substrs=['SourceDerived'])
+
+ self.expect(
+ 'frame var -d run-target myObserver->_source -T',
+ 'the KVO-ed class is hidden',
+ matching=False,
+ substrs=['NSKVONotify'])
# This test is not entirely related to the main thrust of this test case, but since we're here,
- # try stepping into setProperty, and make sure we get into the version in Source:
+ # try stepping into setProperty, and make sure we get into the version
+ # in Source:
thread.StepInto()
- threads = lldbutil.get_stopped_threads (process, lldb.eStopReasonPlanComplete)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.get_stopped_threads(
+ process, lldb.eStopReasonPlanComplete)
+ self.assertTrue(len(threads) == 1)
line_entry = threads[0].GetFrameAtIndex(0).GetLineEntry()
- self.assertEqual (line_entry.GetLine(), self.set_property_line)
- self.assertEqual (line_entry.GetFileSpec().GetFilename(), self.source_name)
+ self.assertEqual(line_entry.GetLine(), self.set_property_line)
+ self.assertEqual(
+ line_entry.GetFileSpec().GetFilename(),
+ self.source_name)
- # Okay, back to the main business. Continue to the handle_SourceBase and make sure we get the correct dynamic value.
+ # Okay, back to the main business. Continue to the handle_SourceBase
+ # and make sure we get the correct dynamic value.
- threads = lldbutil.continue_to_breakpoint (process, handle_SourceBase_bkpt)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.continue_to_breakpoint(
+ process, handle_SourceBase_bkpt)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
@@ -130,49 +157,55 @@ class ObjCDynamicValueTestCase(TestBase):
noDynamic = lldb.eNoDynamicValues
useDynamic = lldb.eDynamicCanRunTarget
- object_static = frame.FindVariable ('object', noDynamic)
- object_dynamic = frame.FindVariable ('object', useDynamic)
+ object_static = frame.FindVariable('object', noDynamic)
+ object_dynamic = frame.FindVariable('object', useDynamic)
- # Delete this object to make sure that this doesn't cause havoc with the dynamic object that depends on it.
+ # Delete this object to make sure that this doesn't cause havoc with
+ # the dynamic object that depends on it.
del (object_static)
- self.examine_SourceDerived_ptr (object_dynamic)
-
+ self.examine_SourceDerived_ptr(object_dynamic)
+
# Get "this" using FindValue, make sure that works too:
- object_static = frame.FindValue ('object', lldb.eValueTypeVariableArgument, noDynamic)
- object_dynamic = frame.FindValue ('object', lldb.eValueTypeVariableArgument, useDynamic)
+ object_static = frame.FindValue(
+ 'object', lldb.eValueTypeVariableArgument, noDynamic)
+ object_dynamic = frame.FindValue(
+ 'object', lldb.eValueTypeVariableArgument, useDynamic)
del (object_static)
- self.examine_SourceDerived_ptr (object_dynamic)
+ self.examine_SourceDerived_ptr(object_dynamic)
# Get "this" using the EvaluateExpression:
- object_static = frame.EvaluateExpression ('object', noDynamic)
- object_dynamic = frame.EvaluateExpression ('object', useDynamic)
+ object_static = frame.EvaluateExpression('object', noDynamic)
+ object_dynamic = frame.EvaluateExpression('object', useDynamic)
del (object_static)
- self.examine_SourceDerived_ptr (object_dynamic)
-
+ self.examine_SourceDerived_ptr(object_dynamic)
+
# Continue again to the handle_SourceBase and make sure we get the correct dynamic value.
# This one looks exactly the same, but in fact this is an "un-KVO'ed" version of SourceBase, so
- # its isa pointer points to SourceBase not NSKVOSourceBase or whatever...
+ # its isa pointer points to SourceBase not NSKVOSourceBase or
+ # whatever...
- threads = lldbutil.continue_to_breakpoint (process, handle_SourceBase_bkpt)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.continue_to_breakpoint(
+ process, handle_SourceBase_bkpt)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
# Get "object" using FindVariable:
- object_static = frame.FindVariable ('object', noDynamic)
- object_dynamic = frame.FindVariable ('object', useDynamic)
+ object_static = frame.FindVariable('object', noDynamic)
+ object_dynamic = frame.FindVariable('object', useDynamic)
- # Delete this object to make sure that this doesn't cause havoc with the dynamic object that depends on it.
+ # Delete this object to make sure that this doesn't cause havoc with
+ # the dynamic object that depends on it.
del (object_static)
- self.examine_SourceDerived_ptr (object_dynamic)
+ self.examine_SourceDerived_ptr(object_dynamic)
- def examine_SourceDerived_ptr (self, object):
- self.assertTrue (object)
- self.assertTrue (object.GetTypeName().find ('SourceDerived') != -1)
- derivedValue = object.GetChildMemberWithName ('_derivedValue')
- self.assertTrue (derivedValue)
- self.assertTrue (int (derivedValue.GetValue(), 0) == 30)
+ def examine_SourceDerived_ptr(self, object):
+ self.assertTrue(object)
+ self.assertTrue(object.GetTypeName().find('SourceDerived') != -1)
+ derivedValue = object.GetChildMemberWithName('_derivedValue')
+ self.assertTrue(derivedValue)
+ self.assertTrue(int(derivedValue.GetValue(), 0) == 30)
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py b/packages/Python/lldbsuite/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
index 049b41e08d08..03121e6f956a 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-ivar-offsets/TestObjCIvarOffsets.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCIvarOffsets(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,7 +20,8 @@ class TestObjCIvarOffsets(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "main.m"
- self.stop_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.stop_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
@@ -31,45 +33,54 @@ class TestObjCIvarOffsets(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- breakpoint = target.BreakpointCreateByLocation(self.main_source, self.stop_line)
+ breakpoint = target.BreakpointCreateByLocation(
+ self.main_source, self.stop_line)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue (process, "Created a process.")
- self.assertTrue (process.GetState() == lldb.eStateStopped, "Stopped it too.")
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, "Created a process.")
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ "Stopped it too.")
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue (len(thread_list) == 1)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint)
+ self.assertTrue(len(thread_list) == 1)
thread = thread_list[0]
-
+
frame = thread.GetFrameAtIndex(0)
- self.assertTrue (frame, "frame 0 is valid")
-
+ self.assertTrue(frame, "frame 0 is valid")
+
mine = thread.GetFrameAtIndex(0).FindVariable("mine")
self.assertTrue(mine, "Found local variable mine.")
-
+
# Test the value object value for BaseClass->_backed_int
error = lldb.SBError()
- mine_backed_int = mine.GetChildMemberWithName ("_backed_int")
- self.assertTrue(mine_backed_int, "Found mine->backed_int local variable.")
- backed_value = mine_backed_int.GetValueAsSigned (error)
- self.assertTrue (error.Success())
- self.assertTrue (backed_value == 1111)
-
+ mine_backed_int = mine.GetChildMemberWithName("_backed_int")
+ self.assertTrue(
+ mine_backed_int,
+ "Found mine->backed_int local variable.")
+ backed_value = mine_backed_int.GetValueAsSigned(error)
+ self.assertTrue(error.Success())
+ self.assertTrue(backed_value == 1111)
+
# Test the value object value for DerivedClass->_derived_backed_int
- mine_derived_backed_int = mine.GetChildMemberWithName ("_derived_backed_int")
- self.assertTrue(mine_derived_backed_int, "Found mine->derived_backed_int local variable.")
- derived_backed_value = mine_derived_backed_int.GetValueAsSigned (error)
- self.assertTrue (error.Success())
- self.assertTrue (derived_backed_value == 3333)
+ mine_derived_backed_int = mine.GetChildMemberWithName(
+ "_derived_backed_int")
+ self.assertTrue(mine_derived_backed_int,
+ "Found mine->derived_backed_int local variable.")
+ derived_backed_value = mine_derived_backed_int.GetValueAsSigned(error)
+ self.assertTrue(error.Success())
+ self.assertTrue(derived_backed_value == 3333)
# Make sure we also get bit-field offsets correct:
- mine_flag2 = mine.GetChildMemberWithName ("flag2")
+ mine_flag2 = mine.GetChildMemberWithName("flag2")
self.assertTrue(mine_flag2, "Found mine->flag2 local variable.")
- flag2_value = mine_flag2.GetValueAsUnsigned (error)
- self.assertTrue (error.Success())
- self.assertTrue (flag2_value == 7)
+ flag2_value = mine_flag2.GetValueAsUnsigned(error)
+ self.assertTrue(error.Success())
+ self.assertTrue(flag2_value == 7)
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py b/packages/Python/lldbsuite/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py
index 791ce27dad00..804905106dfc 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-ivar-protocols/TestIvarProtocols.py
@@ -1,4 +1,6 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows])
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py b/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py
index d9007c57bfb4..dde9ebadba4f 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCIvarStripped(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,10 +20,13 @@ class TestObjCIvarStripped(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "main.m"
- self.stop_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.stop_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
- @skipIf(debug_info=no_match("dsym"), bugnumber="This test requires a stripped binary and a dSYM")
+ @skipIf(
+ debug_info=no_match("dsym"),
+ bugnumber="This test requires a stripped binary and a dSYM")
@add_test_categories(['pyapi'])
def test_with_python_api(self):
"""Test that we can find stripped Objective-C ivars in the runtime"""
@@ -34,26 +38,33 @@ class TestObjCIvarStripped(TestBase):
self.dbg.HandleCommand("add-dsym a.out.dSYM")
- breakpoint = target.BreakpointCreateByLocation(self.main_source, self.stop_line)
- self.assertTrue(breakpoint.IsValid() and breakpoint.GetNumLocations() > 0, VALID_BREAKPOINT)
+ breakpoint = target.BreakpointCreateByLocation(
+ self.main_source, self.stop_line)
+ self.assertTrue(
+ breakpoint.IsValid() and breakpoint.GetNumLocations() > 0,
+ VALID_BREAKPOINT)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue (process, "Created a process.")
- self.assertTrue (process.GetState() == lldb.eStateStopped, "Stopped it too.")
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, "Created a process.")
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ "Stopped it too.")
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue (len(thread_list) == 1)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint)
+ self.assertTrue(len(thread_list) == 1)
thread = thread_list[0]
-
+
frame = thread.GetFrameAtIndex(0)
- self.assertTrue (frame, "frame 0 is valid")
-
+ self.assertTrue(frame, "frame 0 is valid")
+
# Test the expression for mc->_foo
error = lldb.SBError()
- ivar = frame.EvaluateExpression ("(mc->_foo)")
+ ivar = frame.EvaluateExpression("(mc->_foo)")
self.assertTrue(ivar, "Got result for mc->_foo")
- ivar_value = ivar.GetValueAsSigned (error)
- self.assertTrue (error.Success())
- self.assertTrue (ivar_value == 3)
+ ivar_value = ivar.GetValueAsSigned(error)
+ self.assertTrue(error.Success())
+ self.assertTrue(ivar_value == 3)
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py b/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
index a0cf6a7a055d..add3f7a01ad6 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
@@ -3,9 +3,9 @@
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import platform
from distutils.version import StrictVersion
@@ -15,6 +15,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCNewSyntaxTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,79 +27,127 @@ class ObjCNewSyntaxTestCase(TestBase):
self.line = line_number('main.m', '// Set breakpoint 0 here.')
@skipUnlessDarwin
- @expectedFailureAll(oslist=['macosx'], compiler='clang', compiler_version=['<', '7.0.0'])
- @unittest2.skipIf(platform.system() != "Darwin" or StrictVersion('12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
+ @expectedFailureAll(
+ oslist=['macosx'],
+ compiler='clang',
+ compiler_version=[
+ '<',
+ '7.0.0'])
+ @skipIf(macos_version=["<", "10.12"])
+ @expectedFailureAll(archs=["i[3-6]86"])
def test_expr(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ 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)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
-
- self.expect("expr --object-description -- immutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo"])
-
- self.expect("expr --object-description -- mutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo"])
-
- self.expect("expr --object-description -- mutable_array[0] = @\"bar\"", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["bar"])
-
- self.expect("expr --object-description -- mutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["bar"])
-
- self.expect("expr --object-description -- immutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["value"])
-
- self.expect("expr --object-description -- mutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["value"])
-
- self.expect("expr --object-description -- mutable_dictionary[@\"key\"] = @\"object\"", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["object"])
-
- self.expect("expr --object-description -- mutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["object"])
-
- self.expect("expr --object-description -- @[ @\"foo\", @\"bar\" ]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["NSArray", "foo", "bar"])
-
- self.expect("expr --object-description -- @{ @\"key\" : @\"object\" }", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["key", "object"])
-
- self.expect("expr --object-description -- @'a'", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = [str(ord('a'))])
-
- self.expect("expr --object-description -- @1", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["1"])
-
- self.expect("expr --object-description -- @1l", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["1"])
-
- self.expect("expr --object-description -- @1ul", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["1"])
-
- self.expect("expr --object-description -- @1ll", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["1"])
-
- self.expect("expr --object-description -- @1ull", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["1"])
+ substrs=[' resolved, hit count = 1'])
+
+ self.expect(
+ "expr --object-description -- immutable_array[0]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["foo"])
+
+ self.expect(
+ "expr --object-description -- mutable_array[0]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["foo"])
+
+ self.expect(
+ "expr --object-description -- mutable_array[0] = @\"bar\"",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["bar"])
+
+ self.expect(
+ "expr --object-description -- mutable_array[0]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["bar"])
+
+ self.expect(
+ "expr --object-description -- immutable_dictionary[@\"key\"]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["value"])
+
+ self.expect(
+ "expr --object-description -- mutable_dictionary[@\"key\"]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["value"])
+
+ self.expect(
+ "expr --object-description -- mutable_dictionary[@\"key\"] = @\"object\"",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["object"])
+
+ self.expect(
+ "expr --object-description -- mutable_dictionary[@\"key\"]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["object"])
+
+ self.expect(
+ "expr --object-description -- @[ @\"foo\", @\"bar\" ]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "NSArray",
+ "foo",
+ "bar"])
+
+ self.expect(
+ "expr --object-description -- @{ @\"key\" : @\"object\" }",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "key",
+ "object"])
+
+ self.expect("expr --object-description -- @'a'",
+ VARIABLES_DISPLAYED_CORRECTLY, substrs=[str(ord('a'))])
+
+ self.expect(
+ "expr --object-description -- @1",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ self.expect(
+ "expr --object-description -- @1l",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ self.expect(
+ "expr --object-description -- @1ul",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ self.expect(
+ "expr --object-description -- @1ll",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ self.expect(
+ "expr --object-description -- @1ull",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
self.expect("expr -- @123.45", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["NSNumber", "123.45"])
-
- self.expect("expr --object-description -- @( 1 + 3 )", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["4"])
- self.expect("expr -- @((char*)\"Hello world\" + 6)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["NSString", "world"])
+ substrs=["NSNumber", "123.45"])
+
+ self.expect(
+ "expr --object-description -- @( 1 + 3 )",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["4"])
+ self.expect(
+ "expr -- @((char*)\"Hello world\" + 6)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "NSString",
+ "world"])
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-optimized/TestObjcOptimized.py b/packages/Python/lldbsuite/test/lang/objc/objc-optimized/TestObjcOptimized.py
index 2c3ac27d418f..08e9594be69f 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-optimized/TestObjcOptimized.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-optimized/TestObjcOptimized.py
@@ -10,8 +10,8 @@ optimized it into a register.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
import re
@@ -21,6 +21,8 @@ from lldbsuite.test import lldbutil
# rdar://problem/9087739
# test failure: objc_optimized does not work for "-C clang -A i386"
+
+
@skipUnlessDarwin
class ObjcOptimizedTestCase(TestBase):
@@ -35,15 +37,24 @@ class ObjcOptimizedTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_symbol (self, self.method_spec, num_expected_locations=1, sym_exact=True)
+ 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,
- substrs = ["stop reason = breakpoint"],
- patterns = ["frame.*0:.*%s %s" % (self.myclass, self.mymethod)])
+ self.expect(
+ "thread backtrace",
+ STOPPED_DUE_TO_BREAKPOINT,
+ substrs=["stop reason = breakpoint"],
+ patterns=[
+ "frame.*0:.*%s %s" %
+ (self.myclass,
+ self.mymethod)])
self.expect('expression member',
- startstr = "(int) $0 = 5")
+ startstr="(int) $0 = 5")
# <rdar://problem/12693963>
interp = self.dbg.GetCommandInterpreter()
@@ -59,7 +70,7 @@ class ObjcOptimizedTestCase(TestBase):
desired_pointer = mo.group(0)
self.expect('expression (self)',
- substrs = [("(%s *) $1 = " % self.myclass), desired_pointer])
+ substrs=[("(%s *) $1 = " % self.myclass), desired_pointer])
self.expect('expression self->non_member', error=True,
- substrs = ["does not have a member named 'non_member'"])
+ substrs=["does not have a member named 'non_member'"])
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py b/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py
index 22fe3136a511..790bc9c08619 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py
@@ -5,23 +5,24 @@ Use lldb Python API to verify that expression evaluation for property references
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCPropertyTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
- # Call super's setUp().
+ # Call super's setUp().
TestBase.setUp(self)
- # Find the line number to break for main.c.
+ # Find the line number to break for main.c.
self.source_name = 'main.m'
@skipUnlessDarwin
@@ -36,61 +37,68 @@ class ObjCPropertyTestCase(TestBase):
# Create a target from the debugger.
- target = self.dbg.CreateTarget (exe)
+ target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Set up our breakpoints:
-
- main_bkpt = target.BreakpointCreateBySourceRegex ("Set a breakpoint here.", lldb.SBFileSpec (self.source_name))
+
+ main_bkpt = target.BreakpointCreateBySourceRegex(
+ "Set a breakpoint here.", lldb.SBFileSpec(self.source_name))
self.assertTrue(main_bkpt and
main_bkpt.GetNumLocations() == 1,
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, main_bkpt)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, main_bkpt)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
- mine = frame.FindVariable ("mine")
- self.assertTrue (mine.IsValid())
- access_count = mine.GetChildMemberWithName ("_access_count")
- self.assertTrue (access_count.IsValid())
- start_access_count = access_count.GetValueAsUnsigned (123456)
- self.assertTrue (start_access_count != 123456)
+ mine = frame.FindVariable("mine")
+ self.assertTrue(mine.IsValid())
+ access_count = mine.GetChildMemberWithName("_access_count")
+ self.assertTrue(access_count.IsValid())
+ start_access_count = access_count.GetValueAsUnsigned(123456)
+ self.assertTrue(start_access_count != 123456)
#
# The first set of tests test calling the getter & setter of
# a property that actually only has a getter & setter and no
# @property.
#
- nonexistant_value = frame.EvaluateExpression("mine.nonexistantInt", False)
+ nonexistant_value = frame.EvaluateExpression(
+ "mine.nonexistantInt", False)
nonexistant_error = nonexistant_value.GetError()
- self.assertTrue (nonexistant_error.Success())
- nonexistant_int = nonexistant_value.GetValueAsUnsigned (123456)
- self.assertTrue (nonexistant_int == 6)
-
- # Calling the getter function would up the access count, so make sure that happened.
-
- new_access_count = access_count.GetValueAsUnsigned (123456)
- self.assertTrue (new_access_count - start_access_count == 1)
+ self.assertTrue(nonexistant_error.Success())
+ nonexistant_int = nonexistant_value.GetValueAsUnsigned(123456)
+ self.assertTrue(nonexistant_int == 6)
+
+ # Calling the getter function would up the access count, so make sure
+ # that happened.
+
+ new_access_count = access_count.GetValueAsUnsigned(123456)
+ self.assertTrue(new_access_count - start_access_count == 1)
start_access_count = new_access_count
#
# Now call the setter, then make sure that
- nonexistant_change = frame.EvaluateExpression("mine.nonexistantInt = 10", False)
+ nonexistant_change = frame.EvaluateExpression(
+ "mine.nonexistantInt = 10", False)
nonexistant_error = nonexistant_change.GetError()
- self.assertTrue (nonexistant_error.Success())
+ self.assertTrue(nonexistant_error.Success())
+
+ # Calling the setter function would up the access count, so make sure
+ # that happened.
- # Calling the setter function would up the access count, so make sure that happened.
-
- new_access_count = access_count.GetValueAsUnsigned (123456)
- self.assertTrue (new_access_count - start_access_count == 1)
+ new_access_count = access_count.GetValueAsUnsigned(123456)
+ self.assertTrue(new_access_count - start_access_count == 1)
start_access_count = new_access_count
#
@@ -100,30 +108,32 @@ class ObjCPropertyTestCase(TestBase):
backed_value = frame.EvaluateExpression("mine.backedInt", False)
backed_error = backed_value.GetError()
- self.assertTrue (backed_error.Success())
- backing_value = mine.GetChildMemberWithName ("_backedInt")
- self.assertTrue (backing_value.IsValid())
- self.assertTrue (backed_value.GetValueAsUnsigned (12345) == backing_value.GetValueAsUnsigned(23456))
+ self.assertTrue(backed_error.Success())
+ backing_value = mine.GetChildMemberWithName("_backedInt")
+ self.assertTrue(backing_value.IsValid())
+ self.assertTrue(backed_value.GetValueAsUnsigned(12345)
+ == backing_value.GetValueAsUnsigned(23456))
unbacked_value = frame.EvaluateExpression("mine.unbackedInt", False)
unbacked_error = unbacked_value.GetError()
- self.assertTrue (unbacked_error.Success())
+ self.assertTrue(unbacked_error.Success())
- idWithProtocol_value = frame.EvaluateExpression("mine.idWithProtocol", False)
+ idWithProtocol_value = frame.EvaluateExpression(
+ "mine.idWithProtocol", False)
idWithProtocol_error = idWithProtocol_value.GetError()
- self.assertTrue (idWithProtocol_error.Success())
- self.assertTrue (idWithProtocol_value.GetTypeName() == "id")
+ self.assertTrue(idWithProtocol_error.Success())
+ self.assertTrue(idWithProtocol_value.GetTypeName() == "id")
# Make sure that class property getter works as expected
value = frame.EvaluateExpression("BaseClass.classInt", False)
- self.assertTrue (value.GetError().Success())
- self.assertTrue (value.GetValueAsUnsigned (11111) == 123)
+ self.assertTrue(value.GetError().Success())
+ self.assertTrue(value.GetValueAsUnsigned(11111) == 123)
# Make sure that class property setter works as expected
value = frame.EvaluateExpression("BaseClass.classInt = 234", False)
- self.assertTrue (value.GetError().Success())
+ self.assertTrue(value.GetError().Success())
# Verify that setter above actually worked
value = frame.EvaluateExpression("BaseClass.classInt", False)
- self.assertTrue (value.GetError().Success())
- self.assertTrue (value.GetValueAsUnsigned (11111) == 234)
+ self.assertTrue(value.GetError().Success())
+ self.assertTrue(value.GetValueAsUnsigned(11111) == 234)
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-runtime-ivars/TestRuntimeIvars.py b/packages/Python/lldbsuite/test/lang/objc/objc-runtime-ivars/TestRuntimeIvars.py
index 791ce27dad00..f2c3ec0031b4 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-runtime-ivars/TestRuntimeIvars.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-runtime-ivars/TestRuntimeIvars.py
@@ -1,4 +1,6 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows, decorators.skipIf(archs=["i386", "i686"])])
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py b/packages/Python/lldbsuite/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py
index 7d88292a051c..65dc5ace544e 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCStaticMethodStripped(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,11 +20,14 @@ class TestObjCStaticMethodStripped(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "static.m"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
- @skipIf(debug_info=no_match("dsym"), bugnumber="This test requires a stripped binary and a dSYM")
+ @skipIf(
+ debug_info=no_match("dsym"),
+ bugnumber="This test requires a stripped binary and a dSYM")
#<rdar://problem/12042992>
def test_with_python_api(self):
"""Test calling functions in static methods with a stripped binary."""
@@ -35,31 +39,42 @@ class TestObjCStaticMethodStripped(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
- # Now make sure we can call a function in the static method we've stopped in.
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
+
+ # Now make sure we can call a function in the static method we've
+ # stopped in.
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
- cmd_value = frame.EvaluateExpression ("(char *) sel_getName (_cmd)")
- self.assertTrue (cmd_value.IsValid())
+ cmd_value = frame.EvaluateExpression("(char *) sel_getName (_cmd)")
+ self.assertTrue(cmd_value.IsValid())
sel_name = cmd_value.GetSummary()
- self.assertTrue (sel_name == "\"doSomethingWithString:\"", "Got the right value for the selector as string.")
+ self.assertTrue(
+ sel_name == "\"doSomethingWithString:\"",
+ "Got the right value for the selector as string.")
- cmd_value = frame.EvaluateExpression ("[Foo doSomethingElseWithString:string]")
- self.assertTrue (cmd_value.IsValid())
+ cmd_value = frame.EvaluateExpression(
+ "[Foo doSomethingElseWithString:string]")
+ self.assertTrue(cmd_value.IsValid())
string_length = cmd_value.GetValueAsUnsigned()
- self.assertTrue (string_length == 27, "Got the right value from another class method on the same class.")
+ self.assertTrue(
+ string_length == 27,
+ "Got the right value from another class method on the same class.")
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-static-method/TestObjCStaticMethod.py b/packages/Python/lldbsuite/test/lang/objc/objc-static-method/TestObjCStaticMethod.py
index ccba42db4ebe..9f74d86d6336 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-static-method/TestObjCStaticMethod.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-static-method/TestObjCStaticMethod.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCStaticMethod(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,7 +20,8 @@ class TestObjCStaticMethod(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "static.m"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
@@ -32,31 +34,42 @@ class TestObjCStaticMethod(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
- # Now make sure we can call a function in the static method we've stopped in.
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
+
+ # Now make sure we can call a function in the static method we've
+ # stopped in.
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
- cmd_value = frame.EvaluateExpression ("(char *) sel_getName (_cmd)")
- self.assertTrue (cmd_value.IsValid())
+ cmd_value = frame.EvaluateExpression("(char *) sel_getName (_cmd)")
+ self.assertTrue(cmd_value.IsValid())
sel_name = cmd_value.GetSummary()
- self.assertTrue (sel_name == "\"doSomethingWithString:\"", "Got the right value for the selector as string.")
+ self.assertTrue(
+ sel_name == "\"doSomethingWithString:\"",
+ "Got the right value for the selector as string.")
- cmd_value = frame.EvaluateExpression ("[self doSomethingElseWithString:string]")
- self.assertTrue (cmd_value.IsValid())
+ cmd_value = frame.EvaluateExpression(
+ "[self doSomethingElseWithString:string]")
+ self.assertTrue(cmd_value.IsValid())
string_length = cmd_value.GetValueAsUnsigned()
- self.assertTrue (string_length == 27, "Got the right value from another class method on the same class.")
+ self.assertTrue(
+ string_length == 27,
+ "Got the right value from another class method on the same class.")
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py b/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py
index d035287cfa00..8516ef3281ff 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py
@@ -3,16 +3,17 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCStepping(TestBase):
- def getCategories (self):
+ def getCategories(self):
return ['basic_process']
mydir = TestBase.compute_mydir(__file__)
@@ -22,11 +23,16 @@ class TestObjCStepping(TestBase):
TestBase.setUp(self)
# Find the line numbers that we will step to in main:
self.main_source = "stepping-tests.m"
- self.source_randomMethod_line = line_number (self.main_source, '// Source randomMethod start line.')
- self.sourceBase_randomMethod_line = line_number (self.main_source, '// SourceBase randomMethod start line.')
- self.source_returnsStruct_start_line = line_number (self.main_source, '// Source returnsStruct start line.')
- self.sourceBase_returnsStruct_start_line = line_number (self.main_source, '// SourceBase returnsStruct start line.')
- self.stepped_past_nil_line = line_number (self.main_source, '// Step over nil should stop here.')
+ self.source_randomMethod_line = line_number(
+ self.main_source, '// Source randomMethod start line.')
+ self.sourceBase_randomMethod_line = line_number(
+ self.main_source, '// SourceBase randomMethod start line.')
+ self.source_returnsStruct_start_line = line_number(
+ self.main_source, '// Source returnsStruct start line.')
+ self.sourceBase_returnsStruct_start_line = line_number(
+ self.main_source, '// SourceBase returnsStruct start line.')
+ self.stepped_past_nil_line = line_number(
+ self.main_source, '// Step over nil should stop here.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
@@ -38,57 +44,65 @@ class TestObjCStepping(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
breakpoints_to_disable = []
- break1 = target.BreakpointCreateBySourceRegex ("// Set first breakpoint here.", self.main_source_spec)
+ break1 = target.BreakpointCreateBySourceRegex(
+ "// Set first breakpoint here.", self.main_source_spec)
self.assertTrue(break1, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break1)
+ breakpoints_to_disable.append(break1)
- break2 = target.BreakpointCreateBySourceRegex ("// Set second breakpoint here.", self.main_source_spec)
+ break2 = target.BreakpointCreateBySourceRegex(
+ "// Set second breakpoint here.", self.main_source_spec)
self.assertTrue(break2, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break2)
+ breakpoints_to_disable.append(break2)
- break3 = target.BreakpointCreateBySourceRegex ('// Set third breakpoint here.', self.main_source_spec)
+ break3 = target.BreakpointCreateBySourceRegex(
+ '// Set third breakpoint here.', self.main_source_spec)
self.assertTrue(break3, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break3)
+ breakpoints_to_disable.append(break3)
- break4 = target.BreakpointCreateBySourceRegex ('// Set fourth breakpoint here.', self.main_source_spec)
+ break4 = target.BreakpointCreateBySourceRegex(
+ '// Set fourth breakpoint here.', self.main_source_spec)
self.assertTrue(break4, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break4)
+ breakpoints_to_disable.append(break4)
- break5 = target.BreakpointCreateBySourceRegex ('// Set fifth breakpoint here.', self.main_source_spec)
+ break5 = target.BreakpointCreateBySourceRegex(
+ '// Set fifth breakpoint here.', self.main_source_spec)
self.assertTrue(break5, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break5)
+ breakpoints_to_disable.append(break5)
- break_returnStruct_call_super = target.BreakpointCreateBySourceRegex ('// Source returnsStruct call line.', self.main_source_spec)
+ break_returnStruct_call_super = target.BreakpointCreateBySourceRegex(
+ '// Source returnsStruct call line.', self.main_source_spec)
self.assertTrue(break_returnStruct_call_super, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break_returnStruct_call_super)
+ breakpoints_to_disable.append(break_returnStruct_call_super)
- break_step_nil = target.BreakpointCreateBySourceRegex ('// Set nil step breakpoint here.', self.main_source_spec)
+ break_step_nil = target.BreakpointCreateBySourceRegex(
+ '// Set nil step breakpoint here.', self.main_source_spec)
self.assertTrue(break_step_nil, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break1)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(process, break1)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint 1.")
+ self.fail("Failed to stop at breakpoint 1.")
thread = threads[0]
mySource = thread.GetFrameAtIndex(0).FindVariable("mySource")
self.assertTrue(mySource, "Found mySource local variable.")
- mySource_isa = mySource.GetChildMemberWithName ("isa")
+ mySource_isa = mySource.GetChildMemberWithName("isa")
self.assertTrue(mySource_isa, "Found mySource->isa local variable.")
- className = mySource_isa.GetSummary ()
+ className = mySource_isa.GetSummary()
if self.TraceOn():
- print(mySource_isa)
+ print(mySource_isa)
# Lets delete mySource so we can check that after stepping a child variable
# with no parent persists and is useful.
@@ -97,77 +111,114 @@ class TestObjCStepping(TestBase):
# Now step in, that should leave us in the Source randomMethod:
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.source_randomMethod_line, "Stepped into Source randomMethod.")
+ self.assertTrue(
+ line_number == self.source_randomMethod_line,
+ "Stepped into Source randomMethod.")
- # Now step in again, through the super call, and that should leave us in the SourceBase randomMethod:
+ # Now step in again, through the super call, and that should leave us
+ # in the SourceBase randomMethod:
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.sourceBase_randomMethod_line, "Stepped through super into SourceBase randomMethod.")
+ self.assertTrue(
+ line_number == self.sourceBase_randomMethod_line,
+ "Stepped through super into SourceBase randomMethod.")
- threads = lldbutil.continue_to_breakpoint (process, break2)
- self.assertTrue (len(threads) == 1, "Continued to second breakpoint in main.")
+ threads = lldbutil.continue_to_breakpoint(process, break2)
+ self.assertTrue(
+ len(threads) == 1,
+ "Continued to second breakpoint in main.")
- # Again, step in twice gets us to a stret method and a stret super call:
+ # Again, step in twice gets us to a stret method and a stret super
+ # call:
thread = threads[0]
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.source_returnsStruct_start_line, "Stepped into Source returnsStruct.")
-
- threads = lldbutil.continue_to_breakpoint (process, break_returnStruct_call_super)
- self.assertTrue (len(threads) == 1, "Stepped to the call super line in Source returnsStruct.")
+ self.assertTrue(
+ line_number == self.source_returnsStruct_start_line,
+ "Stepped into Source returnsStruct.")
+
+ threads = lldbutil.continue_to_breakpoint(
+ process, break_returnStruct_call_super)
+ self.assertTrue(
+ len(threads) == 1,
+ "Stepped to the call super line in Source returnsStruct.")
thread = threads[0]
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.sourceBase_returnsStruct_start_line, "Stepped through super into SourceBase returnsStruct.")
+ self.assertTrue(
+ line_number == self.sourceBase_returnsStruct_start_line,
+ "Stepped through super into SourceBase returnsStruct.")
- # Cool now continue to get past the call that initializes the Observer, and then do our steps in again to see that
- # we can find our way when we're stepping through a KVO swizzled object.
+ # Cool now continue to get past the call that initializes the Observer, and then do our steps in again to see that
+ # we can find our way when we're stepping through a KVO swizzled
+ # object.
- threads = lldbutil.continue_to_breakpoint (process, break3)
- self.assertTrue (len(threads) == 1, "Continued to third breakpoint in main, our object should now be swizzled.")
+ threads = lldbutil.continue_to_breakpoint(process, break3)
+ self.assertTrue(
+ len(threads) == 1,
+ "Continued to third breakpoint in main, our object should now be swizzled.")
- newClassName = mySource_isa.GetSummary ()
+ newClassName = mySource_isa.GetSummary()
if self.TraceOn():
- print(mySource_isa)
+ print(mySource_isa)
- self.assertTrue (newClassName != className, "The isa did indeed change, swizzled!")
+ self.assertTrue(
+ newClassName != className,
+ "The isa did indeed change, swizzled!")
# Now step in, that should leave us in the Source randomMethod:
thread = threads[0]
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.source_randomMethod_line, "Stepped into Source randomMethod in swizzled object.")
+ self.assertTrue(
+ line_number == self.source_randomMethod_line,
+ "Stepped into Source randomMethod in swizzled object.")
- # Now step in again, through the super call, and that should leave us in the SourceBase randomMethod:
+ # Now step in again, through the super call, and that should leave us
+ # in the SourceBase randomMethod:
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.sourceBase_randomMethod_line, "Stepped through super into SourceBase randomMethod in swizzled object.")
-
- threads = lldbutil.continue_to_breakpoint (process, break4)
- self.assertTrue (len(threads) == 1, "Continued to fourth breakpoint in main.")
+ self.assertTrue(
+ line_number == self.sourceBase_randomMethod_line,
+ "Stepped through super into SourceBase randomMethod in swizzled object.")
+
+ threads = lldbutil.continue_to_breakpoint(process, break4)
+ self.assertTrue(
+ len(threads) == 1,
+ "Continued to fourth breakpoint in main.")
thread = threads[0]
- # Again, step in twice gets us to a stret method and a stret super call:
+ # Again, step in twice gets us to a stret method and a stret super
+ # call:
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.source_returnsStruct_start_line, "Stepped into Source returnsStruct in swizzled object.")
-
- threads = lldbutil.continue_to_breakpoint(process, break_returnStruct_call_super)
- self.assertTrue (len(threads) == 1, "Stepped to the call super line in Source returnsStruct - second time.")
+ self.assertTrue(
+ line_number == self.source_returnsStruct_start_line,
+ "Stepped into Source returnsStruct in swizzled object.")
+
+ threads = lldbutil.continue_to_breakpoint(
+ process, break_returnStruct_call_super)
+ self.assertTrue(
+ len(threads) == 1,
+ "Stepped to the call super line in Source returnsStruct - second time.")
thread = threads[0]
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.sourceBase_returnsStruct_start_line, "Stepped through super into SourceBase returnsStruct in swizzled object.")
+ self.assertTrue(
+ line_number == self.sourceBase_returnsStruct_start_line,
+ "Stepped through super into SourceBase returnsStruct in swizzled object.")
for bkpt in breakpoints_to_disable:
bkpt.SetEnabled(False)
- threads = lldbutil.continue_to_breakpoint (process, break_step_nil)
- self.assertTrue (len(threads) == 1, "Continued to step nil breakpoint.")
+ threads = lldbutil.continue_to_breakpoint(process, break_step_nil)
+ self.assertTrue(len(threads) == 1, "Continued to step nil breakpoint.")
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.stepped_past_nil_line, "Step in over dispatch to nil stepped over.")
+ self.assertTrue(
+ line_number == self.stepped_past_nil_line,
+ "Step in over dispatch to nil stepped over.")
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py b/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py
index b2f2af766325..75f726340ef7 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCStructArgument(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,7 +20,8 @@ class TestObjCStructArgument(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "test.m"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
@@ -31,28 +33,36 @@ class TestObjCStructArgument(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
+
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
- self.expect("p [summer sumThings:tts]", substrs = ['9'])
+ self.expect("p [summer sumThings:tts]", substrs=['9'])
- self.expect("po [NSValue valueWithRect:rect]", substrs = ['NSRect: {{0, 0}, {10, 20}}'])
+ self.expect(
+ "po [NSValue valueWithRect:rect]",
+ substrs=['NSRect: {{0, 0}, {10, 20}}'])
- # Now make sure we can call a method that returns a struct without crashing.
- cmd_value = frame.EvaluateExpression ("[provider getRange]")
- self.assertTrue (cmd_value.IsValid())
+ # Now make sure we can call a method that returns a struct without
+ # crashing.
+ cmd_value = frame.EvaluateExpression("[provider getRange]")
+ self.assertTrue(cmd_value.IsValid())
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m b/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m
index 8bf0ec07b710..f013c5602395 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/test.m
@@ -25,10 +25,10 @@ int main()
ThingSummer *summer = [ThingSummer alloc];
struct things_to_sum tts = { 2, 3, 4 };
int ret = [summer sumThings:tts];
-
NSRect rect = {{0, 0}, {10, 20}};
-
- // Set breakpoint here.
- return rect.origin.x;
+ // The Objective C V1 runtime won't read types from metadata so we need
+ // NSValue in our debug info to use it in our test.
+ NSValue *v = [NSValue valueWithRect:rect];
+ return rect.origin.x; // Set breakpoint here.
}
}
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-struct-return/TestObjCStructReturn.py b/packages/Python/lldbsuite/test/lang/objc/objc-struct-return/TestObjCStructReturn.py
index 5a8722e71a45..6e56c06e8ae8 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-struct-return/TestObjCStructReturn.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-struct-return/TestObjCStructReturn.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCClassMethod(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,7 +20,8 @@ class TestObjCClassMethod(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "test.m"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
@@ -31,24 +33,30 @@ class TestObjCClassMethod(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
+
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
- # Now make sure we can call a method that returns a struct without crashing.
- cmd_value = frame.EvaluateExpression ("[provider getRange]")
- self.assertTrue (cmd_value.IsValid())
+ # Now make sure we can call a method that returns a struct without
+ # crashing.
+ cmd_value = frame.EvaluateExpression("[provider getRange]")
+ self.assertTrue(cmd_value.IsValid())
diff --git a/packages/Python/lldbsuite/test/lang/objc/objc-super/TestObjCSuper.py b/packages/Python/lldbsuite/test/lang/objc/objc-super/TestObjCSuper.py
index 39a0fb716abe..d1d755e289cd 100644
--- a/packages/Python/lldbsuite/test/lang/objc/objc-super/TestObjCSuper.py
+++ b/packages/Python/lldbsuite/test/lang/objc/objc-super/TestObjCSuper.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCSuperMethod(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,10 +20,10 @@ class TestObjCSuperMethod(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "class.m"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
- @expectedFailureAll(archs=["i[3-6]86"])
@add_test_categories(['pyapi'])
def test_with_python_api(self):
"""Test calling methods on super."""
@@ -32,29 +33,35 @@ class TestObjCSuperMethod(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
- # Now make sure we can call a function in the class method we've stopped in.
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
+
+ # Now make sure we can call a function in the class method we've
+ # stopped in.
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
- cmd_value = frame.EvaluateExpression ("[self get]")
- self.assertTrue (cmd_value.IsValid())
- self.assertTrue (cmd_value.GetValueAsUnsigned() == 2)
+ cmd_value = frame.EvaluateExpression("[self get]")
+ self.assertTrue(cmd_value.IsValid())
+ self.assertTrue(cmd_value.GetValueAsUnsigned() == 2)
- cmd_value = frame.EvaluateExpression ("[super get]")
- self.assertTrue (cmd_value.IsValid())
- self.assertTrue (cmd_value.GetValueAsUnsigned() == 1)
+ cmd_value = frame.EvaluateExpression("[super get]")
+ self.assertTrue(cmd_value.IsValid())
+ self.assertTrue(cmd_value.GetValueAsUnsigned() == 1)
diff --git a/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py b/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py
index 33f7a0519fa8..288f912dc79e 100644
--- a/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py
+++ b/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py
@@ -5,13 +5,14 @@ Test "print object" where another thread blocks the print object from making pro
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class PrintObjTestCase(TestBase):
@@ -47,14 +48,16 @@ class PrintObjTestCase(TestBase):
self.runCmd("breakpoint list")
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.runCmd("thread backtrace all")
# Let's get the current stopped thread. We'd like to switch to the
# other thread to issue our 'po lock_me' command.
import lldbsuite.test.lldbutil as lldbutil
- this_thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ this_thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertTrue(this_thread)
# Find the other thread. The iteration protocol of SBProcess and the
@@ -65,7 +68,8 @@ class PrintObjTestCase(TestBase):
other_thread = t
break
- # Set the other thread as the selected thread to issue our 'po' command.other
+ # Set the other thread as the selected thread to issue our 'po'
+ # command.other
self.assertTrue(other_thread)
process.SetSelectedThread(other_thread)
if self.TraceOn():
@@ -86,4 +90,4 @@ class PrintObjTestCase(TestBase):
break
self.expect("po lock_me", OBJECT_PRINTED_CORRECTLY,
- substrs = ['I am pretty special.'])
+ substrs=['I am pretty special.'])
diff --git a/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py b/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
index 32f2e7c8d6dc..fe7d5d48ca7e 100644
--- a/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
+++ b/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
@@ -5,13 +5,14 @@ Test that objective-c method returning BOOL works correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class MethodReturningBOOLTestCase(TestBase):
@@ -35,12 +36,13 @@ class MethodReturningBOOLTestCase(TestBase):
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ 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,
- substrs = [" at %s:%d" % (self.main_source, self.line),
- "stop reason = breakpoint"])
+ substrs=[" at %s:%d" % (self.main_source, self.line),
+ "stop reason = breakpoint"])
# rdar://problem/9691614
self.runCmd('p (int)[my isValid]')
diff --git a/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py b/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py
index a4654d4bd1b4..1375a78f87a5 100644
--- a/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py
+++ b/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py
@@ -5,13 +5,14 @@ Test that CoreFoundation classes CFGregorianDate and CFRange are not improperly
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class Rdar10967107TestCase(TestBase):
@@ -35,11 +36,38 @@ class Rdar10967107TestCase(TestBase):
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
+ 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
- self.expect("frame variable cf_greg_date --raw", substrs = ['year','month','day','hour','minute','second'])
- self.expect("frame variable cf_range --raw", substrs = ['location','length'])
+ self.expect(
+ "frame variable cf_greg_date --raw",
+ substrs=[
+ 'year',
+ 'month',
+ 'day',
+ 'hour',
+ 'minute',
+ 'second'])
+ self.expect(
+ "frame variable cf_range --raw",
+ substrs=[
+ 'location',
+ 'length'])
# check that printing both does not somehow confuse LLDB
- self.expect("frame variable --raw", substrs = ['year','month','day','hour','minute','second','location','length'])
+ self.expect(
+ "frame variable --raw",
+ substrs=[
+ 'year',
+ 'month',
+ 'day',
+ 'hour',
+ 'minute',
+ 'second',
+ 'location',
+ 'length'])
diff --git a/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py b/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py
index f1d38f8b7d32..26afe71d1de9 100644
--- a/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py
+++ b/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py
@@ -5,13 +5,14 @@ Test that we do not attempt to make a dynamic type for a 'const char*'
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class Rdar10967107TestCase(TestBase):
@@ -35,32 +36,47 @@ class Rdar10967107TestCase(TestBase):
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
+ 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
- self.expect("frame variable my_string", substrs = ['const char *'])
- self.expect("frame variable my_string --dynamic-type run-target", substrs = ['const char *'])
+ # check that we correctly see the const char*, even with dynamic types
+ # on
+ self.expect("frame variable my_string", substrs=['const char *'])
+ self.expect(
+ "frame variable my_string --dynamic-type run-target",
+ substrs=['const char *'])
# check that expr also gets it right
- self.expect("expr my_string", substrs = ['const char *'])
- self.expect("expr -d run -- my_string", substrs = ['const char *'])
+ self.expect("expr my_string", substrs=['const char *'])
+ self.expect("expr -d run -- my_string", substrs=['const char *'])
# but check that we get the real Foolie as such
- self.expect("frame variable my_foolie", substrs = ['FoolMeOnce *'])
- self.expect("frame variable my_foolie --dynamic-type run-target", substrs = ['FoolMeOnce *'])
+ self.expect("frame variable my_foolie", substrs=['FoolMeOnce *'])
+ self.expect(
+ "frame variable my_foolie --dynamic-type run-target",
+ substrs=['FoolMeOnce *'])
# check that expr also gets it right
- self.expect("expr my_foolie", substrs = ['FoolMeOnce *'])
- self.expect("expr -d run -- my_foolie", substrs = ['FoolMeOnce *'])
+ self.expect("expr my_foolie", substrs=['FoolMeOnce *'])
+ self.expect("expr -d run -- my_foolie", substrs=['FoolMeOnce *'])
# now check that assigning a true string does not break anything
self.runCmd("next")
- # check that we correctly see the const char*, even with dynamic types on
- self.expect("frame variable my_string", substrs = ['const char *'])
- self.expect("frame variable my_string --dynamic-type run-target", substrs = ['const char *'])
+ # check that we correctly see the const char*, even with dynamic types
+ # on
+ self.expect("frame variable my_string", substrs=['const char *'])
+ self.expect(
+ "frame variable my_string --dynamic-type run-target",
+ substrs=['const char *'])
# check that expr also gets it right
- self.expect("expr my_string", substrs = ['const char *'])
- self.expect("expr -d run -- my_string", substrs = ['const char *'])
+ self.expect("expr my_string", substrs=['const char *'])
+ self.expect("expr -d run -- my_string", substrs=['const char *'])
# but check that we get the real Foolie as such
- self.expect("frame variable my_foolie", substrs = ['FoolMeOnce *'])
- self.expect("frame variable my_foolie --dynamic-type run-target", substrs = ['FoolMeOnce *'])
+ self.expect("frame variable my_foolie", substrs=['FoolMeOnce *'])
+ self.expect(
+ "frame variable my_foolie --dynamic-type run-target",
+ substrs=['FoolMeOnce *'])
# check that expr also gets it right
- self.expect("expr my_foolie", substrs = ['FoolMeOnce *'])
- self.expect("expr -d run -- my_foolie", substrs = ['FoolMeOnce *'])
+ self.expect("expr my_foolie", substrs=['FoolMeOnce *'])
+ self.expect("expr -d run -- my_foolie", substrs=['FoolMeOnce *'])
diff --git a/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py b/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py
index 7bc92595ef38..d431e98ba797 100644
--- a/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py
+++ b/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py
@@ -5,13 +5,14 @@ Test that we are able to find out how many children NSWindow has
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class Rdar12408181TestCase(TestBase):
@@ -35,15 +36,29 @@ class Rdar12408181TestCase(TestBase):
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
+ 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)
- if self.frame().EvaluateExpression('(void*)_CGSDefaultConnection()').GetValueAsUnsigned() != 0:
+ if self.frame().EvaluateExpression(
+ '(void*)_CGSDefaultConnection()').GetValueAsUnsigned() != 0:
window = self.frame().FindVariable("window")
window_dynamic = window.GetDynamicValue(lldb.eDynamicCanRunTarget)
- self.assertTrue(window.GetNumChildren() > 1, "NSWindow (static) only has 1 child!")
- self.assertTrue(window_dynamic.GetNumChildren() > 1, "NSWindow (dynamic) only has 1 child!")
- self.assertTrue(window.GetChildAtIndex(0).IsValid(), "NSWindow (static) has an invalid child")
- self.assertTrue(window_dynamic.GetChildAtIndex(0).IsValid(), "NSWindow (dynamic) has an invalid child")
+ self.assertTrue(
+ window.GetNumChildren() > 1,
+ "NSWindow (static) only has 1 child!")
+ self.assertTrue(
+ window_dynamic.GetNumChildren() > 1,
+ "NSWindow (dynamic) only has 1 child!")
+ self.assertTrue(
+ window.GetChildAtIndex(0).IsValid(),
+ "NSWindow (static) has an invalid child")
+ self.assertTrue(
+ window_dynamic.GetChildAtIndex(0).IsValid(),
+ "NSWindow (dynamic) has an invalid child")
else:
self.skipTest('no WindowServer connection')
diff --git a/packages/Python/lldbsuite/test/lang/objc/real-definition/TestRealDefinition.py b/packages/Python/lldbsuite/test/lang/objc/real-definition/TestRealDefinition.py
index c8f9a9c82c61..820ddcd9ec6a 100644
--- a/packages/Python/lldbsuite/test/lang/objc/real-definition/TestRealDefinition.py
+++ b/packages/Python/lldbsuite/test/lang/objc/real-definition/TestRealDefinition.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestRealDefinition(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,29 +23,35 @@ class TestRealDefinition(TestBase):
self.build()
self.common_setup()
- 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);
+ 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)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Run and stop at Foo
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
self.runCmd("continue", RUN_SUCCEEDED)
# Run at stop at main
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
-
+ substrs=[' resolved, hit count = 1'])
+
# This should display correctly.
- self.expect("frame variable foo->_bar->_hidden_ivar", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(NSString *)", "foo->_bar->_hidden_ivar = 0x"])
+ self.expect(
+ "frame variable foo->_bar->_hidden_ivar",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(NSString *)",
+ "foo->_bar->_hidden_ivar = 0x"])
@skipUnlessDarwin
def test_frame_var_after_stop_at_implementation(self):
@@ -54,29 +61,35 @@ class TestRealDefinition(TestBase):
self.build()
self.common_setup()
- 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)
+ 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)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Run and stop at Foo
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
self.runCmd("continue", RUN_SUCCEEDED)
# Run at stop at main
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# This should display correctly.
- self.expect("frame variable foo->_bar->_hidden_ivar", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(NSString *)", "foo->_bar->_hidden_ivar = 0x"])
+ self.expect(
+ "frame variable foo->_bar->_hidden_ivar",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(NSString *)",
+ "foo->_bar->_hidden_ivar = 0x"])
def common_setup(self):
exe = os.path.join(os.getcwd(), "a.out")
@@ -84,4 +97,5 @@ class TestRealDefinition(TestBase):
# Break inside the foo function which takes a bar_ptr argument.
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)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", line, num_expected_locations=1, loc_exact=True)
diff --git a/packages/Python/lldbsuite/test/lang/objc/self/TestObjCSelf.py b/packages/Python/lldbsuite/test/lang/objc/self/TestObjCSelf.py
index 004563c55be2..48c4313375c1 100644
--- a/packages/Python/lldbsuite/test/lang/objc/self/TestObjCSelf.py
+++ b/packages/Python/lldbsuite/test/lang/objc/self/TestObjCSelf.py
@@ -6,10 +6,11 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCSelfTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
+
@skipUnlessDarwin
def test_with_run_command(self):
"""Test that the appropriate member variables are available when stopped in Objective-C class and instance methods"""
@@ -22,16 +23,17 @@ class ObjCSelfTestCase(TestBase):
self.runCmd("process launch", RUN_SUCCEEDED)
self.expect("expression -- m_a = 2",
- startstr = "(int) $0 = 2")
-
+ startstr="(int) $0 = 2")
+
self.runCmd("process continue")
-
+
# This would be disallowed if we enforced const. But we don't.
self.expect("expression -- m_a = 2",
error=True)
-
- self.expect("expression -- s_a",
- startstr = "(int) $1 = 5")
+
+ self.expect("expression -- s_a",
+ startstr="(int) $1 = 5")
def set_breakpoint(self, line):
- lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", line, num_expected_locations=1, loc_exact=True)
diff --git a/packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py b/packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py
index 7c294ef8cc64..97b137818a07 100644
--- a/packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py
+++ b/packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py
@@ -3,9 +3,9 @@
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import platform
from distutils.version import StrictVersion
@@ -15,6 +15,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCSingleEntryDictionaryTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -32,37 +33,46 @@ class ObjCSingleEntryDictionaryTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ 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)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
d1 = self.frame().FindVariable("d1")
d1.SetPreferSyntheticValue(True)
d1.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
-
- self.assertTrue(d1.GetNumChildren() == 1, "dictionary has != 1 child elements")
+
+ self.assertTrue(
+ d1.GetNumChildren() == 1,
+ "dictionary has != 1 child elements")
pair = d1.GetChildAtIndex(0)
pair.SetPreferSyntheticValue(True)
pair.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
-
- self.assertTrue(pair.GetNumChildren() == 2, "pair has != 2 child elements")
-
+
+ self.assertTrue(
+ pair.GetNumChildren() == 2,
+ "pair has != 2 child elements")
+
key = pair.GetChildMemberWithName("key")
value = pair.GetChildMemberWithName("value")
-
+
key.SetPreferSyntheticValue(True)
key.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
value.SetPreferSyntheticValue(True)
value.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
-
- self.assertTrue(key.GetSummary() == '@"key"', "key doesn't contain key")
- self.assertTrue(value.GetSummary() == '@"value"', "value doesn't contain value")
+
+ self.assertTrue(
+ key.GetSummary() == '@"key"',
+ "key doesn't contain key")
+ self.assertTrue(
+ value.GetSummary() == '@"value"',
+ "value doesn't contain value")
diff --git a/packages/Python/lldbsuite/test/lang/objc/unicode-string/TestUnicodeString.py b/packages/Python/lldbsuite/test/lang/objc/unicode-string/TestUnicodeString.py
new file mode 100644
index 000000000000..c9986aafd7d1
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/unicode-string/TestUnicodeString.py
@@ -0,0 +1,6 @@
+from lldbsuite.test import lldbinline
+from lldbsuite.test import decorators
+
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipUnlessDarwin])
diff --git a/packages/Python/lldbsuite/test/lang/objc/unicode-string/main.m b/packages/Python/lldbsuite/test/lang/objc/unicode-string/main.m
new file mode 100644
index 000000000000..e55eb1ede9b4
--- /dev/null
+++ b/packages/Python/lldbsuite/test/lang/objc/unicode-string/main.m
@@ -0,0 +1,5 @@
+#import <Foundation/Foundation.h>
+
+int main() {
+ NSLog(@"凸"); //% self.expect("po @\"凹\"", DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ["凹"])
+}
diff --git a/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py b/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py
index 791ce27dad00..804905106dfc 100644
--- a/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py
+++ b/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py
@@ -1,4 +1,6 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows])
diff --git a/packages/Python/lldbsuite/test/lang/objcxx/objcxx-ivar-vector/TestIvarVector.py b/packages/Python/lldbsuite/test/lang/objcxx/objcxx-ivar-vector/TestIvarVector.py
index 49bc148dd579..9b0c1f5eaef1 100644
--- a/packages/Python/lldbsuite/test/lang/objcxx/objcxx-ivar-vector/TestIvarVector.py
+++ b/packages/Python/lldbsuite/test/lang/objcxx/objcxx-ivar-vector/TestIvarVector.py
@@ -1,4 +1,6 @@
from lldbsuite.test import decorators
from lldbsuite.test import lldbinline
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows])