aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/lang/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/lang/cpp')
-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
46 files changed, 1623 insertions, 862 deletions
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'"])