aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/lang/c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-01-02 19:26:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-01-02 19:26:05 +0000
commit14f1b3e8826ce43b978db93a62d1166055db5394 (patch)
tree0a00ad8d3498783fe0193f3b656bca17c4c8697d /packages/Python/lldbsuite/test/lang/c
parent4ee8c119c71a06dcad1e0fecc8c675e480e59337 (diff)
downloadsrc-14f1b3e8826ce43b978db93a62d1166055db5394.tar.gz
src-14f1b3e8826ce43b978db93a62d1166055db5394.zip
Vendor import of lldb trunk r290819:vendor/lldb/lldb-trunk-r290819
Notes
Notes: svn path=/vendor/lldb/dist/; revision=311128 svn path=/vendor/lldb/lldb-trunk-r290819/; revision=311129; tag=vendor/lldb/lldb-trunk-r290819
Diffstat (limited to 'packages/Python/lldbsuite/test/lang/c')
-rw-r--r--packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py97
-rw-r--r--packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py130
-rw-r--r--packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py133
-rw-r--r--packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py37
-rw-r--r--packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py35
-rw-r--r--packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py79
-rw-r--r--packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py36
-rw-r--r--packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py48
-rw-r--r--packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py76
-rw-r--r--packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py10
-rw-r--r--packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py58
-rw-r--r--packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py74
-rw-r--r--packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py101
-rw-r--r--packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py43
-rw-r--r--packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py41
-rw-r--r--packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py58
-rw-r--r--packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py205
-rw-r--r--packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py44
-rw-r--r--packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py32
-rw-r--r--packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py5
-rw-r--r--packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py57
-rw-r--r--packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py34
-rw-r--r--packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py24
23 files changed, 913 insertions, 544 deletions
diff --git a/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py b/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
index e6f1092c702a..6d5f61ebb8bb 100644
--- a/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
+++ b/packages/Python/lldbsuite/test/lang/c/anonymous/TestAnonymous.py
@@ -3,28 +3,31 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class AnonymousTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIf(compiler="icc", bugnumber="llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by ICC")
+ @skipIf(
+ compiler="icc",
+ bugnumber="llvm.org/pr15036: LLDB generates an incorrect AST layout for an anonymous struct when DWARF is generated by ICC")
def test_expr_nest(self):
self.build()
self.common_setup(self.line0)
# These should display correctly.
self.expect("expression n->foo.d", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 4"])
-
+ substrs=["= 4"])
+
self.expect("expression n->b", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 2"])
+ substrs=["= 2"])
def test_expr_child(self):
self.build()
@@ -32,35 +35,40 @@ class AnonymousTestCase(TestBase):
# These should display correctly.
self.expect("expression c->foo.d", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 4"])
-
- self.expect("expression c->grandchild.b", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 2"])
+ substrs=["= 4"])
- @skipIf(compiler="icc", bugnumber="llvm.org/pr15036: This particular regression was introduced by r181498")
+ self.expect(
+ "expression c->grandchild.b",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["= 2"])
+
+ @skipIf(
+ compiler="icc",
+ bugnumber="llvm.org/pr15036: This particular regression was introduced by r181498")
def test_expr_grandchild(self):
self.build()
self.common_setup(self.line2)
# These should display correctly.
self.expect("expression g.child.foo.d", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 4"])
-
+ substrs=["= 4"])
+
self.expect("expression g.child.b", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 2"])
+ substrs=["= 2"])
def test_expr_parent(self):
self.build()
if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion():
- self.skipTest("llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
+ self.skipTest(
+ "llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
self.common_setup(self.line2)
# These should display correctly.
self.expect("expression pz", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(type_z *) $", " = 0x0000"])
+ substrs=["(type_z *) $", " = 0x0000"])
self.expect("expression z.y", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(type_y) $", "dummy = 2"])
+ substrs=["(type_y) $", "dummy = 2"])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21550")
def test_expr_null(self):
@@ -69,48 +77,52 @@ class AnonymousTestCase(TestBase):
# This should fail because pz is 0, but it succeeds on OS/X.
# This fails on Linux with an upstream error "Couldn't dematerialize struct", as does "p *n" with "int *n = 0".
- # Note that this can also trigger llvm.org/pr15036 when run interactively at the lldb command prompt.
- self.expect("expression *(type_z *)pz", error = True)
+ # Note that this can also trigger llvm.org/pr15036 when run
+ # interactively at the lldb command prompt.
+ self.expect("expression *(type_z *)pz", error=True)
def test_child_by_name(self):
self.build()
-
+
# Set debugger into synchronous mode
self.dbg.SetAsync(False)
# Create a target
- exe = os.path.join (os.getcwd(), "a.out")
+ exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- break_in_main = target.BreakpointCreateBySourceRegex ('// Set breakpoint 2 here.', lldb.SBFileSpec(self.source))
+ break_in_main = target.BreakpointCreateBySourceRegex(
+ '// Set breakpoint 2 here.', lldb.SBFileSpec(self.source))
self.assertTrue(break_in_main, VALID_BREAKPOINT)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue (process, PROCESS_IS_VALID)
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, PROCESS_IS_VALID)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_main)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_in_main)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint in main.")
+ self.fail("Failed to stop at breakpoint in main.")
thread = threads[0]
frame = thread.frames[0]
if not frame.IsValid():
- self.fail ("Failed to get frame 0.")
+ self.fail("Failed to get frame 0.")
var_n = frame.FindVariable("n")
if not var_n.IsValid():
- self.fail ("Failed to get the variable 'n'")
+ self.fail("Failed to get the variable 'n'")
elem_a = var_n.GetChildMemberWithName("a")
if not elem_a.IsValid():
- self.fail ("Failed to get the element a in n")
+ self.fail("Failed to get the element a in n")
error = lldb.SBError()
value = elem_a.GetValueAsSigned(error, 1000)
if not error.Success() or value != 0:
- self.fail ("failed to get the correct value for element a in n")
+ self.fail("failed to get the correct value for element a in n")
def test_nest_flat(self):
self.build()
@@ -118,10 +130,10 @@ class AnonymousTestCase(TestBase):
# These should display correctly.
self.expect('frame variable n --flat',
- substrs = ['n.a = 0',
- 'n.b = 2',
- 'n.foo.c = 0',
- 'n.foo.d = 4'])
+ substrs=['n.a = 0',
+ 'n.b = 2',
+ 'n.foo.c = 0',
+ 'n.foo.d = 4'])
def setUp(self):
# Call super's setUp().
@@ -133,7 +145,7 @@ class AnonymousTestCase(TestBase):
self.line2 = line_number(self.source, '// Set breakpoint 2 here.')
def common_setup(self, line):
-
+
# Set debugger into synchronous mode
self.dbg.SetAsync(False)
@@ -142,18 +154,21 @@ class AnonymousTestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- # Set breakpoints inside and outside methods that take pointers to the containing struct.
- lldbutil.run_break_set_by_file_and_line (self, self.source, line, num_expected_locations=1, loc_exact=True)
+ # Set breakpoints inside and outside methods that take pointers to the
+ # containing struct.
+ lldbutil.run_break_set_by_file_and_line(
+ self, self.source, line, num_expected_locations=1, loc_exact=True)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
diff --git a/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py b/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py
index 5a4907465682..d4716de907c7 100644
--- a/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py
+++ b/packages/Python/lldbsuite/test/lang/c/array_types/TestArrayTypes.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ArrayTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,7 +27,8 @@ class ArrayTypesTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=False)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=False)
self.runCmd("run", RUN_SUCCEEDED)
@@ -39,35 +41,45 @@ class ArrayTypesTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = ['resolved, hit count = 1'])
+ substrs=['resolved, hit count = 1'])
# Issue 'variable list' command on several array-type variables.
- self.expect("frame variable --show-types strings", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(char *[4])',
- substrs = ['(char *) [0]',
- '(char *) [1]',
- '(char *) [2]',
- '(char *) [3]',
- 'Hello',
- 'Hola',
- 'Bonjour',
- 'Guten Tag'])
-
- self.expect("frame variable --show-types --raw -- char_16", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(char) [0]',
- '(char) [15]'])
-
- self.expect("frame variable --show-types ushort_matrix", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(unsigned short [2][3])')
-
- self.expect("frame variable --show-types long_6", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(long [6])')
+ self.expect(
+ "frame variable --show-types strings",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(char *[4])',
+ substrs=[
+ '(char *) [0]',
+ '(char *) [1]',
+ '(char *) [2]',
+ '(char *) [3]',
+ 'Hello',
+ 'Hola',
+ 'Bonjour',
+ 'Guten Tag'])
+
+ self.expect(
+ "frame variable --show-types --raw -- char_16",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(char) [0]',
+ '(char) [15]'])
+
+ self.expect(
+ "frame variable --show-types ushort_matrix",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(unsigned short [2][3])')
+
+ self.expect(
+ "frame variable --show-types long_6",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(long [6])')
@add_test_categories(['pyapi'])
def test_and_python_api(self):
@@ -84,24 +96,30 @@ class ArrayTypesTestCase(TestBase):
# Sanity check the print representation of breakpoint.
bp = str(breakpoint)
self.expect(bp, msg="Breakpoint looks good", exe=False,
- substrs = ["file = 'main.c'",
- "line = %d" % self.line,
- "locations = 1"])
- self.expect(bp, msg="Breakpoint is not resolved as yet", exe=False, matching=False,
- substrs = ["resolved = 1"])
+ substrs=["file = 'main.c'",
+ "line = %d" % self.line,
+ "locations = 1"])
+ self.expect(
+ bp,
+ msg="Breakpoint is not resolved as yet",
+ exe=False,
+ matching=False,
+ substrs=["resolved = 1"])
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Sanity check the print representation of process.
proc = str(process)
self.expect(proc, msg="Process looks good", exe=False,
- substrs = ["state = stopped",
- "executable = a.out"])
+ substrs=["state = stopped",
+ "executable = a.out"])
# The stop reason of the thread should be breakpoint.
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
# Sanity check the print representation of thread.
@@ -114,8 +132,11 @@ class ArrayTypesTestCase(TestBase):
tidstr = "tid = %u" % thread.GetThreadID()
else:
tidstr = "tid = 0x%4.4x" % thread.GetThreadID()
- self.expect(thr, "Thread looks good with stop reason = breakpoint", exe=False,
- substrs = [tidstr])
+ self.expect(
+ thr,
+ "Thread looks good with stop reason = breakpoint",
+ exe=False,
+ substrs=[tidstr])
# The breakpoint should have a hit count of 1.
self.assertEqual(breakpoint.GetHitCount(), 1, BREAKPOINT_HIT_ONCE)
@@ -123,24 +144,33 @@ class ArrayTypesTestCase(TestBase):
# The breakpoint should be resolved by now.
bp = str(breakpoint)
self.expect(bp, "Breakpoint looks good and is resolved", exe=False,
- substrs = ["file = 'main.c'",
- "line = %d" % self.line,
- "locations = 1"])
+ substrs=["file = 'main.c'",
+ "line = %d" % self.line,
+ "locations = 1"])
# Sanity check the print representation of frame.
frame = thread.GetFrameAtIndex(0)
frm = str(frame)
- self.expect(frm,
- "Frame looks good with correct index %d" % frame.GetFrameID(),
- exe=False,
- substrs = ["#%d" % frame.GetFrameID()])
+ self.expect(
+ frm,
+ "Frame looks good with correct index %d" %
+ frame.GetFrameID(),
+ exe=False,
+ substrs=[
+ "#%d" %
+ frame.GetFrameID()])
# Lookup the "strings" string array variable and sanity check its print
# representation.
variable = frame.FindVariable("strings")
var = str(variable)
- self.expect(var, "Variable for 'strings' looks good with correct name", exe=False,
- substrs = ["%s" % variable.GetName()])
+ self.expect(
+ var,
+ "Variable for 'strings' looks good with correct name",
+ exe=False,
+ substrs=[
+ "%s" %
+ variable.GetName()])
self.DebugSBValue(variable)
self.assertTrue(variable.GetNumChildren() == 4,
"Variable 'strings' should have 4 children")
@@ -186,9 +216,11 @@ class ArrayTypesTestCase(TestBase):
# Last, check that "long_6" has a value type of eValueTypeVariableLocal
# and "argc" has eValueTypeVariableArgument.
from lldbsuite.test.lldbutil import value_type_to_str
- self.assertTrue(variable.GetValueType() == lldb.eValueTypeVariableLocal,
- "Variable 'long_6' should have '%s' value type." %
- value_type_to_str(lldb.eValueTypeVariableLocal))
+ self.assertTrue(
+ variable.GetValueType() == lldb.eValueTypeVariableLocal,
+ "Variable 'long_6' should have '%s' value type." %
+ value_type_to_str(
+ lldb.eValueTypeVariableLocal))
argc = frame.FindVariable("argc")
self.DebugSBValue(argc)
self.assertTrue(argc.GetValueType() == lldb.eValueTypeVariableArgument,
diff --git a/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py b/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
index 30175c5e1c15..4d0eb48c3b5b 100644
--- a/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
+++ b/packages/Python/lldbsuite/test/lang/c/bitfields/TestBitfields.py
@@ -3,24 +3,27 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BitfieldsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
-
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break inside main().
self.line = line_number('main.c', '// Set break point at this line.')
- @skipIfWindows # BitFields exhibit crashes in record layout on Windows (http://llvm.org/pr21800)
+ # BitFields exhibit crashes in record layout on Windows
+ # (http://llvm.org/pr21800)
+ @skipIfWindows
def test_and_run_command(self):
"""Test 'frame variable ...' on a variable with bitfields."""
self.build()
@@ -28,85 +31,95 @@ class BitfieldsTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# This should display correctly.
- self.expect("frame variable --show-types bits", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(uint32_t:1) b1 = 1',
- '(uint32_t:2) b2 = 3',
- '(uint32_t:3) b3 = 7',
- '(uint32_t) b4 = 15',
- '(uint32_t:5) b5 = 31',
- '(uint32_t:6) b6 = 63',
- '(uint32_t:7) b7 = 127',
- '(uint32_t:4) four = 15'])
+ self.expect(
+ "frame variable --show-types bits",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(uint32_t:1) b1 = 1',
+ '(uint32_t:2) b2 = 3',
+ '(uint32_t:3) b3 = 7',
+ '(uint32_t) b4 = 15',
+ '(uint32_t:5) b5 = 31',
+ '(uint32_t:6) b6 = 63',
+ '(uint32_t:7) b7 = 127',
+ '(uint32_t:4) four = 15'])
# And so should this.
# rdar://problem/8348251
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(uint32_t:1) b1 = 1',
- '(uint32_t:2) b2 = 3',
- '(uint32_t:3) b3 = 7',
- '(uint32_t) b4 = 15',
- '(uint32_t:5) b5 = 31',
- '(uint32_t:6) b6 = 63',
- '(uint32_t:7) b7 = 127',
- '(uint32_t:4) four = 15'])
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(uint32_t:1) b1 = 1',
+ '(uint32_t:2) b2 = 3',
+ '(uint32_t:3) b3 = 7',
+ '(uint32_t) b4 = 15',
+ '(uint32_t:5) b5 = 31',
+ '(uint32_t:6) b6 = 63',
+ '(uint32_t:7) b7 = 127',
+ '(uint32_t:4) four = 15'])
self.expect("expr (bits.b1)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '1'])
+ substrs=['uint32_t', '1'])
self.expect("expr (bits.b2)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '3'])
+ substrs=['uint32_t', '3'])
self.expect("expr (bits.b3)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '7'])
+ substrs=['uint32_t', '7'])
self.expect("expr (bits.b4)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '15'])
+ substrs=['uint32_t', '15'])
self.expect("expr (bits.b5)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '31'])
+ substrs=['uint32_t', '31'])
self.expect("expr (bits.b6)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '63'])
+ substrs=['uint32_t', '63'])
self.expect("expr (bits.b7)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '127'])
+ substrs=['uint32_t', '127'])
self.expect("expr (bits.four)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '15'])
+ substrs=['uint32_t', '15'])
- self.expect("frame variable --show-types more_bits", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(uint32_t:3) a = 3',
- '(uint8_t:1) b = \'\\0\'',
- '(uint8_t:1) c = \'\\x01\'',
- '(uint8_t:1) d = \'\\0\''])
+ self.expect(
+ "frame variable --show-types more_bits",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(uint32_t:3) a = 3',
+ '(uint8_t:1) b = \'\\0\'',
+ '(uint8_t:1) c = \'\\x01\'',
+ '(uint8_t:1) d = \'\\0\''])
self.expect("expr (more_bits.a)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', '3'])
+ substrs=['uint32_t', '3'])
self.expect("expr (more_bits.b)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint8_t', '\\0'])
+ substrs=['uint8_t', '\\0'])
self.expect("expr (more_bits.c)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint8_t', '\\x01'])
+ substrs=['uint8_t', '\\x01'])
self.expect("expr (more_bits.d)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint8_t', '\\0'])
-
- self.expect("expr (packed.a)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['char', "'a'"])
- self.expect("expr (packed.b)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', "10"])
- self.expect("expr/x (packed.c)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['uint32_t', "7112233"])
+ substrs=['uint8_t', '\\0'])
+ self.expect("expr (packed.a)", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['char', "'a'"])
+ self.expect("expr (packed.b)", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['uint32_t', "10"])
+ self.expect("expr/x (packed.c)", VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['uint32_t', "7112233"])
@add_test_categories(['pyapi'])
- @skipIfWindows # BitFields exhibit crashes in record layout on Windows (http://llvm.org/pr21800)
- @expectedFailureAll("llvm.org/pr27510", oslist=["linux"], compiler="clang", compiler_version=[">=", "3.9"])
+ # BitFields exhibit crashes in record layout on Windows
+ # (http://llvm.org/pr21800)
+ @skipIfWindows
def test_and_python_api(self):
"""Use Python APIs to inspect a bitfields variable."""
self.build()
@@ -118,11 +131,13 @@ class BitfieldsTestCase(TestBase):
breakpoint = target.BreakpointCreateByLocation("main.c", self.line)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
# The breakpoint should have a hit count of 1.
@@ -132,10 +147,14 @@ class BitfieldsTestCase(TestBase):
frame = thread.GetFrameAtIndex(0)
bits = frame.FindVariable("bits")
self.DebugSBValue(bits)
- self.assertTrue(bits.GetTypeName() == 'Bits', "bits.GetTypeName() == 'Bits'");
- self.assertTrue(bits.GetNumChildren() == 10, "bits.GetNumChildren() == 10");
+ self.assertTrue(
+ bits.GetTypeName() == 'Bits',
+ "bits.GetTypeName() == 'Bits'")
+ self.assertTrue(
+ bits.GetNumChildren() == 10,
+ "bits.GetNumChildren() == 10")
test_compiler = self.getCompiler()
- self.assertTrue(bits.GetByteSize() == 32, "bits.GetByteSize() == 32");
+ self.assertTrue(bits.GetByteSize() == 32, "bits.GetByteSize() == 32")
# Notice the pattern of int(b1.GetValue(), 0). We pass a base of 0
# so that the proper radix is determined based on the contents of the
diff --git a/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py b/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py
index 0cc9456af32e..4025635eec6f 100644
--- a/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py
+++ b/packages/Python/lldbsuite/test/lang/c/blocks/TestBlocks.py
@@ -3,14 +3,15 @@
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
from lldbsuite.test.decorators import *
import lldbsuite.test.lldbutil as lldbutil
+
class BlocksTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -32,36 +33,46 @@ class BlocksTestCase(TestBase):
# Break inside the foo function which takes a bar_ptr argument.
for line in self.lines:
- lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", line, num_expected_locations=1, loc_exact=True)
self.wait_for_breakpoint()
-
+
@skipUnlessDarwin
def test_expr(self):
self.launch_common()
self.expect("expression a + b", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 7"])
+ substrs=["= 7"])
self.expect("expression c", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 1"])
+ substrs=["= 1"])
self.wait_for_breakpoint()
# This should display correctly.
self.expect("expression (int)neg (-12)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["= 12"])
+ substrs=["= 12"])
@skipUnlessDarwin
def test_define(self):
self.launch_common()
- self.runCmd("expression int (^$add)(int, int) = ^int(int a, int b) { return a + b; };")
+ self.runCmd(
+ "expression int (^$add)(int, int) = ^int(int a, int b) { return a + b; };")
+ self.expect(
+ "expression $add(2,3)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[" = 5"])
+
+ self.runCmd("expression int $a = 3")
+ self.expect(
+ "expression int (^$addA)(int) = ^int(int b) { return $a + b; };",
+ "Proper error is reported on capture",
+ error=True)
- self.expect("expression $add(2,3)", VARIABLES_DISPLAYED_CORRECTLY, substrs = [" = 5"])
-
def wait_for_breakpoint(self):
- if self.is_started == False:
+ if not self.is_started:
self.is_started = True
self.runCmd("process launch", RUN_SUCCEEDED)
else:
@@ -69,5 +80,5 @@ class BlocksTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
diff --git a/packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py b/packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py
index 99544c7bd80e..d54435a4c677 100644
--- a/packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py
+++ b/packages/Python/lldbsuite/test/lang/c/const_variables/TestConstVariables.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ConstVariableTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -25,8 +26,15 @@ class ConstVariableTestCase(TestBase):
compiler="clang", compiler_version=["=", "3.8"])
@expectedFailureAll(oslist=["freebsd", "linux"], compiler="icc")
@expectedFailureAll(archs=['mips', 'mipsel', 'mips64', 'mips64el'])
- @expectedFailureAll(oslist=["linux"], archs=['arm', 'aarch64'], bugnumber="llvm.org/pr27883")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ 'arm',
+ 'aarch64'],
+ bugnumber="llvm.org/pr27883")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
def test_and_run_command(self):
"""Test interpreted and JITted expressions on constant values."""
self.build()
@@ -34,32 +42,35 @@ class ConstVariableTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- lldbutil.run_break_set_by_symbol (self, "main", num_expected_locations=1)
+ lldbutil.run_break_set_by_symbol(
+ self, "main", num_expected_locations=1)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
self.runCmd("next")
self.runCmd("next")
# Try frame variable.
self.expect("frame variable index", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(int32_t) index = 512'])
+ substrs=['(int32_t) index = 512'])
# Try an interpreted expression.
self.expect("expr (index + 512)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['1024'])
+ substrs=['1024'])
# Try a JITted expression.
- self.expect("expr (int)getpid(); (index - 256)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['256'])
+ self.expect(
+ "expr (int)getpid(); (index - 256)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=['256'])
self.runCmd("kill")
diff --git a/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py b/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
index 044accf14f65..b4ea9fae043b 100644
--- a/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
+++ b/packages/Python/lldbsuite/test/lang/c/enum_types/TestEnumTypes.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.decorators import *
+
class EnumTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,7 +21,6 @@ class EnumTypesTestCase(TestBase):
# Find the line number to break inside main().
self.line = line_number('main.c', '// Set break point at this line.')
- @expectedFailureAll(oslist=['windows']) # derefing the null pointer "works" on Windows
def test(self):
"""Test 'image lookup -t days' and check for correct display and enum value printing."""
self.build()
@@ -28,23 +28,35 @@ class EnumTypesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- bkpt_id = lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ bkpt_id = lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Look up information about the 'days' enum type.
# Check for correct display.
self.expect("image lookup -t days", DATA_TYPES_DISPLAYED_CORRECTLY,
- substrs = ['enum days {',
+ substrs=['enum days {',
+ 'Monday',
+ 'Tuesday',
+ 'Wednesday',
+ 'Thursday',
+ 'Friday',
+ 'Saturday',
+ 'Sunday',
+ 'kNumDays',
+ '}'])
+
+ enum_values = ['-4',
'Monday',
'Tuesday',
'Wednesday',
@@ -53,28 +65,41 @@ class EnumTypesTestCase(TestBase):
'Saturday',
'Sunday',
'kNumDays',
- '}'])
-
- enum_values = [ '-4',
- 'Monday',
- 'Tuesday',
- 'Wednesday',
- 'Thursday',
- 'Friday',
- 'Saturday',
- 'Sunday',
- 'kNumDays',
- '5'];
+ '5']
# Make sure a pointer to an anonymous enum type does crash LLDB and displays correctly using
# frame variable and expression commands
- self.expect('frame variable f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['ops *', 'f.op'], patterns = ['0x0+$'])
- self.expect('frame variable *f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['ops', '*f.op', '<parent is NULL>'])
- self.expect('expr f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['ops *', '$'], patterns = ['0x0+$'])
- self.expect('expr *f.op', DATA_TYPES_DISPLAYED_CORRECTLY, substrs = ['error:'], error = True)
+ self.expect(
+ 'frame variable f.op',
+ DATA_TYPES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'ops *',
+ 'f.op'],
+ patterns=['0x0+$'])
+ self.expect(
+ 'frame variable *f.op',
+ DATA_TYPES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'ops',
+ '*f.op',
+ '<parent is NULL>'])
+ self.expect(
+ 'expr f.op',
+ DATA_TYPES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'ops *',
+ '$'],
+ patterns=['0x0+$'])
+ self.expect(
+ 'expr *f.op',
+ DATA_TYPES_DISPLAYED_CORRECTLY,
+ substrs=['error:'],
+ error=True)
bkpt = self.target().FindBreakpointByID(bkpt_id)
for enum_value in enum_values:
- self.expect("frame variable day", 'check for valid enumeration value',
- substrs = [enum_value])
- lldbutil.continue_to_breakpoint (self.process(), bkpt)
+ self.expect(
+ "frame variable day",
+ 'check for valid enumeration value',
+ substrs=[enum_value])
+ lldbutil.continue_to_breakpoint(self.process(), bkpt)
diff --git a/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py b/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
index 33c0de2d72d3..60e7073f146d 100644
--- a/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
+++ b/packages/Python/lldbsuite/test/lang/c/forward/TestForwardDeclaration.py
@@ -3,12 +3,13 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class ForwardDeclarationTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,28 +21,35 @@ class ForwardDeclarationTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_symbol (self, "foo", num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self, "foo", num_expected_locations=1, sym_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# This should display correctly.
# Note that the member fields of a = 1 and b = 2 is by design.
- self.expect("frame variable --show-types *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(bar) *bar_ptr = ',
- '(int) a = 1',
- '(int) b = 2'])
+ self.expect(
+ "frame variable --show-types *bar_ptr",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(bar) *bar_ptr = ',
+ '(int) a = 1',
+ '(int) b = 2'])
# And so should this.
- self.expect("expression --show-types -- *bar_ptr", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['(bar)',
- '(int) a = 1',
- '(int) b = 2'])
+ self.expect(
+ "expression --show-types -- *bar_ptr",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ '(bar)',
+ '(int) a = 1',
+ '(int) b = 2'])
diff --git a/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py b/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py
index 67ccb1aa3fa4..35e902e5bdcb 100644
--- a/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py
+++ b/packages/Python/lldbsuite/test/lang/c/function_types/TestFunctionTypes.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class FunctionTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,18 +27,24 @@ class FunctionTypesTestCase(TestBase):
self.runToBreakpoint()
# Check that the 'callback' variable display properly.
- self.expect("frame variable --show-types callback", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = '(int (*)(const char *)) callback =')
+ self.expect(
+ "frame variable --show-types callback",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr='(int (*)(const char *)) callback =')
# And that we can break on the callback function.
- lldbutil.run_break_set_by_symbol (self, "string_not_empty", num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self,
+ "string_not_empty",
+ num_expected_locations=1,
+ sym_exact=True)
self.runCmd("continue")
# Check that we do indeed stop on the string_not_empty function.
self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['a.out`string_not_empty',
- 'stop reason = breakpoint'])
-
+ substrs=['a.out`string_not_empty',
+ 'stop reason = breakpoint'])
+
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
def test_pointers(self):
"""Test that a function pointer to 'printf' works and can be called."""
@@ -45,33 +52,34 @@ class FunctionTypesTestCase(TestBase):
self.runToBreakpoint()
self.expect("expr string_not_empty",
- substrs = ['(int (*)(const char *)) $0 = ', '(a.out`'])
+ substrs=['(int (*)(const char *)) $0 = ', '(a.out`'])
if self.platformIsDarwin():
regexps = ['lib.*\.dylib`printf']
else:
regexps = ['printf']
self.expect("expr (int (*)(const char*, ...))printf",
- substrs = ['(int (*)(const char *, ...)) $1 = '],
- patterns = regexps)
+ substrs=['(int (*)(const char *, ...)) $1 = '],
+ patterns=regexps)
self.expect("expr $1(\"Hello world\\n\")",
- startstr = '(int) $2 = 12')
+ startstr='(int) $2 = 12')
def runToBreakpoint(self):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
-
+
# Break inside the main.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
-
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+
self.runCmd("run", RUN_SUCCEEDED)
-
+
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
diff --git a/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py b/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
index 87160f5252be..f54202edade3 100644
--- a/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
+++ b/packages/Python/lldbsuite/test/lang/c/global_variables/TestGlobalVariables.py
@@ -7,6 +7,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class GlobalVariablesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -16,11 +17,17 @@ class GlobalVariablesTestCase(TestBase):
TestBase.setUp(self)
# Find the line number to break inside main().
self.source = 'main.c'
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
self.shlib_names = ["a"]
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")
- @expectedFailureAll("llvm.org/pr25872", oslist=["macosx"], debug_info=["dwarf", "gmodules"])
+ @expectedFailureAll(
+ "llvm.org/pr25872, <rdar://problem/28725399>",
+ oslist=["macosx"],
+ debug_info=[
+ "dwarf",
+ "gmodules"])
def test_c_global_variables(self):
"""Test 'frame variable --scope --no-args' which omits args and shows scopes."""
self.build()
@@ -30,48 +37,67 @@ class GlobalVariablesTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Break inside the main.
- lldbutil.run_break_set_by_file_and_line (self, self.source, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, self.source, self.line, num_expected_locations=1, loc_exact=True)
- # Register our shared libraries for remote targets so they get automatically uploaded
- environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
+ environment = self.registerSharedLibrariesWithTarget(
+ target, self.shlib_names)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Check that GLOBAL scopes are indicated for the variables.
- self.expect("frame variable --show-types --scope --show-globals --no-args", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['GLOBAL: (int) g_file_global_int = 42',
- 'STATIC: (const int) g_file_static_int = 2',
- 'GLOBAL: (const char *) g_file_global_cstr',
- '"g_file_global_cstr"',
- 'STATIC: (const char *) g_file_static_cstr',
- '"g_file_static_cstr"',
- 'GLOBAL: (int) g_common_1 = 21'])
+ self.expect(
+ "frame variable --show-types --scope --show-globals --no-args",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'GLOBAL: (int) g_file_global_int = 42',
+ 'STATIC: (const int) g_file_static_int = 2',
+ 'GLOBAL: (const char *) g_file_global_cstr',
+ '"g_file_global_cstr"',
+ 'STATIC: (const char *) g_file_static_cstr',
+ '"g_file_static_cstr"',
+ 'GLOBAL: (int) g_common_1 = 21'])
# 'frame variable' should support address-of operator.
self.runCmd("frame variable &g_file_global_int")
- # Exercise the 'target variable' command to display globals in a.c file.
+ # Exercise the 'target variable' command to display globals in a.c
+ # file.
self.expect("target variable g_a", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['g_a', '123'])
- self.expect("target variable g_marked_spot.x", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['g_marked_spot.x', '20'])
+ substrs=['g_a', '123'])
+ self.expect(
+ "target variable g_marked_spot.x",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'g_marked_spot.x',
+ '20'])
# rdar://problem/9747668
# runCmd: target variable g_marked_spot.y
# output: (int) g_marked_spot.y = <a.o[0x214] can't be resolved, in not currently loaded.
# >
- self.expect("target variable g_marked_spot.y", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ['g_marked_spot.y', '21'])
- self.expect("target variable g_marked_spot.y", VARIABLES_DISPLAYED_CORRECTLY, matching=False,
- substrs = ["can't be resolved"])
+ self.expect(
+ "target variable g_marked_spot.y",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ 'g_marked_spot.y',
+ '21'])
+ self.expect(
+ "target variable g_marked_spot.y",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ matching=False,
+ substrs=["can't be resolved"])
diff --git a/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py b/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
index d6fbf42b7570..576e9ecd52ad 100644
--- a/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
+++ b/packages/Python/lldbsuite/test/lang/c/inlines/TestRedefinitionsInInlines.py
@@ -1,5 +1,11 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr27845"),
- decorators.expectedFailureAll(compiler="clang", compiler_version=["<", "3.5"], bugnumber="llvm.org/pr27845")])
+lldbinline.MakeInlineTest(__file__,
+ globals(),
+ [decorators.expectedFailureAll(oslist=["windows"],
+ bugnumber="llvm.org/pr27845"),
+ decorators.expectedFailureAll(compiler="clang",
+ compiler_version=["<",
+ "3.5"],
+ bugnumber="llvm.org/pr27845")])
diff --git a/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py b/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py
index 5a940e2e5eff..af6c3a722e40 100644
--- a/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py
+++ b/packages/Python/lldbsuite/test/lang/c/modules/TestCModules.py
@@ -3,9 +3,9 @@
from __future__ import print_function
-
from distutils.version import StrictVersion
-import os, time
+import os
+import time
import platform
import lldb
@@ -13,49 +13,65 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CModulesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipIfFreeBSD
- @expectedFailureAll(oslist=["linux"], bugnumber="http://llvm.org/pr23456 'fopen' has unknown return type")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="http://llvm.org/pr23456 'fopen' has unknown return type")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24489: Name lookup not working correctly on Windows")
+ @skipIf(macos_version=["<", "10.12"])
def test_expr(self):
- if platform.system() == "Darwin" and platform.release() < StrictVersion('12.0.0'):
- self.skipTest()
-
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
-
- self.expect("expr -l objc++ -- @import Darwin; 3", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["int", "3"])
-
- self.expect("expr *fopen(\"/dev/zero\", \"w\")", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["FILE", "_close"])
+ substrs=[' resolved, hit count = 1'])
+
+ self.expect(
+ "expr -l objc++ -- @import Darwin; 3",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "int",
+ "3"])
+
+ self.expect(
+ "expr *fopen(\"/dev/zero\", \"w\")",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "FILE",
+ "_close"])
self.expect("expr *myFile", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["a", "5", "b", "9"])
+ substrs=["a", "5", "b", "9"])
- self.expect("expr MIN((uint64_t)2, (uint64_t)3)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["uint64_t", "2"])
+ self.expect(
+ "expr MIN((uint64_t)2, (uint64_t)3)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "uint64_t",
+ "2"])
self.expect("expr stdin", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(FILE *)", "0x"])
+ substrs=["(FILE *)", "0x"])
def setUp(self):
# Call super's setUp().
diff --git a/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py b/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
index 6b2dc6a9b126..f11491e6d633 100644
--- a/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
+++ b/packages/Python/lldbsuite/test/lang/c/register_variables/TestRegisterVariables.py
@@ -2,7 +2,8 @@
from __future__ import print_function
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
@@ -15,6 +16,8 @@ from lldbsuite.test import lldbutil
# Return:
# True if the value has a readable value and is in a register
# False otherwise
+
+
def is_variable_in_register(frame, var_name):
# Ensure we can lookup the variable.
var = frame.FindVariable(var_name)
@@ -52,10 +55,12 @@ def is_variable_in_register(frame, var_name):
return True
-def is_struct_pointer_in_register(frame, var_name):
+def is_struct_pointer_in_register(frame, var_name, trace):
# Ensure we can lookup the variable.
var = frame.FindVariable(var_name)
- # print("\nchecking {}...".format(var_name))
+ if trace:
+ print("\nchecking {}...".format(var_name))
+
if var is None or not var.IsValid():
# print("{} cannot be found".format(var_name))
return False
@@ -65,13 +70,16 @@ def is_struct_pointer_in_register(frame, var_name):
value = var.GetValue()
# print("checking value...")
if value is None:
- # print("value is invalid")
+ if trace:
+ print("value is invalid")
return False
- # else:
- # print("value is {}".format(value))
+ else:
+ if trace:
+ print("value is {}".format(value))
var_loc = var.GetLocation()
- # print("checking location: {}".format(var_loc))
+ if trace:
+ print("checking location: {}".format(var_loc))
if var_loc is None or var_loc.startswith("0x"):
# The frame var is not in a register but rather a memory location.
# print("frame var {} is not in a register".format(var_name))
@@ -90,9 +98,9 @@ class RegisterVariableTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
-
@expectedFailureAll(compiler="clang", compiler_version=['<', '3.5'])
- @expectedFailureAll(compiler="gcc", compiler_version=['>=', '4.8.2'], archs=["i386", "x86_64"])
+ @expectedFailureAll(compiler="gcc", compiler_version=[
+ '>=', '4.8.2'], archs=["i386"])
def test_and_run_command(self):
"""Test expressions on register values."""
@@ -108,7 +116,8 @@ class RegisterVariableTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the main.
- lldbutil.run_break_set_by_source_regexp(self, "break", num_expected_locations=3)
+ lldbutil.run_break_set_by_source_regexp(
+ self, "break", num_expected_locations=3)
####################
# First breakpoint
@@ -117,24 +126,25 @@ class RegisterVariableTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Try some variables that should be visible
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
+ frame = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame()
if is_variable_in_register(frame, 'a'):
register_variables_count += 1
self.expect("expr a", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [re_expr_equals('int', 2)])
+ patterns=[re_expr_equals('int', 2)])
- if is_struct_pointer_in_register(frame, 'b'):
+ if is_struct_pointer_in_register(frame, 'b', self.TraceOn()):
register_variables_count += 1
self.expect("expr b->m1", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [re_expr_equals('int', 3)])
+ patterns=[re_expr_equals('int', 3)])
#####################
# Second breakpoint
@@ -143,24 +153,25 @@ class RegisterVariableTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Try some variables that should be visible
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
- if is_struct_pointer_in_register(frame, 'b'):
+ frame = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame()
+ if is_struct_pointer_in_register(frame, 'b', self.TraceOn()):
register_variables_count += 1
self.expect("expr b->m2", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [re_expr_equals('int', 5)])
+ patterns=[re_expr_equals('int', 5)])
if is_variable_in_register(frame, 'c'):
register_variables_count += 1
self.expect("expr c", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [re_expr_equals('int', 5)])
+ patterns=[re_expr_equals('int', 5)])
#####################
# Third breakpoint
@@ -169,22 +180,25 @@ class RegisterVariableTestCase(TestBase):
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# Try some variables that should be visible
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
+ frame = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame()
if is_variable_in_register(frame, 'f'):
register_variables_count += 1
self.expect("expr f", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = [re_expr_equals('float', '3.1')])
+ patterns=[re_expr_equals('float', '3.1')])
# Validate that we verified at least one register variable
- self.assertTrue(register_variables_count > 0, "expected to verify at least one variable in a register")
+ self.assertTrue(
+ register_variables_count > 0,
+ "expected to verify at least one variable in a register")
# print("executed {} expressions with values in registers".format(register_variables_count))
self.runCmd("kill")
diff --git a/packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py b/packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py
index 12e20dd42d44..bb94f1c4182b 100644
--- a/packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py
+++ b/packages/Python/lldbsuite/test/lang/c/set_values/TestSetValues.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SetValuesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -31,81 +32,111 @@ class SetValuesTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Set breakpoints on several places to set program variables.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line1, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line1, num_expected_locations=1, loc_exact=True)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line2, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line2, num_expected_locations=1, loc_exact=True)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line3, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line3, num_expected_locations=1, loc_exact=True)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line4, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line4, num_expected_locations=1, loc_exact=True)
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line5, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line5, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# main.c:15
- # Check that 'frame variable --show-types' displays the correct data type and value.
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(char) i = 'a'")
+ # Check that 'frame variable --show-types' displays the correct data
+ # type and value.
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(char) i = 'a'")
# Now set variable 'i' and check that it is correctly displayed.
self.runCmd("expression i = 'b'")
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(char) i = 'b'")
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(char) i = 'b'")
self.runCmd("continue")
# main.c:36
- # Check that 'frame variable --show-types' displays the correct data type and value.
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\((short unsigned int|unsigned short)\) i = 33"])
+ # Check that 'frame variable --show-types' displays the correct data
+ # type and value.
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ patterns=["\((short unsigned int|unsigned short)\) i = 33"])
# Now set variable 'i' and check that it is correctly displayed.
self.runCmd("expression i = 333")
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\((short unsigned int|unsigned short)\) i = 333"])
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ patterns=["\((short unsigned int|unsigned short)\) i = 333"])
self.runCmd("continue")
# main.c:57
- # Check that 'frame variable --show-types' displays the correct data type and value.
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(long) i = 33")
+ # Check that 'frame variable --show-types' displays the correct data
+ # type and value.
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(long) i = 33")
# Now set variable 'i' and check that it is correctly displayed.
self.runCmd("expression i = 33333")
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(long) i = 33333")
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(long) i = 33333")
self.runCmd("continue")
# main.c:78
- # Check that 'frame variable --show-types' displays the correct data type and value.
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(double) i = 2.25")
+ # Check that 'frame variable --show-types' displays the correct data
+ # type and value.
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(double) i = 2.25")
# Now set variable 'i' and check that it is correctly displayed.
self.runCmd("expression i = 1.5")
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(double) i = 1.5")
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(double) i = 1.5")
self.runCmd("continue")
# main.c:85
- # Check that 'frame variable --show-types' displays the correct data type and value.
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(long double) i = 2.25")
+ # Check that 'frame variable --show-types' displays the correct data
+ # type and value.
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(long double) i = 2.25")
# Now set variable 'i' and check that it is correctly displayed.
self.runCmd("expression i = 1.5")
- self.expect("frame variable --show-types", VARIABLES_DISPLAYED_CORRECTLY,
- startstr = "(long double) i = 1.5")
+ self.expect(
+ "frame variable --show-types",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ startstr="(long double) i = 1.5")
diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py b/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
index 954d1bac6362..61a67dc13987 100644
--- a/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
+++ b/packages/Python/lldbsuite/test/lang/c/shared_lib/TestSharedLib.py
@@ -3,12 +3,12 @@
from __future__ import print_function
-
import unittest2
import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class SharedLibTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -16,14 +16,20 @@ class SharedLibTestCase(TestBase):
def test_expr(self):
"""Test that types work when defined in a shared library and forward-declared in the main executable"""
if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion():
- self.skipTest("llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
+ self.skipTest(
+ "llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
self.build()
self.common_setup()
# This should display correctly.
- self.expect("expression --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
+ self.expect(
+ "expression --show-types -- *my_foo_ptr",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(foo)",
+ "(sub_foo)",
+ "other_element = 3"])
@unittest2.expectedFailure("rdar://problem/10704639")
def test_frame_variable(self):
@@ -32,8 +38,13 @@ class SharedLibTestCase(TestBase):
self.common_setup()
# This should display correctly.
- self.expect("frame variable --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
+ self.expect(
+ "frame variable --show-types -- *my_foo_ptr",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(foo)",
+ "(sub_foo)",
+ "other_element = 3"])
def setUp(self):
# Call super's setUp().
@@ -42,7 +53,7 @@ class SharedLibTestCase(TestBase):
self.source = 'main.c'
self.line = line_number(self.source, '// Set breakpoint 0 here.')
self.shlib_names = ["foo"]
-
+
def common_setup(self):
# Run in synchronous mode
self.dbg.SetAsync(False)
@@ -52,20 +63,24 @@ class SharedLibTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, self.source, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, self.source, self.line, num_expected_locations=1, loc_exact=True)
- # Register our shared libraries for remote targets so they get automatically uploaded
- environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
+ environment = self.registerSharedLibrariesWithTarget(
+ target, self.shlib_names)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
diff --git a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py b/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
index 011e4d1f22a4..7b371a2a9a99 100644
--- a/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
+++ b/packages/Python/lldbsuite/test/lang/c/shared_lib_stripped_symbols/TestSharedLibStrippedSymbols.py
@@ -3,13 +3,13 @@
from __future__ import print_function
-
import unittest2
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SharedLibStrippedTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -18,14 +18,20 @@ class SharedLibStrippedTestCase(TestBase):
def test_expr(self):
"""Test that types work when defined in a shared library and forward-declared in the main executable"""
if "clang" in self.getCompiler() and "3.4" in self.getCompilerVersion():
- self.skipTest("llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
+ self.skipTest(
+ "llvm.org/pr16214 -- clang emits partial DWARF for structures referenced via typedef")
self.build()
self.common_setup()
# This should display correctly.
- self.expect("expression --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
+ self.expect(
+ "expression --show-types -- *my_foo_ptr",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(foo)",
+ "(sub_foo)",
+ "other_element = 3"])
@expectedFailureAll(oslist=["windows"])
@unittest2.expectedFailure("rdar://problem/10381325")
@@ -35,8 +41,13 @@ class SharedLibStrippedTestCase(TestBase):
self.common_setup()
# This should display correctly.
- self.expect("frame variable --show-types -- *my_foo_ptr", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(foo)", "(sub_foo)", "other_element = 3"])
+ self.expect(
+ "frame variable --show-types -- *my_foo_ptr",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(foo)",
+ "(sub_foo)",
+ "other_element = 3"])
def setUp(self):
# Call super's setUp().
@@ -55,20 +66,24 @@ class SharedLibStrippedTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, self.source, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, self.source, self.line, num_expected_locations=1, loc_exact=True)
- # Register our shared libraries for remote targets so they get automatically uploaded
- environment = self.registerSharedLibrariesWithTarget(target, self.shlib_names)
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
+ environment = self.registerSharedLibrariesWithTarget(
+ target, self.shlib_names)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
diff --git a/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py b/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
index 2bd72434d390..b1aa98c50ba4 100644
--- a/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
+++ b/packages/Python/lldbsuite/test/lang/c/step-target/TestStepTarget.py
@@ -2,12 +2,14 @@
from __future__ import print_function
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestStepTarget(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,30 +25,32 @@ class TestStepTarget(TestBase):
self.end_line = line_number(self.main_source, "All done")
@add_test_categories(['pyapi'])
-
- def get_to_start (self):
+ def get_to_start(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
- break_in_main = target.BreakpointCreateBySourceRegex ('Break here to try targetted stepping', self.main_source_spec)
+ break_in_main = target.BreakpointCreateBySourceRegex(
+ 'Break here to try targetted stepping', self.main_source_spec)
self.assertTrue(break_in_main, VALID_BREAKPOINT)
- self.assertTrue(break_in_main.GetNumLocations() > 0,"Has locations.")
+ self.assertTrue(break_in_main.GetNumLocations() > 0, "Has locations.")
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_main)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_in_main)
if len(threads) != 1:
- self.fail ("Failed to stop at first breakpoint in main.")
+ self.fail("Failed to stop at first breakpoint in main.")
thread = threads[0]
return thread
@@ -60,7 +64,7 @@ class TestStepTarget(TestBase):
thread.StepInto("lotsOfArgs", self.end_line, error)
frame = thread.frames[0]
- self.assertTrue (frame.name == "lotsOfArgs", "Stepped to lotsOfArgs.")
+ self.assertTrue(frame.name == "lotsOfArgs", "Stepped to lotsOfArgs.")
def test_with_end_line_bad_name(self):
"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
@@ -70,7 +74,9 @@ class TestStepTarget(TestBase):
error = lldb.SBError()
thread.StepInto("lotsOfArgssss", self.end_line, error)
frame = thread.frames[0]
- self.assertTrue (frame.line_entry.line == self.end_line, "Stepped to the block end.")
+ self.assertTrue(
+ frame.line_entry.line == self.end_line,
+ "Stepped to the block end.")
def test_with_end_line_deeper(self):
"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
@@ -80,7 +86,7 @@ class TestStepTarget(TestBase):
error = lldb.SBError()
thread.StepInto("modifyInt", self.end_line, error)
frame = thread.frames[0]
- self.assertTrue (frame.name == "modifyInt", "Stepped to modifyInt.")
+ self.assertTrue(frame.name == "modifyInt", "Stepped to modifyInt.")
def test_with_command_and_block(self):
"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
@@ -88,11 +94,14 @@ class TestStepTarget(TestBase):
thread = self.get_to_start()
result = lldb.SBCommandReturnObject()
- self.dbg.GetCommandInterpreter().HandleCommand('thread step-in -t "lotsOfArgs" -e block', result)
- self.assertTrue(result.Succeeded(), "thread step-in command succeeded.")
+ self.dbg.GetCommandInterpreter().HandleCommand(
+ 'thread step-in -t "lotsOfArgs" -e block', result)
+ self.assertTrue(
+ result.Succeeded(),
+ "thread step-in command succeeded.")
frame = thread.frames[0]
- self.assertTrue (frame.name == "lotsOfArgs", "Stepped to lotsOfArgs.")
+ self.assertTrue(frame.name == "lotsOfArgs", "Stepped to lotsOfArgs.")
def test_with_command_and_block_and_bad_name(self):
"""Test stepping over vrs. hitting breakpoints & subsequent stepping in various forms."""
@@ -100,14 +109,17 @@ class TestStepTarget(TestBase):
thread = self.get_to_start()
result = lldb.SBCommandReturnObject()
- self.dbg.GetCommandInterpreter().HandleCommand('thread step-in -t "lotsOfArgsssss" -e block', result)
- self.assertTrue(result.Succeeded(), "thread step-in command succeeded.")
+ self.dbg.GetCommandInterpreter().HandleCommand(
+ 'thread step-in -t "lotsOfArgsssss" -e block', result)
+ self.assertTrue(
+ result.Succeeded(),
+ "thread step-in command succeeded.")
frame = thread.frames[0]
- self.assertTrue (frame.name == "main", "Stepped back out to main.")
- # end_line is set to the line after the containing block. Check that we got there:
- self.assertTrue(frame.line_entry.line == self.end_line, "Got out of the block")
-
-
-
+ self.assertTrue(frame.name == "main", "Stepped back out to main.")
+ # end_line is set to the line after the containing block. Check that
+ # we got there:
+ self.assertTrue(
+ frame.line_entry.line == self.end_line,
+ "Got out of the block")
diff --git a/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py b/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
index cfaff91daa45..d693e1dada51 100644
--- a/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
+++ b/packages/Python/lldbsuite/test/lang/c/stepping/TestStepAndBreakpoints.py
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestCStepping(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -35,36 +36,43 @@ class TestCStepping(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
breakpoints_to_disable = []
- break_1_in_main = target.BreakpointCreateBySourceRegex ('// frame select 2, thread step-out while stopped at .c.1..', self.main_source_spec)
+ break_1_in_main = target.BreakpointCreateBySourceRegex(
+ '// frame select 2, thread step-out while stopped at .c.1..',
+ self.main_source_spec)
self.assertTrue(break_1_in_main, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break_1_in_main)
+ breakpoints_to_disable.append(break_1_in_main)
- break_in_a = target.BreakpointCreateBySourceRegex ('// break here to stop in a before calling b', self.main_source_spec)
+ break_in_a = target.BreakpointCreateBySourceRegex(
+ '// break here to stop in a before calling b', self.main_source_spec)
self.assertTrue(break_in_a, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break_in_a)
+ breakpoints_to_disable.append(break_in_a)
- break_in_b = target.BreakpointCreateBySourceRegex ('// thread step-out while stopped at .c.2..', self.main_source_spec)
+ break_in_b = target.BreakpointCreateBySourceRegex(
+ '// thread step-out while stopped at .c.2..', self.main_source_spec)
self.assertTrue(break_in_b, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break_in_b)
+ breakpoints_to_disable.append(break_in_b)
- break_in_c = target.BreakpointCreateBySourceRegex ('// Find the line number of function .c. here.', self.main_source_spec)
+ break_in_c = target.BreakpointCreateBySourceRegex(
+ '// Find the line number of function .c. here.', self.main_source_spec)
self.assertTrue(break_in_c, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break_in_c)
+ breakpoints_to_disable.append(break_in_c)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_1_in_main)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_1_in_main)
if len(threads) != 1:
- self.fail ("Failed to stop at first breakpoint in main.")
+ self.fail("Failed to stop at first breakpoint in main.")
thread = threads[0]
@@ -75,22 +83,26 @@ class TestCStepping(TestBase):
thread.StepOver()
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_a)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_in_a)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint in a.")
+ self.fail("Failed to stop at breakpoint in a.")
# Check that the stop ID increases:
new_stop_id = process.GetStopID()
- self.assertTrue(new_stop_id > old_stop_id, "Stop ID increases monotonically.")
+ self.assertTrue(
+ new_stop_id > old_stop_id,
+ "Stop ID increases monotonically.")
thread = threads[0]
# Step over, and we should hit the breakpoint in b:
thread.StepOver()
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_b)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_in_b)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint in b.")
+ self.fail("Failed to stop at breakpoint in b.")
thread = threads[0]
# Now try running some function, and make sure that we still end up in the same place
@@ -105,32 +117,51 @@ class TestCStepping(TestBase):
stop_id_before_expression = process.GetStopID()
stop_id_before_including_expressions = process.GetStopID(True)
- frame.EvaluateExpression ("(int) printf (print_string)")
+ frame.EvaluateExpression("(int) printf (print_string)")
frame = thread.GetFrameAtIndex(0)
- self.assertTrue (current_line == frame.GetLineEntry().GetLine(), "The line stayed the same after expression.")
- self.assertTrue (current_file == frame.GetLineEntry().GetFileSpec(), "The file stayed the same after expression.")
- self.assertTrue (thread.GetStopReason() == lldb.eStopReasonBreakpoint, "We still say we stopped for a breakpoint.")
- self.assertTrue (thread.GetStopReasonDataAtIndex(0) == current_bp[0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.")
-
+ self.assertTrue(
+ current_line == frame.GetLineEntry().GetLine(),
+ "The line stayed the same after expression.")
+ self.assertTrue(
+ current_file == frame.GetLineEntry().GetFileSpec(),
+ "The file stayed the same after expression.")
+ self.assertTrue(
+ thread.GetStopReason() == lldb.eStopReasonBreakpoint,
+ "We still say we stopped for a breakpoint.")
+ self.assertTrue(thread.GetStopReasonDataAtIndex(0) == current_bp[
+ 0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.")
+
# Also make sure running the expression didn't change the public stop id
# but did change if we are asking for expression stops as well.
stop_id_after_expression = process.GetStopID()
stop_id_after_including_expressions = process.GetStopID(True)
- self.assertTrue (stop_id_before_expression == stop_id_after_expression, "Expression calling doesn't change stop ID")
+ self.assertTrue(
+ stop_id_before_expression == stop_id_after_expression,
+ "Expression calling doesn't change stop ID")
- self.assertTrue (stop_id_after_including_expressions > stop_id_before_including_expressions, "Stop ID including expressions increments over expression call.")
+ self.assertTrue(
+ stop_id_after_including_expressions > stop_id_before_including_expressions,
+ "Stop ID including expressions increments over expression call.")
- # Do the same thing with an expression that's going to crash, and make sure we are still unchanged.
+ # Do the same thing with an expression that's going to crash, and make
+ # sure we are still unchanged.
- frame.EvaluateExpression ("((char *) 0)[0] = 'a'")
+ frame.EvaluateExpression("((char *) 0)[0] = 'a'")
frame = thread.GetFrameAtIndex(0)
- self.assertTrue (current_line == frame.GetLineEntry().GetLine(), "The line stayed the same after expression.")
- self.assertTrue (current_file == frame.GetLineEntry().GetFileSpec(), "The file stayed the same after expression.")
- self.assertTrue (thread.GetStopReason() == lldb.eStopReasonBreakpoint, "We still say we stopped for a breakpoint.")
- self.assertTrue (thread.GetStopReasonDataAtIndex(0) == current_bp[0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.")
+ self.assertTrue(
+ current_line == frame.GetLineEntry().GetLine(),
+ "The line stayed the same after expression.")
+ self.assertTrue(
+ current_file == frame.GetLineEntry().GetFileSpec(),
+ "The file stayed the same after expression.")
+ self.assertTrue(
+ thread.GetStopReason() == lldb.eStopReasonBreakpoint,
+ "We still say we stopped for a breakpoint.")
+ self.assertTrue(thread.GetStopReasonDataAtIndex(0) == current_bp[
+ 0] and thread.GetStopReasonDataAtIndex(1) == current_bp[1], "And it is the same breakpoint.")
# Now continue and make sure we just complete the step:
# Disable all our breakpoints first - sometimes the compiler puts two line table entries in for the
@@ -140,16 +171,17 @@ class TestCStepping(TestBase):
process.Continue()
- self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "a")
- self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete)
+ self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "a")
+ self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
# And one more time should get us back to main:
process.Continue()
- self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "main")
- self.assertTrue (thread.GetStopReason() == lldb.eStopReasonPlanComplete)
+ self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "main")
+ self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
- # Now make sure we can call a function, break in the called function, then have "continue" get us back out again:
+ # Now make sure we can call a function, break in the called function,
+ # then have "continue" get us back out again:
frame = thread.GetFrameAtIndex(0)
frame = thread.GetFrameAtIndex(0)
current_line = frame.GetLineEntry().GetLine()
@@ -160,12 +192,13 @@ class TestCStepping(TestBase):
options.SetIgnoreBreakpoints(False)
options.SetFetchDynamicValue(False)
options.SetUnwindOnError(False)
- frame.EvaluateExpression ("b (4)", options)
+ frame.EvaluateExpression("b (4)", options)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break_in_b)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, break_in_b)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint in b when calling b.")
+ self.fail("Failed to stop at breakpoint in b when calling b.")
thread = threads[0]
# So do a step over here to make sure we can still do that:
@@ -174,75 +207,95 @@ class TestCStepping(TestBase):
# See that we are still in b:
func_name = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue (func_name == "b", "Should be in 'b', were in %s"%(func_name))
+ self.assertTrue(
+ func_name == "b",
+ "Should be in 'b', were in %s" %
+ (func_name))
- # Okay, now if we continue, we will finish off our function call and we should end up back in "a" as if nothing had happened:
- process.Continue ()
+ # Okay, now if we continue, we will finish off our function call and we
+ # should end up back in "a" as if nothing had happened:
+ process.Continue()
- self.assertTrue (thread.GetFrameAtIndex(0).GetLineEntry().GetLine() == current_line)
- self.assertTrue (thread.GetFrameAtIndex(0).GetLineEntry().GetFileSpec() == current_file)
+ self.assertTrue(thread.GetFrameAtIndex(
+ 0).GetLineEntry().GetLine() == current_line)
+ self.assertTrue(thread.GetFrameAtIndex(
+ 0).GetLineEntry().GetFileSpec() == current_file)
# Now we are going to test step in targeting a function:
- break_in_b.SetEnabled (False)
+ break_in_b.SetEnabled(False)
- break_before_complex_1 = target.BreakpointCreateBySourceRegex ('// Stop here to try step in targeting b.', self.main_source_spec)
+ break_before_complex_1 = target.BreakpointCreateBySourceRegex(
+ '// Stop here to try step in targeting b.', self.main_source_spec)
self.assertTrue(break_before_complex_1, VALID_BREAKPOINT)
- break_before_complex_2 = target.BreakpointCreateBySourceRegex ('// Stop here to try step in targeting complex.', self.main_source_spec)
+ break_before_complex_2 = target.BreakpointCreateBySourceRegex(
+ '// Stop here to try step in targeting complex.', self.main_source_spec)
self.assertTrue(break_before_complex_2, VALID_BREAKPOINT)
- break_before_complex_3 = target.BreakpointCreateBySourceRegex ('// Stop here to step targeting b and hitting breakpoint.', self.main_source_spec)
+ break_before_complex_3 = target.BreakpointCreateBySourceRegex(
+ '// Stop here to step targeting b and hitting breakpoint.', self.main_source_spec)
self.assertTrue(break_before_complex_3, VALID_BREAKPOINT)
- break_before_complex_4 = target.BreakpointCreateBySourceRegex ('// Stop here to make sure bogus target steps over.', self.main_source_spec)
+ break_before_complex_4 = target.BreakpointCreateBySourceRegex(
+ '// Stop here to make sure bogus target steps over.', self.main_source_spec)
self.assertTrue(break_before_complex_4, VALID_BREAKPOINT)
- threads = lldbutil.continue_to_breakpoint(process, break_before_complex_1)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.continue_to_breakpoint(
+ process, break_before_complex_1)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
break_before_complex_1.SetEnabled(False)
- thread.StepInto ("b")
- self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "b")
+ thread.StepInto("b")
+ self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "b")
- # Now continue out and stop at the next call to complex. This time step all the way into complex:
- threads = lldbutil.continue_to_breakpoint (process, break_before_complex_2)
- self.assertTrue (len(threads) == 1)
+ # Now continue out and stop at the next call to complex. This time
+ # step all the way into complex:
+ threads = lldbutil.continue_to_breakpoint(
+ process, break_before_complex_2)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
break_before_complex_2.SetEnabled(False)
- thread.StepInto ("complex")
- self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "complex")
-
- # Now continue out and stop at the next call to complex. This time enable breakpoints in a and c and then step targeting b:
- threads = lldbutil.continue_to_breakpoint (process, break_before_complex_3)
- self.assertTrue (len(threads) == 1)
+ thread.StepInto("complex")
+ self.assertTrue(thread.GetFrameAtIndex(
+ 0).GetFunctionName() == "complex")
+
+ # Now continue out and stop at the next call to complex. This time
+ # enable breakpoints in a and c and then step targeting b:
+ threads = lldbutil.continue_to_breakpoint(
+ process, break_before_complex_3)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
break_before_complex_3.SetEnabled(False)
- break_at_start_of_a = target.BreakpointCreateByName ('a')
- break_at_start_of_c = target.BreakpointCreateByName ('c')
+ break_at_start_of_a = target.BreakpointCreateByName('a')
+ break_at_start_of_c = target.BreakpointCreateByName('c')
- thread.StepInto ("b")
- threads = lldbutil.get_stopped_threads(process, lldb.eStopReasonBreakpoint);
+ thread.StepInto("b")
+ threads = lldbutil.get_stopped_threads(
+ process, lldb.eStopReasonBreakpoint)
- self.assertTrue (len(threads) == 1)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
stop_break_id = thread.GetStopReasonDataAtIndex(0)
- self.assertTrue(stop_break_id == break_at_start_of_a.GetID() or stop_break_id == break_at_start_of_c.GetID())
+ self.assertTrue(stop_break_id == break_at_start_of_a.GetID()
+ or stop_break_id == break_at_start_of_c.GetID())
break_at_start_of_a.SetEnabled(False)
break_at_start_of_c.SetEnabled(False)
process.Continue()
- self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "b")
-
- # Now continue out and stop at the next call to complex. This time enable breakpoints in a and c and then step targeting b:
- threads = lldbutil.continue_to_breakpoint (process, break_before_complex_4)
- self.assertTrue (len(threads) == 1)
+ self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "b")
+
+ # Now continue out and stop at the next call to complex. This time
+ # enable breakpoints in a and c and then step targeting b:
+ threads = lldbutil.continue_to_breakpoint(
+ process, break_before_complex_4)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
break_before_complex_4.SetEnabled(False)
thread.StepInto("NoSuchFunction")
- self.assertTrue (thread.GetFrameAtIndex(0).GetFunctionName() == "main")
+ self.assertTrue(thread.GetFrameAtIndex(0).GetFunctionName() == "main")
diff --git a/packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py b/packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py
index c3ed3f933ab0..c436000d882f 100644
--- a/packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py
+++ b/packages/Python/lldbsuite/test/lang/c/stepping/TestThreadStepping.py
@@ -5,14 +5,15 @@ Test thread stepping features in combination with frame select.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class ThreadSteppingTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,10 +22,14 @@ class ThreadSteppingTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to of function 'c'.
- self.line1 = line_number('main.c', '// Find the line number of function "c" here.')
- self.line2 = line_number('main.c', '// frame select 2, thread step-out while stopped at "c(1)"')
- self.line3 = line_number('main.c', '// thread step-out while stopped at "c(2)"')
- self.line4 = line_number('main.c', '// frame select 1, thread step-out while stopped at "c(3)"')
+ self.line1 = line_number(
+ 'main.c', '// Find the line number of function "c" here.')
+ self.line2 = line_number(
+ 'main.c', '// frame select 2, thread step-out while stopped at "c(1)"')
+ self.line3 = line_number(
+ 'main.c', '// thread step-out while stopped at "c(2)"')
+ self.line4 = line_number(
+ 'main.c', '// frame select 1, thread step-out while stopped at "c(3)"')
def test_step_out_with_run_command(self):
"""Exercise thread step-out and frame select followed by thread step-out."""
@@ -33,49 +38,50 @@ class ThreadSteppingTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Create a breakpoint inside function 'c'.
- lldbutil.run_break_set_by_file_and_line (self, "main.c", self.line1, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", self.line1, num_expected_locations=1, loc_exact=True)
# Now run the program.
self.runCmd("run", RUN_SUCCEEDED)
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
# The frame #0 should correspond to main.c:32, the executable statement
# in function name 'c'. And frame #3 should point to main.c:37.
self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint"],
- patterns = ["frame #0.*main.c:%d" % self.line1,
- "frame #3.*main.c:%d" % self.line2])
+ substrs=["stop reason = breakpoint"],
+ patterns=["frame #0.*main.c:%d" % self.line1,
+ "frame #3.*main.c:%d" % self.line2])
# We want to move the pc to frame #3. This can be accomplished by
# 'frame select 2', followed by 'thread step-out'.
self.runCmd("frame select 2")
self.runCmd("thread step-out")
self.expect("thread backtrace", STEP_OUT_SUCCEEDED,
- substrs = ["stop reason = step out"],
- patterns = ["frame #0.*main.c:%d" % self.line2])
+ substrs=["stop reason = step out"],
+ patterns=["frame #0.*main.c:%d" % self.line2])
# Let's move on to a single step-out case.
self.runCmd("process continue")
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
self.runCmd("thread step-out")
self.expect("thread backtrace", STEP_OUT_SUCCEEDED,
- substrs = ["stop reason = step out"],
- patterns = ["frame #0.*main.c:%d" % self.line3])
+ substrs=["stop reason = step out"],
+ patterns=["frame #0.*main.c:%d" % self.line3])
# Do another frame selct, followed by thread step-out.
self.runCmd("process continue")
# The process should be stopped at this point.
self.expect("process status", PROCESS_STOPPED,
- patterns = ['Process .* stopped'])
+ patterns=['Process .* stopped'])
self.runCmd("frame select 1")
self.runCmd("thread step-out")
self.expect("thread backtrace", STEP_OUT_SUCCEEDED,
- substrs = ["stop reason = step out"],
- patterns = ["frame #0.*main.c:%d" % self.line4])
+ substrs=["stop reason = step out"],
+ patterns=["frame #0.*main.c:%d" % self.line4])
diff --git a/packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py b/packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py
index a9f49c30d101..27821845e280 100644
--- a/packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py
+++ b/packages/Python/lldbsuite/test/lang/c/strings/TestCStrings.py
@@ -6,10 +6,11 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CStringsTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
+
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr21765")
def test_with_run_command(self):
"""Tests that C strings work as expected in expressions"""
@@ -17,39 +18,40 @@ class CStringsTestCase(TestBase):
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
line = line_number('main.c', '// breakpoint 1')
- lldbutil.run_break_set_by_file_and_line (self, "main.c", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", line, num_expected_locations=1, loc_exact=True)
self.runCmd("process launch", RUN_SUCCEEDED)
self.expect("expression -- a[2]",
- patterns = ["\((const )?char\) \$0 = 'c'"])
+ patterns=["\((const )?char\) \$0 = 'c'"])
self.expect("expression -- z[2]",
- startstr = "(const char) $1 = 'x'")
+ startstr="(const char) $1 = 'x'")
# On Linux, the expression below will test GNU indirect function calls.
self.expect("expression -- (int)strlen(\"hello\")",
- startstr = "(int) $2 = 5")
+ startstr="(int) $2 = 5")
self.expect("expression -- \"world\"[2]",
- startstr = "(const char) $3 = 'r'")
+ startstr="(const char) $3 = 'r'")
self.expect("expression -- \"\"[0]",
- startstr = "(const char) $4 = '\\0'")
+ startstr="(const char) $4 = '\\0'")
self.expect("expr --raw -- \"hello\"",
- substrs = ['[0] = \'h\'',
- '[5] = \'\\0\''])
+ substrs=['[0] = \'h\'',
+ '[5] = \'\\0\''])
self.expect("p \"hello\"",
- substrs = ['[6]) $', 'hello'])
+ substrs=['[6]) $', 'hello'])
self.expect("p (char*)\"hello\"",
- substrs = ['(char *) $', ' = 0x',
- 'hello'])
+ substrs=['(char *) $', ' = 0x',
+ 'hello'])
self.expect("p (int)strlen(\"\")",
- substrs = ['(int) $', ' = 0'])
+ substrs=['(int) $', ' = 0'])
self.expect("expression !z",
- substrs = ['false'])
+ substrs=['false'])
diff --git a/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py b/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py
index 2249a8c9b16a..af362f5be5d7 100644
--- a/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py
+++ b/packages/Python/lldbsuite/test/lang/c/struct_types/TestStructTypes.py
@@ -1,4 +1,7 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24764")] )
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.expectedFailureAll(
+ oslist=["windows"], bugnumber="llvm.org/pr24764")])
diff --git a/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py b/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
index 0ca9923c89a6..c6952d4d904a 100644
--- a/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
+++ b/packages/Python/lldbsuite/test/lang/c/tls_globals/TestTlsGlobals.py
@@ -3,14 +3,15 @@
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TlsGlobalTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,15 +20,31 @@ class TlsGlobalTestCase(TestBase):
TestBase.setUp(self)
if self.getPlatform() == "freebsd" or self.getPlatform() == "linux":
- # LD_LIBRARY_PATH must be set so the shared libraries are found on startup
+ # LD_LIBRARY_PATH must be set so the shared libraries are found on
+ # startup
if "LD_LIBRARY_PATH" in os.environ:
- self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.environ["LD_LIBRARY_PATH"] + ":" + os.getcwd())
+ self.runCmd(
+ "settings set target.env-vars " +
+ self.dylibPath +
+ "=" +
+ os.environ["LD_LIBRARY_PATH"] +
+ ":" +
+ os.getcwd())
else:
- self.runCmd("settings set target.env-vars " + self.dylibPath + "=" + os.getcwd())
- self.addTearDownHook(lambda: self.runCmd("settings remove target.env-vars " + self.dylibPath))
-
- @skipIfWindows # TLS works differently on Windows, this would need to be implemented separately.
- @expectedFailureAll(bugnumber="llvm.org/pr28392", oslist=no_match(lldbplatformutil.getDarwinOSTriples()))
+ self.runCmd("settings set target.env-vars " +
+ self.dylibPath + "=" + os.getcwd())
+ self.addTearDownHook(
+ lambda: self.runCmd(
+ "settings remove target.env-vars " +
+ self.dylibPath))
+
+ # TLS works differently on Windows, this would need to be implemented
+ # separately.
+ @skipIfWindows
+ @expectedFailureAll(
+ bugnumber="llvm.org/pr28392",
+ oslist=no_match(
+ lldbplatformutil.getDarwinOSTriples()))
def test(self):
"""Test thread-local storage."""
self.build()
@@ -35,14 +52,15 @@ class TlsGlobalTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
line1 = line_number('main.c', '// thread breakpoint')
- lldbutil.run_break_set_by_file_and_line (self, "main.c", line1, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", line1, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.runCmd("process status", "Get process status")
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# BUG: sometimes lldb doesn't change threads to the stopped thread.
# (unrelated to this test).
@@ -50,20 +68,21 @@ class TlsGlobalTestCase(TestBase):
# Check that TLS evaluates correctly within the thread.
self.expect("expr var_static", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\(int\) \$.* = 88"])
+ patterns=["\(int\) \$.* = 88"])
self.expect("expr var_shared", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\(int\) \$.* = 66"])
+ patterns=["\(int\) \$.* = 66"])
# Continue on the main thread
line2 = line_number('main.c', '// main breakpoint')
- lldbutil.run_break_set_by_file_and_line (self, "main.c", line2, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", line2, num_expected_locations=1, loc_exact=True)
self.runCmd("continue", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.runCmd("process status", "Get process status")
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# BUG: sometimes lldb doesn't change threads to the stopped thread.
# (unrelated to this test).
@@ -71,6 +90,6 @@ class TlsGlobalTestCase(TestBase):
# Check that TLS evaluates correctly within the main thread.
self.expect("expr var_static", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\(int\) \$.* = 44"])
+ patterns=["\(int\) \$.* = 44"])
self.expect("expr var_shared", VARIABLES_DISPLAYED_CORRECTLY,
- patterns = ["\(int\) \$.* = 33"])
+ patterns=["\(int\) \$.* = 33"])
diff --git a/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py b/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py
index 232a86a2cde3..71d00c5a9a67 100644
--- a/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py
+++ b/packages/Python/lldbsuite/test/lang/c/typedef/Testtypedef.py
@@ -3,19 +3,22 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TypedefTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@expectedFailureAll(compiler="clang", bugnumber="llvm.org/pr19238")
- @expectedFailureAll(oslist=["freebsd"], bugnumber="llvm.org/pr25626 expectedFailureClang fails on FreeBSD")
+ @expectedFailureAll(
+ oslist=["freebsd"],
+ bugnumber="llvm.org/pr25626 expectedFailureClang fails on FreeBSD")
def test_typedef(self):
"""Test 'image lookup -t a' and check for correct display at different scopes."""
self.build()
@@ -25,17 +28,28 @@ class TypedefTestCase(TestBase):
"""Test 'image lookup -t a' at different scopes and check for correct display."""
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- typearray = ("float", "float", "char", "double *", "float", "int", "double", "float", "float")
- arraylen = len(typearray)+1
- for i in range(1,arraylen):
- loc_line = line_number('main.c', '// Set break point ' + str(i) + '.')
- lldbutil.run_break_set_by_file_and_line (self, "main.c",loc_line, num_expected_locations=1, loc_exact=True)
+ typearray = (
+ "float",
+ "float",
+ "char",
+ "double *",
+ "float",
+ "int",
+ "double",
+ "float",
+ "float")
+ arraylen = len(typearray) + 1
+ for i in range(1, arraylen):
+ loc_line = line_number(
+ 'main.c', '// Set break point ' + str(i) + '.')
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.c", loc_line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
for t in typearray:
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped', 'stop reason = breakpoint'])
+ substrs=['stopped', 'stop reason = breakpoint'])
self.expect("image lookup -t a", DATA_TYPES_DISPLAYED_CORRECTLY,
- substrs = ['name = "' + t + '"'])
+ substrs=['name = "' + t + '"'])
self.runCmd("continue")
diff --git a/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py b/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
index 114be3ade01a..496398b1d0ac 100644
--- a/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
+++ b/packages/Python/lldbsuite/test/lang/c/unions/TestUnionMembers.py
@@ -2,6 +2,7 @@ import lldb
from lldbsuite.test.lldbtest import *
import lldbsuite.test.lldbutil as lldbutil
+
class TestUnionMembers(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -10,22 +11,29 @@ class TestUnionMembers(TestBase):
self._load_exe()
# Set breakpoints
- bp = self.target.BreakpointCreateBySourceRegex("Break here", self.src_file_spec)
- self.assertTrue(bp.IsValid() and bp.GetNumLocations() >= 1, VALID_BREAKPOINT)
+ bp = self.target.BreakpointCreateBySourceRegex(
+ "Break here", self.src_file_spec)
+ self.assertTrue(
+ bp.IsValid() and bp.GetNumLocations() >= 1,
+ VALID_BREAKPOINT)
# Launch the process
- self.process = self.target.LaunchSimple(None, None, self.get_process_working_directory())
+ self.process = self.target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(self.process.IsValid(), PROCESS_IS_VALID)
- self.assertTrue(self.process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+ self.assertTrue(
+ self.process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(self.process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ self.process, lldb.eStopReasonBreakpoint)
self.assertTrue(thread.IsValid())
frame = thread.GetSelectedFrame()
self.assertTrue(frame.IsValid())
- val = frame.EvaluateExpression("u");
+ val = frame.EvaluateExpression("u")
self.assertTrue(val.IsValid())
- val = frame.EvaluateExpression("u.s");
+ val = frame.EvaluateExpression("u.s")
self.assertTrue(val.IsValid())
self.assertEqual(val.GetNumChildren(), 2)
@@ -39,7 +47,7 @@ class TestUnionMembers(TestBase):
self.assertTrue(self.src_file_spec.IsValid(), "breakpoint file")
# Get the path of the executable
- exe_path = os.path.join(cwd, 'a.out')
+ exe_path = os.path.join(cwd, 'a.out')
# Load the executable
self.target = self.dbg.CreateTarget(exe_path)