[Lldb-commits] [lldb] r280751 - *** This commit represents a complete reformatting of the LLDB source code
Kate Stone via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 6 13:58:36 PDT 2016
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-ivar-stripped/TestObjCIvarStripped.py Tue Sep 6 15:57:50 2016
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCIvarStripped(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,10 +20,13 @@ class TestObjCIvarStripped(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "main.m"
- self.stop_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.stop_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
- @skipIf(debug_info=no_match("dsym"), bugnumber="This test requires a stripped binary and a dSYM")
+ @skipIf(
+ debug_info=no_match("dsym"),
+ bugnumber="This test requires a stripped binary and a dSYM")
@add_test_categories(['pyapi'])
def test_with_python_api(self):
"""Test that we can find stripped Objective-C ivars in the runtime"""
@@ -34,26 +38,33 @@ class TestObjCIvarStripped(TestBase):
self.dbg.HandleCommand("add-dsym a.out.dSYM")
- breakpoint = target.BreakpointCreateByLocation(self.main_source, self.stop_line)
- self.assertTrue(breakpoint.IsValid() and breakpoint.GetNumLocations() > 0, VALID_BREAKPOINT)
-
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
- self.assertTrue (process, "Created a process.")
- self.assertTrue (process.GetState() == lldb.eStateStopped, "Stopped it too.")
-
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue (len(thread_list) == 1)
+ breakpoint = target.BreakpointCreateByLocation(
+ self.main_source, self.stop_line)
+ self.assertTrue(
+ breakpoint.IsValid() and breakpoint.GetNumLocations() > 0,
+ VALID_BREAKPOINT)
+
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
+ self.assertTrue(process, "Created a process.")
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ "Stopped it too.")
+
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint)
+ self.assertTrue(len(thread_list) == 1)
thread = thread_list[0]
-
+
frame = thread.GetFrameAtIndex(0)
- self.assertTrue (frame, "frame 0 is valid")
-
+ self.assertTrue(frame, "frame 0 is valid")
+
# Test the expression for mc->_foo
error = lldb.SBError()
- ivar = frame.EvaluateExpression ("(mc->_foo)")
+ ivar = frame.EvaluateExpression("(mc->_foo)")
self.assertTrue(ivar, "Got result for mc->_foo")
- ivar_value = ivar.GetValueAsSigned (error)
- self.assertTrue (error.Success())
- self.assertTrue (ivar_value == 3)
+ ivar_value = ivar.GetValueAsSigned(error)
+ self.assertTrue(error.Success())
+ self.assertTrue(ivar_value == 3)
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-new-syntax/TestObjCNewSyntax.py Tue Sep 6 15:57:50 2016
@@ -3,9 +3,9 @@
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import platform
from distutils.version import StrictVersion
@@ -15,6 +15,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCNewSyntaxTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,80 +27,131 @@ class ObjCNewSyntaxTestCase(TestBase):
self.line = line_number('main.m', '// Set breakpoint 0 here.')
@skipUnlessDarwin
- @expectedFailureAll(oslist=['macosx'], compiler='clang', compiler_version=['<', '7.0.0'])
- @expectedFailureAll(oslist=['macosx'], debug_info=['gmodules'], bugnumber='rdar://27792848')
- @unittest2.skipIf(platform.system() != "Darwin" or StrictVersion('12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
+ @expectedFailureAll(
+ oslist=['macosx'],
+ compiler='clang',
+ compiler_version=[
+ '<',
+ '7.0.0'])
+ @expectedFailureAll(
+ oslist=['macosx'],
+ debug_info=['gmodules'],
+ bugnumber='rdar://27792848')
+ @unittest2.skipIf(platform.system() != "Darwin" or StrictVersion(
+ '12.0.0') > platform.release(), "Only supported on Darwin 12.0.0+")
def test_expr(self):
self.build()
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
-
- self.expect("expr --object-description -- immutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo"])
-
- self.expect("expr --object-description -- mutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["foo"])
-
- self.expect("expr --object-description -- mutable_array[0] = @\"bar\"", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["bar"])
-
- self.expect("expr --object-description -- mutable_array[0]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["bar"])
-
- self.expect("expr --object-description -- immutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["value"])
-
- self.expect("expr --object-description -- mutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["value"])
-
- self.expect("expr --object-description -- mutable_dictionary[@\"key\"] = @\"object\"", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["object"])
-
- self.expect("expr --object-description -- mutable_dictionary[@\"key\"]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["object"])
-
- self.expect("expr --object-description -- @[ @\"foo\", @\"bar\" ]", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["NSArray", "foo", "bar"])
-
- self.expect("expr --object-description -- @{ @\"key\" : @\"object\" }", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["key", "object"])
-
- self.expect("expr --object-description -- @'a'", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = [str(ord('a'))])
-
- self.expect("expr --object-description -- @1", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["1"])
-
- self.expect("expr --object-description -- @1l", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["1"])
-
- self.expect("expr --object-description -- @1ul", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["1"])
-
- self.expect("expr --object-description -- @1ll", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["1"])
+ substrs=[' resolved, hit count = 1'])
- self.expect("expr --object-description -- @1ull", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["1"])
+ self.expect(
+ "expr --object-description -- immutable_array[0]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["foo"])
+
+ self.expect(
+ "expr --object-description -- mutable_array[0]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["foo"])
+
+ self.expect(
+ "expr --object-description -- mutable_array[0] = @\"bar\"",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["bar"])
+
+ self.expect(
+ "expr --object-description -- mutable_array[0]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["bar"])
+
+ self.expect(
+ "expr --object-description -- immutable_dictionary[@\"key\"]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["value"])
+
+ self.expect(
+ "expr --object-description -- mutable_dictionary[@\"key\"]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["value"])
+
+ self.expect(
+ "expr --object-description -- mutable_dictionary[@\"key\"] = @\"object\"",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["object"])
+
+ self.expect(
+ "expr --object-description -- mutable_dictionary[@\"key\"]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["object"])
+
+ self.expect(
+ "expr --object-description -- @[ @\"foo\", @\"bar\" ]",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "NSArray",
+ "foo",
+ "bar"])
+
+ self.expect(
+ "expr --object-description -- @{ @\"key\" : @\"object\" }",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "key",
+ "object"])
+
+ self.expect("expr --object-description -- @'a'",
+ VARIABLES_DISPLAYED_CORRECTLY, substrs=[str(ord('a'))])
+
+ self.expect(
+ "expr --object-description -- @1",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ self.expect(
+ "expr --object-description -- @1l",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ self.expect(
+ "expr --object-description -- @1ul",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ self.expect(
+ "expr --object-description -- @1ll",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
+
+ self.expect(
+ "expr --object-description -- @1ull",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["1"])
self.expect("expr -- @123.45", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["NSNumber", "123.45"])
+ substrs=["NSNumber", "123.45"])
- self.expect("expr --object-description -- @( 1 + 3 )", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["4"])
- self.expect("expr -- @((char*)\"Hello world\" + 6)", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["NSString", "world"])
+ self.expect(
+ "expr --object-description -- @( 1 + 3 )",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=["4"])
+ self.expect(
+ "expr -- @((char*)\"Hello world\" + 6)",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "NSString",
+ "world"])
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-optimized/TestObjcOptimized.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-optimized/TestObjcOptimized.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-optimized/TestObjcOptimized.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-optimized/TestObjcOptimized.py Tue Sep 6 15:57:50 2016
@@ -10,8 +10,8 @@ optimized it into a register.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
import re
@@ -21,6 +21,8 @@ from lldbsuite.test import lldbutil
# rdar://problem/9087739
# test failure: objc_optimized does not work for "-C clang -A i386"
+
+
@skipUnlessDarwin
class ObjcOptimizedTestCase(TestBase):
@@ -35,15 +37,24 @@ class ObjcOptimizedTestCase(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_symbol (self, self.method_spec, num_expected_locations=1, sym_exact=True)
+ lldbutil.run_break_set_by_symbol(
+ self,
+ self.method_spec,
+ num_expected_locations=1,
+ sym_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
- self.expect("thread backtrace", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ["stop reason = breakpoint"],
- patterns = ["frame.*0:.*%s %s" % (self.myclass, self.mymethod)])
+ self.expect(
+ "thread backtrace",
+ STOPPED_DUE_TO_BREAKPOINT,
+ substrs=["stop reason = breakpoint"],
+ patterns=[
+ "frame.*0:.*%s %s" %
+ (self.myclass,
+ self.mymethod)])
self.expect('expression member',
- startstr = "(int) $0 = 5")
+ startstr="(int) $0 = 5")
# <rdar://problem/12693963>
interp = self.dbg.GetCommandInterpreter()
@@ -59,7 +70,7 @@ class ObjcOptimizedTestCase(TestBase):
desired_pointer = mo.group(0)
self.expect('expression (self)',
- substrs = [("(%s *) $1 = " % self.myclass), desired_pointer])
+ substrs=[("(%s *) $1 = " % self.myclass), desired_pointer])
self.expect('expression self->non_member', error=True,
- substrs = ["does not have a member named 'non_member'"])
+ substrs=["does not have a member named 'non_member'"])
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-property/TestObjCProperty.py Tue Sep 6 15:57:50 2016
@@ -5,23 +5,24 @@ Use lldb Python API to verify that expre
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCPropertyTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
- # Call super's setUp().
+ # Call super's setUp().
TestBase.setUp(self)
- # Find the line number to break for main.c.
+ # Find the line number to break for main.c.
self.source_name = 'main.m'
@skipUnlessDarwin
@@ -36,61 +37,68 @@ class ObjCPropertyTestCase(TestBase):
# Create a target from the debugger.
- target = self.dbg.CreateTarget (exe)
+ target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
# Set up our breakpoints:
-
- main_bkpt = target.BreakpointCreateBySourceRegex ("Set a breakpoint here.", lldb.SBFileSpec (self.source_name))
+
+ main_bkpt = target.BreakpointCreateBySourceRegex(
+ "Set a breakpoint here.", lldb.SBFileSpec(self.source_name))
self.assertTrue(main_bkpt and
main_bkpt.GetNumLocations() == 1,
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, main_bkpt)
- self.assertTrue (len(threads) == 1)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, main_bkpt)
+ self.assertTrue(len(threads) == 1)
thread = threads[0]
frame = thread.GetFrameAtIndex(0)
- mine = frame.FindVariable ("mine")
- self.assertTrue (mine.IsValid())
- access_count = mine.GetChildMemberWithName ("_access_count")
- self.assertTrue (access_count.IsValid())
- start_access_count = access_count.GetValueAsUnsigned (123456)
- self.assertTrue (start_access_count != 123456)
+ mine = frame.FindVariable("mine")
+ self.assertTrue(mine.IsValid())
+ access_count = mine.GetChildMemberWithName("_access_count")
+ self.assertTrue(access_count.IsValid())
+ start_access_count = access_count.GetValueAsUnsigned(123456)
+ self.assertTrue(start_access_count != 123456)
#
# The first set of tests test calling the getter & setter of
# a property that actually only has a getter & setter and no
# @property.
#
- nonexistant_value = frame.EvaluateExpression("mine.nonexistantInt", False)
+ nonexistant_value = frame.EvaluateExpression(
+ "mine.nonexistantInt", False)
nonexistant_error = nonexistant_value.GetError()
- self.assertTrue (nonexistant_error.Success())
- nonexistant_int = nonexistant_value.GetValueAsUnsigned (123456)
- self.assertTrue (nonexistant_int == 6)
-
- # Calling the getter function would up the access count, so make sure that happened.
-
- new_access_count = access_count.GetValueAsUnsigned (123456)
- self.assertTrue (new_access_count - start_access_count == 1)
+ self.assertTrue(nonexistant_error.Success())
+ nonexistant_int = nonexistant_value.GetValueAsUnsigned(123456)
+ self.assertTrue(nonexistant_int == 6)
+
+ # Calling the getter function would up the access count, so make sure
+ # that happened.
+
+ new_access_count = access_count.GetValueAsUnsigned(123456)
+ self.assertTrue(new_access_count - start_access_count == 1)
start_access_count = new_access_count
#
# Now call the setter, then make sure that
- nonexistant_change = frame.EvaluateExpression("mine.nonexistantInt = 10", False)
+ nonexistant_change = frame.EvaluateExpression(
+ "mine.nonexistantInt = 10", False)
nonexistant_error = nonexistant_change.GetError()
- self.assertTrue (nonexistant_error.Success())
+ self.assertTrue(nonexistant_error.Success())
+
+ # Calling the setter function would up the access count, so make sure
+ # that happened.
- # Calling the setter function would up the access count, so make sure that happened.
-
- new_access_count = access_count.GetValueAsUnsigned (123456)
- self.assertTrue (new_access_count - start_access_count == 1)
+ new_access_count = access_count.GetValueAsUnsigned(123456)
+ self.assertTrue(new_access_count - start_access_count == 1)
start_access_count = new_access_count
#
@@ -100,30 +108,32 @@ class ObjCPropertyTestCase(TestBase):
backed_value = frame.EvaluateExpression("mine.backedInt", False)
backed_error = backed_value.GetError()
- self.assertTrue (backed_error.Success())
- backing_value = mine.GetChildMemberWithName ("_backedInt")
- self.assertTrue (backing_value.IsValid())
- self.assertTrue (backed_value.GetValueAsUnsigned (12345) == backing_value.GetValueAsUnsigned(23456))
+ self.assertTrue(backed_error.Success())
+ backing_value = mine.GetChildMemberWithName("_backedInt")
+ self.assertTrue(backing_value.IsValid())
+ self.assertTrue(backed_value.GetValueAsUnsigned(12345)
+ == backing_value.GetValueAsUnsigned(23456))
unbacked_value = frame.EvaluateExpression("mine.unbackedInt", False)
unbacked_error = unbacked_value.GetError()
- self.assertTrue (unbacked_error.Success())
+ self.assertTrue(unbacked_error.Success())
- idWithProtocol_value = frame.EvaluateExpression("mine.idWithProtocol", False)
+ idWithProtocol_value = frame.EvaluateExpression(
+ "mine.idWithProtocol", False)
idWithProtocol_error = idWithProtocol_value.GetError()
- self.assertTrue (idWithProtocol_error.Success())
- self.assertTrue (idWithProtocol_value.GetTypeName() == "id")
+ self.assertTrue(idWithProtocol_error.Success())
+ self.assertTrue(idWithProtocol_value.GetTypeName() == "id")
# Make sure that class property getter works as expected
value = frame.EvaluateExpression("BaseClass.classInt", False)
- self.assertTrue (value.GetError().Success())
- self.assertTrue (value.GetValueAsUnsigned (11111) == 123)
+ self.assertTrue(value.GetError().Success())
+ self.assertTrue(value.GetValueAsUnsigned(11111) == 123)
# Make sure that class property setter works as expected
value = frame.EvaluateExpression("BaseClass.classInt = 234", False)
- self.assertTrue (value.GetError().Success())
+ self.assertTrue(value.GetError().Success())
# Verify that setter above actually worked
value = frame.EvaluateExpression("BaseClass.classInt", False)
- self.assertTrue (value.GetError().Success())
- self.assertTrue (value.GetValueAsUnsigned (11111) == 234)
+ self.assertTrue(value.GetError().Success())
+ self.assertTrue(value.GetValueAsUnsigned(11111) == 234)
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-runtime-ivars/TestRuntimeIvars.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-runtime-ivars/TestRuntimeIvars.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-runtime-ivars/TestRuntimeIvars.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-runtime-ivars/TestRuntimeIvars.py Tue Sep 6 15:57:50 2016
@@ -1,4 +1,6 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows])
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-static-method-stripped/TestObjCStaticMethodStripped.py Tue Sep 6 15:57:50 2016
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCStaticMethodStripped(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,11 +20,14 @@ class TestObjCStaticMethodStripped(TestB
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "static.m"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
- @skipIf(debug_info=no_match("dsym"), bugnumber="This test requires a stripped binary and a dSYM")
+ @skipIf(
+ debug_info=no_match("dsym"),
+ bugnumber="This test requires a stripped binary and a dSYM")
#<rdar://problem/12042992>
def test_with_python_api(self):
"""Test calling functions in static methods with a stripped binary."""
@@ -35,31 +39,42 @@ class TestObjCStaticMethodStripped(TestB
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
- # Now make sure we can call a function in the static method we've stopped in.
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
+
+ # Now make sure we can call a function in the static method we've
+ # stopped in.
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
- cmd_value = frame.EvaluateExpression ("(char *) sel_getName (_cmd)")
- self.assertTrue (cmd_value.IsValid())
+ cmd_value = frame.EvaluateExpression("(char *) sel_getName (_cmd)")
+ self.assertTrue(cmd_value.IsValid())
sel_name = cmd_value.GetSummary()
- self.assertTrue (sel_name == "\"doSomethingWithString:\"", "Got the right value for the selector as string.")
-
- cmd_value = frame.EvaluateExpression ("[Foo doSomethingElseWithString:string]")
- self.assertTrue (cmd_value.IsValid())
+ self.assertTrue(
+ sel_name == "\"doSomethingWithString:\"",
+ "Got the right value for the selector as string.")
+
+ cmd_value = frame.EvaluateExpression(
+ "[Foo doSomethingElseWithString:string]")
+ self.assertTrue(cmd_value.IsValid())
string_length = cmd_value.GetValueAsUnsigned()
- self.assertTrue (string_length == 27, "Got the right value from another class method on the same class.")
+ self.assertTrue(
+ string_length == 27,
+ "Got the right value from another class method on the same class.")
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-static-method/TestObjCStaticMethod.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-static-method/TestObjCStaticMethod.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-static-method/TestObjCStaticMethod.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-static-method/TestObjCStaticMethod.py Tue Sep 6 15:57:50 2016
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCStaticMethod(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,7 +20,8 @@ class TestObjCStaticMethod(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "static.m"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
@@ -32,31 +34,42 @@ class TestObjCStaticMethod(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
- # Now make sure we can call a function in the static method we've stopped in.
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
+
+ # Now make sure we can call a function in the static method we've
+ # stopped in.
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
- cmd_value = frame.EvaluateExpression ("(char *) sel_getName (_cmd)")
- self.assertTrue (cmd_value.IsValid())
+ cmd_value = frame.EvaluateExpression("(char *) sel_getName (_cmd)")
+ self.assertTrue(cmd_value.IsValid())
sel_name = cmd_value.GetSummary()
- self.assertTrue (sel_name == "\"doSomethingWithString:\"", "Got the right value for the selector as string.")
-
- cmd_value = frame.EvaluateExpression ("[self doSomethingElseWithString:string]")
- self.assertTrue (cmd_value.IsValid())
+ self.assertTrue(
+ sel_name == "\"doSomethingWithString:\"",
+ "Got the right value for the selector as string.")
+
+ cmd_value = frame.EvaluateExpression(
+ "[self doSomethingElseWithString:string]")
+ self.assertTrue(cmd_value.IsValid())
string_length = cmd_value.GetValueAsUnsigned()
- self.assertTrue (string_length == 27, "Got the right value from another class method on the same class.")
+ self.assertTrue(
+ string_length == 27,
+ "Got the right value from another class method on the same class.")
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-stepping/TestObjCStepping.py Tue Sep 6 15:57:50 2016
@@ -3,16 +3,17 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCStepping(TestBase):
- def getCategories (self):
+ def getCategories(self):
return ['basic_process']
mydir = TestBase.compute_mydir(__file__)
@@ -22,11 +23,16 @@ class TestObjCStepping(TestBase):
TestBase.setUp(self)
# Find the line numbers that we will step to in main:
self.main_source = "stepping-tests.m"
- self.source_randomMethod_line = line_number (self.main_source, '// Source randomMethod start line.')
- self.sourceBase_randomMethod_line = line_number (self.main_source, '// SourceBase randomMethod start line.')
- self.source_returnsStruct_start_line = line_number (self.main_source, '// Source returnsStruct start line.')
- self.sourceBase_returnsStruct_start_line = line_number (self.main_source, '// SourceBase returnsStruct start line.')
- self.stepped_past_nil_line = line_number (self.main_source, '// Step over nil should stop here.')
+ self.source_randomMethod_line = line_number(
+ self.main_source, '// Source randomMethod start line.')
+ self.sourceBase_randomMethod_line = line_number(
+ self.main_source, '// SourceBase randomMethod start line.')
+ self.source_returnsStruct_start_line = line_number(
+ self.main_source, '// Source returnsStruct start line.')
+ self.sourceBase_returnsStruct_start_line = line_number(
+ self.main_source, '// SourceBase returnsStruct start line.')
+ self.stepped_past_nil_line = line_number(
+ self.main_source, '// Step over nil should stop here.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
@@ -38,57 +44,65 @@ class TestObjCStepping(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
breakpoints_to_disable = []
- break1 = target.BreakpointCreateBySourceRegex ("// Set first breakpoint here.", self.main_source_spec)
+ break1 = target.BreakpointCreateBySourceRegex(
+ "// Set first breakpoint here.", self.main_source_spec)
self.assertTrue(break1, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break1)
+ breakpoints_to_disable.append(break1)
- break2 = target.BreakpointCreateBySourceRegex ("// Set second breakpoint here.", self.main_source_spec)
+ break2 = target.BreakpointCreateBySourceRegex(
+ "// Set second breakpoint here.", self.main_source_spec)
self.assertTrue(break2, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break2)
+ breakpoints_to_disable.append(break2)
- break3 = target.BreakpointCreateBySourceRegex ('// Set third breakpoint here.', self.main_source_spec)
+ break3 = target.BreakpointCreateBySourceRegex(
+ '// Set third breakpoint here.', self.main_source_spec)
self.assertTrue(break3, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break3)
+ breakpoints_to_disable.append(break3)
- break4 = target.BreakpointCreateBySourceRegex ('// Set fourth breakpoint here.', self.main_source_spec)
+ break4 = target.BreakpointCreateBySourceRegex(
+ '// Set fourth breakpoint here.', self.main_source_spec)
self.assertTrue(break4, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break4)
+ breakpoints_to_disable.append(break4)
- break5 = target.BreakpointCreateBySourceRegex ('// Set fifth breakpoint here.', self.main_source_spec)
+ break5 = target.BreakpointCreateBySourceRegex(
+ '// Set fifth breakpoint here.', self.main_source_spec)
self.assertTrue(break5, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break5)
+ breakpoints_to_disable.append(break5)
- break_returnStruct_call_super = target.BreakpointCreateBySourceRegex ('// Source returnsStruct call line.', self.main_source_spec)
+ break_returnStruct_call_super = target.BreakpointCreateBySourceRegex(
+ '// Source returnsStruct call line.', self.main_source_spec)
self.assertTrue(break_returnStruct_call_super, VALID_BREAKPOINT)
- breakpoints_to_disable.append (break_returnStruct_call_super)
+ breakpoints_to_disable.append(break_returnStruct_call_super)
- break_step_nil = target.BreakpointCreateBySourceRegex ('// Set nil step breakpoint here.', self.main_source_spec)
+ break_step_nil = target.BreakpointCreateBySourceRegex(
+ '// Set nil step breakpoint here.', self.main_source_spec)
self.assertTrue(break_step_nil, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break1)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(process, break1)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint 1.")
+ self.fail("Failed to stop at breakpoint 1.")
thread = threads[0]
mySource = thread.GetFrameAtIndex(0).FindVariable("mySource")
self.assertTrue(mySource, "Found mySource local variable.")
- mySource_isa = mySource.GetChildMemberWithName ("isa")
+ mySource_isa = mySource.GetChildMemberWithName("isa")
self.assertTrue(mySource_isa, "Found mySource->isa local variable.")
- className = mySource_isa.GetSummary ()
+ className = mySource_isa.GetSummary()
if self.TraceOn():
- print(mySource_isa)
+ print(mySource_isa)
# Lets delete mySource so we can check that after stepping a child variable
# with no parent persists and is useful.
@@ -97,77 +111,114 @@ class TestObjCStepping(TestBase):
# Now step in, that should leave us in the Source randomMethod:
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.source_randomMethod_line, "Stepped into Source randomMethod.")
+ self.assertTrue(
+ line_number == self.source_randomMethod_line,
+ "Stepped into Source randomMethod.")
- # Now step in again, through the super call, and that should leave us in the SourceBase randomMethod:
+ # Now step in again, through the super call, and that should leave us
+ # in the SourceBase randomMethod:
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.sourceBase_randomMethod_line, "Stepped through super into SourceBase randomMethod.")
+ self.assertTrue(
+ line_number == self.sourceBase_randomMethod_line,
+ "Stepped through super into SourceBase randomMethod.")
- threads = lldbutil.continue_to_breakpoint (process, break2)
- self.assertTrue (len(threads) == 1, "Continued to second breakpoint in main.")
+ threads = lldbutil.continue_to_breakpoint(process, break2)
+ self.assertTrue(
+ len(threads) == 1,
+ "Continued to second breakpoint in main.")
- # Again, step in twice gets us to a stret method and a stret super call:
+ # Again, step in twice gets us to a stret method and a stret super
+ # call:
thread = threads[0]
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.source_returnsStruct_start_line, "Stepped into Source returnsStruct.")
+ self.assertTrue(
+ line_number == self.source_returnsStruct_start_line,
+ "Stepped into Source returnsStruct.")
- threads = lldbutil.continue_to_breakpoint (process, break_returnStruct_call_super)
- self.assertTrue (len(threads) == 1, "Stepped to the call super line in Source returnsStruct.")
+ threads = lldbutil.continue_to_breakpoint(
+ process, break_returnStruct_call_super)
+ self.assertTrue(
+ len(threads) == 1,
+ "Stepped to the call super line in Source returnsStruct.")
thread = threads[0]
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.sourceBase_returnsStruct_start_line, "Stepped through super into SourceBase returnsStruct.")
+ self.assertTrue(
+ line_number == self.sourceBase_returnsStruct_start_line,
+ "Stepped through super into SourceBase returnsStruct.")
- # Cool now continue to get past the call that initializes the Observer, and then do our steps in again to see that
- # we can find our way when we're stepping through a KVO swizzled object.
+ # Cool now continue to get past the call that initializes the Observer, and then do our steps in again to see that
+ # we can find our way when we're stepping through a KVO swizzled
+ # object.
- threads = lldbutil.continue_to_breakpoint (process, break3)
- self.assertTrue (len(threads) == 1, "Continued to third breakpoint in main, our object should now be swizzled.")
+ threads = lldbutil.continue_to_breakpoint(process, break3)
+ self.assertTrue(
+ len(threads) == 1,
+ "Continued to third breakpoint in main, our object should now be swizzled.")
- newClassName = mySource_isa.GetSummary ()
+ newClassName = mySource_isa.GetSummary()
if self.TraceOn():
- print(mySource_isa)
+ print(mySource_isa)
- self.assertTrue (newClassName != className, "The isa did indeed change, swizzled!")
+ self.assertTrue(
+ newClassName != className,
+ "The isa did indeed change, swizzled!")
# Now step in, that should leave us in the Source randomMethod:
thread = threads[0]
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.source_randomMethod_line, "Stepped into Source randomMethod in swizzled object.")
+ self.assertTrue(
+ line_number == self.source_randomMethod_line,
+ "Stepped into Source randomMethod in swizzled object.")
- # Now step in again, through the super call, and that should leave us in the SourceBase randomMethod:
+ # Now step in again, through the super call, and that should leave us
+ # in the SourceBase randomMethod:
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.sourceBase_randomMethod_line, "Stepped through super into SourceBase randomMethod in swizzled object.")
+ self.assertTrue(
+ line_number == self.sourceBase_randomMethod_line,
+ "Stepped through super into SourceBase randomMethod in swizzled object.")
- threads = lldbutil.continue_to_breakpoint (process, break4)
- self.assertTrue (len(threads) == 1, "Continued to fourth breakpoint in main.")
+ threads = lldbutil.continue_to_breakpoint(process, break4)
+ self.assertTrue(
+ len(threads) == 1,
+ "Continued to fourth breakpoint in main.")
thread = threads[0]
- # Again, step in twice gets us to a stret method and a stret super call:
+ # Again, step in twice gets us to a stret method and a stret super
+ # call:
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.source_returnsStruct_start_line, "Stepped into Source returnsStruct in swizzled object.")
+ self.assertTrue(
+ line_number == self.source_returnsStruct_start_line,
+ "Stepped into Source returnsStruct in swizzled object.")
- threads = lldbutil.continue_to_breakpoint(process, break_returnStruct_call_super)
- self.assertTrue (len(threads) == 1, "Stepped to the call super line in Source returnsStruct - second time.")
+ threads = lldbutil.continue_to_breakpoint(
+ process, break_returnStruct_call_super)
+ self.assertTrue(
+ len(threads) == 1,
+ "Stepped to the call super line in Source returnsStruct - second time.")
thread = threads[0]
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.sourceBase_returnsStruct_start_line, "Stepped through super into SourceBase returnsStruct in swizzled object.")
+ self.assertTrue(
+ line_number == self.sourceBase_returnsStruct_start_line,
+ "Stepped through super into SourceBase returnsStruct in swizzled object.")
for bkpt in breakpoints_to_disable:
bkpt.SetEnabled(False)
- threads = lldbutil.continue_to_breakpoint (process, break_step_nil)
- self.assertTrue (len(threads) == 1, "Continued to step nil breakpoint.")
+ threads = lldbutil.continue_to_breakpoint(process, break_step_nil)
+ self.assertTrue(len(threads) == 1, "Continued to step nil breakpoint.")
thread.StepInto()
line_number = thread.GetFrameAtIndex(0).GetLineEntry().GetLine()
- self.assertTrue (line_number == self.stepped_past_nil_line, "Step in over dispatch to nil stepped over.")
+ self.assertTrue(
+ line_number == self.stepped_past_nil_line,
+ "Step in over dispatch to nil stepped over.")
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-argument/TestObjCStructArgument.py Tue Sep 6 15:57:50 2016
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCStructArgument(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,7 +20,8 @@ class TestObjCStructArgument(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "test.m"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
@@ -31,28 +33,36 @@ class TestObjCStructArgument(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
- frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
- self.expect("p [summer sumThings:tts]", substrs = ['9'])
+ frame = thread_list[0].GetFrameAtIndex(0)
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
- self.expect("po [NSValue valueWithRect:rect]", substrs = ['NSRect: {{0, 0}, {10, 20}}'])
+ self.expect("p [summer sumThings:tts]", substrs=['9'])
- # Now make sure we can call a method that returns a struct without crashing.
- cmd_value = frame.EvaluateExpression ("[provider getRange]")
- self.assertTrue (cmd_value.IsValid())
+ self.expect(
+ "po [NSValue valueWithRect:rect]",
+ substrs=['NSRect: {{0, 0}, {10, 20}}'])
+
+ # Now make sure we can call a method that returns a struct without
+ # crashing.
+ cmd_value = frame.EvaluateExpression("[provider getRange]")
+ self.assertTrue(cmd_value.IsValid())
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-return/TestObjCStructReturn.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-return/TestObjCStructReturn.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-return/TestObjCStructReturn.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-struct-return/TestObjCStructReturn.py Tue Sep 6 15:57:50 2016
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCClassMethod(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,7 +20,8 @@ class TestObjCClassMethod(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "test.m"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
@add_test_categories(['pyapi'])
@@ -31,24 +33,30 @@ class TestObjCClassMethod(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
+
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
- # Now make sure we can call a method that returns a struct without crashing.
- cmd_value = frame.EvaluateExpression ("[provider getRange]")
- self.assertTrue (cmd_value.IsValid())
+ # Now make sure we can call a method that returns a struct without
+ # crashing.
+ cmd_value = frame.EvaluateExpression("[provider getRange]")
+ self.assertTrue(cmd_value.IsValid())
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-super/TestObjCSuper.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-super/TestObjCSuper.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-super/TestObjCSuper.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/objc-super/TestObjCSuper.py Tue Sep 6 15:57:50 2016
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestObjCSuperMethod(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,7 +20,8 @@ class TestObjCSuperMethod(TestBase):
TestBase.setUp(self)
# Find the line numbers to break inside main().
self.main_source = "class.m"
- self.break_line = line_number(self.main_source, '// Set breakpoint here.')
+ self.break_line = line_number(
+ self.main_source, '// Set breakpoint here.')
@skipUnlessDarwin
@expectedFailureAll(archs=["i[3-6]86"])
@@ -32,29 +34,35 @@ class TestObjCSuperMethod(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- bpt = target.BreakpointCreateByLocation(self.main_source, self.break_line)
+ bpt = target.BreakpointCreateByLocation(
+ self.main_source, self.break_line)
self.assertTrue(bpt, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, bpt)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(process, bpt)
# Make sure we stopped at the first breakpoint.
- self.assertTrue (len(thread_list) != 0, "No thread stopped at our breakpoint.")
- self.assertTrue (len(thread_list) == 1, "More than one thread stopped at our breakpoint.")
-
- # Now make sure we can call a function in the class method we've stopped in.
+ self.assertTrue(
+ len(thread_list) != 0,
+ "No thread stopped at our breakpoint.")
+ self.assertTrue(len(thread_list) == 1,
+ "More than one thread stopped at our breakpoint.")
+
+ # Now make sure we can call a function in the class method we've
+ # stopped in.
frame = thread_list[0].GetFrameAtIndex(0)
- self.assertTrue (frame, "Got a valid frame 0 frame.")
+ self.assertTrue(frame, "Got a valid frame 0 frame.")
- cmd_value = frame.EvaluateExpression ("[self get]")
- self.assertTrue (cmd_value.IsValid())
- self.assertTrue (cmd_value.GetValueAsUnsigned() == 2)
-
- cmd_value = frame.EvaluateExpression ("[super get]")
- self.assertTrue (cmd_value.IsValid())
- self.assertTrue (cmd_value.GetValueAsUnsigned() == 1)
+ cmd_value = frame.EvaluateExpression("[self get]")
+ self.assertTrue(cmd_value.IsValid())
+ self.assertTrue(cmd_value.GetValueAsUnsigned() == 2)
+
+ cmd_value = frame.EvaluateExpression("[super get]")
+ self.assertTrue(cmd_value.IsValid())
+ self.assertTrue(cmd_value.GetValueAsUnsigned() == 1)
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/print-obj/TestPrintObj.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,14 @@ Test "print object" where another thread
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class PrintObjTestCase(TestBase):
@@ -47,14 +48,16 @@ class PrintObjTestCase(TestBase):
self.runCmd("breakpoint list")
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.runCmd("thread backtrace all")
# Let's get the current stopped thread. We'd like to switch to the
# other thread to issue our 'po lock_me' command.
import lldbsuite.test.lldbutil as lldbutil
- this_thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ this_thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertTrue(this_thread)
# Find the other thread. The iteration protocol of SBProcess and the
@@ -65,7 +68,8 @@ class PrintObjTestCase(TestBase):
other_thread = t
break
- # Set the other thread as the selected thread to issue our 'po' command.other
+ # Set the other thread as the selected thread to issue our 'po'
+ # command.other
self.assertTrue(other_thread)
process.SetSelectedThread(other_thread)
if self.TraceOn():
@@ -86,4 +90,4 @@ class PrintObjTestCase(TestBase):
break
self.expect("po lock_me", OBJECT_PRINTED_CORRECTLY,
- substrs = ['I am pretty special.'])
+ substrs=['I am pretty special.'])
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/radar-9691614/TestObjCMethodReturningBOOL.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,14 @@ Test that objective-c method returning B
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class MethodReturningBOOLTestCase(TestBase):
@@ -35,12 +36,13 @@ class MethodReturningBOOLTestCase(TestBa
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
self.expect("process status", STOPPED_DUE_TO_BREAKPOINT,
- substrs = [" at %s:%d" % (self.main_source, self.line),
- "stop reason = breakpoint"])
+ substrs=[" at %s:%d" % (self.main_source, self.line),
+ "stop reason = breakpoint"])
# rdar://problem/9691614
self.runCmd('p (int)[my isValid]')
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-10967107/TestRdar10967107.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,14 @@ Test that CoreFoundation classes CFGrego
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class Rdar10967107TestCase(TestBase):
@@ -35,11 +36,38 @@ class Rdar10967107TestCase(TestBase):
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ self.main_source,
+ self.line,
+ num_expected_locations=1,
+ loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# check that each type is correctly bound to its list of children
- self.expect("frame variable cf_greg_date --raw", substrs = ['year','month','day','hour','minute','second'])
- self.expect("frame variable cf_range --raw", substrs = ['location','length'])
+ self.expect(
+ "frame variable cf_greg_date --raw",
+ substrs=[
+ 'year',
+ 'month',
+ 'day',
+ 'hour',
+ 'minute',
+ 'second'])
+ self.expect(
+ "frame variable cf_range --raw",
+ substrs=[
+ 'location',
+ 'length'])
# check that printing both does not somehow confuse LLDB
- self.expect("frame variable --raw", substrs = ['year','month','day','hour','minute','second','location','length'])
+ self.expect(
+ "frame variable --raw",
+ substrs=[
+ 'year',
+ 'month',
+ 'day',
+ 'hour',
+ 'minute',
+ 'second',
+ 'location',
+ 'length'])
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-11355592/TestRdar11355592.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,14 @@ Test that we do not attempt to make a dy
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class Rdar10967107TestCase(TestBase):
@@ -35,32 +36,47 @@ class Rdar10967107TestCase(TestBase):
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ self.main_source,
+ self.line,
+ num_expected_locations=1,
+ loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
- # check that we correctly see the const char*, even with dynamic types on
- self.expect("frame variable my_string", substrs = ['const char *'])
- self.expect("frame variable my_string --dynamic-type run-target", substrs = ['const char *'])
+ # check that we correctly see the const char*, even with dynamic types
+ # on
+ self.expect("frame variable my_string", substrs=['const char *'])
+ self.expect(
+ "frame variable my_string --dynamic-type run-target",
+ substrs=['const char *'])
# check that expr also gets it right
- self.expect("expr my_string", substrs = ['const char *'])
- self.expect("expr -d run -- my_string", substrs = ['const char *'])
+ self.expect("expr my_string", substrs=['const char *'])
+ self.expect("expr -d run -- my_string", substrs=['const char *'])
# but check that we get the real Foolie as such
- self.expect("frame variable my_foolie", substrs = ['FoolMeOnce *'])
- self.expect("frame variable my_foolie --dynamic-type run-target", substrs = ['FoolMeOnce *'])
+ self.expect("frame variable my_foolie", substrs=['FoolMeOnce *'])
+ self.expect(
+ "frame variable my_foolie --dynamic-type run-target",
+ substrs=['FoolMeOnce *'])
# check that expr also gets it right
- self.expect("expr my_foolie", substrs = ['FoolMeOnce *'])
- self.expect("expr -d run -- my_foolie", substrs = ['FoolMeOnce *'])
+ self.expect("expr my_foolie", substrs=['FoolMeOnce *'])
+ self.expect("expr -d run -- my_foolie", substrs=['FoolMeOnce *'])
# now check that assigning a true string does not break anything
self.runCmd("next")
- # check that we correctly see the const char*, even with dynamic types on
- self.expect("frame variable my_string", substrs = ['const char *'])
- self.expect("frame variable my_string --dynamic-type run-target", substrs = ['const char *'])
+ # check that we correctly see the const char*, even with dynamic types
+ # on
+ self.expect("frame variable my_string", substrs=['const char *'])
+ self.expect(
+ "frame variable my_string --dynamic-type run-target",
+ substrs=['const char *'])
# check that expr also gets it right
- self.expect("expr my_string", substrs = ['const char *'])
- self.expect("expr -d run -- my_string", substrs = ['const char *'])
+ self.expect("expr my_string", substrs=['const char *'])
+ self.expect("expr -d run -- my_string", substrs=['const char *'])
# but check that we get the real Foolie as such
- self.expect("frame variable my_foolie", substrs = ['FoolMeOnce *'])
- self.expect("frame variable my_foolie --dynamic-type run-target", substrs = ['FoolMeOnce *'])
+ self.expect("frame variable my_foolie", substrs=['FoolMeOnce *'])
+ self.expect(
+ "frame variable my_foolie --dynamic-type run-target",
+ substrs=['FoolMeOnce *'])
# check that expr also gets it right
- self.expect("expr my_foolie", substrs = ['FoolMeOnce *'])
- self.expect("expr -d run -- my_foolie", substrs = ['FoolMeOnce *'])
+ self.expect("expr my_foolie", substrs=['FoolMeOnce *'])
+ self.expect("expr -d run -- my_foolie", substrs=['FoolMeOnce *'])
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/rdar-12408181/TestRdar12408181.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,14 @@ Test that we are able to find out how ma
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class Rdar12408181TestCase(TestBase):
@@ -35,15 +36,29 @@ class Rdar12408181TestCase(TestBase):
exe = os.path.join(os.getcwd(), self.exe_name)
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, self.main_source, self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self,
+ self.main_source,
+ self.line,
+ num_expected_locations=1,
+ loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
- if self.frame().EvaluateExpression('(void*)_CGSDefaultConnection()').GetValueAsUnsigned() != 0:
+ if self.frame().EvaluateExpression(
+ '(void*)_CGSDefaultConnection()').GetValueAsUnsigned() != 0:
window = self.frame().FindVariable("window")
window_dynamic = window.GetDynamicValue(lldb.eDynamicCanRunTarget)
- self.assertTrue(window.GetNumChildren() > 1, "NSWindow (static) only has 1 child!")
- self.assertTrue(window_dynamic.GetNumChildren() > 1, "NSWindow (dynamic) only has 1 child!")
- self.assertTrue(window.GetChildAtIndex(0).IsValid(), "NSWindow (static) has an invalid child")
- self.assertTrue(window_dynamic.GetChildAtIndex(0).IsValid(), "NSWindow (dynamic) has an invalid child")
+ self.assertTrue(
+ window.GetNumChildren() > 1,
+ "NSWindow (static) only has 1 child!")
+ self.assertTrue(
+ window_dynamic.GetNumChildren() > 1,
+ "NSWindow (dynamic) only has 1 child!")
+ self.assertTrue(
+ window.GetChildAtIndex(0).IsValid(),
+ "NSWindow (static) has an invalid child")
+ self.assertTrue(
+ window_dynamic.GetChildAtIndex(0).IsValid(),
+ "NSWindow (dynamic) has an invalid child")
else:
self.skipTest('no WindowServer connection')
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/real-definition/TestRealDefinition.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/real-definition/TestRealDefinition.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/real-definition/TestRealDefinition.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/real-definition/TestRealDefinition.py Tue Sep 6 15:57:50 2016
@@ -3,13 +3,14 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestRealDefinition(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,29 +23,35 @@ class TestRealDefinition(TestBase):
self.build()
self.common_setup()
- line = line_number('Foo.m', '// Set breakpoint where Bar is an interface')
- lldbutil.run_break_set_by_file_and_line (self, 'Foo.m', line, num_expected_locations=1, loc_exact=True);
+ line = line_number(
+ 'Foo.m', '// Set breakpoint where Bar is an interface')
+ lldbutil.run_break_set_by_file_and_line(
+ self, 'Foo.m', line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Run and stop at Foo
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
self.runCmd("continue", RUN_SUCCEEDED)
# Run at stop at main
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
-
+ substrs=[' resolved, hit count = 1'])
+
# This should display correctly.
- self.expect("frame variable foo->_bar->_hidden_ivar", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(NSString *)", "foo->_bar->_hidden_ivar = 0x"])
+ self.expect(
+ "frame variable foo->_bar->_hidden_ivar",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(NSString *)",
+ "foo->_bar->_hidden_ivar = 0x"])
@skipUnlessDarwin
def test_frame_var_after_stop_at_implementation(self):
@@ -54,29 +61,35 @@ class TestRealDefinition(TestBase):
self.build()
self.common_setup()
- line = line_number('Bar.m', '// Set breakpoint where Bar is an implementation')
- lldbutil.run_break_set_by_file_and_line (self, 'Bar.m', line, num_expected_locations=1, loc_exact=True)
+ line = line_number(
+ 'Bar.m', '// Set breakpoint where Bar is an implementation')
+ lldbutil.run_break_set_by_file_and_line(
+ self, 'Bar.m', line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# Run and stop at Foo
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
self.runCmd("continue", RUN_SUCCEEDED)
# Run at stop at main
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
# This should display correctly.
- self.expect("frame variable foo->_bar->_hidden_ivar", VARIABLES_DISPLAYED_CORRECTLY,
- substrs = ["(NSString *)", "foo->_bar->_hidden_ivar = 0x"])
+ self.expect(
+ "frame variable foo->_bar->_hidden_ivar",
+ VARIABLES_DISPLAYED_CORRECTLY,
+ substrs=[
+ "(NSString *)",
+ "foo->_bar->_hidden_ivar = 0x"])
def common_setup(self):
exe = os.path.join(os.getcwd(), "a.out")
@@ -84,4 +97,5 @@ class TestRealDefinition(TestBase):
# Break inside the foo function which takes a bar_ptr argument.
line = line_number('main.m', '// Set breakpoint in main')
- lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", line, num_expected_locations=1, loc_exact=True)
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/self/TestObjCSelf.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/self/TestObjCSelf.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/self/TestObjCSelf.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/self/TestObjCSelf.py Tue Sep 6 15:57:50 2016
@@ -6,10 +6,11 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCSelfTestCase(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
-
+
@skipUnlessDarwin
def test_with_run_command(self):
"""Test that the appropriate member variables are available when stopped in Objective-C class and instance methods"""
@@ -22,16 +23,17 @@ class ObjCSelfTestCase(TestBase):
self.runCmd("process launch", RUN_SUCCEEDED)
self.expect("expression -- m_a = 2",
- startstr = "(int) $0 = 2")
-
+ startstr="(int) $0 = 2")
+
self.runCmd("process continue")
-
+
# This would be disallowed if we enforced const. But we don't.
self.expect("expression -- m_a = 2",
error=True)
-
- self.expect("expression -- s_a",
- startstr = "(int) $1 = 5")
+
+ self.expect("expression -- s_a",
+ startstr="(int) $1 = 5")
def set_breakpoint(self, line):
- lldbutil.run_break_set_by_file_and_line (self, "main.m", line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", line, num_expected_locations=1, loc_exact=True)
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/single-entry-dictionary/TestObjCSingleEntryDictionary.py Tue Sep 6 15:57:50 2016
@@ -3,9 +3,9 @@
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import platform
from distutils.version import StrictVersion
@@ -15,6 +15,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCSingleEntryDictionaryTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -32,37 +33,46 @@ class ObjCSingleEntryDictionaryTestCase(
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# Break inside the foo function which takes a bar_ptr argument.
- lldbutil.run_break_set_by_file_and_line (self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.m", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# The breakpoint should have a hit count of 1.
self.expect("breakpoint list -f", BREAKPOINT_HIT_ONCE,
- substrs = [' resolved, hit count = 1'])
+ substrs=[' resolved, hit count = 1'])
d1 = self.frame().FindVariable("d1")
d1.SetPreferSyntheticValue(True)
d1.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
-
- self.assertTrue(d1.GetNumChildren() == 1, "dictionary has != 1 child elements")
+
+ self.assertTrue(
+ d1.GetNumChildren() == 1,
+ "dictionary has != 1 child elements")
pair = d1.GetChildAtIndex(0)
pair.SetPreferSyntheticValue(True)
pair.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
-
- self.assertTrue(pair.GetNumChildren() == 2, "pair has != 2 child elements")
-
+
+ self.assertTrue(
+ pair.GetNumChildren() == 2,
+ "pair has != 2 child elements")
+
key = pair.GetChildMemberWithName("key")
value = pair.GetChildMemberWithName("value")
-
+
key.SetPreferSyntheticValue(True)
key.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
value.SetPreferSyntheticValue(True)
value.SetPreferDynamicValue(lldb.eDynamicCanRunTarget)
-
- self.assertTrue(key.GetSummary() == '@"key"', "key doesn't contain key")
- self.assertTrue(value.GetSummary() == '@"value"', "value doesn't contain value")
+
+ self.assertTrue(
+ key.GetSummary() == '@"key"',
+ "key doesn't contain key")
+ self.assertTrue(
+ value.GetSummary() == '@"value"',
+ "value doesn't contain value")
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objc/variadic_methods/TestVariadicMethods.py Tue Sep 6 15:57:50 2016
@@ -1,4 +1,6 @@
from lldbsuite.test import lldbinline
from lldbsuite.test import decorators
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows])
Modified: lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/objcxx-ivar-vector/TestIvarVector.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/objcxx-ivar-vector/TestIvarVector.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/objcxx-ivar-vector/TestIvarVector.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lang/objcxx/objcxx-ivar-vector/TestIvarVector.py Tue Sep 6 15:57:50 2016
@@ -1,4 +1,6 @@
from lldbsuite.test import decorators
from lldbsuite.test import lldbinline
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows])
Modified: lldb/trunk/packages/Python/lldbsuite/test/linux/builtin_trap/TestBuiltinTrap.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/builtin_trap/TestBuiltinTrap.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/linux/builtin_trap/TestBuiltinTrap.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/builtin_trap/TestBuiltinTrap.py Tue Sep 6 15:57:50 2016
@@ -6,13 +6,13 @@ Test lldb ability to unwind a stack with
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BuiltinTrapTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,8 +23,14 @@ class BuiltinTrapTestCase(TestBase):
# Find the line number to break at.
self.line = line_number('main.cpp', '// Set break point at this line.')
- @expectedFailureAll("llvm.org/pr15936", compiler="gcc", compiler_version=["<=","4.6"])
- @expectedFailureAll(archs="arm", compiler="gcc", triple=".*-android") # gcc generates incorrect linetable
+ @expectedFailureAll(
+ "llvm.org/pr15936",
+ compiler="gcc",
+ compiler_version=[
+ "<=",
+ "4.6"])
+ # gcc generates incorrect linetable
+ @expectedFailureAll(archs="arm", compiler="gcc", triple=".*-android")
@expectedFailureAll(oslist=['linux'], archs=['arm'])
@skipIfWindows
def test_with_run_command(self):
@@ -32,22 +38,22 @@ class BuiltinTrapTestCase(TestBase):
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line,
- num_expected_locations=1,
- loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(self, "main.cpp", self.line,
+ num_expected_locations=1,
+ loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# print backtrace, expect both 'bar' and 'main' functions to be listed
- self.expect('bt', substrs = ['bar', 'main'])
+ self.expect('bt', substrs=['bar', 'main'])
# go up one frame
self.runCmd("up", RUN_SUCCEEDED)
# evaluate a local
- self.expect('p foo', substrs = ['= 5'])
+ self.expect('p foo', substrs=['= 5'])
Modified: lldb/trunk/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/linux/thread/create_during_instruction_step/TestCreateDuringInstructionStep.py Tue Sep 6 15:57:50 2016
@@ -6,13 +6,13 @@ over a thread creation instruction.
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CreateDuringInstructionStepTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,7 +23,10 @@ class CreateDuringInstructionStepTestCas
@skipUnlessPlatform(['linux'])
@expectedFailureAndroid('llvm.org/pr24737', archs=['arm'])
- @expectedFailureAll(oslist=["linux"], archs=["arm"], bugnumber="llvm.org/pr24737")
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["arm"],
+ bugnumber="llvm.org/pr24737")
def test_step_inst(self):
self.build(dictionary=self.getBuildFlags())
exe = os.path.join(os.getcwd(), "a.out")
@@ -32,36 +35,53 @@ class CreateDuringInstructionStepTestCas
# This should create a breakpoint in the stepping thread.
breakpoint = target.BreakpointCreateByName("main")
- self.assertTrue(breakpoint and breakpoint.IsValid(), "Breakpoint is valid")
+ self.assertTrue(
+ breakpoint and breakpoint.IsValid(),
+ "Breakpoint is valid")
# Run the program.
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process and process.IsValid(), PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
+ self.assertEqual(
+ process.GetState(),
+ lldb.eStateStopped,
+ PROCESS_STOPPED)
- threads = lldbutil.get_threads_stopped_at_breakpoint(process, breakpoint)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint)
self.assertEqual(len(threads), 1, STOPPED_DUE_TO_BREAKPOINT)
thread = threads[0]
self.assertTrue(thread and thread.IsValid(), "Thread is valid")
# Make sure we see only one threads
- self.assertEqual(process.GetNumThreads(), 1, 'Number of expected threads and actual threads do not match.')
+ self.assertEqual(
+ process.GetNumThreads(),
+ 1,
+ 'Number of expected threads and actual threads do not match.')
# Keep stepping until we see the thread creation
while process.GetNumThreads() < 2:
thread.StepInstruction(False)
- self.assertEqual(process.GetState(), lldb.eStateStopped, PROCESS_STOPPED)
- self.assertEqual(thread.GetStopReason(), lldb.eStopReasonPlanComplete, "Step operation succeeded")
+ self.assertEqual(
+ process.GetState(),
+ lldb.eStateStopped,
+ PROCESS_STOPPED)
+ self.assertEqual(
+ thread.GetStopReason(),
+ lldb.eStopReasonPlanComplete,
+ "Step operation succeeded")
if self.TraceOn():
self.runCmd("disassemble --pc")
if self.TraceOn():
self.runCmd("thread list")
- # We have successfully caught thread creation. Now just run to completion
+ # We have successfully caught thread creation. Now just run to
+ # completion
process.Continue()
# At this point, the inferior process should have exited.
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbbench.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbbench.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbbench.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbbench.py Tue Sep 6 15:57:50 2016
@@ -8,6 +8,7 @@ import time
# LLDB modules
from .lldbtest import *
+
class Stopwatch(object):
"""Stopwatch provides a simple utility to start/stop your stopwatch multiple
times. Each start/stop is equal to a lap, with its elapsed time accumulated
@@ -64,7 +65,8 @@ class Stopwatch(object):
if self.__start__ is None:
self.__start__ = time.time()
else:
- raise Exception("start() already called, did you forget to stop() first?")
+ raise Exception(
+ "start() already called, did you forget to stop() first?")
# Return self to facilitate the context manager __enter__ protocol.
return self
@@ -75,7 +77,7 @@ class Stopwatch(object):
self.__total_elapsed__ += elapsed
self.__laps__ += 1
self.__nums__.append(elapsed)
- self.__start__ = None # Reset __start__ to be None again.
+ self.__start__ = None # Reset __start__ to be None again.
else:
raise Exception("stop() called without first start()?")
@@ -87,32 +89,30 @@ class Stopwatch(object):
"""Equal to total elapsed time divided by the number of laps."""
return self.__total_elapsed__ / self.__laps__
- #def sigma(self):
+ # def sigma(self):
# """Return the standard deviation of the available samples."""
# if self.__laps__ <= 0:
# return None
# return numpy.std(self.__nums__)
def __str__(self):
- return "Avg: %f (Laps: %d, Total Elapsed Time: %f, min=%f, max=%f)" % (self.avg(),
- self.__laps__,
- self.__total_elapsed__,
- min(self.__nums__),
- max(self.__nums__))
+ return "Avg: %f (Laps: %d, Total Elapsed Time: %f, min=%f, max=%f)" % (self.avg(
+ ), self.__laps__, self.__total_elapsed__, min(self.__nums__), max(self.__nums__))
+
class BenchBase(TestBase):
"""
Abstract base class for benchmark tests.
"""
+
def setUp(self):
"""Fixture for unittest test case setup."""
super(BenchBase, self).setUp()
- #TestBase.setUp(self)
+ # TestBase.setUp(self)
self.stopwatch = Stopwatch()
def tearDown(self):
"""Fixture for unittest test case teardown."""
super(BenchBase, self).tearDown()
- #TestBase.tearDown(self)
+ # TestBase.tearDown(self)
del self.stopwatch
-
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbcurses.py Tue Sep 6 15:57:50 2016
@@ -4,14 +4,16 @@ from __future__ import absolute_import
import curses
import curses.panel
import sys
-import time
+import time
# Third-party modules
import six
# LLDB modules
+
class Point(object):
+
def __init__(self, x, y):
self.x = x
self.y = y
@@ -27,11 +29,13 @@ class Point(object):
def __ne__(self, rhs):
return self.x != rhs.x or self.y != rhs.y
-
+
def is_valid_coordinate(self):
return self.x >= 0 and self.y >= 0
-
+
+
class Size(object):
+
def __init__(self, w, h):
self.w = w
self.h = h
@@ -48,11 +52,13 @@ class Size(object):
def __ne__(self, rhs):
return self.w != rhs.w or self.h != rhs.h
+
class Rect(object):
+
def __init__(self, x=0, y=0, w=0, h=0):
self.origin = Point(x, y)
self.size = Size(w, h)
-
+
def __repr__(self):
return str(self)
@@ -70,7 +76,7 @@ class Rect(object):
def get_max_y(self):
return self.origin.y + self.size.h
-
+
def contains_point(self, pt):
if pt.x < self.get_max_x():
if pt.y < self.get_max_y():
@@ -84,12 +90,16 @@ class Rect(object):
def __ne__(self, rhs):
return self.origin != rhs.origin or self.size != rhs.size
+
class QuitException(Exception):
+
def __init__(self):
super(QuitException, self).__init__('QuitException')
+
class Window(object):
- def __init__(self, window, delegate = None, can_become_first_responder = True):
+
+ def __init__(self, window, delegate=None, can_become_first_responder=True):
self.window = window
self.parent = None
self.delegate = delegate
@@ -97,11 +107,11 @@ class Window(object):
self.first_responders = list()
self.can_become_first_responder = can_become_first_responder
self.key_actions = dict()
-
+
def add_child(self, window):
self.children.append(window)
window.parent = self
-
+
def resize(self, size):
self.window.resize(size.h, size.w)
@@ -109,7 +119,13 @@ class Window(object):
if child in self.children:
frame = self.get_frame()
orig_frame = child.get_frame()
- new_frame = Rect(x=orig_frame.origin.x, y=orig_frame.origin.y, w=orig_frame.size.w + delta_size.w, h=orig_frame.size.h + delta_size.h)
+ new_frame = Rect(
+ x=orig_frame.origin.x,
+ y=orig_frame.origin.y,
+ w=orig_frame.size.w +
+ delta_size.w,
+ h=orig_frame.size.h +
+ delta_size.h)
old_child_max_x = orig_frame.get_max_x()
new_child_max_x = new_frame.get_max_x()
window_max_x = frame.get_max_x()
@@ -122,7 +138,7 @@ class Window(object):
new_frame.origin.x -= new_child_max_x - window_max_x
child.set_position(new_frame.origin)
child.resize(new_frame.size)
-
+
if adjust_neighbors:
#print('orig_frame = %s\r\n' % (str(orig_frame)), end='')
for curr_child in self.children:
@@ -131,32 +147,33 @@ class Window(object):
curr_child_frame = curr_child.get_frame()
if delta_size.w != 0:
#print('curr_child_frame = %s\r\n' % (str(curr_child_frame)), end='')
- if curr_child_frame.get_min_x() == orig_frame.get_max_x():
+ if curr_child_frame.get_min_x() == orig_frame.get_max_x():
curr_child_frame.origin.x += delta_size.w
curr_child_frame.size.w -= delta_size.w
#print('adjusted curr_child_frame = %s\r\n' % (str(curr_child_frame)), end='')
- curr_child.resize (curr_child_frame.size)
- curr_child.slide_position (Size(w=delta_size.w, h=0))
+ curr_child.resize(curr_child_frame.size)
+ curr_child.slide_position(
+ Size(w=delta_size.w, h=0))
elif curr_child_frame.get_max_x() == orig_frame.get_min_x():
curr_child_frame.size.w -= delta_size.w
#print('adjusted curr_child_frame = %s\r\n' % (str(curr_child_frame)), end='')
- curr_child.resize (curr_child_frame.size)
-
+ curr_child.resize(curr_child_frame.size)
+
def add_key_action(self, arg, callback, decription):
if isinstance(arg, list):
for key in arg:
self.add_key_action(key, callback, description)
else:
if isinstance(arg, six.integer_types):
- key_action_dict = { 'key' : arg,
- 'callback' : callback,
- 'description' : decription }
+ key_action_dict = {'key': arg,
+ 'callback': callback,
+ 'description': decription}
self.key_actions[arg] = key_action_dict
- elif isinstance(arg, basestring):
+ elif isinstance(arg, basestring):
key_integer = ord(arg)
- key_action_dict = { 'key' : key_integer,
- 'callback' : callback,
- 'description' : decription }
+ key_action_dict = {'key': key_integer,
+ 'callback': callback,
+ 'description': decription}
self.key_actions[key_integer] = key_action_dict
else:
raise ValueError
@@ -164,16 +181,16 @@ class Window(object):
def draw_title_box(self, title):
is_in_first_responder_chain = self.is_in_first_responder_chain()
if is_in_first_responder_chain:
- self.attron (curses.A_REVERSE)
+ self.attron(curses.A_REVERSE)
self.box()
if is_in_first_responder_chain:
- self.attroff (curses.A_REVERSE)
+ self.attroff(curses.A_REVERSE)
if title:
self.addstr(Point(x=2, y=0), ' ' + title + ' ')
-
+
def remove_child(self, window):
self.children.remove(window)
-
+
def get_first_responder(self):
if len(self.first_responders):
return self.first_responders[-1]
@@ -182,12 +199,16 @@ class Window(object):
def set_first_responder(self, window):
if window.can_become_first_responder:
- if six.callable(getattr(window, "hidden", None)) and window.hidden():
+ if six.callable(
+ getattr(
+ window,
+ "hidden",
+ None)) and window.hidden():
return False
- if not window in self.children:
+ if window not in self.children:
self.add_child(window)
# See if we have a current first responder, and if we do, let it know that
- # it will be resigning as first responder
+ # it will be resigning as first responder
first_responder = self.get_first_responder()
if first_responder:
first_responder.relinquish_first_responder()
@@ -199,29 +220,31 @@ class Window(object):
return True
else:
return False
-
+
def push_first_responder(self, window):
- # Only push the window as the new first responder if the window isn't already the first responder
+ # Only push the window as the new first responder if the window isn't
+ # already the first responder
if window != self.get_first_responder():
self.first_responders.append(window)
-
- def pop_first_responder(self, window):
- # Only pop the window from the first responder list if it is the first responder
+
+ def pop_first_responder(self, window):
+ # Only pop the window from the first responder list if it is the first
+ # responder
if window == self.get_first_responder():
old_first_responder = self.first_responders.pop()
old_first_responder.relinquish_first_responder()
return True
else:
return False
-
+
def relinquish_first_responder(self):
'''Override if there is something that you need to do when you lose first responder status.'''
- pass
-
- # def resign_first_responder(self, remove_from_parent, new_first_responder):
+ pass
+
+ # def resign_first_responder(self, remove_from_parent, new_first_responder):
# success = False
# if self.parent:
- # if self.is_first_responder():
+ # if self.is_first_responder():
# self.relinquish_first_responder()
# if len(self.parent.first_responder):
# self.parent.first_responder = None
@@ -253,21 +276,21 @@ class Window(object):
num_children = len(self.children)
if num_children == 1:
return self.set_first_responder(self.children[0])
- for (i,window) in enumerate(self.children):
+ for (i, window) in enumerate(self.children):
if window.is_first_responder():
break
if i < num_children:
- for i in range(i+1,num_children):
+ for i in range(i + 1, num_children):
if self.set_first_responder(self.children[i]):
return True
for i in range(0, i):
if self.set_first_responder(self.children[i]):
return True
-
+
def point_in_window(self, pt):
size = self.get_size()
return pt.x >= 0 and pt.x < size.w and pt.y >= 0 and pt.y < size.h
-
+
def addch(self, c):
try:
self.window.addch(c)
@@ -291,6 +314,7 @@ class Window(object):
self.window.addnstr(pt.y, pt.x, str, n)
except:
pass
+
def addnstr(self, str, n):
try:
self.window.addnstr(str, n)
@@ -298,19 +322,26 @@ class Window(object):
pass
def attron(self, attr):
- return self.window.attron (attr)
+ return self.window.attron(attr)
def attroff(self, attr):
- return self.window.attroff (attr)
+ return self.window.attroff(attr)
def box(self, vertch=0, horch=0):
if vertch == 0:
vertch = curses.ACS_VLINE
- if horch == 0:
+ if horch == 0:
horch = curses.ACS_HLINE
self.window.box(vertch, horch)
- def get_contained_rect(self, top_inset=0, bottom_inset=0, left_inset=0, right_inset=0, height=-1, width=-1):
+ def get_contained_rect(
+ self,
+ top_inset=0,
+ bottom_inset=0,
+ left_inset=0,
+ right_inset=0,
+ height=-1,
+ width=-1):
'''Get a rectangle based on the top "height" lines of this window'''
rect = self.get_frame()
x = rect.origin.x + left_inset
@@ -323,11 +354,11 @@ class Window(object):
w = rect.size.w - (left_inset + right_inset)
else:
w = width
- return Rect (x = x, y = y, w = w, h = h)
+ return Rect(x=x, y=y, w=w, h=h)
def erase(self):
self.window.erase()
-
+
def get_cursor(self):
(y, x) = self.window.getyx()
return Point(x=x, y=y)
@@ -341,11 +372,11 @@ class Window(object):
position = self.get_position_in_parent()
size = self.get_size()
return Rect(x=position.x, y=position.y, w=size.w, h=size.h)
-
+
def get_position_in_parent(self):
(y, x) = self.window.getparyx()
return Point(x, y)
-
+
def get_position(self):
(y, x) = self.window.getbegyx()
return Point(x, y)
@@ -362,22 +393,22 @@ class Window(object):
curses.panel.update_panels()
self.move(Point(x=0, y=0))
return self.window.refresh()
-
+
def resize(self, size):
return self.window.resize(size.h, size.w)
-
+
def timeout(self, timeout_msec):
return self.window.timeout(timeout_msec)
def handle_key(self, key, check_parent=True):
'''Handle a key press in this window.'''
-
+
# First try the first responder if this window has one, but don't allow
# it to check with its parent (False second parameter) so we don't recurse
# and get a stack overflow
for first_responder in reversed(self.first_responders):
if first_responder.handle_key(key, False):
- return True
+ return True
# Check our key map to see if we have any actions. Actions don't take
# any arguments, they must be callable
@@ -391,23 +422,23 @@ class Window(object):
key_action['callback']()
return True
# Check if the window delegate wants to handle this key press
- if self.delegate:
+ if self.delegate:
if six.callable(getattr(self.delegate, "handle_key", None)):
if self.delegate.handle_key(self, key):
return True
if self.delegate(self, key):
return True
- # Check if we have a parent window and if so, let the parent
+ # Check if we have a parent window and if so, let the parent
# window handle the key press
if check_parent and self.parent:
return self.parent.handle_key(key, True)
else:
- return False # Key not handled
+ return False # Key not handled
def update(self):
for child in self.children:
child.update()
-
+
def quit_action(self):
raise QuitException
@@ -425,17 +456,17 @@ class Window(object):
else:
c = c << 8 | escape_key
self.timeout(timeout_msec)
- return c
-
+ return c
+
def key_event_loop(self, timeout_msec=-1, n=sys.maxsize):
'''Run an event loop to receive key presses and pass them along to the
responder chain.
-
+
timeout_msec is the timeout it milliseconds. If the value is -1, an
infinite wait will be used. It the value is zero, a non-blocking mode
will be used, and if greater than zero it will wait for a key press
for timeout_msec milliseconds.
-
+
n is the number of times to go through the event loop before exiting'''
done = False
while not done and n > 0:
@@ -447,10 +478,21 @@ class Window(object):
done = True
n -= 1
+
class Panel(Window):
- def __init__(self, frame, delegate = None, can_become_first_responder = True):
- window = curses.newwin(frame.size.h,frame.size.w, frame.origin.y, frame.origin.x)
- super(Panel, self).__init__(window, delegate, can_become_first_responder)
+
+ def __init__(self, frame, delegate=None, can_become_first_responder=True):
+ window = curses.newwin(
+ frame.size.h,
+ frame.size.w,
+ frame.origin.y,
+ frame.origin.x)
+ super(
+ Panel,
+ self).__init__(
+ window,
+ delegate,
+ can_become_first_responder)
self.panel = curses.panel.new_panel(window)
def hide(self):
@@ -464,31 +506,63 @@ class Panel(Window):
def top(self):
return self.panel.top()
-
+
def set_position(self, pt):
self.panel.move(pt.y, pt.x)
-
+
def slide_position(self, size):
new_position = self.get_position()
new_position.x = new_position.x + size.w
new_position.y = new_position.y + size.h
self.set_position(new_position)
+
class BoxedPanel(Panel):
- def __init__(self, frame, title, delegate = None, can_become_first_responder = True):
- super(BoxedPanel, self).__init__(frame, delegate, can_become_first_responder)
+
+ def __init__(self, frame, title, delegate=None,
+ can_become_first_responder=True):
+ super(
+ BoxedPanel,
+ self).__init__(
+ frame,
+ delegate,
+ can_become_first_responder)
self.title = title
self.lines = list()
self.first_visible_idx = 0
self.selected_idx = -1
- self.add_key_action(curses.KEY_UP, self.select_prev, "Select the previous item")
- self.add_key_action(curses.KEY_DOWN, self.select_next, "Select the next item")
- self.add_key_action(curses.KEY_HOME, self.scroll_begin, "Go to the beginning of the list")
- self.add_key_action(curses.KEY_END, self.scroll_end, "Go to the end of the list")
- self.add_key_action(0x1b4f48, self.scroll_begin, "Go to the beginning of the list")
- self.add_key_action(0x1b4f46, self.scroll_end, "Go to the end of the list")
- self.add_key_action(curses.KEY_PPAGE, self.scroll_page_backward, "Scroll to previous page")
- self.add_key_action(curses.KEY_NPAGE, self.scroll_page_forward, "Scroll to next forward")
+ self.add_key_action(
+ curses.KEY_UP,
+ self.select_prev,
+ "Select the previous item")
+ self.add_key_action(
+ curses.KEY_DOWN,
+ self.select_next,
+ "Select the next item")
+ self.add_key_action(
+ curses.KEY_HOME,
+ self.scroll_begin,
+ "Go to the beginning of the list")
+ self.add_key_action(
+ curses.KEY_END,
+ self.scroll_end,
+ "Go to the end of the list")
+ self.add_key_action(
+ 0x1b4f48,
+ self.scroll_begin,
+ "Go to the beginning of the list")
+ self.add_key_action(
+ 0x1b4f46,
+ self.scroll_end,
+ "Go to the end of the list")
+ self.add_key_action(
+ curses.KEY_PPAGE,
+ self.scroll_page_backward,
+ "Scroll to previous page")
+ self.add_key_action(
+ curses.KEY_NPAGE,
+ self.scroll_page_forward,
+ "Scroll to next forward")
self.update()
def clear(self, update=True):
@@ -497,21 +571,21 @@ class BoxedPanel(Panel):
self.selected_idx = -1
if update:
self.update()
-
+
def get_usable_width(self):
- '''Valid usable width is 0 to (width - 3) since the left and right lines display the box around
+ '''Valid usable width is 0 to (width - 3) since the left and right lines display the box around
this frame and we skip a leading space'''
w = self.get_size().w
if w > 3:
- return w-3
+ return w - 3
else:
return 0
-
+
def get_usable_height(self):
'''Valid line indexes are 0 to (height - 2) since the top and bottom lines display the box around this frame.'''
h = self.get_size().h
if h > 2:
- return h-2
+ return h - 2
else:
return 0
@@ -520,24 +594,25 @@ class BoxedPanel(Panel):
line_idx = global_line_idx - self.first_visible_idx
num_lines = self.get_usable_height()
if line_idx < num_lines:
- return Point(x=2, y=1+line_idx)
+ return Point(x=2, y=1 + line_idx)
else:
- return Point(x=-1, y=-1) # return an invalid coordinate if the line index isn't valid
-
- def set_title (self, title, update=True):
+ # return an invalid coordinate if the line index isn't valid
+ return Point(x=-1, y=-1)
+
+ def set_title(self, title, update=True):
self.title = title
if update:
self.update()
- def scroll_to_line (self, idx):
+ def scroll_to_line(self, idx):
if idx < len(self.lines):
self.selected_idx = idx
- max_visible_lines = self.get_usable_height()
+ max_visible_lines = self.get_usable_height()
if idx < self.first_visible_idx or idx >= self.first_visible_idx + max_visible_lines:
self.first_visible_idx = idx
self.refresh()
- def scroll_begin (self):
+ def scroll_begin(self):
self.first_visible_idx = 0
if len(self.lines) > 0:
self.selected_idx = 0
@@ -545,39 +620,39 @@ class BoxedPanel(Panel):
self.selected_idx = -1
self.update()
- def scroll_end (self):
+ def scroll_end(self):
max_visible_lines = self.get_usable_height()
num_lines = len(self.lines)
if num_lines > max_visible_lines:
self.first_visible_idx = num_lines - max_visible_lines
else:
self.first_visible_idx = 0
- self.selected_idx = num_lines-1
+ self.selected_idx = num_lines - 1
self.update()
-
+
def scroll_page_backward(self):
- num_lines = len(self.lines)
- max_visible_lines = self.get_usable_height()
+ num_lines = len(self.lines)
+ max_visible_lines = self.get_usable_height()
new_index = self.first_visible_idx - max_visible_lines
if new_index < 0:
self.first_visible_idx = 0
else:
self.first_visible_idx = new_index
self.refresh()
-
+
def scroll_page_forward(self):
- max_visible_lines = self.get_usable_height()
+ max_visible_lines = self.get_usable_height()
self.first_visible_idx += max_visible_lines
self._adjust_first_visible_line()
self.refresh()
- def select_next (self):
+ def select_next(self):
self.selected_idx += 1
if self.selected_idx >= len(self.lines):
self.selected_idx = len(self.lines) - 1
self.refresh()
-
- def select_prev (self):
+
+ def select_prev(self):
self.selected_idx -= 1
if self.selected_idx < 0:
if len(self.lines) > 0:
@@ -588,13 +663,14 @@ class BoxedPanel(Panel):
def get_selected_idx(self):
return self.selected_idx
-
+
def _adjust_first_visible_line(self):
num_lines = len(self.lines)
max_visible_lines = self.get_usable_height()
- if (self.first_visible_idx >= num_lines) or (num_lines - self.first_visible_idx) > max_visible_lines:
+ if (self.first_visible_idx >= num_lines) or (
+ num_lines - self.first_visible_idx) > max_visible_lines:
self.first_visible_idx = num_lines - max_visible_lines
-
+
def append_line(self, s, update=True):
self.lines.append(s)
self._adjust_first_visible_line()
@@ -611,9 +687,9 @@ class BoxedPanel(Panel):
self._adjust_first_visible_line()
if update:
self.update()
-
+
def update(self):
- self.erase()
+ self.erase()
self.draw_title_box(self.title)
max_width = self.get_usable_width()
for line_idx in range(self.first_visible_idx, len(self.lines)):
@@ -621,11 +697,11 @@ class BoxedPanel(Panel):
if pt.is_valid_coordinate():
is_selected = line_idx == self.selected_idx
if is_selected:
- self.attron (curses.A_REVERSE)
+ self.attron(curses.A_REVERSE)
self.move(pt)
self.addnstr(self.lines[line_idx], max_width)
if is_selected:
- self.attroff (curses.A_REVERSE)
+ self.attroff(curses.A_REVERSE)
else:
return
@@ -636,16 +712,19 @@ class BoxedPanel(Panel):
for (idx, line) in enumerate(self.lines):
# Remove any tabs from lines since they hose up the display
if "\t" in line:
- self.lines[idx] = (8*' ').join(line.split('\t'))
+ self.lines[idx] = (8 * ' ').join(line.split('\t'))
self.selected_idx = 0
self.first_visible_idx = 0
self.refresh()
+
class Item(object):
+
def __init__(self, title, action):
self.title = title
self.action = action
+
class TreeItemDelegate(object):
def might_have_children(self):
@@ -663,21 +742,29 @@ class TreeItemDelegate(object):
def draw_item(self, tree_window, item):
self.draw_item_string(tree_window, item, item.title)
-
+
def do_action(self):
pass
+
class TreeItem(object):
- def __init__(self, delegate, parent = None, title = None, action = None, is_expanded = False):
+
+ def __init__(
+ self,
+ delegate,
+ parent=None,
+ title=None,
+ action=None,
+ is_expanded=False):
self.parent = parent
self.title = title
- self.action = action
+ self.action = action
self.delegate = delegate
- self.is_expanded = not parent or is_expanded == True
+ self.is_expanded = not parent or is_expanded
self._might_have_children = None
self.children = None
self._children_might_have_children = False
-
+
def get_children(self):
if self.is_expanded and self.might_have_children():
if self.children is None:
@@ -691,7 +778,7 @@ class TreeItem(object):
self._children_might_have_children = False
self.children = None
return self.children
-
+
def append_visible_items(self, items):
items.append(self)
children = self.get_children()
@@ -705,7 +792,8 @@ class TreeItem(object):
# Root item always might have children
self._might_have_children = True
else:
- # Check with the delegate to see if the item might have children
+ # Check with the delegate to see if the item might have
+ # children
self._might_have_children = self.delegate.might_have_children()
return self._might_have_children
@@ -717,10 +805,10 @@ class TreeItem(object):
self.children = self.delegate.update_children(self)
for child in self.children:
child.update_children()
- else:
+ else:
self.children = None
return self.children
-
+
def get_num_visible_rows(self):
rows = 1
if self.is_expanded:
@@ -729,6 +817,7 @@ class TreeItem(object):
for child in children:
rows += child.get_num_visible_rows()
return rows
+
def draw(self, tree_window, row):
display_row = tree_window.get_display_row(row)
if display_row >= 0:
@@ -736,79 +825,112 @@ class TreeItem(object):
if self.parent:
self.parent.draw_tree_for_child(tree_window, self, 0)
if self.might_have_children():
- tree_window.addch (curses.ACS_DIAMOND)
- tree_window.addch (curses.ACS_HLINE)
+ tree_window.addch(curses.ACS_DIAMOND)
+ tree_window.addch(curses.ACS_HLINE)
elif self.parent and self.parent.children_might_have_children():
if self.parent.parent:
- tree_window.addch (curses.ACS_HLINE)
- tree_window.addch (curses.ACS_HLINE)
+ tree_window.addch(curses.ACS_HLINE)
+ tree_window.addch(curses.ACS_HLINE)
else:
- tree_window.addch (' ')
- tree_window.addch (' ')
+ tree_window.addch(' ')
+ tree_window.addch(' ')
is_selected = tree_window.is_selected(row)
if is_selected:
- tree_window.attron (curses.A_REVERSE)
+ tree_window.attron(curses.A_REVERSE)
self.delegate.draw_item(tree_window, self)
if is_selected:
- tree_window.attroff (curses.A_REVERSE)
-
- def draw_tree_for_child (self, tree_window, child, reverse_depth):
+ tree_window.attroff(curses.A_REVERSE)
+
+ def draw_tree_for_child(self, tree_window, child, reverse_depth):
if self.parent:
- self.parent.draw_tree_for_child (tree_window, self, reverse_depth + 1)
+ self.parent.draw_tree_for_child(
+ tree_window, self, reverse_depth + 1)
if self.children[-1] == child:
# Last child
if reverse_depth == 0:
- tree_window.addch (curses.ACS_LLCORNER)
- tree_window.addch (curses.ACS_HLINE)
+ tree_window.addch(curses.ACS_LLCORNER)
+ tree_window.addch(curses.ACS_HLINE)
else:
- tree_window.addch (' ')
- tree_window.addch (' ')
+ tree_window.addch(' ')
+ tree_window.addch(' ')
else:
# Middle child
if reverse_depth == 0:
- tree_window.addch (curses.ACS_LTEE)
- tree_window.addch (curses.ACS_HLINE)
+ tree_window.addch(curses.ACS_LTEE)
+ tree_window.addch(curses.ACS_HLINE)
else:
- tree_window.addch (curses.ACS_VLINE)
- tree_window.addch (' ')
-
- def was_selected(self):
+ tree_window.addch(curses.ACS_VLINE)
+ tree_window.addch(' ')
+
+ def was_selected(self):
self.delegate.do_action()
-
+
+
class TreePanel(Panel):
+
def __init__(self, frame, title, root_item):
self.root_item = root_item
self.title = title
self.first_visible_idx = 0
self.selected_idx = 0
self.items = None
- super(TreePanel, self).__init__(frame)
- self.add_key_action(curses.KEY_UP, self.select_prev, "Select the previous item")
- self.add_key_action(curses.KEY_DOWN, self.select_next, "Select the next item")
- self.add_key_action(curses.KEY_RIGHT,self.right_arrow, "Expand an item")
- self.add_key_action(curses.KEY_LEFT, self.left_arrow, "Unexpand an item or navigate to parent")
- self.add_key_action(curses.KEY_HOME, self.scroll_begin, "Go to the beginning of the tree")
- self.add_key_action(curses.KEY_END, self.scroll_end, "Go to the end of the tree")
- self.add_key_action(0x1b4f48, self.scroll_begin, "Go to the beginning of the tree")
- self.add_key_action(0x1b4f46, self.scroll_end, "Go to the end of the tree")
- self.add_key_action(curses.KEY_PPAGE, self.scroll_page_backward, "Scroll to previous page")
- self.add_key_action(curses.KEY_NPAGE, self.scroll_page_forward, "Scroll to next forward")
+ super(TreePanel, self).__init__(frame)
+ self.add_key_action(
+ curses.KEY_UP,
+ self.select_prev,
+ "Select the previous item")
+ self.add_key_action(
+ curses.KEY_DOWN,
+ self.select_next,
+ "Select the next item")
+ self.add_key_action(
+ curses.KEY_RIGHT,
+ self.right_arrow,
+ "Expand an item")
+ self.add_key_action(
+ curses.KEY_LEFT,
+ self.left_arrow,
+ "Unexpand an item or navigate to parent")
+ self.add_key_action(
+ curses.KEY_HOME,
+ self.scroll_begin,
+ "Go to the beginning of the tree")
+ self.add_key_action(
+ curses.KEY_END,
+ self.scroll_end,
+ "Go to the end of the tree")
+ self.add_key_action(
+ 0x1b4f48,
+ self.scroll_begin,
+ "Go to the beginning of the tree")
+ self.add_key_action(
+ 0x1b4f46,
+ self.scroll_end,
+ "Go to the end of the tree")
+ self.add_key_action(
+ curses.KEY_PPAGE,
+ self.scroll_page_backward,
+ "Scroll to previous page")
+ self.add_key_action(
+ curses.KEY_NPAGE,
+ self.scroll_page_forward,
+ "Scroll to next forward")
def get_selected_item(self):
if self.selected_idx < len(self.items):
return self.items[self.selected_idx]
else:
return None
-
+
def select_item(self, item):
if self.items and item in self.items:
self.selected_idx = self.items.index(item)
return True
else:
return False
-
+
def get_visible_items(self):
- # Clear self.items when you want to update all chidren
+ # Clear self.items when you want to update all chidren
if self.items is None:
self.items = list()
children = self.root_item.get_children()
@@ -816,15 +938,15 @@ class TreePanel(Panel):
for child in children:
child.append_visible_items(self.items)
return self.items
-
+
def update(self):
- self.erase()
- self.draw_title_box(self.title)
+ self.erase()
+ self.draw_title_box(self.title)
visible_items = self.get_visible_items()
for (row, child) in enumerate(visible_items):
- child.draw(self, row)
+ child.draw(self, row)
- def get_item_draw_point(self, row):
+ def get_item_draw_point(self, row):
display_row = self.get_display_row(row)
if display_row >= 0:
return Point(2, display_row + 1)
@@ -834,28 +956,29 @@ class TreePanel(Panel):
def get_display_row(self, row):
if row >= self.first_visible_idx:
display_row = row - self.first_visible_idx
- if display_row < self.get_size().h-2:
- return display_row
+ if display_row < self.get_size().h - 2:
+ return display_row
return -1
def is_selected(self, row):
return row == self.selected_idx
- def get_num_lines(self):
+ def get_num_lines(self):
self.get_visible_items()
return len(self.items)
-
+
def get_num_visible_lines(self):
- return self.get_size().h-2
- def select_next (self):
- self.selected_idx += 1
+ return self.get_size().h - 2
+
+ def select_next(self):
+ self.selected_idx += 1
num_lines = self.get_num_lines()
if self.selected_idx >= num_lines:
- self.selected_idx = num_lines - 1
+ self.selected_idx = num_lines - 1
self._selection_changed()
self.refresh()
- def select_prev (self):
+ def select_prev(self):
self.selected_idx -= 1
if self.selected_idx < 0:
num_lines = self.get_num_lines()
@@ -866,7 +989,7 @@ class TreePanel(Panel):
self._selection_changed()
self.refresh()
- def scroll_begin (self):
+ def scroll_begin(self):
self.first_visible_idx = 0
num_lines = self.get_num_lines()
if num_lines > 0:
@@ -874,36 +997,35 @@ class TreePanel(Panel):
else:
self.selected_idx = -1
self.refresh()
-
+
def redisplay_tree(self):
self.items = None
self.refresh()
- def right_arrow(self):
+ def right_arrow(self):
selected_item = self.get_selected_item()
if selected_item and selected_item.is_expanded == False:
selected_item.is_expanded = True
self.redisplay_tree()
-
+
def left_arrow(self):
selected_item = self.get_selected_item()
if selected_item:
- if selected_item.is_expanded == True:
+ if selected_item.is_expanded:
selected_item.is_expanded = False
self.redisplay_tree()
elif selected_item.parent:
if self.select_item(selected_item.parent):
self.refresh()
-
- def scroll_end (self):
+ def scroll_end(self):
num_visible_lines = self.get_num_visible_lines()
num_lines = self.get_num_lines()
if num_lines > num_visible_lines:
self.first_visible_idx = num_lines - num_visible_lines
else:
self.first_visible_idx = 0
- self.selected_idx = num_lines-1
+ self.selected_idx = num_lines - 1
self.refresh()
def scroll_page_backward(self):
@@ -912,7 +1034,7 @@ class TreePanel(Panel):
if new_index < 0:
self.selected_idx = 0
else:
- self.selected_idx = new_index
+ self.selected_idx = new_index
self._selection_changed()
self.refresh()
@@ -926,59 +1048,87 @@ class TreePanel(Panel):
self._selection_changed()
self.refresh()
- def _selection_changed(self):
- num_lines = self.get_num_lines()
+ def _selection_changed(self):
+ num_lines = self.get_num_lines()
num_visible_lines = self.get_num_visible_lines()
last_visible_index = self.first_visible_idx + num_visible_lines
if self.selected_idx >= last_visible_index:
- self.first_visible_idx += (self.selected_idx - last_visible_index + 1)
+ self.first_visible_idx += (self.selected_idx -
+ last_visible_index + 1)
if self.selected_idx < self.first_visible_idx:
- self.first_visible_idx = self.selected_idx
+ self.first_visible_idx = self.selected_idx
if self.selected_idx >= 0 and self.selected_idx < len(self.items):
item = self.items[self.selected_idx]
item.was_selected()
class Menu(BoxedPanel):
+
def __init__(self, title, items):
max_title_width = 0
for item in items:
if max_title_width < len(item.title):
max_title_width = len(item.title)
- frame = Rect(x=0, y=0, w=max_title_width+4, h=len(items)+2)
- super(Menu, self).__init__(frame, title=None, delegate=None, can_become_first_responder=True)
+ frame = Rect(x=0, y=0, w=max_title_width + 4, h=len(items) + 2)
+ super(
+ Menu,
+ self).__init__(
+ frame,
+ title=None,
+ delegate=None,
+ can_become_first_responder=True)
self.selected_idx = 0
self.title = title
self.items = items
for (item_idx, item) in enumerate(items):
self.set_line(item_idx, item.title)
self.hide()
-
+
def update(self):
super(Menu, self).update()
def relinquish_first_responder(self):
if not self.hidden():
- self.hide()
-
- def perform_action(self):
+ self.hide()
+
+ def perform_action(self):
selected_idx = self.get_selected_idx()
if selected_idx < len(self.items):
action = self.items[selected_idx].action
if action:
action()
-
+
+
class MenuBar(Panel):
+
def __init__(self, frame):
super(MenuBar, self).__init__(frame, can_become_first_responder=True)
self.menus = list()
self.selected_menu_idx = -1
- self.add_key_action(curses.KEY_LEFT, self.select_prev, "Select the previous menu")
- self.add_key_action(curses.KEY_RIGHT, self.select_next, "Select the next menu")
- self.add_key_action(curses.KEY_DOWN, lambda: self.select(0), "Select the first menu")
- self.add_key_action(27, self.relinquish_first_responder, "Hide current menu")
- self.add_key_action(curses.KEY_ENTER, self.perform_action, "Select the next menu item")
- self.add_key_action(10, self.perform_action, "Select the next menu item")
+ self.add_key_action(
+ curses.KEY_LEFT,
+ self.select_prev,
+ "Select the previous menu")
+ self.add_key_action(
+ curses.KEY_RIGHT,
+ self.select_next,
+ "Select the next menu")
+ self.add_key_action(
+ curses.KEY_DOWN,
+ lambda: self.select(0),
+ "Select the first menu")
+ self.add_key_action(
+ 27,
+ self.relinquish_first_responder,
+ "Hide current menu")
+ self.add_key_action(
+ curses.KEY_ENTER,
+ self.perform_action,
+ "Select the next menu item")
+ self.add_key_action(
+ 10,
+ self.perform_action,
+ "Select the next menu item")
def insert_menu(self, menu, index=sys.maxsize):
if index >= len(self.menus):
@@ -989,8 +1139,8 @@ class MenuBar(Panel):
for menu in self.menus:
menu.set_position(pt)
pt.x += len(menu.title) + 5
-
- def perform_action(self):
+
+ def perform_action(self):
'''If no menu is visible, show the first menu. If a menu is visible, perform the action
associated with the selected menu item in the menu'''
menu_visible = False
@@ -1004,22 +1154,22 @@ class MenuBar(Panel):
self._selected_menu_changed()
else:
self.select(0)
-
+
def relinquish_first_responder(self):
if self.selected_menu_idx >= 0:
self.selected_menu_idx = -1
self._selected_menu_changed()
-
+
def _selected_menu_changed(self):
for (menu_idx, menu) in enumerate(self.menus):
is_hidden = menu.hidden()
- if menu_idx != self.selected_menu_idx:
+ if menu_idx != self.selected_menu_idx:
if not is_hidden:
if self.parent.pop_first_responder(menu) == False:
menu.hide()
for (menu_idx, menu) in enumerate(self.menus):
is_hidden = menu.hidden()
- if menu_idx == self.selected_menu_idx:
+ if menu_idx == self.selected_menu_idx:
if is_hidden:
menu.show()
self.parent.push_first_responder(menu)
@@ -1030,8 +1180,8 @@ class MenuBar(Panel):
if index < len(self.menus):
self.selected_menu_idx = index
self._selected_menu_changed()
-
- def select_next (self):
+
+ def select_next(self):
num_menus = len(self.menus)
if self.selected_menu_idx == -1:
if num_menus > 0:
@@ -1044,7 +1194,7 @@ class MenuBar(Panel):
self.selected_menu_idx = -1
self._selected_menu_changed()
- def select_prev (self):
+ def select_prev(self):
num_menus = len(self.menus)
if self.selected_menu_idx == -1:
if num_menus > 0:
@@ -1061,41 +1211,47 @@ class MenuBar(Panel):
self.erase()
is_in_first_responder_chain = self.is_in_first_responder_chain()
if is_in_first_responder_chain:
- self.attron (curses.A_REVERSE)
+ self.attron(curses.A_REVERSE)
pt = Point(x=0, y=0)
- for menu in self.menus:
+ for menu in self.menus:
self.addstr(pt, '| ' + menu.title + ' ')
pt.x += len(menu.title) + 5
- self.addstr(pt, '|')
+ self.addstr(pt, '|')
width = self.get_size().w
while pt.x < width:
self.addch_at_point(pt, ' ')
- pt.x += 1
+ pt.x += 1
if is_in_first_responder_chain:
- self.attroff (curses.A_REVERSE)
+ self.attroff(curses.A_REVERSE)
for menu in self.menus:
menu.update()
-
-
+
+
class StatusPanel(Panel):
+
def __init__(self, frame):
- super(StatusPanel, self).__init__(frame, delegate=None, can_become_first_responder=False)
+ super(
+ StatusPanel,
+ self).__init__(
+ frame,
+ delegate=None,
+ can_become_first_responder=False)
self.status_items = list()
self.status_dicts = dict()
self.next_status_x = 1
-
+
def add_status_item(self, name, title, format, width, value, update=True):
- status_item_dict = { 'name': name,
- 'title' : title,
- 'width' : width,
- 'format' : format,
- 'value' : value,
- 'x' : self.next_status_x }
+ status_item_dict = {'name': name,
+ 'title': title,
+ 'width': width,
+ 'format': format,
+ 'value': value,
+ 'x': self.next_status_x}
index = len(self.status_items)
self.status_items.append(status_item_dict)
self.status_dicts[name] = index
- self.next_status_x += width + 2;
+ self.next_status_x += width + 2
if update:
self.update()
@@ -1106,7 +1262,7 @@ class StatusPanel(Panel):
status_item_dict['value'] = status_item_dict['value'] + 1
if update:
self.update()
-
+
def update_status(self, name, value, update=True):
if name in self.status_dicts:
status_item_idx = self.status_dicts[name]
@@ -1114,13 +1270,22 @@ class StatusPanel(Panel):
status_item_dict['value'] = status_item_dict['format'] % (value)
if update:
self.update()
+
def update(self):
- self.erase();
+ self.erase()
for status_item_dict in self.status_items:
- self.addnstr_at_point(Point(x=status_item_dict['x'], y=0), '%s: %s' % (status_item_dict['title'], status_item_dict['value']), status_item_dict['width'])
+ self.addnstr_at_point(
+ Point(
+ x=status_item_dict['x'],
+ y=0),
+ '%s: %s' %
+ (status_item_dict['title'],
+ status_item_dict['value']),
+ status_item_dict['width'])
stdscr = None
+
def intialize_curses():
global stdscr
stdscr = curses.initscr()
@@ -1133,6 +1298,7 @@ def intialize_curses():
pass
return Window(stdscr)
+
def terminate_curses():
global stdscr
if stdscr:
@@ -1140,4 +1306,3 @@ def terminate_curses():
curses.echo()
curses.nocbreak()
curses.endwin()
-
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbinline.py Tue Sep 6 15:57:50 2016
@@ -13,19 +13,21 @@ from . import configuration
from . import lldbutil
from .decorators import *
+
def source_type(filename):
_, extension = os.path.splitext(filename)
return {
- '.c' : 'C_SOURCES',
- '.cpp' : 'CXX_SOURCES',
- '.cxx' : 'CXX_SOURCES',
- '.cc' : 'CXX_SOURCES',
- '.m' : 'OBJC_SOURCES',
- '.mm' : 'OBJCXX_SOURCES'
+ '.c': 'C_SOURCES',
+ '.cpp': 'CXX_SOURCES',
+ '.cxx': 'CXX_SOURCES',
+ '.cc': 'CXX_SOURCES',
+ '.m': 'OBJC_SOURCES',
+ '.mm': 'OBJCXX_SOURCES'
}.get(extension, None)
class CommandParser:
+
def __init__(self):
self.breakpoints = []
@@ -46,27 +48,31 @@ class CommandParser:
file_handle = open(source_file)
lines = file_handle.readlines()
line_number = 0
- current_breakpoint = None # non-NULL means we're looking through whitespace to find additional commands
+ # non-NULL means we're looking through whitespace to find
+ # additional commands
+ current_breakpoint = None
for line in lines:
- line_number = line_number + 1 # 1-based, so we do this first
+ line_number = line_number + 1 # 1-based, so we do this first
(command, new_breakpoint) = self.parse_one_command(line)
if new_breakpoint:
current_breakpoint = None
- if command != None:
- if current_breakpoint == None:
+ if command is not None:
+ if current_breakpoint is None:
current_breakpoint = {}
current_breakpoint['file_name'] = source_file
current_breakpoint['line_number'] = line_number
current_breakpoint['command'] = command
self.breakpoints.append(current_breakpoint)
else:
- current_breakpoint['command'] = current_breakpoint['command'] + "\n" + command
+ current_breakpoint['command'] = current_breakpoint[
+ 'command'] + "\n" + command
def set_breakpoints(self, target):
for breakpoint in self.breakpoints:
- breakpoint['breakpoint'] = target.BreakpointCreateByLocation(breakpoint['file_name'], breakpoint['line_number'])
+ breakpoint['breakpoint'] = target.BreakpointCreateByLocation(
+ breakpoint['file_name'], breakpoint['line_number'])
def handle_breakpoint(self, test, breakpoint_id):
for breakpoint in self.breakpoints:
@@ -74,12 +80,14 @@ class CommandParser:
test.execute_user_command(breakpoint['command'])
return
+
class InlineTest(TestBase):
# Internal implementation
def getRerunArgs(self):
# The -N option says to NOT run a if it matches the option argument, so
- # if we are using dSYM we say to NOT run dwarf (-N dwarf) and vice versa.
+ # if we are using dSYM we say to NOT run dwarf (-N dwarf) and vice
+ # versa.
if self.using_dsym is None:
# The test was skipped altogether.
return ""
@@ -104,7 +112,8 @@ class InlineTest(TestBase):
makefile = open("Makefile", 'w+')
- level = os.sep.join([".."] * len(self.mydir.split(os.sep))) + os.sep + "make"
+ level = os.sep.join(
+ [".."] * len(self.mydir.split(os.sep))) + os.sep + "make"
makefile.write("LEVEL = " + level + "\n")
@@ -112,8 +121,10 @@ class InlineTest(TestBase):
line = t + " := " + " ".join(categories[t])
makefile.write(line + "\n")
- if ('OBJCXX_SOURCES' in list(categories.keys())) or ('OBJC_SOURCES' in list(categories.keys())):
- makefile.write("LDFLAGS = $(CFLAGS) -lobjc -framework Foundation\n")
+ if ('OBJCXX_SOURCES' in list(categories.keys())) or (
+ 'OBJC_SOURCES' in list(categories.keys())):
+ makefile.write(
+ "LDFLAGS = $(CFLAGS) -lobjc -framework Foundation\n")
if ('CXX_SOURCES' in list(categories.keys())):
makefile.write("CXXFLAGS += -std=c++11\n")
@@ -154,7 +165,7 @@ class InlineTest(TestBase):
def do_test(self):
exe_name = "a.out"
exe = os.path.join(os.getcwd(), exe_name)
- source_files = [ f for f in os.listdir(os.getcwd()) if source_type(f) ]
+ source_files = [f for f in os.listdir(os.getcwd()) if source_type(f)]
target = self.dbg.CreateTarget(exe)
parser = CommandParser()
@@ -164,17 +175,17 @@ class InlineTest(TestBase):
process = target.LaunchSimple(None, None, os.getcwd())
while lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint):
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- breakpoint_id = thread.GetStopReasonDataAtIndex (0)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ breakpoint_id = thread.GetStopReasonDataAtIndex(0)
parser.handle_breakpoint(self, breakpoint_id)
process.Continue()
-
# Utilities for testcases
- def check_expression (self, expression, expected_result, use_summary = True):
- value = self.frame().EvaluateExpression (expression)
- self.assertTrue(value.IsValid(), expression+"returned a valid value")
+ def check_expression(self, expression, expected_result, use_summary=True):
+ value = self.frame().EvaluateExpression(expression)
+ self.assertTrue(value.IsValid(), expression + "returned a valid value")
if self.TraceOn():
print(value.GetSummary())
print(value.GetValue())
@@ -182,12 +193,14 @@ class InlineTest(TestBase):
answer = value.GetSummary()
else:
answer = value.GetValue()
- report_str = "%s expected: %s got: %s"%(expression, expected_result, answer)
+ report_str = "%s expected: %s got: %s" % (
+ expression, expected_result, answer)
self.assertTrue(answer == expected_result, report_str)
+
def ApplyDecoratorsToFunction(func, decorators):
tmp = func
- if type(decorators) == list:
+ if isinstance(decorators, list):
for decorator in decorators:
tmp = decorator(tmp)
elif hasattr(decorators, '__call__'):
@@ -212,20 +225,27 @@ def MakeInlineTest(__file, __globals, de
test.name = test_name
target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
- if test_categories.is_supported_on_platform("dsym", target_platform, configuration.compilers):
- test.test_with_dsym = ApplyDecoratorsToFunction(test._InlineTest__test_with_dsym, decorators)
- if test_categories.is_supported_on_platform("dwarf", target_platform, configuration.compilers):
- test.test_with_dwarf = ApplyDecoratorsToFunction(test._InlineTest__test_with_dwarf, decorators)
- if test_categories.is_supported_on_platform("dwo", target_platform, configuration.compilers):
- test.test_with_dwo = ApplyDecoratorsToFunction(test._InlineTest__test_with_dwo, decorators)
- if test_categories.is_supported_on_platform("gmodules", target_platform, configuration.compilers):
- test.test_with_gmodules = ApplyDecoratorsToFunction(test._InlineTest__test_with_gmodules, decorators)
+ if test_categories.is_supported_on_platform(
+ "dsym", target_platform, configuration.compilers):
+ test.test_with_dsym = ApplyDecoratorsToFunction(
+ test._InlineTest__test_with_dsym, decorators)
+ if test_categories.is_supported_on_platform(
+ "dwarf", target_platform, configuration.compilers):
+ test.test_with_dwarf = ApplyDecoratorsToFunction(
+ test._InlineTest__test_with_dwarf, decorators)
+ if test_categories.is_supported_on_platform(
+ "dwo", target_platform, configuration.compilers):
+ test.test_with_dwo = ApplyDecoratorsToFunction(
+ test._InlineTest__test_with_dwo, decorators)
+ if test_categories.is_supported_on_platform(
+ "gmodules", target_platform, configuration.compilers):
+ test.test_with_gmodules = ApplyDecoratorsToFunction(
+ test._InlineTest__test_with_gmodules, decorators)
# Add the test case to the globals, and hide InlineTest
- __globals.update({test_name : test})
+ __globals.update({test_name: test})
# Keep track of the original test filename so we report it
# correctly in test results.
test.test_filename = __file
return test
-
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbpexpect.py Tue Sep 6 15:57:50 2016
@@ -20,7 +20,7 @@ else:
import pexpect
class PExpectTest(TestBase):
-
+
mydir = TestBase.compute_mydir(__file__)
def setUp(self):
@@ -30,40 +30,66 @@ else:
pass
def launch(self, timeout=None):
- if timeout is None: timeout = 30
+ if timeout is None:
+ timeout = 30
logfile = sys.stdout if self.TraceOn() else None
- self.child = pexpect.spawn('%s --no-use-colors %s' % (lldbtest_config.lldbExec, self.launchArgs()), logfile=logfile)
+ self.child = pexpect.spawn(
+ '%s --no-use-colors %s' %
+ (lldbtest_config.lldbExec, self.launchArgs()), logfile=logfile)
self.child.timeout = timeout
self.timeout = timeout
def expect(self, patterns=None, timeout=None, exact=None):
- if patterns is None: return None
- if timeout is None: timeout = self.timeout
- if exact is None: exact = False
+ if patterns is None:
+ return None
+ if timeout is None:
+ timeout = self.timeout
+ if exact is None:
+ exact = False
if exact:
return self.child.expect_exact(patterns, timeout=timeout)
else:
return self.child.expect(patterns, timeout=timeout)
def expectall(self, patterns=None, timeout=None, exact=None):
- if patterns is None: return None
- if timeout is None: timeout = self.timeout
- if exact is None: exact = False
+ if patterns is None:
+ return None
+ if timeout is None:
+ timeout = self.timeout
+ if exact is None:
+ exact = False
for pattern in patterns:
self.expect(pattern, timeout=timeout, exact=exact)
- def sendimpl(self, sender, command, patterns=None, timeout=None, exact=None):
+ def sendimpl(
+ self,
+ sender,
+ command,
+ patterns=None,
+ timeout=None,
+ exact=None):
sender(command)
return self.expect(patterns=patterns, timeout=timeout, exact=exact)
def send(self, command, patterns=None, timeout=None, exact=None):
- return self.sendimpl(self.child.send, command, patterns, timeout, exact)
+ return self.sendimpl(
+ self.child.send,
+ command,
+ patterns,
+ timeout,
+ exact)
def sendline(self, command, patterns=None, timeout=None, exact=None):
- return self.sendimpl(self.child.sendline, command, patterns, timeout, exact)
+ return self.sendimpl(
+ self.child.sendline,
+ command,
+ patterns,
+ timeout,
+ exact)
def quit(self, gracefully=None):
- if gracefully is None: gracefully = True
+ if gracefully is None:
+ gracefully = True
self.child.sendeof()
self.child.close(force=not gracefully)
self.child = None
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbplatform.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbplatform.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbplatform.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbplatform.py Tue Sep 6 15:57:50 2016
@@ -12,19 +12,20 @@ import six
import use_lldb_suite
import lldb
-windows, linux, macosx, darwin, ios, darwin_all, freebsd, netbsd, bsd_all, android = range(10)
+windows, linux, macosx, darwin, ios, darwin_all, freebsd, netbsd, bsd_all, android = range(
+ 10)
__name_lookup = {
- windows : ["windows"],
- linux : ["linux"],
- macosx : ["macosx"],
- darwin : ["darwin"],
- ios : ["ios"],
- darwin_all : ["macosx", "darwin", "ios"],
- freebsd : ["freebsd"],
- netbsd : ["netbsd"],
- bsd_all : ["freebsd", "netbsd"],
- android : ["android"]
+ windows: ["windows"],
+ linux: ["linux"],
+ macosx: ["macosx"],
+ darwin: ["darwin"],
+ ios: ["ios"],
+ darwin_all: ["macosx", "darwin", "ios"],
+ freebsd: ["freebsd"],
+ netbsd: ["netbsd"],
+ bsd_all: ["freebsd", "netbsd"],
+ android: ["android"]
}
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbplatformutil.py Tue Sep 6 15:57:50 2016
@@ -18,32 +18,40 @@ from . import configuration
import use_lldb_suite
import lldb
+
def check_first_register_readable(test_case):
arch = test_case.getArchitecture()
if arch in ['x86_64', 'i386']:
- test_case.expect("register read eax", substrs = ['eax = 0x'])
+ test_case.expect("register read eax", substrs=['eax = 0x'])
elif arch in ['arm']:
- test_case.expect("register read r0", substrs = ['r0 = 0x'])
+ test_case.expect("register read r0", substrs=['r0 = 0x'])
elif arch in ['aarch64']:
- test_case.expect("register read x0", substrs = ['x0 = 0x'])
- elif re.match("mips",arch):
- test_case.expect("register read zero", substrs = ['zero = 0x'])
+ test_case.expect("register read x0", substrs=['x0 = 0x'])
+ elif re.match("mips", arch):
+ test_case.expect("register read zero", substrs=['zero = 0x'])
elif arch in ['s390x']:
- test_case.expect("register read r0", substrs = ['r0 = 0x'])
+ test_case.expect("register read r0", substrs=['r0 = 0x'])
else:
# TODO: Add check for other architectures
- test_case.fail("Unsupported architecture for test case (arch: %s)" % test_case.getArchitecture())
+ test_case.fail(
+ "Unsupported architecture for test case (arch: %s)" %
+ test_case.getArchitecture())
+
def _run_adb_command(cmd, device_id):
device_id_args = []
if device_id:
device_id_args = ["-s", device_id]
full_cmd = ["adb"] + device_id_args + cmd
- p = subprocess.Popen(full_cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ p = subprocess.Popen(
+ full_cmd,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
return p.returncode, stdout, stderr
+
def _target_is_android():
if not hasattr(_target_is_android, 'result'):
triple = lldb.DBG.GetSelectedPlatform().GetTriple()
@@ -51,6 +59,7 @@ def _target_is_android():
_target_is_android.result = match is not None
return _target_is_android.result
+
def android_device_api():
if not hasattr(android_device_api, 'result'):
assert configuration.lldb_platform_url is not None
@@ -69,9 +78,11 @@ def android_device_api():
raise LookupError(
">>> Unable to determine the API level of the Android device.\n"
">>> stdout:\n%s\n"
- ">>> stderr:\n%s\n" % (stdout, stderr))
+ ">>> stderr:\n%s\n" %
+ (stdout, stderr))
return android_device_api.result
+
def match_android_device(device_arch, valid_archs=None, valid_api_levels=None):
if not _target_is_android():
return False
@@ -82,6 +93,7 @@ def match_android_device(device_arch, va
return True
+
def finalize_build_dictionary(dictionary):
if _target_is_android():
if dictionary is None:
@@ -91,6 +103,7 @@ def finalize_build_dictionary(dictionary
dictionary["PIE"] = 1
return dictionary
+
def getHostPlatform():
"""Returns the host platform running the test suite."""
# Attempts to return a platform name matching a target Triple platform.
@@ -111,6 +124,7 @@ def getHostPlatform():
def getDarwinOSTriples():
return ['darwin', 'macosx', 'ios']
+
def getPlatform():
"""Returns the target platform which the tests are running on."""
platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
@@ -120,10 +134,12 @@ def getPlatform():
platform = 'netbsd'
return platform
+
def platformIsDarwin():
"""Returns true if the OS triple for the selected platform is any valid apple OS"""
return getPlatform() in getDarwinOSTriples()
+
class _PlatformContext(object):
"""Value object class which contains platform-specific options."""
@@ -132,6 +148,7 @@ class _PlatformContext(object):
self.shlib_prefix = shlib_prefix
self.shlib_extension = shlib_extension
+
def createPlatformContext():
if platformIsDarwin():
return _PlatformContext('DYLD_LIBRARY_PATH', 'lib', 'dylib')
@@ -140,9 +157,10 @@ def createPlatformContext():
else:
return None
+
def hasChattyStderr(test_case):
"""Some targets produce garbage on the standard error output. This utility function
determines whether the tests can be strict about the expected stderr contents."""
if match_android_device(test_case.getArchitecture(), ['aarch64'], [22]):
- return True # The dynamic linker on the device will complain about unknown DT entries
+ return True # The dynamic linker on the device will complain about unknown DT entries
return False
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest.py Tue Sep 6 15:57:50 2016
@@ -28,7 +28,7 @@ Collected 72 tests
Ran 72 tests in 135.468s
OK
-$
+$
"""
from __future__ import absolute_import
@@ -74,20 +74,23 @@ from lldbsuite.support import funcutils
# directory at the same time
# Enable it to cause test failures and stderr messages if dotest instances try to run in
# the same directory simultaneously
-# it is disabled by default because it litters the test directories with ".dirlock" files
+# it is disabled by default because it litters the test directories with
+# ".dirlock" files
debug_confirm_directory_exclusivity = False
# See also dotest.parseOptionsAndInitTestdirs(), where the environment variables
-# LLDB_COMMAND_TRACE and LLDB_DO_CLEANUP are set from '-t' and '-r dir' options.
+# LLDB_COMMAND_TRACE and LLDB_DO_CLEANUP are set from '-t' and '-r dir'
+# options.
# By default, traceAlways is False.
-if "LLDB_COMMAND_TRACE" in os.environ and os.environ["LLDB_COMMAND_TRACE"]=="YES":
+if "LLDB_COMMAND_TRACE" in os.environ and os.environ[
+ "LLDB_COMMAND_TRACE"] == "YES":
traceAlways = True
else:
traceAlways = False
# By default, doCleanup is True.
-if "LLDB_DO_CLEANUP" in os.environ and os.environ["LLDB_DO_CLEANUP"]=="NO":
+if "LLDB_DO_CLEANUP" in os.environ and os.environ["LLDB_DO_CLEANUP"] == "NO":
doCleanup = False
else:
doCleanup = True
@@ -182,27 +185,37 @@ VARIABLES_DISPLAYED_CORRECTLY = "Variabl
WATCHPOINT_CREATED = "Watchpoint created successfully"
+
def CMD_MSG(str):
'''A generic "Command '%s' returns successfully" message generator.'''
return "Command '%s' returns successfully" % str
+
def COMPLETION_MSG(str_before, str_after):
'''A generic message generator for the completion mechanism.'''
return "'%s' successfully completes to '%s'" % (str_before, str_after)
+
def EXP_MSG(str, actual, exe):
'''A generic "'%s' returns expected result" message generator if exe.
Otherwise, it generates "'%s' matches expected result" message.'''
-
- return "'%s' %s expected result, got '%s'" % (str, 'returns' if exe else 'matches', actual.strip())
+
+ return "'%s' %s expected result, got '%s'" % (
+ str, 'returns' if exe else 'matches', actual.strip())
+
def SETTING_MSG(setting):
'''A generic "Value of setting '%s' is correct" message generator.'''
return "Value of setting '%s' is correct" % setting
+
def EnvArray():
"""Returns an env variable array from the os.environ map object."""
- return list(map(lambda k,v: k+"="+v, list(os.environ.keys()), list(os.environ.values())))
+ return list(map(lambda k,
+ v: k + "=" + v,
+ list(os.environ.keys()),
+ list(os.environ.values())))
+
def line_number(filename, string_to_match):
"""Helper function to return the line number of the first matched string."""
@@ -210,8 +223,11 @@ def line_number(filename, string_to_matc
for i, line in enumerate(f):
if line.find(string_to_match) != -1:
# Found our match.
- return i+1
- raise Exception("Unable to find '%s' within file %s" % (string_to_match, filename))
+ return i + 1
+ raise Exception(
+ "Unable to find '%s' within file %s" %
+ (string_to_match, filename))
+
def pointer_size():
"""Return the pointer size of the host system."""
@@ -219,10 +235,12 @@ def pointer_size():
a_pointer = ctypes.c_void_p(0xffff)
return 8 * ctypes.sizeof(a_pointer)
+
def is_exe(fpath):
"""Returns true if fpath is an executable."""
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
def which(program):
"""Returns the full path to a program; None otherwise."""
fpath, fname = os.path.split(program)
@@ -236,12 +254,14 @@ def which(program):
return exe_file
return None
+
class recording(SixStringIO):
"""
A nice little context manager for recording the debugger interactions into
our session object. If trace flag is ON, it also emits the interactions
into the stderr.
"""
+
def __init__(self, test, trace):
"""Create a SixStringIO instance; record the session obj and trace flag."""
SixStringIO.__init__(self)
@@ -269,6 +289,7 @@ class recording(SixStringIO):
print(self.getvalue(), file=self.session)
self.close()
+
@add_metaclass(abc.ABCMeta)
class _BaseProcess(object):
@@ -284,6 +305,7 @@ class _BaseProcess(object):
def terminate(self):
"""Terminates previously launched process.."""
+
class _LocalProcess(_BaseProcess):
def __init__(self, trace_on):
@@ -296,25 +318,31 @@ class _LocalProcess(_BaseProcess):
return self._proc.pid
def launch(self, executable, args):
- self._proc = Popen([executable] + args,
- stdout = open(os.devnull) if not self._trace_on else None,
- stdin = PIPE)
+ self._proc = Popen(
+ [executable] + args,
+ stdout=open(
+ os.devnull) if not self._trace_on else None,
+ stdin=PIPE)
def terminate(self):
- if self._proc.poll() == None:
+ if self._proc.poll() is None:
# Terminate _proc like it does the pexpect
- signals_to_try = [sig for sig in ['SIGHUP', 'SIGCONT', 'SIGINT'] if sig in dir(signal)]
+ signals_to_try = [
+ sig for sig in [
+ 'SIGHUP',
+ 'SIGCONT',
+ 'SIGINT'] if sig in dir(signal)]
for sig in signals_to_try:
try:
self._proc.send_signal(getattr(signal, sig))
time.sleep(self._delayafterterminate)
- if self._proc.poll() != None:
+ if self._proc.poll() is not None:
return
except ValueError:
pass # Windows says SIGINT is not a valid signal to send
self._proc.terminate()
time.sleep(self._delayafterterminate)
- if self._proc.poll() != None:
+ if self._proc.poll() is not None:
return
self._proc.kill()
time.sleep(self._delayafterterminate)
@@ -322,6 +350,7 @@ class _LocalProcess(_BaseProcess):
def poll(self):
return self._proc.poll()
+
class _RemoteProcess(_BaseProcess):
def __init__(self, install_remote):
@@ -335,19 +364,24 @@ class _RemoteProcess(_BaseProcess):
def launch(self, executable, args):
if self._install_remote:
src_path = executable
- dst_path = lldbutil.append_to_process_working_directory(os.path.basename(executable))
+ dst_path = lldbutil.append_to_process_working_directory(
+ os.path.basename(executable))
dst_file_spec = lldb.SBFileSpec(dst_path, False)
- err = lldb.remote_platform.Install(lldb.SBFileSpec(src_path, True), dst_file_spec)
+ err = lldb.remote_platform.Install(
+ lldb.SBFileSpec(src_path, True), dst_file_spec)
if err.Fail():
- raise Exception("remote_platform.Install('%s', '%s') failed: %s" % (src_path, dst_path, err))
+ raise Exception(
+ "remote_platform.Install('%s', '%s') failed: %s" %
+ (src_path, dst_path, err))
else:
dst_path = executable
dst_file_spec = lldb.SBFileSpec(executable, False)
launch_info = lldb.SBLaunchInfo(args)
launch_info.SetExecutableFile(dst_file_spec, True)
- launch_info.SetWorkingDirectory(lldb.remote_platform.GetWorkingDirectory())
+ launch_info.SetWorkingDirectory(
+ lldb.remote_platform.GetWorkingDirectory())
# Redirect stdout and stderr to /dev/null
launch_info.AddSuppressFileAction(1, False, True)
@@ -355,7 +389,9 @@ class _RemoteProcess(_BaseProcess):
err = lldb.remote_platform.Launch(launch_info)
if err.Fail():
- raise Exception("remote_platform.Launch('%s', '%s') failed: %s" % (dst_path, args, err))
+ raise Exception(
+ "remote_platform.Launch('%s', '%s') failed: %s" %
+ (dst_path, args, err))
self._pid = launch_info.GetProcessID()
def terminate(self):
@@ -363,6 +399,8 @@ class _RemoteProcess(_BaseProcess):
# From 2.7's subprocess.check_output() convenience function.
# Return a tuple (stdoutdata, stderrdata).
+
+
def system(commands, **kwargs):
r"""Run an os command with arguments and return its output as a byte string.
@@ -393,15 +431,23 @@ def system(commands, **kwargs):
error = ""
for shellCommand in commandList:
if 'stdout' in kwargs:
- raise ValueError('stdout argument not allowed, it will be overridden.')
- if 'shell' in kwargs and kwargs['shell']==False:
+ raise ValueError(
+ 'stdout argument not allowed, it will be overridden.')
+ if 'shell' in kwargs and kwargs['shell'] == False:
raise ValueError('shell=False not allowed')
- process = Popen(shellCommand, stdout=PIPE, stderr=PIPE, shell=True, universal_newlines=True, **kwargs)
+ process = Popen(
+ shellCommand,
+ stdout=PIPE,
+ stderr=PIPE,
+ shell=True,
+ universal_newlines=True,
+ **kwargs)
pid = process.pid
this_output, this_error = process.communicate()
retcode = process.poll()
- # Enable trace on failure return while tracking down FreeBSD buildbot issues
+ # Enable trace on failure return while tracking down FreeBSD buildbot
+ # issues
trace = traceAlways
if not trace and retcode and sys.platform.startswith("freebsd"):
trace = True
@@ -431,6 +477,7 @@ def system(commands, **kwargs):
error = error + this_error
return (output, error)
+
def getsource_if_available(obj):
"""
Return the text of the source code for an object if available. Otherwise,
@@ -442,6 +489,7 @@ def getsource_if_available(obj):
except:
return repr(obj)
+
def builder_module():
if sys.platform.startswith("freebsd"):
return __import__("builder_freebsd")
@@ -459,7 +507,7 @@ class Base(unittest2.TestCase):
Abstract base for performing lldb (see TestBase) or other generic tests (see
BenchBase for one example). lldbtest.Base works with the test driver to
accomplish things.
-
+
"""
# The concrete subclass should override this attribute.
@@ -470,16 +518,16 @@ class Base(unittest2.TestCase):
@staticmethod
def compute_mydir(test_file):
- '''Subclasses should call this function to correctly calculate the required "mydir" attribute as follows:
-
+ '''Subclasses should call this function to correctly calculate the required "mydir" attribute as follows:
+
mydir = TestBase.compute_mydir(__file__)'''
test_dir = os.path.dirname(test_file)
- return test_dir[len(os.environ["LLDB_TEST"])+1:]
-
+ return test_dir[len(os.environ["LLDB_TEST"]) + 1:]
+
def TraceOn(self):
"""Returns True if we are in trace mode (tracing detailed test execution)."""
return traceAlways
-
+
@classmethod
def setUpClass(cls):
"""
@@ -514,7 +562,12 @@ class Base(unittest2.TestCase):
cls.dir_lock.acquire()
# read the previous owner from the lock file
lock_id = cls.dir_lock.handle.read()
- print("LOCK ERROR: {} wants to lock '{}' but it is already locked by '{}'".format(cls.__name__, full_dir, lock_id), file=sys.stderr)
+ print(
+ "LOCK ERROR: {} wants to lock '{}' but it is already locked by '{}'".format(
+ cls.__name__,
+ full_dir,
+ lock_id),
+ file=sys.stderr)
raise ioerror
# Set platform context.
@@ -535,7 +588,10 @@ class Base(unittest2.TestCase):
# Subclass might have specific cleanup function defined.
if getattr(cls, "classCleanup", None):
if traceAlways:
- print("Call class-specific cleanup function for class:", cls, file=sys.stderr)
+ print(
+ "Call class-specific cleanup function for class:",
+ cls,
+ file=sys.stderr)
try:
cls.classCleanup()
except:
@@ -557,7 +613,8 @@ class Base(unittest2.TestCase):
By default, we skip long running test case.
This can be overridden by passing '-l' to the test driver (dotest.py).
"""
- if "LLDB_SKIP_LONG_RUNNING_TEST" in os.environ and "NO" == os.environ["LLDB_SKIP_LONG_RUNNING_TEST"]:
+ if "LLDB_SKIP_LONG_RUNNING_TEST" in os.environ and "NO" == os.environ[
+ "LLDB_SKIP_LONG_RUNNING_TEST"]:
return False
else:
return True
@@ -587,9 +644,11 @@ class Base(unittest2.TestCase):
# communicate gdb-remote categories to debugserver
os.environ["LLDB_DEBUGSERVER_LOG_FLAGS"] = categories
- self.ci.HandleCommand(log_enable + channel_with_categories, self.res)
+ self.ci.HandleCommand(
+ log_enable + channel_with_categories, self.res)
if not self.res.Succeeded():
- raise Exception('log enable failed (check LLDB_LOG_OPTION env variable)')
+ raise Exception(
+ 'log enable failed (check LLDB_LOG_OPTION env variable)')
# Communicate log path name to debugserver & lldb-server
# For remote debugging, these variables need to be set when starting the platform
@@ -600,7 +659,8 @@ class Base(unittest2.TestCase):
os.environ["LLDB_DEBUGSERVER_LOG_FILE"] = server_log_path
# Communicate channels to lldb-server
- os.environ["LLDB_SERVER_LOG_CHANNELS"] = ":".join(lldbtest_config.channels)
+ os.environ["LLDB_SERVER_LOG_CHANNELS"] = ":".join(
+ lldbtest_config.channels)
self.addTearDownHook(self.disableLogChannelsForCurrentTest)
@@ -611,7 +671,8 @@ class Base(unittest2.TestCase):
channel = channel_and_categories.split(' ', 1)[0]
self.ci.HandleCommand("log disable " + channel, self.res)
if not self.res.Succeeded():
- raise Exception('log disable failed (check LLDB_LOG_OPTION env variable)')
+ raise Exception(
+ 'log disable failed (check LLDB_LOG_OPTION env variable)')
# Retrieve the server log (if any) from the remote system. It is assumed the server log
# is writing to the "server.log" file in the current test directory. This can be
@@ -619,19 +680,21 @@ class Base(unittest2.TestCase):
# platform. If the remote logging is not enabled, then just let the Get() command silently
# fail.
if lldb.remote_platform:
- lldb.remote_platform.Get(lldb.SBFileSpec("server.log"),
- lldb.SBFileSpec(self.getLogBasenameForCurrentTest()+"-server.log"))
+ lldb.remote_platform.Get(
+ lldb.SBFileSpec("server.log"), lldb.SBFileSpec(
+ self.getLogBasenameForCurrentTest() + "-server.log"))
def setPlatformWorkingDir(self):
if not lldb.remote_platform or not configuration.lldb_platform_working_dir:
return
remote_test_dir = lldbutil.join_remote_paths(
- configuration.lldb_platform_working_dir,
- self.getArchitecture(),
- str(self.test_number),
- self.mydir)
- error = lldb.remote_platform.MakeDirectory(remote_test_dir, 448) # 448 = 0o700
+ configuration.lldb_platform_working_dir,
+ self.getArchitecture(),
+ str(self.test_number),
+ self.mydir)
+ error = lldb.remote_platform.MakeDirectory(
+ remote_test_dir, 448) # 448 = 0o700
if error.Success():
lldb.remote_platform.SetWorkingDirectory(remote_test_dir)
@@ -643,11 +706,13 @@ class Base(unittest2.TestCase):
# TODO: Make it working on Windows when we need it for remote debugging support
# TODO: Replace the heuristic to remove the files with a logic what collects the
# list of files we have to remove during test runs.
- shell_cmd = lldb.SBPlatformShellCommand("rm %s/*" % remote_test_dir)
+ shell_cmd = lldb.SBPlatformShellCommand(
+ "rm %s/*" % remote_test_dir)
lldb.remote_platform.Run(shell_cmd)
self.addTearDownHook(clean_working_directory)
else:
- print("error: making remote directory '%s': %s" % (remote_test_dir, error))
+ print("error: making remote directory '%s': %s" % (
+ remote_test_dir, error))
def setUp(self):
"""Fixture for unittest test case setup.
@@ -655,7 +720,7 @@ class Base(unittest2.TestCase):
It works with the test driver to conditionally skip tests and does other
initializations."""
#import traceback
- #traceback.print_stack()
+ # traceback.print_stack()
if "LIBCXX_PATH" in os.environ:
self.libcxxPath = os.environ["LIBCXX_PATH"]
@@ -718,9 +783,9 @@ class Base(unittest2.TestCase):
# (self.session) is then dumped into a session specific file for
# diagnosis.
self.__cleanup_errored__ = False
- self.__errored__ = False
- self.__failed__ = False
- self.__expected__ = False
+ self.__errored__ = False
+ self.__failed__ = False
+ self.__expected__ = False
# We are also interested in unexpected success.
self.__unexpected__ = False
# And skipped tests.
@@ -757,7 +822,7 @@ class Base(unittest2.TestCase):
self.setPlatformWorkingDir()
self.enableLogChannelsForCurrentTest()
- #Initialize debug_info
+ # Initialize debug_info
self.debug_info = None
def setAsync(self, value):
@@ -786,7 +851,8 @@ class Base(unittest2.TestCase):
otherwise the test suite will leak processes.
"""
- proc = _RemoteProcess(install_remote) if lldb.remote_platform else _LocalProcess(self.TraceOn())
+ proc = _RemoteProcess(
+ install_remote) if lldb.remote_platform else _LocalProcess(self.TraceOn())
proc.launch(executable, args)
self.subprocesses.append(proc)
return proc
@@ -806,7 +872,7 @@ class Base(unittest2.TestCase):
os.dup2(fd, 1)
os.dup2(fd, 2)
# This call causes the child to have its of group ID
- os.setpgid(0,0)
+ os.setpgid(0, 0)
os.execvp(executable, [executable] + args)
# Give the child time to get through the execvp() call
time.sleep(0.1)
@@ -836,6 +902,7 @@ class Base(unittest2.TestCase):
self.sys_stdout_hidden = True
old_stdout = sys.stdout
sys.stdout = open(os.devnull, 'w')
+
def restore_stdout():
sys.stdout = old_stdout
self.addTearDownHook(restore_stdout)
@@ -862,9 +929,12 @@ class Base(unittest2.TestCase):
"""
if six.callable(hook):
with recording(self, traceAlways) as sbuf:
- print("Adding tearDown hook:", getsource_if_available(hook), file=sbuf)
+ print(
+ "Adding tearDown hook:",
+ getsource_if_available(hook),
+ file=sbuf)
self.hooks.append(hook)
-
+
return self
def deletePexpectChild(self):
@@ -878,7 +948,8 @@ class Base(unittest2.TestCase):
if self.child_in_script_interpreter:
self.child.sendline('quit()')
self.child.expect_exact(self.child_prompt)
- self.child.sendline('settings set interpreter.prompt-on-quit false')
+ self.child.sendline(
+ 'settings set interpreter.prompt-on-quit false')
self.child.sendline('quit')
self.child.expect(pexpect.EOF)
except (ValueError, pexpect.ExceptionPexpect):
@@ -898,18 +969,21 @@ class Base(unittest2.TestCase):
def tearDown(self):
"""Fixture for unittest test case teardown."""
#import traceback
- #traceback.print_stack()
+ # traceback.print_stack()
self.deletePexpectChild()
# Check and run any hook functions.
for hook in reversed(self.hooks):
with recording(self, traceAlways) as sbuf:
- print("Executing tearDown hook:", getsource_if_available(hook), file=sbuf)
+ print(
+ "Executing tearDown hook:",
+ getsource_if_available(hook),
+ file=sbuf)
if funcutils.requires_self(hook):
hook(self)
else:
- hook() # try the plain call and hope it works
+ hook() # try the plain call and hope it works
del self.hooks
@@ -951,17 +1025,19 @@ class Base(unittest2.TestCase):
# Once by the Python unittest framework, and a second time by us.
print("FAIL", file=sbuf)
- def markExpectedFailure(self,err,bugnumber):
+ def markExpectedFailure(self, err, bugnumber):
"""Callback invoked when an expected failure/error occurred."""
self.__expected__ = True
with recording(self, False) as sbuf:
# False because there's no need to write "expected failure" to the
# stderr twice.
# Once by the Python unittest framework, and a second time by us.
- if bugnumber == None:
+ if bugnumber is None:
print("expected failure", file=sbuf)
else:
- print("expected failure (problem id:" + str(bugnumber) + ")", file=sbuf)
+ print(
+ "expected failure (problem id:" + str(bugnumber) + ")",
+ file=sbuf)
def markSkippedTest(self):
"""Callback invoked when a test is skipped."""
@@ -979,10 +1055,12 @@ class Base(unittest2.TestCase):
# False because there's no need to write "unexpected success" to the
# stderr twice.
# Once by the Python unittest framework, and a second time by us.
- if bugnumber == None:
+ if bugnumber is None:
print("unexpected success", file=sbuf)
else:
- print("unexpected success (problem id:" + str(bugnumber) + ")", file=sbuf)
+ print(
+ "unexpected success (problem id:" + str(bugnumber) + ")",
+ file=sbuf)
def getRerunArgs(self):
return " -f %s.%s" % (self.__class__.__name__, self._testMethodName)
@@ -995,7 +1073,7 @@ class Base(unittest2.TestCase):
<session-dir>/<arch>-<compiler>-<test-file>.<test-class>.<test-method>
"""
dname = os.path.join(os.environ["LLDB_TEST"],
- os.environ["LLDB_SESSION_DIRNAME"])
+ os.environ["LLDB_SESSION_DIRNAME"])
if not os.path.isdir(dname):
os.mkdir(dname)
@@ -1014,7 +1092,8 @@ class Base(unittest2.TestCase):
compiler = compiler[2:]
if os.path.altsep is not None:
compiler = compiler.replace(os.path.altsep, os.path.sep)
- components.extend([x for x in compiler.split(os.path.sep) if x != ""])
+ components.extend(
+ [x for x in compiler.split(os.path.sep) if x != ""])
elif c == 'a':
components.append(self.getArchitecture())
elif c == 'm':
@@ -1078,11 +1157,19 @@ class Base(unittest2.TestCase):
benchmarks = False
import datetime
- print("Session info generated @", datetime.datetime.now().ctime(), file=self.session)
- print("To rerun this test, issue the following command from the 'test' directory:\n", file=self.session)
- print("./dotest.py %s -v %s %s" % (self.getRunOptions(),
- ('+b' if benchmarks else '-t'),
- self.getRerunArgs()), file=self.session)
+ print(
+ "Session info generated @",
+ datetime.datetime.now().ctime(),
+ file=self.session)
+ print(
+ "To rerun this test, issue the following command from the 'test' directory:\n",
+ file=self.session)
+ print(
+ "./dotest.py %s -v %s %s" %
+ (self.getRunOptions(),
+ ('+b' if benchmarks else '-t'),
+ self.getRerunArgs()),
+ file=self.session)
self.session.close()
del self.session
@@ -1135,10 +1222,11 @@ class Base(unittest2.TestCase):
]
output = check_output(command)
- str = output.decode("utf-8");
+ str = output.decode("utf-8")
for line in str.splitlines():
- m = re.search("Current executable set to '.*' \\((.*)\\)\\.", line)
+ m = re.search(
+ "Current executable set to '.*' \\((.*)\\)\\.", line)
if m:
self.lldbArchitecture = m.group(1)
break
@@ -1198,16 +1286,16 @@ class Base(unittest2.TestCase):
Any operator other than the following defaults to an equality test:
'>', '>=', "=>", '<', '<=', '=<', '!=', "!" or 'not'
"""
- if (compiler_version == None):
+ if (compiler_version is None):
return True
operator = str(compiler_version[0])
version = compiler_version[1]
- if (version == None):
+ if (version is None):
return True
if (operator == '>'):
return self.getCompilerVersion() > version
- if (operator == '>=' or operator == '=>'):
+ if (operator == '>=' or operator == '=>'):
return self.getCompilerVersion() >= version
if (operator == '<'):
return self.getCompilerVersion() < version
@@ -1219,7 +1307,7 @@ class Base(unittest2.TestCase):
def expectedCompiler(self, compilers):
"""Returns True iff any element of compilers is a sub-string of the current compiler."""
- if (compilers == None):
+ if (compilers is None):
return True
for compiler in compilers:
@@ -1230,7 +1318,7 @@ class Base(unittest2.TestCase):
def expectedArch(self, archs):
"""Returns True iff any element of archs is a sub-string of the current architecture."""
- if (archs == None):
+ if (archs is None):
return True
for arch in archs:
@@ -1260,16 +1348,16 @@ class Base(unittest2.TestCase):
""" Returns the proper -stdlib flag, or empty if not required."""
if self.platformIsDarwin() or self.getPlatform() == "freebsd":
stdlibflag = "-stdlib=libc++"
- else: # this includes NetBSD
+ else: # this includes NetBSD
stdlibflag = ""
return stdlibflag
def getstdFlag(self):
""" Returns the proper stdflag. """
if "gcc" in self.getCompiler() and "4.6" in self.getCompilerVersion():
- stdflag = "-std=c++0x"
+ stdflag = "-std=c++0x"
else:
- stdflag = "-std=c++11"
+ stdflag = "-std=c++11"
return stdflag
def buildDriver(self, sources, exe_name):
@@ -1279,28 +1367,40 @@ class Base(unittest2.TestCase):
stdflag = self.getstdFlag()
stdlibflag = self.getstdlibFlag()
-
+
lib_dir = os.environ["LLDB_LIB_DIR"]
if sys.platform.startswith("darwin"):
dsym = os.path.join(lib_dir, 'LLDB.framework', 'LLDB')
- d = {'CXX_SOURCES' : sources,
- 'EXE' : exe_name,
- 'CFLAGS_EXTRAS' : "%s %s" % (stdflag, stdlibflag),
- 'FRAMEWORK_INCLUDES' : "-F%s" % lib_dir,
- 'LD_EXTRAS' : "%s -Wl,-rpath,%s" % (dsym, lib_dir),
- }
+ d = {'CXX_SOURCES': sources,
+ 'EXE': exe_name,
+ 'CFLAGS_EXTRAS': "%s %s" % (stdflag, stdlibflag),
+ 'FRAMEWORK_INCLUDES': "-F%s" % lib_dir,
+ 'LD_EXTRAS': "%s -Wl,-rpath,%s" % (dsym, lib_dir),
+ }
elif sys.platform.rstrip('0123456789') in ('freebsd', 'linux', 'netbsd') or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
- d = {'CXX_SOURCES' : sources,
- 'EXE' : exe_name,
- 'CFLAGS_EXTRAS' : "%s %s -I%s" % (stdflag, stdlibflag, os.path.join(os.environ["LLDB_SRC"], "include")),
- 'LD_EXTRAS' : "-L%s -llldb" % lib_dir}
+ d = {
+ 'CXX_SOURCES': sources,
+ 'EXE': exe_name,
+ 'CFLAGS_EXTRAS': "%s %s -I%s" % (stdflag,
+ stdlibflag,
+ os.path.join(
+ os.environ["LLDB_SRC"],
+ "include")),
+ 'LD_EXTRAS': "-L%s -llldb" % lib_dir}
elif sys.platform.startswith('win'):
- d = {'CXX_SOURCES' : sources,
- 'EXE' : exe_name,
- 'CFLAGS_EXTRAS' : "%s %s -I%s" % (stdflag, stdlibflag, os.path.join(os.environ["LLDB_SRC"], "include")),
- 'LD_EXTRAS' : "-L%s -lliblldb" % os.environ["LLDB_IMPLIB_DIR"]}
+ d = {
+ 'CXX_SOURCES': sources,
+ 'EXE': exe_name,
+ 'CFLAGS_EXTRAS': "%s %s -I%s" % (stdflag,
+ stdlibflag,
+ os.path.join(
+ os.environ["LLDB_SRC"],
+ "include")),
+ 'LD_EXTRAS': "-L%s -lliblldb" % os.environ["LLDB_IMPLIB_DIR"]}
if self.TraceOn():
- print("Building LLDB Driver (%s) from sources %s" % (exe_name, sources))
+ print(
+ "Building LLDB Driver (%s) from sources %s" %
+ (exe_name, sources))
self.buildDefault(dictionary=d)
@@ -1312,64 +1412,124 @@ class Base(unittest2.TestCase):
lib_dir = os.environ["LLDB_LIB_DIR"]
if self.platformIsDarwin():
dsym = os.path.join(lib_dir, 'LLDB.framework', 'LLDB')
- d = {'DYLIB_CXX_SOURCES' : sources,
- 'DYLIB_NAME' : lib_name,
- 'CFLAGS_EXTRAS' : "%s -stdlib=libc++" % stdflag,
- 'FRAMEWORK_INCLUDES' : "-F%s" % lib_dir,
- 'LD_EXTRAS' : "%s -Wl,-rpath,%s -dynamiclib" % (dsym, lib_dir),
- }
+ d = {'DYLIB_CXX_SOURCES': sources,
+ 'DYLIB_NAME': lib_name,
+ 'CFLAGS_EXTRAS': "%s -stdlib=libc++" % stdflag,
+ 'FRAMEWORK_INCLUDES': "-F%s" % lib_dir,
+ 'LD_EXTRAS': "%s -Wl,-rpath,%s -dynamiclib" % (dsym, lib_dir),
+ }
elif self.getPlatform() in ('freebsd', 'linux', 'netbsd') or os.environ.get('LLDB_BUILD_TYPE') == 'Makefile':
- d = {'DYLIB_CXX_SOURCES' : sources,
- 'DYLIB_NAME' : lib_name,
- 'CFLAGS_EXTRAS' : "%s -I%s -fPIC" % (stdflag, os.path.join(os.environ["LLDB_SRC"], "include")),
- 'LD_EXTRAS' : "-shared -L%s -llldb" % lib_dir}
+ d = {
+ 'DYLIB_CXX_SOURCES': sources,
+ 'DYLIB_NAME': lib_name,
+ 'CFLAGS_EXTRAS': "%s -I%s -fPIC" % (stdflag,
+ os.path.join(
+ os.environ["LLDB_SRC"],
+ "include")),
+ 'LD_EXTRAS': "-shared -L%s -llldb" % lib_dir}
elif self.getPlatform() == 'windows':
- d = {'DYLIB_CXX_SOURCES' : sources,
- 'DYLIB_NAME' : lib_name,
- 'CFLAGS_EXTRAS' : "%s -I%s -fPIC" % (stdflag, os.path.join(os.environ["LLDB_SRC"], "include")),
- 'LD_EXTRAS' : "-shared -l%s\liblldb.lib" % self.os.environ["LLDB_IMPLIB_DIR"]}
+ d = {
+ 'DYLIB_CXX_SOURCES': sources,
+ 'DYLIB_NAME': lib_name,
+ 'CFLAGS_EXTRAS': "%s -I%s -fPIC" % (stdflag,
+ os.path.join(
+ os.environ["LLDB_SRC"],
+ "include")),
+ 'LD_EXTRAS': "-shared -l%s\liblldb.lib" % self.os.environ["LLDB_IMPLIB_DIR"]}
if self.TraceOn():
- print("Building LLDB Library (%s) from sources %s" % (lib_name, sources))
+ print(
+ "Building LLDB Library (%s) from sources %s" %
+ (lib_name, sources))
self.buildDefault(dictionary=d)
-
+
def buildProgram(self, sources, exe_name):
""" Platform specific way to build an executable from C/C++ sources. """
- d = {'CXX_SOURCES' : sources,
- 'EXE' : exe_name}
+ d = {'CXX_SOURCES': sources,
+ 'EXE': exe_name}
self.buildDefault(dictionary=d)
- def buildDefault(self, architecture=None, compiler=None, dictionary=None, clean=True):
+ def buildDefault(
+ self,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
"""Platform specific way to build the default binaries."""
module = builder_module()
dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
- if not module.buildDefault(self, architecture, compiler, dictionary, clean):
+ if not module.buildDefault(
+ self,
+ architecture,
+ compiler,
+ dictionary,
+ clean):
raise Exception("Don't know how to build default binary")
- def buildDsym(self, architecture=None, compiler=None, dictionary=None, clean=True):
+ def buildDsym(
+ self,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
"""Platform specific way to build binaries with dsym info."""
module = builder_module()
- if not module.buildDsym(self, architecture, compiler, dictionary, clean):
+ if not module.buildDsym(
+ self,
+ architecture,
+ compiler,
+ dictionary,
+ clean):
raise Exception("Don't know how to build binary with dsym")
- def buildDwarf(self, architecture=None, compiler=None, dictionary=None, clean=True):
+ def buildDwarf(
+ self,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
"""Platform specific way to build binaries with dwarf maps."""
module = builder_module()
dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
- if not module.buildDwarf(self, architecture, compiler, dictionary, clean):
+ if not module.buildDwarf(
+ self,
+ architecture,
+ compiler,
+ dictionary,
+ clean):
raise Exception("Don't know how to build binary with dwarf")
- def buildDwo(self, architecture=None, compiler=None, dictionary=None, clean=True):
+ def buildDwo(
+ self,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
"""Platform specific way to build binaries with dwarf maps."""
module = builder_module()
dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
- if not module.buildDwo(self, architecture, compiler, dictionary, clean):
+ if not module.buildDwo(
+ self,
+ architecture,
+ compiler,
+ dictionary,
+ clean):
raise Exception("Don't know how to build binary with dwo")
- def buildGModules(self, architecture=None, compiler=None, dictionary=None, clean=True):
+ def buildGModules(
+ self,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
"""Platform specific way to build binaries with gmodules info."""
module = builder_module()
- if not module.buildGModules(self, architecture, compiler, dictionary, clean):
+ if not module.buildGModules(
+ self,
+ architecture,
+ compiler,
+ dictionary,
+ clean):
raise Exception("Don't know how to build binary with gmodules")
def buildGo(self):
@@ -1379,18 +1539,20 @@ class Base(unittest2.TestCase):
def signBinary(self, binary_path):
if sys.platform.startswith("darwin"):
- codesign_cmd = "codesign --force --sign lldb_codesign %s" % (binary_path)
+ codesign_cmd = "codesign --force --sign lldb_codesign %s" % (
+ binary_path)
call(codesign_cmd, shell=True)
def findBuiltClang(self):
"""Tries to find and use Clang from the build directory as the compiler (instead of the system compiler)."""
paths_to_try = [
- "llvm-build/Release+Asserts/x86_64/Release+Asserts/bin/clang",
- "llvm-build/Debug+Asserts/x86_64/Debug+Asserts/bin/clang",
- "llvm-build/Release/x86_64/Release/bin/clang",
- "llvm-build/Debug/x86_64/Debug/bin/clang",
+ "llvm-build/Release+Asserts/x86_64/Release+Asserts/bin/clang",
+ "llvm-build/Debug+Asserts/x86_64/Debug+Asserts/bin/clang",
+ "llvm-build/Release/x86_64/Release/bin/clang",
+ "llvm-build/Debug/x86_64/Debug/bin/clang",
]
- lldb_root_path = os.path.join(os.path.dirname(__file__), "..", "..", "..", "..")
+ lldb_root_path = os.path.join(
+ os.path.dirname(__file__), "..", "..", "..", "..")
for p in paths_to_try:
path = os.path.join(lldb_root_path, p)
if os.path.exists(path):
@@ -1400,17 +1562,22 @@ class Base(unittest2.TestCase):
path = os.path.join(os.path.dirname(lldbtest_config.lldbExec), "clang")
if os.path.exists(path):
return path
-
+
return os.environ["CC"]
- def getBuildFlags(self, use_cpp11=True, use_libcxx=False, use_libstdcxx=False):
+ def getBuildFlags(
+ self,
+ use_cpp11=True,
+ use_libcxx=False,
+ use_libstdcxx=False):
""" Returns a dictionary (which can be provided to build* functions above) which
contains OS-specific build flags.
"""
cflags = ""
ldflags = ""
- # On Mac OS X, unless specifically requested to use libstdc++, use libc++
+ # On Mac OS X, unless specifically requested to use libstdc++, use
+ # libc++
if not use_libstdcxx and self.platformIsDarwin():
use_libcxx = True
@@ -1420,7 +1587,8 @@ class Base(unittest2.TestCase):
libcxxInclude = os.path.join(self.libcxxPath, "include")
libcxxLib = os.path.join(self.libcxxPath, "lib")
if os.path.isdir(libcxxInclude) and os.path.isdir(libcxxLib):
- cflags += "-nostdinc++ -I%s -L%s -Wl,-rpath,%s " % (libcxxInclude, libcxxLib, libcxxLib)
+ cflags += "-nostdinc++ -I%s -L%s -Wl,-rpath,%s " % (
+ libcxxInclude, libcxxLib, libcxxLib)
if use_cpp11:
cflags += "-std="
@@ -1435,15 +1603,17 @@ class Base(unittest2.TestCase):
elif "clang" in self.getCompiler():
cflags += " -stdlib=libstdc++"
- return {'CFLAGS_EXTRAS' : cflags,
- 'LD_EXTRAS' : ldflags,
- }
+ return {'CFLAGS_EXTRAS': cflags,
+ 'LD_EXTRAS': ldflags,
+ }
def cleanup(self, dictionary=None):
"""Platform specific way to do cleanup after build."""
module = builder_module()
if not module.cleanup(self, dictionary):
- raise Exception("Don't know how to do cleanup with dictionary: "+dictionary)
+ raise Exception(
+ "Don't know how to do cleanup with dictionary: " +
+ dictionary)
def getLLDBLibraryEnvVal(self):
""" Returns the path that the OS-specific library search environment variable
@@ -1451,7 +1621,8 @@ class Base(unittest2.TestCase):
library. If an environment variable named self.dylibPath is already set,
the new path is appended to it and returned.
"""
- existing_library_path = os.environ[self.dylibPath] if self.dylibPath in os.environ else None
+ existing_library_path = os.environ[
+ self.dylibPath] if self.dylibPath in os.environ else None
lib_dir = os.environ["LLDB_LIB_DIR"]
if existing_library_path:
return "%s:%s" % (existing_library_path, lib_dir)
@@ -1464,7 +1635,7 @@ class Base(unittest2.TestCase):
if self.getPlatform() in ('freebsd', 'linux', 'netbsd'):
return ['libc++.so.1']
else:
- return ['libc++.1.dylib','libc++abi.dylib']
+ return ['libc++.1.dylib', 'libc++abi.dylib']
# Metaclass for TestBase to change the list of test metods when a new TestCase is loaded.
# We change the test methods to create a new test method for each test for each debug info we are
@@ -1472,27 +1643,40 @@ class Base(unittest2.TestCase):
# the new test method we remove the old method at the same time. This functionality can be
# supressed by at test case level setting the class attribute NO_DEBUG_INFO_TESTCASE or at test
# level by using the decorator @no_debug_info_test.
+
+
class LLDBTestCaseFactory(type):
+
def __new__(cls, name, bases, attrs):
- original_testcase = super(LLDBTestCaseFactory, cls).__new__(cls, name, bases, attrs)
+ original_testcase = super(
+ LLDBTestCaseFactory, cls).__new__(
+ cls, name, bases, attrs)
if original_testcase.NO_DEBUG_INFO_TESTCASE:
return original_testcase
newattrs = {}
for attrname, attrvalue in attrs.items():
- if attrname.startswith("test") and not getattr(attrvalue, "__no_debug_info_test__", False):
- target_platform = lldb.DBG.GetSelectedPlatform().GetTriple().split('-')[2]
+ if attrname.startswith("test") and not getattr(
+ attrvalue, "__no_debug_info_test__", False):
+ target_platform = lldb.DBG.GetSelectedPlatform(
+ ).GetTriple().split('-')[2]
# If any debug info categories were explicitly tagged, assume that list to be
- # authoritative. If none were specified, try with all debug info formats.
- all_dbginfo_categories = set(test_categories.debug_info_categories)
- categories = set(getattr(attrvalue, "categories", [])) & all_dbginfo_categories
+ # authoritative. If none were specified, try with all debug
+ # info formats.
+ all_dbginfo_categories = set(
+ test_categories.debug_info_categories)
+ categories = set(
+ getattr(
+ attrvalue,
+ "categories",
+ [])) & all_dbginfo_categories
if not categories:
categories = all_dbginfo_categories
- supported_categories = [x for x in categories
- if test_categories.is_supported_on_platform(
- x, target_platform, configuration.compilers)]
+ supported_categories = [
+ x for x in categories if test_categories.is_supported_on_platform(
+ x, target_platform, configuration.compilers)]
if "dsym" in supported_categories:
@decorators.add_test_categories(["dsym"])
@wraps(attrvalue)
@@ -1535,9 +1719,18 @@ class LLDBTestCaseFactory(type):
else:
newattrs[attrname] = attrvalue
- return super(LLDBTestCaseFactory, cls).__new__(cls, name, bases, newattrs)
+ return super(
+ LLDBTestCaseFactory,
+ cls).__new__(
+ cls,
+ name,
+ bases,
+ newattrs)
+
+# Setup the metaclass for this class to change the list of the test
+# methods when a new class is loaded
+
-# Setup the metaclass for this class to change the list of the test methods when a new class is loaded
@add_metaclass(LLDBTestCaseFactory)
class TestBase(Base):
"""
@@ -1597,11 +1790,11 @@ class TestBase(Base):
# Maximum allowed attempts when launching the inferior process.
# Can be overridden by the LLDB_MAX_LAUNCH_COUNT environment variable.
- maxLaunchCount = 3;
+ maxLaunchCount = 3
# Time to wait before the next launching attempt in second(s).
# Can be overridden by the LLDB_TIME_WAIT_NEXT_LAUNCH environment variable.
- timeWaitNextLaunch = 1.0;
+ timeWaitNextLaunch = 1.0
# Returns the list of categories to which this test case belongs
# by default, look for a ".categories" file, and read its contents
@@ -1615,30 +1808,32 @@ class TestBase(Base):
folder = inspect.getfile(self.__class__)
folder = os.path.dirname(folder)
while folder != '/':
- categories_file_name = os.path.join(folder,".categories")
- if os.path.exists(categories_file_name):
- categories_file = open(categories_file_name,'r')
- categories = categories_file.readline()
- categories_file.close()
- categories = str.replace(categories,'\n','')
- categories = str.replace(categories,'\r','')
- return categories.split(',')
- else:
- folder = os.path.dirname(folder)
- continue
+ categories_file_name = os.path.join(folder, ".categories")
+ if os.path.exists(categories_file_name):
+ categories_file = open(categories_file_name, 'r')
+ categories = categories_file.readline()
+ categories_file.close()
+ categories = str.replace(categories, '\n', '')
+ categories = str.replace(categories, '\r', '')
+ return categories.split(',')
+ else:
+ folder = os.path.dirname(folder)
+ continue
def setUp(self):
#import traceback
- #traceback.print_stack()
+ # traceback.print_stack()
- # Works with the test driver to conditionally skip tests via decorators.
+ # Works with the test driver to conditionally skip tests via
+ # decorators.
Base.setUp(self)
if "LLDB_MAX_LAUNCH_COUNT" in os.environ:
self.maxLaunchCount = int(os.environ["LLDB_MAX_LAUNCH_COUNT"])
if "LLDB_TIME_WAIT_NEXT_LAUNCH" in os.environ:
- self.timeWaitNextLaunch = float(os.environ["LLDB_TIME_WAIT_NEXT_LAUNCH"])
+ self.timeWaitNextLaunch = float(
+ os.environ["LLDB_TIME_WAIT_NEXT_LAUNCH"])
# We want our debugger to be synchronous.
self.dbg.SetAsync(False)
@@ -1653,7 +1848,7 @@ class TestBase(Base):
def registerSharedLibrariesWithTarget(self, target, shlibs):
'''If we are remotely running the test suite, register the shared libraries with the target so they get uploaded, otherwise do nothing
-
+
Any modules in the target that have their remote install file specification set will
get uploaded to the remote host. This function registers the local copies of the
shared libraries with the target and sets their remote install locations so they will
@@ -1676,12 +1871,14 @@ class TestBase(Base):
# basename like "libFoo.so". So figure out which one it is and resolve the local copy
# of the shared library accordingly
if os.path.exists(name):
- local_shlib_path = name # name is the full path to the local shared library
+ local_shlib_path = name # name is the full path to the local shared library
else:
# Check relative names
- local_shlib_path = os.path.join(os.getcwd(), shlib_prefix + name + shlib_extension)
+ local_shlib_path = os.path.join(
+ os.getcwd(), shlib_prefix + name + shlib_extension)
if not os.path.exists(local_shlib_path):
- local_shlib_path = os.path.join(os.getcwd(), name + shlib_extension)
+ local_shlib_path = os.path.join(
+ os.getcwd(), name + shlib_extension)
if not os.path.exists(local_shlib_path):
local_shlib_path = os.path.join(os.getcwd(), name)
@@ -1693,8 +1890,10 @@ class TestBase(Base):
if lldb.remote_platform:
# We must set the remote install location if we want the shared library
# to get uploaded to the remote target
- remote_shlib_path = lldbutil.append_to_process_working_directory(os.path.basename(local_shlib_path))
- shlib_module.SetRemoteInstallFileSpec(lldb.SBFileSpec(remote_shlib_path, False))
+ remote_shlib_path = lldbutil.append_to_process_working_directory(
+ os.path.basename(local_shlib_path))
+ shlib_module.SetRemoteInstallFileSpec(
+ lldb.SBFileSpec(remote_shlib_path, False))
return environment
@@ -1717,20 +1916,22 @@ class TestBase(Base):
def frame(self):
if not self.dbg:
raise Exception('Invalid debugger instance')
- return self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
+ return self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame()
def get_process_working_directory(self):
'''Get the working directory that should be used when launching processes for local or remote processes.'''
if lldb.remote_platform:
- # Remote tests set the platform working directory up in TestBase.setUp()
+ # Remote tests set the platform working directory up in
+ # TestBase.setUp()
return lldb.remote_platform.GetWorkingDirectory()
else:
# local tests change directory into each test subdirectory
- return os.getcwd()
-
+ return os.getcwd()
+
def tearDown(self):
#import traceback
- #traceback.print_stack()
+ # traceback.print_stack()
# Ensure all the references to SB objects have gone away so that we can
# be sure that all test-specific resources have been freed before we
@@ -1767,8 +1968,9 @@ class TestBase(Base):
from .lldbutil import stop_reason_to_str
self.runCmd('thread list')
output = self.res.GetOutput()
- thread_line_pattern = re.compile("^[ *] thread #([0-9]+):.*stop reason = %s" %
- stop_reason_to_str(stop_reason))
+ thread_line_pattern = re.compile(
+ "^[ *] thread #([0-9]+):.*stop reason = %s" %
+ stop_reason_to_str(stop_reason))
for line in output.splitlines():
matched = thread_line_pattern.match(line)
if matched:
@@ -1815,7 +2017,15 @@ class TestBase(Base):
self.assertTrue(self.res.Succeeded(),
msg if msg else CMD_MSG(cmd))
- def match (self, str, patterns, msg=None, trace=False, error=False, matching=True, exe=True):
+ def match(
+ self,
+ str,
+ patterns,
+ msg=None,
+ trace=False,
+ error=False,
+ matching=True,
+ exe=True):
"""run command in str, and match the result against regexp in patterns returning the match object for the first matching pattern
Otherwise, all the arguments have the same meanings as for the expect function"""
@@ -1824,8 +2034,14 @@ class TestBase(Base):
if exe:
# First run the command. If we are expecting error, set check=False.
- # Pass the assert message along since it provides more semantic info.
- self.runCmd(str, msg=msg, trace = (True if trace else False), check = not error)
+ # Pass the assert message along since it provides more semantic
+ # info.
+ self.runCmd(
+ str,
+ msg=msg,
+ trace=(
+ True if trace else False),
+ check=not error)
# Then compare the output against expected strings.
output = self.res.GetError() if error else self.res.GetOutput()
@@ -1856,9 +2072,21 @@ class TestBase(Base):
self.assertTrue(matched if matching else not matched,
msg if msg else EXP_MSG(str, output, exe))
- return match_object
+ return match_object
- def expect(self, str, msg=None, patterns=None, startstr=None, endstr=None, substrs=None, trace=False, error=False, matching=True, exe=True, inHistory=False):
+ def expect(
+ self,
+ str,
+ msg=None,
+ patterns=None,
+ startstr=None,
+ endstr=None,
+ substrs=None,
+ trace=False,
+ error=False,
+ matching=True,
+ exe=True,
+ inHistory=False):
"""
Similar to runCmd; with additional expect style output matching ability.
@@ -1886,8 +2114,15 @@ class TestBase(Base):
if exe:
# First run the command. If we are expecting error, set check=False.
- # Pass the assert message along since it provides more semantic info.
- self.runCmd(str, msg=msg, trace = (True if trace else False), check = not error, inHistory=inHistory)
+ # Pass the assert message along since it provides more semantic
+ # info.
+ self.runCmd(
+ str,
+ msg=msg,
+ trace=(
+ True if trace else False),
+ check=not error,
+ inHistory=inHistory)
# Then compare the output against expected strings.
output = self.res.GetError() if error else self.res.GetOutput()
@@ -1898,7 +2133,7 @@ class TestBase(Base):
"Command '" + str + "' is expected to fail!")
else:
# No execution required, just compare str against the golden input.
- if isinstance(str,lldb.SBCommandReturnObject):
+ if isinstance(str, lldb.SBCommandReturnObject):
output = str.GetOutput()
else:
output = str
@@ -1910,7 +2145,8 @@ class TestBase(Base):
# Start from the startstr, if specified.
# If there's no startstr, set the initial state appropriately.
- matched = output.startswith(startstr) if startstr else (True if matching else False)
+ matched = output.startswith(startstr) if startstr else (
+ True if matching else False)
if startstr:
with recording(self, trace) as sbuf:
@@ -1956,17 +2192,22 @@ class TestBase(Base):
def invoke(self, obj, name, trace=False):
"""Use reflection to call a method dynamically with no argument."""
trace = (True if traceAlways else trace)
-
+
method = getattr(obj, name)
import inspect
self.assertTrue(inspect.ismethod(method),
name + "is a method name of object: " + str(obj))
result = method()
with recording(self, trace) as sbuf:
- print(str(method) + ":", result, file=sbuf)
+ print(str(method) + ":", result, file=sbuf)
return result
- def build(self, architecture=None, compiler=None, dictionary=None, clean=True):
+ def build(
+ self,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
"""Platform specific way to build the default binaries."""
module = builder_module()
dictionary = lldbplatformutil.finalize_build_dictionary(dictionary)
@@ -1979,7 +2220,8 @@ class TestBase(Base):
elif self.debug_info == "dwo":
return self.buildDwo(architecture, compiler, dictionary, clean)
elif self.debug_info == "gmodules":
- return self.buildGModules(architecture, compiler, dictionary, clean)
+ return self.buildGModules(
+ architecture, compiler, dictionary, clean)
else:
self.fail("Can't build for debug info: %s" % self.debug_info)
@@ -2002,15 +2244,24 @@ class TestBase(Base):
err = sys.stderr
err.write(val.GetName() + ":\n")
- err.write('\t' + "TypeName -> " + val.GetTypeName() + '\n')
- err.write('\t' + "ByteSize -> " + str(val.GetByteSize()) + '\n')
- err.write('\t' + "NumChildren -> " + str(val.GetNumChildren()) + '\n')
- err.write('\t' + "Value -> " + str(val.GetValue()) + '\n')
- err.write('\t' + "ValueAsUnsigned -> " + str(val.GetValueAsUnsigned())+ '\n')
- err.write('\t' + "ValueType -> " + value_type_to_str(val.GetValueType()) + '\n')
- err.write('\t' + "Summary -> " + str(val.GetSummary()) + '\n')
- err.write('\t' + "IsPointerType -> " + str(val.TypeIsPointerType()) + '\n')
- err.write('\t' + "Location -> " + val.GetLocation() + '\n')
+ err.write('\t' + "TypeName -> " + val.GetTypeName() + '\n')
+ err.write('\t' + "ByteSize -> " +
+ str(val.GetByteSize()) + '\n')
+ err.write('\t' + "NumChildren -> " +
+ str(val.GetNumChildren()) + '\n')
+ err.write('\t' + "Value -> " + str(val.GetValue()) + '\n')
+ err.write('\t' + "ValueAsUnsigned -> " +
+ str(val.GetValueAsUnsigned()) + '\n')
+ err.write(
+ '\t' +
+ "ValueType -> " +
+ value_type_to_str(
+ val.GetValueType()) +
+ '\n')
+ err.write('\t' + "Summary -> " + str(val.GetSummary()) + '\n')
+ err.write('\t' + "IsPointerType -> " +
+ str(val.TypeIsPointerType()) + '\n')
+ err.write('\t' + "Location -> " + val.GetLocation() + '\n')
def DebugSBType(self, type):
"""Debug print a SBType object, if traceAlways is True."""
@@ -2019,9 +2270,12 @@ class TestBase(Base):
err = sys.stderr
err.write(type.GetName() + ":\n")
- err.write('\t' + "ByteSize -> " + str(type.GetByteSize()) + '\n')
- err.write('\t' + "IsPointerType -> " + str(type.IsPointerType()) + '\n')
- err.write('\t' + "IsReferenceType -> " + str(type.IsReferenceType()) + '\n')
+ err.write('\t' + "ByteSize -> " +
+ str(type.GetByteSize()) + '\n')
+ err.write('\t' + "IsPointerType -> " +
+ str(type.IsPointerType()) + '\n')
+ err.write('\t' + "IsReferenceType -> " +
+ str(type.IsReferenceType()) + '\n')
def DebugPExpect(self, child):
"""Debug the spwaned pexpect object."""
@@ -2038,8 +2292,10 @@ class TestBase(Base):
# On Windows, the first attempt to delete a recently-touched file can fail
# because of a race with antimalware scanners. This function will detect a
# failure and retry.
-def remove_file(file, num_retries = 1, sleep_duration = 0.5):
- for i in range(num_retries+1):
+
+
+def remove_file(file, num_retries=1, sleep_duration=0.5):
+ for i in range(num_retries + 1):
try:
os.remove(file)
return True
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbtest_config.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbtest_config.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbtest_config.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbtest_config.py Tue Sep 6 15:57:50 2016
@@ -18,4 +18,3 @@ log_success = False
# path to the lldb command line executable tool
lldbExec = None
-
Modified: lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lldbutil.py Tue Sep 6 15:57:50 2016
@@ -30,6 +30,7 @@ def is_exe(fpath):
"""Returns True if fpath is an executable."""
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
+
def which(program):
"""Returns the full path to a program; None otherwise."""
fpath, fname = os.path.split(program)
@@ -47,6 +48,7 @@ def which(program):
# Disassembly for an SBFunction or an SBSymbol object
# ===================================================
+
def disassemble(target, function_or_symbol):
"""Disassemble the function or symbol given a target.
@@ -62,6 +64,7 @@ def disassemble(target, function_or_symb
# Integer (byte size 1, 2, 4, and 8) to bytearray conversion
# ==========================================================
+
def int_to_bytearray(val, bytesize):
"""Utility function to convert an integer into a bytearray.
@@ -87,6 +90,7 @@ def int_to_bytearray(val, bytesize):
packed = struct.pack(fmt, val)
return bytearray(packed)
+
def bytearray_to_int(bytes, bytesize):
"""Utility function to convert a bytearray into an integer.
@@ -142,7 +146,7 @@ def get_description(obj, option=None):
if not success:
return None
return stream.GetData()
-
+
# =================================================
# Convert some enum value to its string counterpart
@@ -177,6 +181,7 @@ def state_type_to_str(enum):
else:
raise Exception("Unknown StateType enum")
+
def stop_reason_to_str(enum):
"""Returns the stopReason string given an enum."""
if enum == lldb.eStopReasonInvalid:
@@ -202,6 +207,7 @@ def stop_reason_to_str(enum):
else:
raise Exception("Unknown StopReason enum")
+
def symbol_type_to_str(enum):
"""Returns the symbolType string given an enum."""
if enum == lldb.eSymbolTypeInvalid:
@@ -253,6 +259,7 @@ def symbol_type_to_str(enum):
elif enum == lldb.eSymbolTypeUndefined:
return "undefined"
+
def value_type_to_str(enum):
"""Returns the valueType string given an enum."""
if enum == lldb.eValueTypeInvalid:
@@ -280,12 +287,12 @@ def value_type_to_str(enum):
# ==================================================
def sort_stopped_threads(process,
- breakpoint_threads = None,
- crashed_threads = None,
- watchpoint_threads = None,
- signal_threads = None,
- exiting_threads = None,
- other_threads = None):
+ breakpoint_threads=None,
+ crashed_threads=None,
+ watchpoint_threads=None,
+ signal_threads=None,
+ exiting_threads=None,
+ other_threads=None):
""" Fills array *_threads with threads stopped for the corresponding stop
reason.
"""
@@ -314,8 +321,16 @@ def sort_stopped_threads(process,
# Utility functions for setting breakpoints
# ==================================================
-def run_break_set_by_file_and_line (test, file_name, line_number, extra_options = None, num_expected_locations = 1, loc_exact=False, module_name=None):
- """Set a breakpoint by file and line, returning the breakpoint number.
+
+def run_break_set_by_file_and_line(
+ test,
+ file_name,
+ line_number,
+ extra_options=None,
+ num_expected_locations=1,
+ loc_exact=False,
+ module_name=None):
+ """Set a breakpoint by file and line, returning the breakpoint number.
If extra_options is not None, then we append it to the breakpoint set command.
@@ -323,10 +338,10 @@ def run_break_set_by_file_and_line (test
If loc_exact is true, we check that there is one location, and that location must be at the input file and line number."""
- if file_name == None:
- command = 'breakpoint set -l %d'%(line_number)
+ if file_name is None:
+ command = 'breakpoint set -l %d' % (line_number)
else:
- command = 'breakpoint set -f "%s" -l %d'%(file_name, line_number)
+ command = 'breakpoint set -f "%s" -l %d' % (file_name, line_number)
if module_name:
command += " --shlib '%s'" % (module_name)
@@ -334,20 +349,36 @@ def run_break_set_by_file_and_line (test
if extra_options:
command += " " + extra_options
- break_results = run_break_set_command (test, command)
+ break_results = run_break_set_command(test, command)
if num_expected_locations == 1 and loc_exact:
- check_breakpoint_result (test, break_results, num_locations=num_expected_locations, file_name = file_name, line_number = line_number, module_name=module_name)
- else:
- check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
-
- return get_bpno_from_match (break_results)
-
-def run_break_set_by_symbol (test, symbol, extra_options = None, num_expected_locations = -1, sym_exact = False, module_name=None):
+ check_breakpoint_result(
+ test,
+ break_results,
+ num_locations=num_expected_locations,
+ file_name=file_name,
+ line_number=line_number,
+ module_name=module_name)
+ else:
+ check_breakpoint_result(
+ test,
+ break_results,
+ num_locations=num_expected_locations)
+
+ return get_bpno_from_match(break_results)
+
+
+def run_break_set_by_symbol(
+ test,
+ symbol,
+ extra_options=None,
+ num_expected_locations=-1,
+ sym_exact=False,
+ module_name=None):
"""Set a breakpoint by symbol name. Common options are the same as run_break_set_by_file_and_line.
If sym_exact is true, then the output symbol must match the input exactly, otherwise we do a substring match."""
- command = 'breakpoint set -n "%s"'%(symbol)
+ command = 'breakpoint set -n "%s"' % (symbol)
if module_name:
command += " --shlib '%s'" % (module_name)
@@ -355,16 +386,30 @@ def run_break_set_by_symbol (test, symbo
if extra_options:
command += " " + extra_options
- break_results = run_break_set_command (test, command)
+ break_results = run_break_set_command(test, command)
if num_expected_locations == 1 and sym_exact:
- check_breakpoint_result (test, break_results, num_locations = num_expected_locations, symbol_name = symbol, module_name=module_name)
- else:
- check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
-
- return get_bpno_from_match (break_results)
-
-def run_break_set_by_selector (test, selector, extra_options = None, num_expected_locations = -1, module_name=None):
+ check_breakpoint_result(
+ test,
+ break_results,
+ num_locations=num_expected_locations,
+ symbol_name=symbol,
+ module_name=module_name)
+ else:
+ check_breakpoint_result(
+ test,
+ break_results,
+ num_locations=num_expected_locations)
+
+ return get_bpno_from_match(break_results)
+
+
+def run_break_set_by_selector(
+ test,
+ selector,
+ extra_options=None,
+ num_expected_locations=-1,
+ module_name=None):
"""Set a breakpoint by selector. Common options are the same as run_break_set_by_file_and_line."""
command = 'breakpoint set -S "%s"' % (selector)
@@ -375,42 +420,68 @@ def run_break_set_by_selector (test, sel
if extra_options:
command += " " + extra_options
- break_results = run_break_set_command (test, command)
+ break_results = run_break_set_command(test, command)
if num_expected_locations == 1:
- check_breakpoint_result (test, break_results, num_locations = num_expected_locations, symbol_name = selector, symbol_match_exact=False, module_name=module_name)
- else:
- check_breakpoint_result (test, break_results, num_locations = num_expected_locations)
-
- return get_bpno_from_match (break_results)
-
-def run_break_set_by_regexp (test, regexp, extra_options=None, num_expected_locations=-1):
+ check_breakpoint_result(
+ test,
+ break_results,
+ num_locations=num_expected_locations,
+ symbol_name=selector,
+ symbol_match_exact=False,
+ module_name=module_name)
+ else:
+ check_breakpoint_result(
+ test,
+ break_results,
+ num_locations=num_expected_locations)
+
+ return get_bpno_from_match(break_results)
+
+
+def run_break_set_by_regexp(
+ test,
+ regexp,
+ extra_options=None,
+ num_expected_locations=-1):
"""Set a breakpoint by regular expression match on symbol name. Common options are the same as run_break_set_by_file_and_line."""
- command = 'breakpoint set -r "%s"'%(regexp)
+ command = 'breakpoint set -r "%s"' % (regexp)
if extra_options:
command += " " + extra_options
-
- break_results = run_break_set_command (test, command)
-
- check_breakpoint_result (test, break_results, num_locations=num_expected_locations)
- return get_bpno_from_match (break_results)
+ break_results = run_break_set_command(test, command)
-def run_break_set_by_source_regexp (test, regexp, extra_options=None, num_expected_locations=-1):
+ check_breakpoint_result(
+ test,
+ break_results,
+ num_locations=num_expected_locations)
+
+ return get_bpno_from_match(break_results)
+
+
+def run_break_set_by_source_regexp(
+ test,
+ regexp,
+ extra_options=None,
+ num_expected_locations=-1):
"""Set a breakpoint by source regular expression. Common options are the same as run_break_set_by_file_and_line."""
- command = 'breakpoint set -p "%s"'%(regexp)
+ command = 'breakpoint set -p "%s"' % (regexp)
if extra_options:
command += " " + extra_options
-
- break_results = run_break_set_command (test, command)
-
- check_breakpoint_result (test, break_results, num_locations=num_expected_locations)
- return get_bpno_from_match (break_results)
+ break_results = run_break_set_command(test, command)
+
+ check_breakpoint_result(
+ test,
+ break_results,
+ num_locations=num_expected_locations)
+
+ return get_bpno_from_match(break_results)
-def run_break_set_command (test, command):
- """Run the command passed in - it must be some break set variant - and analyze the result.
+
+def run_break_set_command(test, command):
+ """Run the command passed in - it must be some break set variant - and analyze the result.
Returns a dictionary of information gleaned from the command-line results.
Will assert if the breakpoint setting fails altogether.
@@ -427,11 +498,12 @@ def run_break_set_command (test, command
module - module
address - address at which the breakpoint was set."""
- patterns = [r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>[0-9]+) locations\.$",
- r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>no) locations \(pending\)\.",
- r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>[+\-]{0,1}[^+]+)( \+ (?P<offset>[0-9]+)){0,1}( \[inlined\] (?P<inline_symbol>.*)){0,1} at (?P<file>[^:]+):(?P<line_no>[0-9]+), address = (?P<address>0x[0-9a-fA-F]+)$",
- r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>.*)( \+ (?P<offset>[0-9]+)){0,1}, address = (?P<address>0x[0-9a-fA-F]+)$"]
- match_object = test.match (command, patterns)
+ patterns = [
+ r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>[0-9]+) locations\.$",
+ r"^Breakpoint (?P<bpno>[0-9]+): (?P<num_locations>no) locations \(pending\)\.",
+ r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>[+\-]{0,1}[^+]+)( \+ (?P<offset>[0-9]+)){0,1}( \[inlined\] (?P<inline_symbol>.*)){0,1} at (?P<file>[^:]+):(?P<line_no>[0-9]+), address = (?P<address>0x[0-9a-fA-F]+)$",
+ r"^Breakpoint (?P<bpno>[0-9]+): where = (?P<module>.*)`(?P<symbol>.*)( \+ (?P<offset>[0-9]+)){0,1}, address = (?P<address>0x[0-9a-fA-F]+)$"]
+ match_object = test.match(command, patterns)
break_results = match_object.groupdict()
# We always insert the breakpoint number, setting it to -1 if we couldn't find it
@@ -440,7 +512,7 @@ def run_break_set_command (test, command
break_results['bpno'] = -1
else:
break_results['bpno'] = int(break_results['bpno'])
-
+
# We always insert the number of locations
# If ONE location is set for the breakpoint, then the output doesn't mention locations, but it has to be 1...
# We also make sure it is an integer.
@@ -455,61 +527,101 @@ def run_break_set_command (test, command
num_locations = int(break_results['num_locations'])
break_results['num_locations'] = num_locations
-
+
if 'line_no' in break_results:
break_results['line_no'] = int(break_results['line_no'])
return break_results
-def get_bpno_from_match (break_results):
- return int (break_results['bpno'])
-def check_breakpoint_result (test, break_results, file_name=None, line_number=-1, symbol_name=None, symbol_match_exact=True, module_name=None, offset=-1, num_locations=-1):
+def get_bpno_from_match(break_results):
+ return int(break_results['bpno'])
+
+
+def check_breakpoint_result(
+ test,
+ break_results,
+ file_name=None,
+ line_number=-1,
+ symbol_name=None,
+ symbol_match_exact=True,
+ module_name=None,
+ offset=-1,
+ num_locations=-1):
out_num_locations = break_results['num_locations']
if num_locations == -1:
- test.assertTrue (out_num_locations > 0, "Expecting one or more locations, got none.")
+ test.assertTrue(out_num_locations > 0,
+ "Expecting one or more locations, got none.")
else:
- test.assertTrue (num_locations == out_num_locations, "Expecting %d locations, got %d."%(num_locations, out_num_locations))
+ test.assertTrue(
+ num_locations == out_num_locations,
+ "Expecting %d locations, got %d." %
+ (num_locations,
+ out_num_locations))
if file_name:
out_file_name = ""
if 'file' in break_results:
out_file_name = break_results['file']
- test.assertTrue (file_name == out_file_name, "Breakpoint file name '%s' doesn't match resultant name '%s'."%(file_name, out_file_name))
+ test.assertTrue(
+ file_name == out_file_name,
+ "Breakpoint file name '%s' doesn't match resultant name '%s'." %
+ (file_name,
+ out_file_name))
if line_number != -1:
out_line_number = -1
if 'line_no' in break_results:
out_line_number = break_results['line_no']
- test.assertTrue (line_number == out_line_number, "Breakpoint line number %s doesn't match resultant line %s."%(line_number, out_line_number))
+ test.assertTrue(
+ line_number == out_line_number,
+ "Breakpoint line number %s doesn't match resultant line %s." %
+ (line_number,
+ out_line_number))
if symbol_name:
out_symbol_name = ""
- # Look first for the inlined symbol name, otherwise use the symbol name:
+ # Look first for the inlined symbol name, otherwise use the symbol
+ # name:
if 'inline_symbol' in break_results and break_results['inline_symbol']:
out_symbol_name = break_results['inline_symbol']
elif 'symbol' in break_results:
out_symbol_name = break_results['symbol']
if symbol_match_exact:
- test.assertTrue(symbol_name == out_symbol_name, "Symbol name '%s' doesn't match resultant symbol '%s'."%(symbol_name, out_symbol_name))
+ test.assertTrue(
+ symbol_name == out_symbol_name,
+ "Symbol name '%s' doesn't match resultant symbol '%s'." %
+ (symbol_name,
+ out_symbol_name))
else:
- test.assertTrue(out_symbol_name.find(symbol_name) != -1, "Symbol name '%s' isn't in resultant symbol '%s'."%(symbol_name, out_symbol_name))
+ test.assertTrue(
+ out_symbol_name.find(symbol_name) != -
+ 1,
+ "Symbol name '%s' isn't in resultant symbol '%s'." %
+ (symbol_name,
+ out_symbol_name))
if module_name:
out_module_name = None
if 'module' in break_results:
out_module_name = break_results['module']
-
- test.assertTrue (module_name.find(out_module_name) != -1, "Symbol module name '%s' isn't in expected module name '%s'."%(out_module_name, module_name))
+
+ test.assertTrue(
+ module_name.find(out_module_name) != -
+ 1,
+ "Symbol module name '%s' isn't in expected module name '%s'." %
+ (out_module_name,
+ module_name))
# ==================================================
# Utility functions related to Threads and Processes
# ==================================================
+
def get_stopped_threads(process, reason):
"""Returns the thread(s) with the specified stop reason in a list.
@@ -521,6 +633,7 @@ def get_stopped_threads(process, reason)
threads.append(t)
return threads
+
def get_stopped_thread(process, reason):
"""A convenience function which returns the first thread with the given stop
reason or None.
@@ -549,28 +662,32 @@ def get_stopped_thread(process, reason):
return None
return threads[0]
+
def get_threads_stopped_at_breakpoint_id(process, bpid):
""" For a stopped process returns the thread stopped at the breakpoint passed in bkpt"""
stopped_threads = []
threads = []
- stopped_threads = get_stopped_threads (process, lldb.eStopReasonBreakpoint)
+ stopped_threads = get_stopped_threads(process, lldb.eStopReasonBreakpoint)
if len(stopped_threads) == 0:
return threads
-
+
for thread in stopped_threads:
# Make sure we've hit our breakpoint...
- break_id = thread.GetStopReasonDataAtIndex (0)
+ break_id = thread.GetStopReasonDataAtIndex(0)
if break_id == bpid:
threads.append(thread)
return threads
-def get_threads_stopped_at_breakpoint (process, bkpt):
+
+def get_threads_stopped_at_breakpoint(process, bkpt):
return get_threads_stopped_at_breakpoint_id(process, bkpt.GetID())
-def get_one_thread_stopped_at_breakpoint_id(process, bpid, require_exactly_one = True):
+
+def get_one_thread_stopped_at_breakpoint_id(
+ process, bpid, require_exactly_one=True):
threads = get_threads_stopped_at_breakpoint_id(process, bpid)
if len(threads) == 0:
return None
@@ -579,20 +696,27 @@ def get_one_thread_stopped_at_breakpoint
return threads[0]
-def get_one_thread_stopped_at_breakpoint(process, bkpt, require_exactly_one = True):
- return get_one_thread_stopped_at_breakpoint_id(process, bkpt.GetID(), require_exactly_one)
-def is_thread_crashed (test, thread):
+def get_one_thread_stopped_at_breakpoint(
+ process, bkpt, require_exactly_one=True):
+ return get_one_thread_stopped_at_breakpoint_id(
+ process, bkpt.GetID(), require_exactly_one)
+
+
+def is_thread_crashed(test, thread):
"""In the test suite we dereference a null pointer to simulate a crash. The way this is
reported depends on the platform."""
if test.platformIsDarwin():
- return thread.GetStopReason() == lldb.eStopReasonException and "EXC_BAD_ACCESS" in thread.GetStopDescription(100)
+ return thread.GetStopReason(
+ ) == lldb.eStopReasonException and "EXC_BAD_ACCESS" in thread.GetStopDescription(100)
elif test.getPlatform() == "linux":
- return thread.GetStopReason() == lldb.eStopReasonSignal and thread.GetStopReasonDataAtIndex(0) == thread.GetProcess().GetUnixSignals().GetSignalNumberFromName("SIGSEGV")
+ return thread.GetStopReason() == lldb.eStopReasonSignal and thread.GetStopReasonDataAtIndex(
+ 0) == thread.GetProcess().GetUnixSignals().GetSignalNumberFromName("SIGSEGV")
else:
return "invalid address" in thread.GetStopDescription(100)
-def get_crashed_threads (test, process):
+
+def get_crashed_threads(test, process):
threads = []
if process.GetState() != lldb.eStateStopped:
return threads
@@ -601,13 +725,15 @@ def get_crashed_threads (test, process):
threads.append(thread)
return threads
-def continue_to_breakpoint (process, bkpt):
+
+def continue_to_breakpoint(process, bkpt):
""" Continues the process, if it stops, returns the threads stopped at bkpt; otherwise, returns None"""
process.Continue()
if process.GetState() != lldb.eStateStopped:
return None
else:
- return get_threads_stopped_at_breakpoint (process, bkpt)
+ return get_threads_stopped_at_breakpoint(process, bkpt)
+
def get_caller_symbol(thread):
"""
@@ -658,7 +784,8 @@ def get_filenames(thread):
Returns a sequence of file names from the stack frames of this thread.
"""
def GetFilename(i):
- return thread.GetFrameAtIndex(i).GetLineEntry().GetFileSpec().GetFilename()
+ return thread.GetFrameAtIndex(
+ i).GetLineEntry().GetFileSpec().GetFilename()
return list(map(GetFilename, list(range(thread.GetNumFrames()))))
@@ -678,7 +805,8 @@ def get_module_names(thread):
Returns a sequence of module names from the stack frames of this thread.
"""
def GetModuleName(i):
- return thread.GetFrameAtIndex(i).GetModule().GetFileSpec().GetFilename()
+ return thread.GetFrameAtIndex(
+ i).GetModule().GetFileSpec().GetFilename()
return list(map(GetModuleName, list(range(thread.GetNumFrames()))))
@@ -693,7 +821,7 @@ def get_stack_frames(thread):
return list(map(GetStackFrame, list(range(thread.GetNumFrames()))))
-def print_stacktrace(thread, string_buffer = False):
+def print_stacktrace(thread, string_buffer=False):
"""Prints a simple stack trace of this thread."""
output = SixStringIO() if string_buffer else sys.stdout
@@ -709,11 +837,15 @@ def print_stacktrace(thread, string_buff
addrs = get_pc_addresses(thread)
if thread.GetStopReason() != lldb.eStopReasonInvalid:
- desc = "stop reason=" + stop_reason_to_str(thread.GetStopReason())
+ desc = "stop reason=" + stop_reason_to_str(thread.GetStopReason())
else:
desc = ""
- print("Stack trace for thread id={0:#x} name={1} queue={2} ".format(
- thread.GetThreadID(), thread.GetName(), thread.GetQueueName()) + desc, file=output)
+ print(
+ "Stack trace for thread id={0:#x} name={1} queue={2} ".format(
+ thread.GetThreadID(),
+ thread.GetName(),
+ thread.GetQueueName()) + desc,
+ file=output)
for i in range(depth):
frame = thread.GetFrameAtIndex(i)
@@ -724,20 +856,34 @@ def print_stacktrace(thread, string_buff
file_addr = addrs[i].GetFileAddress()
start_addr = frame.GetSymbol().GetStartAddress().GetFileAddress()
symbol_offset = file_addr - start_addr
- print(" frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}".format(
- num=i, addr=load_addr, mod=mods[i], symbol=symbols[i], offset=symbol_offset), file=output)
+ print(
+ " frame #{num}: {addr:#016x} {mod}`{symbol} + {offset}".format(
+ num=i,
+ addr=load_addr,
+ mod=mods[i],
+ symbol=symbols[i],
+ offset=symbol_offset),
+ file=output)
else:
- print(" frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}".format(
- num=i, addr=load_addr, mod=mods[i],
- func='%s [inlined]' % funcs[i] if frame.IsInlined() else funcs[i],
- file=files[i], line=lines[i],
- args=get_args_as_string(frame, showFuncName=False) if not frame.IsInlined() else '()'), file=output)
+ print(
+ " frame #{num}: {addr:#016x} {mod}`{func} at {file}:{line} {args}".format(
+ num=i,
+ addr=load_addr,
+ mod=mods[i],
+ func='%s [inlined]' %
+ funcs[i] if frame.IsInlined() else funcs[i],
+ file=files[i],
+ line=lines[i],
+ args=get_args_as_string(
+ frame,
+ showFuncName=False) if not frame.IsInlined() else '()'),
+ file=output)
if string_buffer:
return output.getvalue()
-def print_stacktraces(process, string_buffer = False):
+def print_stacktraces(process, string_buffer=False):
"""Prints the stack traces of all the threads."""
output = SixStringIO() if string_buffer else sys.stdout
@@ -750,16 +896,21 @@ def print_stacktraces(process, string_bu
if string_buffer:
return output.getvalue()
-def expect_state_changes(test, listener, process, states, timeout = 5):
+
+def expect_state_changes(test, listener, process, states, timeout=5):
"""Listens for state changed events on the listener and makes sure they match what we
expect. Stop-and-restart events (where GetRestartedFromEvent() returns true) are ignored."""
for expected_state in states:
def get_next_event():
event = lldb.SBEvent()
- if not listener.WaitForEventForBroadcasterWithType(timeout, process.GetBroadcaster(),
- lldb.SBProcess.eBroadcastBitStateChanged, event):
- test.fail("Timed out while waiting for a transition to state %s" %
+ if not listener.WaitForEventForBroadcasterWithType(
+ timeout,
+ process.GetBroadcaster(),
+ lldb.SBProcess.eBroadcastBitStateChanged,
+ event):
+ test.fail(
+ "Timed out while waiting for a transition to state %s" %
lldb.SBDebugger.StateAsCString(expected_state))
return event
@@ -768,16 +919,21 @@ def expect_state_changes(test, listener,
lldb.SBProcess.GetRestartedFromEvent(event)):
# Ignore restarted event and the subsequent running event.
event = get_next_event()
- test.assertEqual(lldb.SBProcess.GetStateFromEvent(event), lldb.eStateRunning,
- "Restarted event followed by a running event")
+ test.assertEqual(
+ lldb.SBProcess.GetStateFromEvent(event),
+ lldb.eStateRunning,
+ "Restarted event followed by a running event")
event = get_next_event()
- test.assertEqual(lldb.SBProcess.GetStateFromEvent(event), expected_state)
+ test.assertEqual(
+ lldb.SBProcess.GetStateFromEvent(event),
+ expected_state)
# ===================================
# Utility functions related to Frames
# ===================================
+
def get_parent_frame(frame):
"""
Returns the parent frame of the input frame object; None if not available.
@@ -793,6 +949,7 @@ def get_parent_frame(frame):
# If we reach here, no parent has been found, return None.
return None
+
def get_args_as_string(frame, showFuncName=True):
"""
Returns the args of the input frame object as a string.
@@ -801,8 +958,8 @@ def get_args_as_string(frame, showFuncNa
# locals => False
# statics => False
# in_scope_only => True
- vars = frame.GetVariables(True, False, False, True) # type of SBValueList
- args = [] # list of strings
+ vars = frame.GetVariables(True, False, False, True) # type of SBValueList
+ args = [] # list of strings
for var in vars:
args.append("(%s)%s=%s" % (var.GetTypeName(),
var.GetName(),
@@ -817,37 +974,46 @@ def get_args_as_string(frame, showFuncNa
return "%s(%s)" % (name, ", ".join(args))
else:
return "(%s)" % (", ".join(args))
-
-def print_registers(frame, string_buffer = False):
+
+
+def print_registers(frame, string_buffer=False):
"""Prints all the register sets of the frame."""
output = SixStringIO() if string_buffer else sys.stdout
print("Register sets for " + str(frame), file=output)
- registerSet = frame.GetRegisters() # Return type of SBValueList.
- print("Frame registers (size of register set = %d):" % registerSet.GetSize(), file=output)
+ registerSet = frame.GetRegisters() # Return type of SBValueList.
+ print("Frame registers (size of register set = %d):" %
+ registerSet.GetSize(), file=output)
for value in registerSet:
#print(value, file=output)
- print("%s (number of children = %d):" % (value.GetName(), value.GetNumChildren()), file=output)
+ print("%s (number of children = %d):" %
+ (value.GetName(), value.GetNumChildren()), file=output)
for child in value:
- print("Name: %s, Value: %s" % (child.GetName(), child.GetValue()), file=output)
+ print(
+ "Name: %s, Value: %s" %
+ (child.GetName(),
+ child.GetValue()),
+ file=output)
if string_buffer:
return output.getvalue()
+
def get_registers(frame, kind):
"""Returns the registers given the frame and the kind of registers desired.
Returns None if there's no such kind.
"""
- registerSet = frame.GetRegisters() # Return type of SBValueList.
+ registerSet = frame.GetRegisters() # Return type of SBValueList.
for value in registerSet:
if kind.lower() in value.GetName().lower():
return value
return None
+
def get_GPRs(frame):
"""Returns the general purpose registers of the frame as an SBValue.
@@ -861,6 +1027,7 @@ def get_GPRs(frame):
"""
return get_registers(frame, "general purpose")
+
def get_FPRs(frame):
"""Returns the floating point registers of the frame as an SBValue.
@@ -874,6 +1041,7 @@ def get_FPRs(frame):
"""
return get_registers(frame, "floating point")
+
def get_ESRs(frame):
"""Returns the exception state registers of the frame as an SBValue.
@@ -891,8 +1059,10 @@ def get_ESRs(frame):
# Utility classes/functions for SBValues
# ======================================
+
class BasicFormatter(object):
"""The basic formatter inspects the value object and prints the value."""
+
def format(self, value, buffer=None, indent=0):
if not buffer:
output = SixStringIO()
@@ -901,25 +1071,28 @@ class BasicFormatter(object):
# If there is a summary, it suffices.
val = value.GetSummary()
# Otherwise, get the value.
- if val == None:
+ if val is None:
val = value.GetValue()
- if val == None and value.GetNumChildren() > 0:
+ if val is None and value.GetNumChildren() > 0:
val = "%s (location)" % value.GetLocation()
print("{indentation}({type}) {name} = {value}".format(
- indentation = ' ' * indent,
- type = value.GetTypeName(),
- name = value.GetName(),
- value = val), file=output)
+ indentation=' ' * indent,
+ type=value.GetTypeName(),
+ name=value.GetName(),
+ value=val), file=output)
return output.getvalue()
+
class ChildVisitingFormatter(BasicFormatter):
"""The child visiting formatter prints the value and its immediate children.
The constructor takes a keyword arg: indent_child, which defaults to 2.
"""
+
def __init__(self, indent_child=2):
"""Default indentation of 2 SPC's for the children."""
self.cindent = indent_child
+
def format(self, value, buffer=None):
if not buffer:
output = SixStringIO()
@@ -928,21 +1101,25 @@ class ChildVisitingFormatter(BasicFormat
BasicFormatter.format(self, value, buffer=output)
for child in value:
- BasicFormatter.format(self, child, buffer=output, indent=self.cindent)
+ BasicFormatter.format(
+ self, child, buffer=output, indent=self.cindent)
return output.getvalue()
+
class RecursiveDecentFormatter(BasicFormatter):
"""The recursive decent formatter prints the value and the decendents.
The constructor takes two keyword args: indent_level, which defaults to 0,
and indent_child, which defaults to 2. The current indentation level is
determined by indent_level, while the immediate children has an additional
- indentation by inden_child.
+ indentation by inden_child.
"""
+
def __init__(self, indent_level=0, indent_child=2):
self.lindent = indent_level
self.cindent = indent_child
+
def format(self, value, buffer=None):
if not buffer:
output = SixStringIO()
@@ -952,14 +1129,16 @@ class RecursiveDecentFormatter(BasicForm
BasicFormatter.format(self, value, buffer=output, indent=self.lindent)
new_indent = self.lindent + self.cindent
for child in value:
- if child.GetSummary() != None:
- BasicFormatter.format(self, child, buffer=output, indent=new_indent)
+ if child.GetSummary() is not None:
+ BasicFormatter.format(
+ self, child, buffer=output, indent=new_indent)
else:
if child.GetNumChildren() > 0:
rdf = RecursiveDecentFormatter(indent_level=new_indent)
rdf.format(child, buffer=output)
else:
- BasicFormatter.format(self, child, buffer=output, indent=new_indent)
+ BasicFormatter.format(
+ self, child, buffer=output, indent=new_indent)
return output.getvalue()
@@ -967,12 +1146,14 @@ class RecursiveDecentFormatter(BasicForm
# Utility functions for path manipulation on remote platforms
# ===========================================================
+
def join_remote_paths(*paths):
# TODO: update with actual platform name for remote windows once it exists
if lldb.remote_platform.GetName() == 'remote-windows':
return os.path.join(*paths).replace(os.path.sep, '\\')
return os.path.join(*paths).replace(os.path.sep, '/')
+
def append_to_process_working_directory(*paths):
remote = lldb.remote_platform
if remote:
@@ -985,6 +1166,7 @@ def append_to_process_working_directory(
import signal
+
def get_signal_number(signal_name):
platform = lldb.remote_platform
if platform and platform.IsValid():
@@ -996,20 +1178,23 @@ def get_signal_number(signal_name):
# No remote platform; fall back to using local python signals.
return getattr(signal, signal_name)
+
class PrintableRegex(object):
+
def __init__(self, text):
self.regex = re.compile(text)
self.text = text
-
+
def match(self, str):
return self.regex.match(str)
-
+
def __str__(self):
return "%s" % (self.text)
-
+
def __repr__(self):
return "re.compile(%s) -> %s" % (self.text, self.regex)
+
def skip_if_callable(test, mycallable, reason):
if six.callable(mycallable):
if mycallable(test):
@@ -1017,6 +1202,7 @@ def skip_if_callable(test, mycallable, r
return True
return False
+
def skip_if_library_missing(test, target, library):
def find_library(target, library):
for module in target.modules:
@@ -1028,11 +1214,18 @@ def skip_if_library_missing(test, target
if library.match(filename):
return False
return True
+
def find_library_callable(test):
return find_library(target, library)
- return skip_if_callable(test, find_library_callable, "could not find library matching '%s' in target %s" % (library, target))
+ return skip_if_callable(
+ test,
+ find_library_callable,
+ "could not find library matching '%s' in target %s" %
+ (library,
+ target))
+
-def wait_for_file_on_target(testcase, file_path, max_attempts = 6):
+def wait_for_file_on_target(testcase, file_path, max_attempts=6):
for i in range(max_attempts):
err, retcode, msg = testcase.run_platform_command("ls %s" % file_path)
if err.Success() and retcode == 0:
@@ -1042,10 +1235,13 @@ def wait_for_file_on_target(testcase, fi
import time
time.sleep(pow(2, i) * 0.25)
else:
- testcase.fail("File %s not found even after %d attempts." % (file_path, max_attempts))
+ testcase.fail(
+ "File %s not found even after %d attempts." %
+ (file_path, max_attempts))
err, retcode, data = testcase.run_platform_command("cat %s" % (file_path))
- testcase.assertTrue(err.Success() and retcode == 0,
- "Failed to read file %s: %s, retcode: %d" % (file_path, err.GetCString(), retcode))
+ testcase.assertTrue(
+ err.Success() and retcode == 0, "Failed to read file %s: %s, retcode: %d" %
+ (file_path, err.GetCString(), retcode))
return data
Modified: lldb/trunk/packages/Python/lldbsuite/test/lock.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/lock.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/lock.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/lock.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Interprocess mutex based on file locks
import fcntl
import os
+
class Lock:
def __init__(self, filename):
Modified: lldb/trunk/packages/Python/lldbsuite/test/logging/TestLogging.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/logging/TestLogging.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/logging/TestLogging.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/logging/TestLogging.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,15 @@ Test lldb logging. This test just makes
from __future__ import print_function
-
-import os, time, string
+import os
+import time
+import string
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LogTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,86 +26,97 @@ class LogTestCase(TestBase):
cls.RemoveTempFile(cls.truncate_log_file)
cls.RemoveTempFile(cls.append_log_file)
- def test (self):
+ def test(self):
self.build()
if self.debug_info == "dsym":
- self.command_log_tests ("dsym")
+ self.command_log_tests("dsym")
else:
- self.command_log_tests ("dwarf")
+ self.command_log_tests("dwarf")
- def command_log_tests (self, type):
- exe = os.path.join (os.getcwd(), "a.out")
+ def command_log_tests(self, type):
+ exe = os.path.join(os.getcwd(), "a.out")
self.expect("file " + exe,
- patterns = [ "Current executable set to .*a.out" ])
+ patterns=["Current executable set to .*a.out"])
- log_file = os.path.join (os.getcwd(), "lldb-commands-log-%s-%s-%s.txt" % (type,
- os.path.basename(self.getCompiler()),
- self.getArchitecture()))
+ log_file = os.path.join(
+ os.getcwd(),
+ "lldb-commands-log-%s-%s-%s.txt" %
+ (type,
+ os.path.basename(
+ self.getCompiler()),
+ self.getArchitecture()))
- if (os.path.exists (log_file)):
- os.remove (log_file)
+ if (os.path.exists(log_file)):
+ os.remove(log_file)
# By default, Debugger::EnableLog() will set log options to
# PREPEND_THREAD_NAME + OPTION_THREADSAFE. We don't want the
# threadnames here, so we enable just threadsafe (-t).
- self.runCmd ("log enable -t -f '%s' lldb commands" % (log_file))
-
- self.runCmd ("command alias bp breakpoint")
-
- self.runCmd ("bp set -n main")
+ self.runCmd("log enable -t -f '%s' lldb commands" % (log_file))
+
+ self.runCmd("command alias bp breakpoint")
- self.runCmd ("bp l")
+ self.runCmd("bp set -n main")
+
+ self.runCmd("bp l")
self.runCmd("log disable lldb")
- self.assertTrue (os.path.isfile (log_file))
+ self.assertTrue(os.path.isfile(log_file))
- f = open (log_file)
+ f = open(log_file)
log_lines = f.readlines()
- f.close ()
- os.remove (log_file)
+ f.close()
+ os.remove(log_file)
- self.assertGreater(len(log_lines), 0, "Something was written to the log file.")
+ self.assertGreater(
+ len(log_lines),
+ 0,
+ "Something was written to the log file.")
# Check that lldb truncates its log files
@no_debug_info_test
- def test_log_truncate (self):
- if (os.path.exists (self.truncate_log_file)):
- os.remove (self.truncate_log_file)
+ def test_log_truncate(self):
+ if (os.path.exists(self.truncate_log_file)):
+ os.remove(self.truncate_log_file)
# put something in our log file
with open(self.truncate_log_file, "w") as f:
for i in range(1, 1000):
f.write("bacon\n")
- self.runCmd ("log enable -t -f '%s' lldb commands" % (self.truncate_log_file))
- self.runCmd ("help log")
- self.runCmd ("log disable lldb")
+ self.runCmd(
+ "log enable -t -f '%s' lldb commands" %
+ (self.truncate_log_file))
+ self.runCmd("help log")
+ self.runCmd("log disable lldb")
- self.assertTrue (os.path.isfile (self.truncate_log_file))
+ self.assertTrue(os.path.isfile(self.truncate_log_file))
with open(self.truncate_log_file, "r") as f:
- contents = f.read ()
+ contents = f.read()
# check that it got removed
self.assertEquals(contents.find("bacon"), -1)
# Check that lldb can append to a log file
@no_debug_info_test
- def test_log_append (self):
- if (os.path.exists (self.append_log_file)):
- os.remove (self.append_log_file)
+ def test_log_append(self):
+ if (os.path.exists(self.append_log_file)):
+ os.remove(self.append_log_file)
# put something in our log file
with open(self.append_log_file, "w") as f:
f.write("bacon\n")
- self.runCmd ("log enable -t -a -f '%s' lldb commands" % (self.append_log_file))
- self.runCmd ("help log")
- self.runCmd ("log disable lldb")
+ self.runCmd(
+ "log enable -t -a -f '%s' lldb commands" %
+ (self.append_log_file))
+ self.runCmd("help log")
+ self.runCmd("log disable lldb")
- self.assertTrue (os.path.isfile (self.append_log_file))
+ self.assertTrue(os.path.isfile(self.append_log_file))
with open(self.append_log_file, "r") as f:
- contents = f.read ()
+ contents = f.read()
# check that it is still there
self.assertEquals(contents.find("bacon"), 0)
Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/add-dsym/TestAddDsymMidExecutionCommand.py Tue Sep 6 15:57:50 2016
@@ -3,14 +3,15 @@
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
import sys
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipUnlessDarwin
class AddDsymMidExecutionCommandCase(TestBase):
@@ -21,7 +22,7 @@ class AddDsymMidExecutionCommandCase(Tes
TestBase.setUp(self)
self.source = 'main.c'
- @no_debug_info_test # Prevent the genaration of the dwarf version of this test
+ @no_debug_info_test # Prevent the genaration of the dwarf version of this test
def test_add_dsym_mid_execution(self):
"""Test that add-dsym mid-execution loads the symbols at the right place for a slid binary."""
self.buildDsym(clean=True)
@@ -30,11 +31,12 @@ class AddDsymMidExecutionCommandCase(Tes
self.target = self.dbg.CreateTarget(exe)
self.assertTrue(self.target, VALID_TARGET)
- main_bp = self.target.BreakpointCreateByName ("main", "a.out")
+ main_bp = self.target.BreakpointCreateByName("main", "a.out")
self.assertTrue(main_bp, VALID_BREAKPOINT)
self.runCmd("settings set target.disable-aslr false")
- 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, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
@@ -44,4 +46,4 @@ class AddDsymMidExecutionCommandCase(Tes
self.runCmd("add-dsym hide.app/Contents/a.out.dSYM")
self.expect("frame select",
- substrs = ['a.out`main at main.c'])
+ substrs=['a.out`main at main.c'])
Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/debug-info/apple_types/TestAppleTypesIsProduced.py Tue Sep 6 15:57:50 2016
@@ -5,19 +5,20 @@ Test that clang produces the __apple acc
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
from lldbsuite.test.lldbutil import symbol_type_to_str
+
class AppleTypesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- #rdar://problem/11166975
+ # rdar://problem/11166975
@skipUnlessDarwin
def test_debug_info_for_apple_types(self):
"""Test that __apple_types section does get produced by clang."""
@@ -27,7 +28,8 @@ class AppleTypesTestCase(TestBase):
self.build()
if self.debug_info == "dsym":
- exe = os.path.join(os.getcwd(), "a.out.dSYM/Contents/Resources/DWARF/a.out")
+ exe = os.path.join(os.getcwd(),
+ "a.out.dSYM/Contents/Resources/DWARF/a.out")
else:
exe = os.path.join(os.getcwd(), "main.o")
Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/indirect_symbol/TestIndirectSymbols.py Tue Sep 6 15:57:50 2016
@@ -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 TestIndirectFunctions(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -30,60 +31,83 @@ class TestIndirectFunctions(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)
- break1 = target.BreakpointCreateBySourceRegex ("Set breakpoint here to step in indirect.", self.main_source_spec)
+ break1 = target.BreakpointCreateBySourceRegex(
+ "Set breakpoint here to step in indirect.", self.main_source_spec)
self.assertTrue(break1, VALID_BREAKPOINT)
- break2 = target.BreakpointCreateBySourceRegex ("Set breakpoint here to step in reexported.", self.main_source_spec)
+ break2 = target.BreakpointCreateBySourceRegex(
+ "Set breakpoint here to step in reexported.", self.main_source_spec)
self.assertTrue(break2, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break1)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(process, break1)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint 1.")
+ self.fail("Failed to stop at breakpoint 1.")
thread = threads[0]
- # Now do a step-into, and we should end up in the hidden target of this indirect function.
+ # Now do a step-into, and we should end up in the hidden target of this
+ # indirect function.
thread.StepInto()
curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue (curr_function == "call_through_indirect_hidden", "Stepped into indirect symbols.")
-
- # Now set a breakpoint using the indirect symbol name, and make sure we get to that:
- break_indirect = target.BreakpointCreateByName ("call_through_indirect");
- self.assertTrue (break_indirect, VALID_BREAKPOINT)
-
- # Now continue should take us to the second call through the indirect symbol:
-
- threads = lldbutil.continue_to_breakpoint (process, break_indirect)
- self.assertTrue (len(threads) == 1, "Stopped at breakpoint in indirect function.")
+ self.assertTrue(
+ curr_function == "call_through_indirect_hidden",
+ "Stepped into indirect symbols.")
+
+ # Now set a breakpoint using the indirect symbol name, and make sure we
+ # get to that:
+ break_indirect = target.BreakpointCreateByName("call_through_indirect")
+ self.assertTrue(break_indirect, VALID_BREAKPOINT)
+
+ # Now continue should take us to the second call through the indirect
+ # symbol:
+
+ threads = lldbutil.continue_to_breakpoint(process, break_indirect)
+ self.assertTrue(
+ len(threads) == 1,
+ "Stopped at breakpoint in indirect function.")
curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue (curr_function == "call_through_indirect_hidden", "Stepped into indirect symbols.")
+ self.assertTrue(
+ curr_function == "call_through_indirect_hidden",
+ "Stepped into indirect symbols.")
# Delete this breakpoint so it won't get in the way:
- target.BreakpointDelete (break_indirect.GetID())
+ target.BreakpointDelete(break_indirect.GetID())
- # Now continue to the site of the first re-exported function call in main:
- threads = lldbutil.continue_to_breakpoint (process, break2)
+ # Now continue to the site of the first re-exported function call in
+ # main:
+ threads = lldbutil.continue_to_breakpoint(process, break2)
- # This is stepping Into through a re-exported symbol to an indirect symbol:
+ # This is stepping Into through a re-exported symbol to an indirect
+ # symbol:
thread.StepInto()
curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue (curr_function == "call_through_indirect_hidden", "Stepped into indirect symbols.")
-
- # And the last bit is to set a breakpoint on the re-exported symbol and make sure we are again in out target function.
- break_reexported = target.BreakpointCreateByName ("reexport_to_indirect");
- self.assertTrue (break_reexported, VALID_BREAKPOINT)
-
- # Now continue should take us to the second call through the indirect symbol:
-
- threads = lldbutil.continue_to_breakpoint (process, break_reexported)
- self.assertTrue (len(threads) == 1, "Stopped at breakpoint in reexported function target.")
+ self.assertTrue(
+ curr_function == "call_through_indirect_hidden",
+ "Stepped into indirect symbols.")
+
+ # And the last bit is to set a breakpoint on the re-exported symbol and
+ # make sure we are again in out target function.
+ break_reexported = target.BreakpointCreateByName(
+ "reexport_to_indirect")
+ self.assertTrue(break_reexported, VALID_BREAKPOINT)
+
+ # Now continue should take us to the second call through the indirect
+ # symbol:
+
+ threads = lldbutil.continue_to_breakpoint(process, break_reexported)
+ self.assertTrue(
+ len(threads) == 1,
+ "Stopped at breakpoint in reexported function target.")
curr_function = thread.GetFrameAtIndex(0).GetFunctionName()
- self.assertTrue (curr_function == "call_through_indirect_hidden", "Stepped into indirect symbols.")
+ self.assertTrue(
+ curr_function == "call_through_indirect_hidden",
+ "Stepped into indirect symbols.")
Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/nslog/TestDarwinNSLogOutput.py Tue Sep 6 15:57:50 2016
@@ -18,6 +18,7 @@ from lldbsuite.test import decorators
from lldbsuite.test import lldbtest
from lldbsuite.test import lldbtest_config
+
@decorators.skipUnlessDarwin
class DarwinNSLogOutputTestCase(lldbtest.TestBase):
NO_DEBUG_INFO_TESTCASE = True
@@ -125,7 +126,9 @@ class DarwinNSLogOutputTestCase(lldbtest
])
self.assertIsNotNone(self.child.match)
self.assertGreater(len(self.child.match.groups()), 0)
- self.assertEqual("This is a message from NSLog", self.child.match.group(1))
+ self.assertEqual(
+ "This is a message from NSLog",
+ self.child.match.group(1))
def test_nslog_output_is_suppressed_with_env_var(self):
"""Test that NSLog() output does not show up with the ignore env var."""
Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/order/TestOrderFile.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Test that debug symbols have the correct
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class OrderFileTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -30,7 +31,7 @@ class OrderFileTestCase(TestBase):
output = self.res.GetOutput()
mo_f3 = re.search("Code +.+f3", output)
mo_f1 = re.search("Code +.+f1", output)
-
+
# Match objects for f3 and f1 must exist and f3 must come before f1.
self.assertTrue(mo_f3 and mo_f1 and mo_f3.start() < mo_f1.start(),
"Symbols have correct order by the order file")
Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/queues/TestQueues.py Tue Sep 6 15:57:50 2016
@@ -3,20 +3,21 @@
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 TestQueues(TestBase):
mydir = TestBase.compute_mydir(__file__)
@skipUnlessDarwin
- @add_test_categories(['pyapi'])
+ @add_test_categories(['pyapi'])
def test_with_python_api(self):
"""Test queues inspection SB APIs."""
self.build()
@@ -30,16 +31,34 @@ class TestQueues(TestBase):
self.main_source = "main.c"
def check_queue_for_valid_queue_id(self, queue):
- self.assertTrue(queue.GetQueueID() != 0, "Check queue %s for valid QueueID (got 0x%x)" % (queue.GetName(), queue.GetQueueID()))
-
- def check_running_and_pending_items_on_queue(self, queue, expected_running, expected_pending):
- self.assertTrue(queue.GetNumPendingItems() == expected_pending, "queue %s should have %d pending items, instead has %d pending items" % (queue.GetName(), expected_pending, (queue.GetNumPendingItems())))
- self.assertTrue(queue.GetNumRunningItems() == expected_running, "queue %s should have %d running items, instead has %d running items" % (queue.GetName(), expected_running, (queue.GetNumRunningItems())))
+ self.assertTrue(
+ queue.GetQueueID() != 0, "Check queue %s for valid QueueID (got 0x%x)" %
+ (queue.GetName(), queue.GetQueueID()))
+
+ def check_running_and_pending_items_on_queue(
+ self, queue, expected_running, expected_pending):
+ self.assertTrue(
+ queue.GetNumPendingItems() == expected_pending,
+ "queue %s should have %d pending items, instead has %d pending items" %
+ (queue.GetName(),
+ expected_pending,
+ (queue.GetNumPendingItems())))
+ self.assertTrue(
+ queue.GetNumRunningItems() == expected_running,
+ "queue %s should have %d running items, instead has %d running items" %
+ (queue.GetName(),
+ expected_running,
+ (queue.GetNumRunningItems())))
def check_number_of_threads_owned_by_queue(self, queue, number_threads):
- self.assertTrue(queue.GetNumThreads() == number_threads, "queue %s should have %d thread executing, but has %d" % (queue.GetName(), number_threads, queue.GetNumThreads()))
+ self.assertTrue(
+ queue.GetNumThreads() == number_threads,
+ "queue %s should have %d thread executing, but has %d" %
+ (queue.GetName(),
+ number_threads,
+ queue.GetNumThreads()))
- def check_queue_kind (self, queue, kind):
+ def check_queue_kind(self, queue, kind):
expected_kind_string = "Unknown"
if kind == lldb.eQueueKindSerial:
expected_kind_string = "Serial queue"
@@ -50,15 +69,39 @@ class TestQueues(TestBase):
actual_kind_string = "Serial queue"
if queue.GetKind() == lldb.eQueueKindConcurrent:
actual_kind_string = "Concurrent queue"
- self.assertTrue(queue.GetKind() == kind, "queue %s is expected to be a %s but it is actually a %s" % (queue.GetName(), expected_kind_string, actual_kind_string))
+ self.assertTrue(
+ queue.GetKind() == kind,
+ "queue %s is expected to be a %s but it is actually a %s" %
+ (queue.GetName(),
+ expected_kind_string,
+ actual_kind_string))
def check_queues_threads_match_queue(self, queue):
for idx in range(0, queue.GetNumThreads()):
t = queue.GetThreadAtIndex(idx)
- self.assertTrue(t.IsValid(), "Queue %s's thread #%d must be valid" % (queue.GetName(), idx))
- self.assertTrue(t.GetQueueID() == queue.GetQueueID(), "Queue %s has a QueueID of %d but its thread #%d has a QueueID of %d" % (queue.GetName(), queue.GetQueueID(), idx, t.GetQueueID()))
- self.assertTrue(t.GetQueueName() == queue.GetName(), "Queue %s has a QueueName of %s but its thread #%d has a QueueName of %s" % (queue.GetName(), queue.GetName(), idx, t.GetQueueName()))
- self.assertTrue(t.GetQueue().GetQueueID() == queue.GetQueueID(), "Thread #%d's Queue's QueueID of %d is not the same as the QueueID of its owning queue %d" % (idx, t.GetQueue().GetQueueID(), queue.GetQueueID()))
+ self.assertTrue(
+ t.IsValid(), "Queue %s's thread #%d must be valid" %
+ (queue.GetName(), idx))
+ self.assertTrue(
+ t.GetQueueID() == queue.GetQueueID(),
+ "Queue %s has a QueueID of %d but its thread #%d has a QueueID of %d" %
+ (queue.GetName(),
+ queue.GetQueueID(),
+ idx,
+ t.GetQueueID()))
+ self.assertTrue(
+ t.GetQueueName() == queue.GetName(),
+ "Queue %s has a QueueName of %s but its thread #%d has a QueueName of %s" %
+ (queue.GetName(),
+ queue.GetName(),
+ idx,
+ t.GetQueueName()))
+ self.assertTrue(
+ t.GetQueue().GetQueueID() == queue.GetQueueID(),
+ "Thread #%d's Queue's QueueID of %d is not the same as the QueueID of its owning queue %d" %
+ (idx,
+ t.GetQueue().GetQueueID(),
+ queue.GetQueueID()))
def queues(self):
"""Test queues inspection SB APIs without libBacktraceRecording."""
@@ -66,53 +109,58 @@ class TestQueues(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
- break1 = target.BreakpointCreateByName ("stopper", 'a.out')
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
+ break1 = target.BreakpointCreateByName("stopper", 'a.out')
self.assertTrue(break1, 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)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break1)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(process, break1)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint 1.")
+ self.fail("Failed to stop at breakpoint 1.")
queue_submittor_1 = lldb.SBQueue()
queue_performer_1 = lldb.SBQueue()
queue_performer_2 = lldb.SBQueue()
queue_performer_3 = lldb.SBQueue()
- for idx in range (0, process.GetNumQueues()):
- q = process.GetQueueAtIndex(idx)
- if q.GetName() == "com.apple.work_submittor_1":
- queue_submittor_1 = q
- if q.GetName() == "com.apple.work_performer_1":
- queue_performer_1 = q
- if q.GetName() == "com.apple.work_performer_2":
- queue_performer_2 = q
- if q.GetName() == "com.apple.work_performer_3":
- queue_performer_3 = q
-
- self.assertTrue(queue_submittor_1.IsValid() and queue_performer_1.IsValid() and queue_performer_2.IsValid() and queue_performer_3.IsValid(), "Got all four expected queues: %s %s %s %s" % (queue_submittor_1.IsValid(), queue_performer_1.IsValid(), queue_performer_2.IsValid(), queue_performer_3.IsValid()))
-
- self.check_queue_for_valid_queue_id (queue_submittor_1)
- self.check_queue_for_valid_queue_id (queue_performer_1)
- self.check_queue_for_valid_queue_id (queue_performer_2)
- self.check_queue_for_valid_queue_id (queue_performer_3)
-
- self.check_number_of_threads_owned_by_queue (queue_submittor_1, 1)
- self.check_number_of_threads_owned_by_queue (queue_performer_1, 1)
- self.check_number_of_threads_owned_by_queue (queue_performer_2, 1)
- self.check_number_of_threads_owned_by_queue (queue_performer_3, 4)
-
- self.check_queue_kind (queue_submittor_1, lldb.eQueueKindSerial)
- self.check_queue_kind (queue_performer_1, lldb.eQueueKindSerial)
- self.check_queue_kind (queue_performer_2, lldb.eQueueKindSerial)
- self.check_queue_kind (queue_performer_3, lldb.eQueueKindConcurrent)
-
- self.check_queues_threads_match_queue (queue_submittor_1)
- self.check_queues_threads_match_queue (queue_performer_1)
- self.check_queues_threads_match_queue (queue_performer_2)
- self.check_queues_threads_match_queue (queue_performer_3)
-
-
+ for idx in range(0, process.GetNumQueues()):
+ q = process.GetQueueAtIndex(idx)
+ if q.GetName() == "com.apple.work_submittor_1":
+ queue_submittor_1 = q
+ if q.GetName() == "com.apple.work_performer_1":
+ queue_performer_1 = q
+ if q.GetName() == "com.apple.work_performer_2":
+ queue_performer_2 = q
+ if q.GetName() == "com.apple.work_performer_3":
+ queue_performer_3 = q
+
+ self.assertTrue(
+ queue_submittor_1.IsValid() and queue_performer_1.IsValid() and queue_performer_2.IsValid() and queue_performer_3.IsValid(),
+ "Got all four expected queues: %s %s %s %s" %
+ (queue_submittor_1.IsValid(),
+ queue_performer_1.IsValid(),
+ queue_performer_2.IsValid(),
+ queue_performer_3.IsValid()))
+
+ self.check_queue_for_valid_queue_id(queue_submittor_1)
+ self.check_queue_for_valid_queue_id(queue_performer_1)
+ self.check_queue_for_valid_queue_id(queue_performer_2)
+ self.check_queue_for_valid_queue_id(queue_performer_3)
+
+ self.check_number_of_threads_owned_by_queue(queue_submittor_1, 1)
+ self.check_number_of_threads_owned_by_queue(queue_performer_1, 1)
+ self.check_number_of_threads_owned_by_queue(queue_performer_2, 1)
+ self.check_number_of_threads_owned_by_queue(queue_performer_3, 4)
+
+ self.check_queue_kind(queue_submittor_1, lldb.eQueueKindSerial)
+ self.check_queue_kind(queue_performer_1, lldb.eQueueKindSerial)
+ self.check_queue_kind(queue_performer_2, lldb.eQueueKindSerial)
+ self.check_queue_kind(queue_performer_3, lldb.eQueueKindConcurrent)
+
+ self.check_queues_threads_match_queue(queue_submittor_1)
+ self.check_queues_threads_match_queue(queue_performer_1)
+ self.check_queues_threads_match_queue(queue_performer_2)
+ self.check_queues_threads_match_queue(queue_performer_3)
# We have threads running with all the different dispatch QoS service
# levels - find those threads and check that we can get the correct
@@ -135,109 +183,172 @@ class TestQueues(TestBase):
if th.GetName() == "background QoS":
background_thread = th
- self.assertTrue(user_initiated_thread.IsValid(), "Found user initiated QoS thread")
- self.assertTrue(user_interactive_thread.IsValid(), "Found user interactive QoS thread")
+ self.assertTrue(
+ user_initiated_thread.IsValid(),
+ "Found user initiated QoS thread")
+ self.assertTrue(
+ user_interactive_thread.IsValid(),
+ "Found user interactive QoS thread")
self.assertTrue(utility_thread.IsValid(), "Found utility QoS thread")
- self.assertTrue(unspecified_thread.IsValid(), "Found unspecified QoS thread")
- self.assertTrue(background_thread.IsValid(), "Found background QoS thread")
+ self.assertTrue(
+ unspecified_thread.IsValid(),
+ "Found unspecified QoS thread")
+ self.assertTrue(
+ background_thread.IsValid(),
+ "Found background QoS thread")
stream = lldb.SBStream()
- self.assertTrue(user_initiated_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for user initiated QoS thread")
- self.assertTrue(stream.GetData() == "User Initiated", "user initiated QoS thread name is valid")
+ self.assertTrue(
+ user_initiated_thread.GetInfoItemByPathAsString(
+ "requested_qos.printable_name",
+ stream),
+ "Get QoS printable string for user initiated QoS thread")
+ self.assertTrue(
+ stream.GetData() == "User Initiated",
+ "user initiated QoS thread name is valid")
stream.Clear()
- self.assertTrue(user_interactive_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for user interactive QoS thread")
- self.assertTrue(stream.GetData() == "User Interactive", "user interactive QoS thread name is valid")
+ self.assertTrue(
+ user_interactive_thread.GetInfoItemByPathAsString(
+ "requested_qos.printable_name",
+ stream),
+ "Get QoS printable string for user interactive QoS thread")
+ self.assertTrue(
+ stream.GetData() == "User Interactive",
+ "user interactive QoS thread name is valid")
stream.Clear()
- self.assertTrue(utility_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for utility QoS thread")
- self.assertTrue(stream.GetData() == "Utility", "utility QoS thread name is valid")
+ self.assertTrue(
+ utility_thread.GetInfoItemByPathAsString(
+ "requested_qos.printable_name",
+ stream),
+ "Get QoS printable string for utility QoS thread")
+ self.assertTrue(
+ stream.GetData() == "Utility",
+ "utility QoS thread name is valid")
stream.Clear()
- self.assertTrue(unspecified_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for unspecified QoS thread")
- self.assertTrue(stream.GetData() == "User Initiated", "unspecified QoS thread name is valid")
+ self.assertTrue(
+ unspecified_thread.GetInfoItemByPathAsString(
+ "requested_qos.printable_name",
+ stream),
+ "Get QoS printable string for unspecified QoS thread")
+ self.assertTrue(
+ stream.GetData() == "User Initiated",
+ "unspecified QoS thread name is valid")
stream.Clear()
- self.assertTrue(background_thread.GetInfoItemByPathAsString("requested_qos.printable_name", stream), "Get QoS printable string for background QoS thread")
- self.assertTrue(stream.GetData() == "Background", "background QoS thread name is valid")
+ self.assertTrue(
+ background_thread.GetInfoItemByPathAsString(
+ "requested_qos.printable_name",
+ stream),
+ "Get QoS printable string for background QoS thread")
+ self.assertTrue(
+ stream.GetData() == "Background",
+ "background QoS thread name is valid")
def queues_with_libBacktraceRecording(self):
"""Test queues inspection SB APIs with libBacktraceRecording present."""
exe = os.path.join(os.getcwd(), "a.out")
- if not os.path.isfile('/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib'):
- self.skipTest ("Skipped because libBacktraceRecording.dylib was present on the system.")
-
- if not os.path.isfile('/usr/lib/system/introspection/libdispatch.dylib'):
- self.skipTest ("Skipped because introspection libdispatch dylib is not present.")
-
+ if not os.path.isfile(
+ '/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib'):
+ self.skipTest(
+ "Skipped because libBacktraceRecording.dylib was present on the system.")
+
+ if not os.path.isfile(
+ '/usr/lib/system/introspection/libdispatch.dylib'):
+ self.skipTest(
+ "Skipped because introspection libdispatch dylib is not present.")
+
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)
- break1 = target.BreakpointCreateByName ("stopper", 'a.out')
+ break1 = target.BreakpointCreateByName("stopper", 'a.out')
self.assertTrue(break1, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, ['DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib', 'DYLD_LIBRARY_PATH=/usr/lib/system/introspection'], self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None,
+ [
+ 'DYLD_INSERT_LIBRARIES=/Applications/Xcode.app/Contents/Developer/usr/lib/libBacktraceRecording.dylib',
+ 'DYLD_LIBRARY_PATH=/usr/lib/system/introspection'],
+ self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# The stop reason of the thread should be breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break1)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(process, break1)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint 1.")
+ self.fail("Failed to stop at breakpoint 1.")
libbtr_module_filespec = lldb.SBFileSpec("libBacktraceRecording.dylib")
- libbtr_module = target.FindModule (libbtr_module_filespec)
+ libbtr_module = target.FindModule(libbtr_module_filespec)
if not libbtr_module.IsValid():
- self.skipTest ("Skipped because libBacktraceRecording.dylib was not loaded into the process.")
+ self.skipTest(
+ "Skipped because libBacktraceRecording.dylib was not loaded into the process.")
- self.assertTrue(process.GetNumQueues() >= 4, "Found the correct number of queues.")
+ self.assertTrue(
+ process.GetNumQueues() >= 4,
+ "Found the correct number of queues.")
queue_submittor_1 = lldb.SBQueue()
queue_performer_1 = lldb.SBQueue()
queue_performer_2 = lldb.SBQueue()
queue_performer_3 = lldb.SBQueue()
- for idx in range (0, process.GetNumQueues()):
- q = process.GetQueueAtIndex(idx)
- if q.GetName() == "com.apple.work_submittor_1":
- queue_submittor_1 = q
- if q.GetName() == "com.apple.work_performer_1":
- queue_performer_1 = q
- if q.GetName() == "com.apple.work_performer_2":
- queue_performer_2 = q
- if q.GetName() == "com.apple.work_performer_3":
- queue_performer_3 = q
-
- self.assertTrue(queue_submittor_1.IsValid() and queue_performer_1.IsValid() and queue_performer_2.IsValid() and queue_performer_3.IsValid(), "Got all four expected queues: %s %s %s %s" % (queue_submittor_1.IsValid(), queue_performer_1.IsValid(), queue_performer_2.IsValid(), queue_performer_3.IsValid()))
-
- self.check_queue_for_valid_queue_id (queue_submittor_1)
- self.check_queue_for_valid_queue_id (queue_performer_1)
- self.check_queue_for_valid_queue_id (queue_performer_2)
- self.check_queue_for_valid_queue_id (queue_performer_3)
-
- self.check_running_and_pending_items_on_queue (queue_submittor_1, 1, 0)
- self.check_running_and_pending_items_on_queue (queue_performer_1, 1, 3)
- self.check_running_and_pending_items_on_queue (queue_performer_2, 1, 9999)
- self.check_running_and_pending_items_on_queue (queue_performer_3, 4, 0)
-
- self.check_number_of_threads_owned_by_queue (queue_submittor_1, 1)
- self.check_number_of_threads_owned_by_queue (queue_performer_1, 1)
- self.check_number_of_threads_owned_by_queue (queue_performer_2, 1)
- self.check_number_of_threads_owned_by_queue (queue_performer_3, 4)
-
- self.check_queue_kind (queue_submittor_1, lldb.eQueueKindSerial)
- self.check_queue_kind (queue_performer_1, lldb.eQueueKindSerial)
- self.check_queue_kind (queue_performer_2, lldb.eQueueKindSerial)
- self.check_queue_kind (queue_performer_3, lldb.eQueueKindConcurrent)
-
-
- self.check_queues_threads_match_queue (queue_submittor_1)
- self.check_queues_threads_match_queue (queue_performer_1)
- self.check_queues_threads_match_queue (queue_performer_2)
- self.check_queues_threads_match_queue (queue_performer_3)
-
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(0).IsValid(), "queue 2's pending item #0 is valid")
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(0).GetAddress().GetSymbol().GetName() == "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
- self.assertTrue(queue_performer_2.GetNumPendingItems() == 9999, "verify that queue 2 still has 9999 pending items")
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(9998).IsValid(), "queue 2's pending item #9998 is valid")
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(9998).GetAddress().GetSymbol().GetName() == "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
- self.assertTrue(queue_performer_2.GetPendingItemAtIndex(9999).IsValid() == False, "queue 2's pending item #9999 is invalid")
+ for idx in range(0, process.GetNumQueues()):
+ q = process.GetQueueAtIndex(idx)
+ if q.GetName() == "com.apple.work_submittor_1":
+ queue_submittor_1 = q
+ if q.GetName() == "com.apple.work_performer_1":
+ queue_performer_1 = q
+ if q.GetName() == "com.apple.work_performer_2":
+ queue_performer_2 = q
+ if q.GetName() == "com.apple.work_performer_3":
+ queue_performer_3 = q
+
+ self.assertTrue(
+ queue_submittor_1.IsValid() and queue_performer_1.IsValid() and queue_performer_2.IsValid() and queue_performer_3.IsValid(),
+ "Got all four expected queues: %s %s %s %s" %
+ (queue_submittor_1.IsValid(),
+ queue_performer_1.IsValid(),
+ queue_performer_2.IsValid(),
+ queue_performer_3.IsValid()))
+
+ self.check_queue_for_valid_queue_id(queue_submittor_1)
+ self.check_queue_for_valid_queue_id(queue_performer_1)
+ self.check_queue_for_valid_queue_id(queue_performer_2)
+ self.check_queue_for_valid_queue_id(queue_performer_3)
+
+ self.check_running_and_pending_items_on_queue(queue_submittor_1, 1, 0)
+ self.check_running_and_pending_items_on_queue(queue_performer_1, 1, 3)
+ self.check_running_and_pending_items_on_queue(
+ queue_performer_2, 1, 9999)
+ self.check_running_and_pending_items_on_queue(queue_performer_3, 4, 0)
+
+ self.check_number_of_threads_owned_by_queue(queue_submittor_1, 1)
+ self.check_number_of_threads_owned_by_queue(queue_performer_1, 1)
+ self.check_number_of_threads_owned_by_queue(queue_performer_2, 1)
+ self.check_number_of_threads_owned_by_queue(queue_performer_3, 4)
+
+ self.check_queue_kind(queue_submittor_1, lldb.eQueueKindSerial)
+ self.check_queue_kind(queue_performer_1, lldb.eQueueKindSerial)
+ self.check_queue_kind(queue_performer_2, lldb.eQueueKindSerial)
+ self.check_queue_kind(queue_performer_3, lldb.eQueueKindConcurrent)
+
+ self.check_queues_threads_match_queue(queue_submittor_1)
+ self.check_queues_threads_match_queue(queue_performer_1)
+ self.check_queues_threads_match_queue(queue_performer_2)
+ self.check_queues_threads_match_queue(queue_performer_3)
+
+ self.assertTrue(queue_performer_2.GetPendingItemAtIndex(
+ 0).IsValid(), "queue 2's pending item #0 is valid")
+ self.assertTrue(queue_performer_2.GetPendingItemAtIndex(0).GetAddress().GetSymbol(
+ ).GetName() == "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
+ self.assertTrue(
+ queue_performer_2.GetNumPendingItems() == 9999,
+ "verify that queue 2 still has 9999 pending items")
+ self.assertTrue(queue_performer_2.GetPendingItemAtIndex(
+ 9998).IsValid(), "queue 2's pending item #9998 is valid")
+ self.assertTrue(queue_performer_2.GetPendingItemAtIndex(9998).GetAddress().GetSymbol(
+ ).GetName() == "doing_the_work_2", "queue 2's pending item #0 should be doing_the_work_2")
+ self.assertTrue(queue_performer_2.GetPendingItemAtIndex(
+ 9999).IsValid() == False, "queue 2's pending item #9999 is invalid")
Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/safe-to-func-call/TestSafeFuncCalls.py Tue Sep 6 15:57:50 2016
@@ -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 TestSafeFuncCalls(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,36 +30,44 @@ class TestSafeFuncCalls(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- self.main_source_spec = lldb.SBFileSpec (self.main_source)
- break1 = target.BreakpointCreateByName ("stopper", 'a.out')
+ self.main_source_spec = lldb.SBFileSpec(self.main_source)
+ break1 = target.BreakpointCreateByName("stopper", 'a.out')
self.assertTrue(break1, 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)
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, break1)
+ threads = lldbutil.get_threads_stopped_at_breakpoint(process, break1)
if len(threads) != 1:
- self.fail ("Failed to stop at breakpoint 1.")
+ self.fail("Failed to stop at breakpoint 1.")
self.check_number_of_threads(process)
main_thread = lldb.SBThread()
select_thread = lldb.SBThread()
- for idx in range (0, process.GetNumThreads()):
- t = process.GetThreadAtIndex (idx)
+ for idx in range(0, process.GetNumThreads()):
+ t = process.GetThreadAtIndex(idx)
if t.GetName() == "main thread":
main_thread = t
if t.GetName() == "select thread":
select_thread = t
- self.assertTrue(main_thread.IsValid() and select_thread.IsValid(), "Got both expected threads")
+ self.assertTrue(
+ main_thread.IsValid() and select_thread.IsValid(),
+ "Got both expected threads")
- self.safe_to_call_func_on_main_thread (main_thread)
- self.safe_to_call_func_on_select_thread (select_thread)
+ self.safe_to_call_func_on_main_thread(main_thread)
+ self.safe_to_call_func_on_select_thread(select_thread)
def check_number_of_threads(self, process):
- self.assertTrue(process.GetNumThreads() == 2, "Check that the process has two threads when sitting at the stopper() breakpoint")
-
- def safe_to_call_func_on_main_thread (self, main_thread):
- self.assertTrue(main_thread.SafeToCallFunctions() == True, "It is safe to call functions on the main thread")
-
- def safe_to_call_func_on_select_thread (self, select_thread):
- self.assertTrue(select_thread.SafeToCallFunctions() == False, "It is not safe to call functions on the select thread")
+ self.assertTrue(
+ process.GetNumThreads() == 2,
+ "Check that the process has two threads when sitting at the stopper() breakpoint")
+
+ def safe_to_call_func_on_main_thread(self, main_thread):
+ self.assertTrue(main_thread.SafeToCallFunctions(),
+ "It is safe to call functions on the main thread")
+
+ def safe_to_call_func_on_select_thread(self, select_thread):
+ self.assertTrue(
+ select_thread.SafeToCallFunctions() == False,
+ "It is not safe to call functions on the select thread")
Modified: lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/macosx/universal/TestUniversal.py Tue Sep 6 15:57:50 2016
@@ -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 UniversalTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,12 +20,12 @@ class UniversalTestCase(TestBase):
# 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.')
+ self.line = line_number('main.c', '// Set break point at this line.')
@add_test_categories(['pyapi'])
@skipUnlessDarwin
- @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in ['i386', 'x86_64'],
- "requires i386 or x86_64")
+ @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in [
+ 'i386', 'x86_64'], "requires i386 or x86_64")
def test_sbdebugger_create_target_with_file_and_target_triple(self):
"""Test the SBDebugger.CreateTargetWithFileAndTargetTriple() API."""
# Invoke the default build rule.
@@ -34,16 +35,18 @@ class UniversalTestCase(TestBase):
exe = os.path.join(os.getcwd(), "testit")
# Create a target by the debugger.
- target = self.dbg.CreateTargetWithFileAndTargetTriple(exe, "i386-apple-macosx")
+ target = self.dbg.CreateTargetWithFileAndTargetTriple(
+ exe, "i386-apple-macosx")
self.assertTrue(target, VALID_TARGET)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
@skipUnlessDarwin
- @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in ['i386', 'x86_64'],
- "requires i386 or x86_64")
+ @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in [
+ 'i386', 'x86_64'], "requires i386 or x86_64")
def test_process_launch_for_universal(self):
"""Test process launch of a universal binary."""
from lldbsuite.test.lldbutil import print_registers
@@ -56,11 +59,12 @@ class UniversalTestCase(TestBase):
# By default, x86_64 is assumed if no architecture is specified.
self.expect("file " + exe, CURRENT_EXECUTABLE_SET,
- startstr = "Current executable set to ",
- substrs = ["testit' (x86_64)."])
+ startstr="Current executable set to ",
+ substrs=["testit' (x86_64)."])
# 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)
# We should be able to launch the x86_64 executable.
self.runCmd("run", RUN_SUCCEEDED)
@@ -75,17 +79,18 @@ class UniversalTestCase(TestBase):
frame = process.GetThreadAtIndex(0).GetFrameAtIndex(0)
registers = print_registers(frame, string_buffer=True)
self.expect(registers, exe=False,
- substrs = ['Name: rax'])
+ substrs=['Name: rax'])
self.runCmd("continue")
# Now specify i386 as the architecture for "testit".
self.expect("file -a i386 " + exe, CURRENT_EXECUTABLE_SET,
- startstr = "Current executable set to ",
- substrs = ["testit' (i386)."])
+ startstr="Current executable set to ",
+ substrs=["testit' (i386)."])
# 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)
# We should be able to launch the i386 executable as well.
self.runCmd("run", RUN_SUCCEEDED)
@@ -97,24 +102,26 @@ class UniversalTestCase(TestBase):
"32-bit process launched")
pointerSize = self.invoke(process, 'GetAddressByteSize')
- self.assertTrue(pointerSize == 4,
- "AddressByteSize of 32-bit process should be 4, got %d instead." % pointerSize)
+ self.assertTrue(
+ pointerSize == 4,
+ "AddressByteSize of 32-bit process should be 4, got %d instead." %
+ pointerSize)
frame = process.GetThreadAtIndex(0).GetFrameAtIndex(0)
registers = print_registers(frame, string_buffer=True)
self.expect(registers, exe=False,
- substrs = ['Name: eax'])
+ substrs=['Name: eax'])
self.runCmd("continue")
-
@skipUnlessDarwin
- @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in ['i386', 'x86_64'],
- "requires i386 or x86_64")
+ @unittest2.skipUnless(hasattr(os, "uname") and os.uname()[4] in [
+ 'i386', 'x86_64'], "requires i386 or x86_64")
def test_process_attach_with_wrong_arch(self):
"""Test that when we attach to a binary from the wrong fork of a universal binary, we fix up the ABI correctly."""
# Now keep the architecture at 32 bit, but switch the binary we launch to
- # 64 bit, and make sure on attach we switch to the correct architecture.
+ # 64 bit, and make sure on attach we switch to the correct
+ # architecture.
# Invoke the default build rule.
self.build()
@@ -122,23 +129,27 @@ class UniversalTestCase(TestBase):
# Note that "testit" is a universal binary.
exe = os.path.join(os.getcwd(), "testit")
-
# Create a target by the debugger.
- target = self.dbg.CreateTargetWithFileAndTargetTriple(exe, "i386-apple-macosx")
+ target = self.dbg.CreateTargetWithFileAndTargetTriple(
+ exe, "i386-apple-macosx")
self.assertTrue(target, VALID_TARGET)
pointer_size = target.GetAddressByteSize()
self.assertTrue(pointer_size == 4, "Initially we were 32 bit.")
- bkpt = target.BreakpointCreateBySourceRegex("sleep", lldb.SBFileSpec("main.c"))
- self.assertTrue (bkpt.IsValid(), "Valid breakpoint")
- self.assertTrue(bkpt.GetNumLocations() >= 1, "Our main breakpoint has locations.")
+ bkpt = target.BreakpointCreateBySourceRegex(
+ "sleep", lldb.SBFileSpec("main.c"))
+ self.assertTrue(bkpt.IsValid(), "Valid breakpoint")
+ self.assertTrue(
+ bkpt.GetNumLocations() >= 1,
+ "Our main breakpoint has locations.")
popen = self.spawnSubprocess(exe, ["keep_waiting"])
self.addTearDownHook(self.cleanupSubprocesses)
error = lldb.SBError()
empty_listener = lldb.SBListener()
- process = target.AttachToProcessWithID(empty_listener, popen.pid, error)
+ process = target.AttachToProcessWithID(
+ empty_listener, popen.pid, error)
self.assertTrue(error.Success(), "Attached to process.")
pointer_size = target.GetAddressByteSize()
@@ -153,4 +164,6 @@ class UniversalTestCase(TestBase):
threads = lldbutil.continue_to_breakpoint(process, bkpt)
self.assertTrue(len(threads) == 1)
thread = threads[0]
- self.assertTrue(thread.GetNumFrames() > 1, "We were able to backtrace.")
+ self.assertTrue(
+ thread.GetNumFrames() > 1,
+ "We were able to backtrace.")
Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_base.py Tue Sep 6 15:57:50 2016
@@ -23,36 +23,41 @@ import lldbsuite.test.lldbtest as lldbte
import lldbsuite.test.lldbutil as lldbutil
from lldbsuite.test_event import build_exception
+
def getArchitecture():
"""Returns the architecture in effect the test suite is running with."""
return os.environ["ARCH"] if "ARCH" in os.environ else ""
+
def getCompiler():
"""Returns the compiler in effect the test suite is running with."""
compiler = os.environ.get("CC", "clang")
compiler = lldbutil.which(compiler)
return os.path.realpath(compiler)
+
def getArchFlag():
"""Returns the flag required to specify the arch"""
compiler = getCompiler()
if compiler is None:
- return ""
+ return ""
elif "gcc" in compiler:
- archflag = "-m"
+ archflag = "-m"
elif "clang" in compiler:
- archflag = "-arch"
+ archflag = "-arch"
else:
- archflag = None
+ archflag = None
return ("ARCHFLAG=" + archflag) if archflag else ""
+
def getMake():
"""Returns the name for GNU make"""
if platform.system() == "FreeBSD" or platform.system() == "NetBSD":
- return "gmake"
+ return "gmake"
else:
- return "make"
+ return "make"
+
def getArchSpec(architecture):
"""
@@ -65,6 +70,7 @@ def getArchSpec(architecture):
return ("ARCH=" + arch) if arch else ""
+
def getCCSpec(compiler):
"""
Helper function to return the key-value string to specify the compiler
@@ -78,6 +84,7 @@ def getCCSpec(compiler):
else:
return ""
+
def getCmdLine(d):
"""
Helper function to return a properly formatted command line argument(s)
@@ -109,55 +116,87 @@ def runBuildCommands(commands, sender):
raise build_exception.BuildError(called_process_error)
-def buildDefault(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+def buildDefault(
+ sender=None,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
"""Build the binaries the default way."""
commands = []
if clean:
commands.append([getMake(), "clean", getCmdLine(dictionary)])
- commands.append([getMake(), getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+ commands.append([getMake(), getArchSpec(architecture),
+ getCCSpec(compiler), getCmdLine(dictionary)])
runBuildCommands(commands, sender=sender)
# True signifies that we can handle building default.
return True
-def buildDwarf(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+
+def buildDwarf(
+ sender=None,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
"""Build the binaries with dwarf debug info."""
commands = []
if clean:
commands.append([getMake(), "clean", getCmdLine(dictionary)])
- commands.append([getMake(), "MAKE_DSYM=NO", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+ commands.append([getMake(), "MAKE_DSYM=NO", getArchSpec(
+ architecture), getCCSpec(compiler), getCmdLine(dictionary)])
runBuildCommands(commands, sender=sender)
# True signifies that we can handle building dwarf.
return True
-def buildDwo(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+
+def buildDwo(
+ sender=None,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
"""Build the binaries with dwarf debug info."""
commands = []
if clean:
commands.append([getMake(), "clean", getCmdLine(dictionary)])
- commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_DWO=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+ commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_DWO=YES", getArchSpec(
+ architecture), getCCSpec(compiler), getCmdLine(dictionary)])
runBuildCommands(commands, sender=sender)
# True signifies that we can handle building dwo.
return True
-def buildGModules(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+
+def buildGModules(
+ sender=None,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
"""Build the binaries with dwarf debug info."""
commands = []
if clean:
commands.append([getMake(), "clean", getCmdLine(dictionary)])
- commands.append([getMake(), "MAKE_DSYM=NO", "MAKE_GMODULES=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+ commands.append([getMake(),
+ "MAKE_DSYM=NO",
+ "MAKE_GMODULES=YES",
+ getArchSpec(architecture),
+ getCCSpec(compiler),
+ getCmdLine(dictionary)])
lldbtest.system(commands, sender=sender)
# True signifies that we can handle building with gmodules.
return True
+
def cleanup(sender=None, dictionary=None):
"""Perform a platform-specific cleanup after the test."""
#import traceback
- #traceback.print_stack()
+ # traceback.print_stack()
commands = []
if os.path.isfile("Makefile"):
commands.append([getMake(), "clean", getCmdLine(dictionary)])
Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_darwin.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_darwin.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_darwin.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_darwin.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,20 @@ import lldbsuite.test.lldbtest as lldbte
from builder_base import *
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+
+def buildDsym(
+ sender=None,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
"""Build the binaries with dsym debug info."""
commands = []
if clean:
commands.append(["make", "clean", getCmdLine(dictionary)])
- commands.append(["make", "MAKE_DSYM=YES", getArchSpec(architecture), getCCSpec(compiler), getCmdLine(dictionary)])
+ commands.append(["make", "MAKE_DSYM=YES", getArchSpec(
+ architecture), getCCSpec(compiler), getCmdLine(dictionary)])
runBuildCommands(commands, sender=sender)
Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_freebsd.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_freebsd.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_freebsd.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_freebsd.py Tue Sep 6 15:57:50 2016
@@ -1,4 +1,10 @@
from builder_base import *
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+
+def buildDsym(
+ sender=None,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
return False
Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_linux.py Tue Sep 6 15:57:50 2016
@@ -1,4 +1,10 @@
from builder_base import *
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+
+def buildDsym(
+ sender=None,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
return False
Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_netbsd.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_netbsd.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_netbsd.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_netbsd.py Tue Sep 6 15:57:50 2016
@@ -1,4 +1,10 @@
from builder_base import *
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+
+def buildDsym(
+ sender=None,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
return False
Modified: lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_win32.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_win32.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_win32.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/plugins/builder_win32.py Tue Sep 6 15:57:50 2016
@@ -1,4 +1,10 @@
from builder_base import *
-def buildDsym(sender=None, architecture=None, compiler=None, dictionary=None, clean=True):
+
+def buildDsym(
+ sender=None,
+ architecture=None,
+ compiler=None,
+ dictionary=None,
+ clean=True):
return False
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Test SBBreakpoint APIs.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class BreakpointAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -36,11 +37,15 @@ class BreakpointAPITestCase(TestBase):
# Now delete it:
did_delete = target.BreakpointDelete(breakpoint.GetID())
- self.assertTrue (did_delete, "Did delete the breakpoint we just created.")
+ self.assertTrue(
+ did_delete,
+ "Did delete the breakpoint we just created.")
# Make sure we can't find it:
- del_bkpt = target.FindBreakpointByID (breakpoint.GetID())
- self.assertTrue (not del_bkpt, "We did delete the breakpoint.")
+ del_bkpt = target.FindBreakpointByID(breakpoint.GetID())
+ self.assertTrue(not del_bkpt, "We did delete the breakpoint.")
# Finally make sure the original breakpoint is no longer valid.
- self.assertTrue (not breakpoint, "Breakpoint we deleted is no longer valid.")
+ self.assertTrue(
+ not breakpoint,
+ "Breakpoint we deleted is no longer valid.")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Test SBType APIs to fetch member functio
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SBTypeMemberFunctionsTest(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -44,35 +45,56 @@ class SBTypeMemberFunctionsTest(TestBase
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
-
+
variable = frame0.FindVariable("d")
Derived = variable.GetType()
Base = Derived.GetDirectBaseClassAtIndex(0).GetType()
- self.assertTrue(Derived.GetNumberOfMemberFunctions() == 2, "Derived declares two methods")
- self.assertTrue(Derived.GetMemberFunctionAtIndex(0).GetType().GetFunctionReturnType().GetName() == "int", "Derived::dImpl returns int")
-
- self.assertTrue(Base.GetNumberOfMemberFunctions() == 4, "Base declares three methods")
- self.assertTrue(Base.GetMemberFunctionAtIndex(3).GetType().GetFunctionArgumentTypes().GetSize() == 3, "Base::sfunc takes three arguments")
- self.assertTrue(Base.GetMemberFunctionAtIndex(3).GetName() == "sfunc", "Base::sfunc not found")
- self.assertTrue(Base.GetMemberFunctionAtIndex(3).GetKind() == lldb.eMemberFunctionKindStaticMethod, "Base::sfunc is a static")
- self.assertTrue(Base.GetMemberFunctionAtIndex(2).GetType().GetFunctionArgumentTypes().GetSize() == 0, "Base::dat takes no arguments")
- self.assertTrue(Base.GetMemberFunctionAtIndex(1).GetType().GetFunctionArgumentTypes().GetTypeAtIndex(1).GetName() == "char", "Base::bar takes a second 'char' argument")
- self.assertTrue(Base.GetMemberFunctionAtIndex(1).GetName() == "bar", "Base::bar not found")
-
+ self.assertTrue(
+ Derived.GetNumberOfMemberFunctions() == 2,
+ "Derived declares two methods")
+ self.assertTrue(Derived.GetMemberFunctionAtIndex(0).GetType(
+ ).GetFunctionReturnType().GetName() == "int", "Derived::dImpl returns int")
+
+ self.assertTrue(
+ Base.GetNumberOfMemberFunctions() == 4,
+ "Base declares three methods")
+ self.assertTrue(Base.GetMemberFunctionAtIndex(3).GetType(
+ ).GetFunctionArgumentTypes().GetSize() == 3, "Base::sfunc takes three arguments")
+ self.assertTrue(Base.GetMemberFunctionAtIndex(
+ 3).GetName() == "sfunc", "Base::sfunc not found")
+ self.assertTrue(Base.GetMemberFunctionAtIndex(3).GetKind(
+ ) == lldb.eMemberFunctionKindStaticMethod, "Base::sfunc is a static")
+ self.assertTrue(Base.GetMemberFunctionAtIndex(2).GetType(
+ ).GetFunctionArgumentTypes().GetSize() == 0, "Base::dat takes no arguments")
+ self.assertTrue(Base.GetMemberFunctionAtIndex(1).GetType().GetFunctionArgumentTypes(
+ ).GetTypeAtIndex(1).GetName() == "char", "Base::bar takes a second 'char' argument")
+ self.assertTrue(Base.GetMemberFunctionAtIndex(
+ 1).GetName() == "bar", "Base::bar not found")
+
variable = frame0.FindVariable("thingy")
Thingy = variable.GetType()
-
- self.assertTrue(Thingy.GetNumberOfMemberFunctions() == 2, "Thingy declares two methods")
-
- self.assertTrue(Thingy.GetMemberFunctionAtIndex(0).GetReturnType().GetName() == "id", "Thingy::init returns an id")
- self.assertTrue(Thingy.GetMemberFunctionAtIndex(1).GetNumberOfArguments() == 2, "Thingy::foo takes two arguments")
- self.assertTrue(Thingy.GetMemberFunctionAtIndex(1).GetArgumentTypeAtIndex(0).GetName() == "int", "Thingy::foo takes an int")
+
+ self.assertTrue(
+ Thingy.GetNumberOfMemberFunctions() == 2,
+ "Thingy declares two methods")
+
+ self.assertTrue(Thingy.GetMemberFunctionAtIndex(
+ 0).GetReturnType().GetName() == "id", "Thingy::init returns an id")
+ self.assertTrue(
+ Thingy.GetMemberFunctionAtIndex(1).GetNumberOfArguments() == 2,
+ "Thingy::foo takes two arguments")
+ self.assertTrue(Thingy.GetMemberFunctionAtIndex(1).GetArgumentTypeAtIndex(
+ 0).GetName() == "int", "Thingy::foo takes an int")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/debugger/TestDebuggerAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/debugger/TestDebuggerAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/debugger/TestDebuggerAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/debugger/TestDebuggerAPI.py Tue Sep 6 15:57:50 2016
@@ -30,7 +30,7 @@ class DebuggerAPITestCase(TestBase):
self.dbg.GetInternalVariableValue(None, None)
# FIXME (filcab): We must first allow for the swig bindings to know if
# a Python callback is set. (Check python-typemaps.swig)
- #self.dbg.SetLoggingCallback(None)
+ # self.dbg.SetLoggingCallback(None)
self.dbg.SetPrompt(None)
self.dbg.SetCurrentPlatform(None)
self.dbg.SetCurrentPlatformSDKRoot(None)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py Tue Sep 6 15:57:50 2016
@@ -14,14 +14,15 @@ after default construction.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class APIDefaultConstructorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -125,7 +126,8 @@ class APIDefaultConstructorTestCase(Test
@add_test_categories(['pyapi'])
@no_debug_info_test
- # darwin: This test passes with swig 3.0.2, fails w/3.0.5 other tests fail with 2.0.12 http://llvm.org/pr23488
+ # darwin: This test passes with swig 3.0.2, fails w/3.0.5 other tests fail
+ # with 2.0.12 http://llvm.org/pr23488
def test_SBError(self):
obj = lldb.SBError()
if self.TraceOn():
@@ -228,8 +230,9 @@ class APIDefaultConstructorTestCase(Test
@add_test_categories(['pyapi'])
@no_debug_info_test
- # Py3 asserts due to a bug in SWIG. Trying to upstream a patch to fix this in 3.0.8
- @skipIf(py_version=['>=', (3,0)], swig_version=['<', (3,0,8)])
+ # Py3 asserts due to a bug in SWIG. Trying to upstream a patch to fix
+ # this in 3.0.8
+ @skipIf(py_version=['>=', (3, 0)], swig_version=['<', (3, 0, 8)])
def test_SBModule(self):
obj = lldb.SBModule()
if self.TraceOn():
@@ -347,7 +350,7 @@ class APIDefaultConstructorTestCase(Test
except:
# Exception is expected.
return
-
+
# Unreachable code because lldb.SBType() should fail.
# Do fuzz testing on the invalid obj, it should not crash lldb.
import sb_type
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_address.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_address.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_address.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_address.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetFileAddress()
obj.GetLoadAddress(lldb.SBTarget())
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_block.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_block.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_block.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_block.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.IsInlined()
obj.GetInlinedName()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpoint.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpoint.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpoint.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetID()
obj.ClearAllBreakpointSites()
@@ -28,7 +29,7 @@ def fuzz_obj(obj):
obj.SetQueueName("my queue")
obj.GetQueueName()
obj.SetScriptCallbackFunction(None)
- obj.SetScriptCallbackBody (None)
+ obj.SetScriptCallbackBody(None)
obj.GetNumResolvedLocations()
obj.GetNumLocations()
obj.GetDescription(lldb.SBStream())
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointlocation.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointlocation.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointlocation.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointlocation.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetAddress()
obj.GetLoadAddress()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_broadcaster.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_broadcaster.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_broadcaster.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_broadcaster.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.BroadcastEventByType(lldb.eBreakpointEventTypeInvalidType, True)
obj.BroadcastEvent(lldb.SBEvent(), False)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_communication.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_communication.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_communication.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_communication.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
broadcaster = obj.GetBroadcaster()
# Do fuzz testing on the broadcaster obj, it should not crash lldb.
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_compileunit.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_compileunit.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_compileunit.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_compileunit.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetFileSpec()
obj.GetNumLineEntries()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.SetAsync(True)
obj.SetAsync(False)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_error.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_error.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_error.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_error.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetCString()
obj.Fail()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_event.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_event.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_event.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_event.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetDataFlavor()
obj.GetType()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_filespec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_filespec.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_filespec.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_filespec.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.Exists()
obj.ResolveExecutableLocation()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_frame.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_frame.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_frame.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_frame.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetFrameID()
obj.GetPC()
@@ -32,6 +33,9 @@ def fuzz_obj(obj):
obj.FindVariable("my_var")
obj.FindVariable("my_var", lldb.eDynamicCanRunTarget)
obj.FindValue("your_var", lldb.eValueTypeVariableGlobal)
- obj.FindValue("your_var", lldb.eValueTypeVariableStatic, lldb.eDynamicCanRunTarget)
+ obj.FindValue(
+ "your_var",
+ lldb.eValueTypeVariableStatic,
+ lldb.eDynamicCanRunTarget)
obj.GetDescription(lldb.SBStream())
obj.Clear()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_function.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_function.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_function.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_function.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetName()
obj.GetMangledName()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instruction.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instruction.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instruction.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instruction.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetAddress()
obj.GetByteSize()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instructionlist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instructionlist.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instructionlist.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instructionlist.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetSize()
obj.GetInstructionAtIndex(0xffffffff)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetStartAddress()
obj.GetEndAddress()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_listener.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_listener.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_listener.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_listener.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.AddEvent(lldb.SBEvent())
obj.StartListeningForEvents(lldb.SBBroadcaster(), 0xffffffff)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_module.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_module.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_module.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_module.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetFileSpec()
obj.GetPlatformFileSpec()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetTarget()
obj.GetByteOrder()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_section.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_section.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_section.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_section.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.IsValid()
obj.GetName()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_stringlist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_stringlist.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_stringlist.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_stringlist.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.AppendString("another string")
obj.AppendString(None)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbol.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbol.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbol.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbol.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetName()
obj.GetMangledName()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbolcontext.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbolcontext.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbolcontext.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbolcontext.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetModule()
obj.GetCompileUnit()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_target.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_target.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_target.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_target.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetProcess()
listener = lldb.SBListener()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_thread.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_thread.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_thread.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_thread.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetStopReason()
obj.GetStopReasonDataCount()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_type.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_type.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_type.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_type.py Tue Sep 6 15:57:50 2016
@@ -5,10 +5,11 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetName()
obj.GetByteSize()
- #obj.GetEncoding(5)
+ # obj.GetEncoding(5)
obj.GetNumberChildren(True)
member = lldb.SBTypeMember()
obj.GetChildAtIndex(True, 0, member)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_value.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_value.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_value.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_value.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetError()
obj.GetID()
@@ -40,26 +41,26 @@ def fuzz_obj(obj):
for child_val in obj:
s = str(child_val)
error = lldb.SBError()
- obj.GetValueAsSigned (error, 0)
- obj.GetValueAsUnsigned (error, 0)
+ obj.GetValueAsSigned(error, 0)
+ obj.GetValueAsUnsigned(error, 0)
obj.GetValueAsSigned(0)
obj.GetValueAsUnsigned(0)
- obj.GetDynamicValue (lldb.eNoDynamicValues)
- obj.GetStaticValue ()
+ obj.GetDynamicValue(lldb.eNoDynamicValues)
+ obj.GetStaticValue()
obj.IsDynamic()
invalid_type = lldb.SBType()
- obj.CreateChildAtOffset ("a", 12, invalid_type)
- obj.Cast (invalid_type)
- obj.CreateValueFromExpression ("pt->x", "pt->x")
- obj.CreateValueFromAddress ("x", 0x123, invalid_type)
+ obj.CreateChildAtOffset("a", 12, invalid_type)
+ obj.Cast(invalid_type)
+ obj.CreateValueFromExpression("pt->x", "pt->x")
+ obj.CreateValueFromAddress("x", 0x123, invalid_type)
invalid_data = lldb.SBData()
- obj.CreateValueFromData ("x", invalid_data, invalid_type)
+ obj.CreateValueFromData("x", invalid_data, invalid_type)
obj.GetValueForExpressionPath("[0]")
obj.AddressOf()
obj.GetLoadAddress()
obj.GetAddress()
- obj.GetPointeeData (0, 1)
- obj.GetData ()
+ obj.GetPointeeData(0, 1)
+ obj.GetData()
obj.GetTarget()
obj.GetProcess()
obj.GetThread()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_valuelist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_valuelist.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_valuelist.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_valuelist.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.Append(lldb.SBValue())
obj.GetSize()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_watchpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_watchpoint.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_watchpoint.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/default-constructor/sb_watchpoint.py Tue Sep 6 15:57:50 2016
@@ -5,6 +5,7 @@ Fuzz tests an object after the default c
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetID()
obj.IsValid()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Use lldb Python API to disassemble raw m
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DisassembleRawDataTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,16 +25,16 @@ class DisassembleRawDataTestCase(TestBas
"""Test disassembling raw bytes with the API."""
# Create a target from the debugger.
arch = self.getArchitecture()
- if re.match("mips*el",arch):
- target = self.dbg.CreateTargetWithFileAndTargetTriple ("", "mipsel")
- raw_bytes = bytearray([0x21,0xf0, 0xa0, 0x03])
- elif re.match("mips",arch):
- target = self.dbg.CreateTargetWithFileAndTargetTriple ("", "mips")
- raw_bytes = bytearray([0x03,0xa0, 0xf0, 0x21])
+ if re.match("mips*el", arch):
+ target = self.dbg.CreateTargetWithFileAndTargetTriple("", "mipsel")
+ raw_bytes = bytearray([0x21, 0xf0, 0xa0, 0x03])
+ elif re.match("mips", arch):
+ target = self.dbg.CreateTargetWithFileAndTargetTriple("", "mips")
+ raw_bytes = bytearray([0x03, 0xa0, 0xf0, 0x21])
else:
- target = self.dbg.CreateTargetWithFileAndTargetTriple ("", "x86_64")
+ target = self.dbg.CreateTargetWithFileAndTargetTriple("", "x86_64")
raw_bytes = bytearray([0x48, 0x89, 0xe5])
-
+
self.assertTrue(target, VALID_TARGET)
insts = target.GetInstructions(lldb.SBAddress(0, target), raw_bytes)
@@ -43,9 +44,11 @@ class DisassembleRawDataTestCase(TestBas
print()
print("Raw bytes: ", [hex(x) for x in raw_bytes])
print("Disassembled%s" % str(inst))
- if re.match("mips",arch):
- self.assertTrue (inst.GetMnemonic(target) == "move")
- self.assertTrue (inst.GetOperands(target) == '$' + "fp, " + '$' + "sp")
+ if re.match("mips", arch):
+ self.assertTrue(inst.GetMnemonic(target) == "move")
+ self.assertTrue(inst.GetOperands(target) ==
+ '$' + "fp, " + '$' + "sp")
else:
- self.assertTrue (inst.GetMnemonic(target) == "movq")
- self.assertTrue (inst.GetOperands(target) == '%' + "rsp, " + '%' + "rbp")
+ self.assertTrue(inst.GetMnemonic(target) == "movq")
+ self.assertTrue(inst.GetOperands(target) ==
+ '%' + "rsp, " + '%' + "rbp")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py Tue Sep 6 15:57:50 2016
@@ -5,25 +5,28 @@ Use lldb Python API to disassemble raw m
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class Disassemble_VST1_64(TestBase):
mydir = TestBase.compute_mydir(__file__)
- @skipTestIfFn(lambda : True, "llvm.org/pr24575: all tests get ERRORs in dotest.py after this")
+ @skipTestIfFn(
+ lambda: True,
+ "llvm.org/pr24575: all tests get ERRORs in dotest.py after this")
@add_test_categories(['pyapi'])
@no_debug_info_test
def test_disassemble_invalid_vst_1_64_raw_data(self):
"""Test disassembling invalid vst1.64 raw bytes with the API."""
# Create a target from the debugger.
- target = self.dbg.CreateTargetWithFileAndTargetTriple ("", "thumbv7")
+ target = self.dbg.CreateTargetWithFileAndTargetTriple("", "thumbv7")
self.assertTrue(target, VALID_TARGET)
raw_bytes = bytearray([0xf0, 0xb5, 0x03, 0xaf,
@@ -55,5 +58,5 @@ class Disassemble_VST1_64(TestBase):
print()
print("Raw bytes: ", [hex(x) for x in raw_bytes])
print("Disassembled%s" % str(inst))
-
- self.assertTrue (inst.GetMnemonic(target) == "vst1.64")
+
+ self.assertTrue(inst.GetMnemonic(target) == "vst1.64")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/event/TestEvents.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/event/TestEvents.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/event/TestEvents.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Test lldb Python event APIs.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
@skipIfLinux # llvm.org/pr25924, sometimes generating SIGSEGV
class EventAPITestCase(TestBase):
@@ -22,10 +23,13 @@ class EventAPITestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to of function 'c'.
- self.line = line_number('main.c', '// Find the line number of function "c" here.')
+ self.line = line_number(
+ 'main.c', '// Find the line number of function "c" here.')
@add_test_categories(['pyapi'])
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr23730 Flaky, fails ~1/10 cases")
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr23730 Flaky, fails ~1/10 cases")
def test_listen_for_and_print_event(self):
"""Exercise SBEvent API."""
self.build()
@@ -44,18 +48,20 @@ class EventAPITestCase(TestBase):
# Now launch the process, and do not stop at the entry point.
error = lldb.SBError()
- process = target.Launch (listener,
- None, # argv
- None, # envp
- None, # stdin_path
- None, # stdout_path
- None, # stderr_path
- None, # working directory
- 0, # launch flags
- False, # Stop at entry
- error) # error
-
- self.assertTrue(process.GetState() == lldb.eStateStopped, PROCESS_STOPPED)
+ process = target.Launch(listener,
+ None, # argv
+ None, # envp
+ None, # stdin_path
+ None, # stdout_path
+ None, # stderr_path
+ None, # working directory
+ 0, # launch flags
+ False, # Stop at entry
+ error) # error
+
+ self.assertTrue(
+ process.GetState() == lldb.eStateStopped,
+ PROCESS_STOPPED)
# Create an empty event object.
event = lldb.SBEvent()
@@ -66,7 +72,9 @@ class EventAPITestCase(TestBase):
# Create MyListeningThread class to wait for any kind of event.
import threading
+
class MyListeningThread(threading.Thread):
+
def run(self):
count = 0
# Let's only try at most 4 times to retrieve any kind of event.
@@ -79,7 +87,10 @@ class EventAPITestCase(TestBase):
desc = lldbutil.get_description(event)
print("Event description:", desc)
print("Event data flavor:", event.GetDataFlavor())
- print("Process state:", lldbutil.state_type_to_str(process.GetState()))
+ print(
+ "Process state:",
+ lldbutil.state_type_to_str(
+ process.GetState()))
print()
else:
if traceOn:
@@ -106,7 +117,7 @@ class EventAPITestCase(TestBase):
# Shouldn't we be testing against some kind of expectation here?
@add_test_categories(['pyapi'])
- @expectedFlakeyLinux("llvm.org/pr23730") # Flaky, fails ~1/100 cases
+ @expectedFlakeyLinux("llvm.org/pr23730") # Flaky, fails ~1/100 cases
@expectedFlakeyOS(oslist=["windows"])
def test_wait_for_event(self):
"""Exercise SBListener.WaitForEvent() API."""
@@ -131,16 +142,16 @@ class EventAPITestCase(TestBase):
# Now launch the process, and do not stop at entry point.
error = lldb.SBError()
- process = target.Launch (listener,
- None, # argv
- None, # envp
- None, # stdin_path
- None, # stdout_path
- None, # stderr_path
- None, # working directory
- 0, # launch flags
- False, # Stop at entry
- error) # error
+ process = target.Launch(listener,
+ None, # argv
+ None, # envp
+ None, # stdin_path
+ None, # stdout_path
+ None, # stderr_path
+ None, # working directory
+ 0, # launch flags
+ False, # Stop at entry
+ error) # error
self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
# Create an empty event object.
@@ -149,7 +160,9 @@ class EventAPITestCase(TestBase):
# Create MyListeningThread to wait for any kind of event.
import threading
+
class MyListeningThread(threading.Thread):
+
def run(self):
count = 0
# Let's only try at most 3 times to retrieve any kind of event.
@@ -179,9 +192,11 @@ class EventAPITestCase(TestBase):
self.assertTrue(event,
"My listening thread successfully received an event")
- @skipIfFreeBSD # llvm.org/pr21325
+ @skipIfFreeBSD # llvm.org/pr21325
@add_test_categories(['pyapi'])
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr23617 Flaky, fails ~1/10 cases")
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr23617 Flaky, fails ~1/10 cases")
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
def test_add_listener_to_broadcaster(self):
"""Exercise some SBBroadcaster APIs."""
@@ -205,22 +220,21 @@ class EventAPITestCase(TestBase):
# Now launch the process, and do not stop at the entry point.
error = lldb.SBError()
- process = target.Launch (listener,
- None, # argv
- None, # envp
- None, # stdin_path
- None, # stdout_path
- None, # stderr_path
- None, # working directory
- 0, # launch flags
- False, # Stop at entry
- error) # error
+ process = target.Launch(listener,
+ None, # argv
+ None, # envp
+ None, # stdin_path
+ None, # stdout_path
+ None, # stderr_path
+ None, # working directory
+ 0, # launch flags
+ False, # Stop at entry
+ error) # error
# Create an empty event object.
event = lldb.SBEvent()
self.assertFalse(event, "Event should not be valid initially")
-
# The finite state machine for our custom listening thread, with an
# initial state of None, which means no event has been received.
# It changes to 'connected' after 'connected' event is received (for remote platforms)
@@ -231,9 +245,12 @@ class EventAPITestCase(TestBase):
self.state = None
# Create MyListeningThread to wait for state changed events.
- # By design, a "running" event is expected following by a "stopped" event.
+ # By design, a "running" event is expected following by a "stopped"
+ # event.
import threading
+
class MyListeningThread(threading.Thread):
+
def run(self):
#print("Running MyListeningThread:", self)
@@ -248,19 +265,21 @@ class EventAPITestCase(TestBase):
#print("Event description:", desc)
match = pattern.search(desc)
if not match:
- break;
+ break
if match.group(1) == 'connected':
# When debugging remote targets with lldb-server, we
# first get the 'connected' event.
- self.context.assertTrue(self.context.state == None)
+ self.context.assertTrue(self.context.state is None)
self.context.state = 'connected'
continue
elif match.group(1) == 'running':
- self.context.assertTrue(self.context.state == None or self.context.state == 'connected')
+ self.context.assertTrue(
+ self.context.state is None or self.context.state == 'connected')
self.context.state = 'running'
continue
elif match.group(1) == 'stopped':
- self.context.assertTrue(self.context.state == 'running')
+ self.context.assertTrue(
+ self.context.state == 'running')
# Whoopee, both events have been received!
self.context.state = 'stopped'
break
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py Tue Sep 6 15:57:50 2016
@@ -1,4 +1,6 @@
from lldbsuite.test import decorators
from lldbsuite.test import lldbinline
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows])
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/findvalue_duplist/TestSBFrameFindValue.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/findvalue_duplist/TestSBFrameFindValue.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/findvalue_duplist/TestSBFrameFindValue.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/findvalue_duplist/TestSBFrameFindValue.py Tue Sep 6 15:57:50 2016
@@ -3,13 +3,15 @@
from __future__ import print_function
-
-import os, sys, time
+import os
+import sys
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SBFrameFindValueTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,26 +28,57 @@ class SBFrameFindValueTestCase(TestBase)
# Create the target
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
-
+
# Set the breakpoints
- breakpoint = target.BreakpointCreateBySourceRegex('Set breakpoint here', lldb.SBFileSpec("main.cpp"))
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ 'Set breakpoint here', lldb.SBFileSpec("main.cpp"))
self.assertTrue(breakpoint.GetNumLocations() > 0, VALID_BREAKPOINT)
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be at our breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
-
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint)
+
self.assertTrue(len(threads) == 1)
self.thread = threads[0]
self.frame = self.thread.frames[0]
self.assertTrue(self.frame, "Frame 0 is valid.")
- self.assertTrue(self.frame.GetVariables(True,True,False,True).GetSize() == 2, "variable count is off")
- self.assertFalse(self.frame.FindValue("NoSuchThing",lldb.eValueTypeVariableArgument,lldb.eDynamicCanRunTarget).IsValid(), "found something that should not be here")
- self.assertTrue(self.frame.GetVariables(True,True,False,True).GetSize() == 2, "variable count is off after failed FindValue()")
- self.assertTrue(self.frame.FindValue("a",lldb.eValueTypeVariableArgument,lldb.eDynamicCanRunTarget).IsValid(), "FindValue() didn't find an argument")
- self.assertTrue(self.frame.GetVariables(True,True,False,True).GetSize() == 2, "variable count is off after successful FindValue()")
+ self.assertTrue(
+ self.frame.GetVariables(
+ True,
+ True,
+ False,
+ True).GetSize() == 2,
+ "variable count is off")
+ self.assertFalse(
+ self.frame.FindValue(
+ "NoSuchThing",
+ lldb.eValueTypeVariableArgument,
+ lldb.eDynamicCanRunTarget).IsValid(),
+ "found something that should not be here")
+ self.assertTrue(
+ self.frame.GetVariables(
+ True,
+ True,
+ False,
+ True).GetSize() == 2,
+ "variable count is off after failed FindValue()")
+ self.assertTrue(
+ self.frame.FindValue(
+ "a",
+ lldb.eValueTypeVariableArgument,
+ lldb.eDynamicCanRunTarget).IsValid(),
+ "FindValue() didn't find an argument")
+ self.assertTrue(
+ self.frame.GetVariables(
+ True,
+ True,
+ False,
+ True).GetSize() == 2,
+ "variable count is off after successful FindValue()")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py Tue Sep 6 15:57:50 2016
@@ -3,13 +3,15 @@
from __future__ import print_function
-
-import os, sys, time
+import os
+import sys
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SBFormattersAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,19 +26,20 @@ class SBFormattersAPITestCase(TestBase):
"""Test Python APIs for working with formatters"""
self.build()
self.setTearDownCleanup()
-
+
"""Test Python APIs for working with formatters"""
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
def cleanup():
@@ -51,265 +54,402 @@ class SBFormattersAPITestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
-
format = lldb.SBTypeFormat(lldb.eFormatHex)
category = self.dbg.GetDefaultCategory()
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("int"),format)
+ category.AddTypeFormat(lldb.SBTypeNameSpecifier("int"), format)
self.expect("frame variable foo.A",
- substrs = ['0x00000001'])
+ substrs=['0x00000001'])
self.expect("frame variable foo.E", matching=False,
- substrs = ['b8cca70a'])
+ substrs=['b8cca70a'])
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("long"),format)
+ category.AddTypeFormat(lldb.SBTypeNameSpecifier("long"), format)
self.expect("frame variable foo.A",
- substrs = ['0x00000001'])
+ substrs=['0x00000001'])
self.expect("frame variable foo.E",
- substrs = ['b8cca70a'])
-
+ substrs=['b8cca70a'])
+
format.format = lldb.eFormatOctal
- category.AddTypeFormat(lldb.SBTypeNameSpecifier("int"),format)
+ category.AddTypeFormat(lldb.SBTypeNameSpecifier("int"), format)
self.expect("frame variable foo.A",
- substrs = ['01'])
+ substrs=['01'])
self.expect("frame variable foo.E",
- substrs = ['b8cca70a'])
-
+ substrs=['b8cca70a'])
+
category.DeleteTypeFormat(lldb.SBTypeNameSpecifier("int"))
category.DeleteTypeFormat(lldb.SBTypeNameSpecifier("long"))
self.expect("frame variable foo.A", matching=False,
- substrs = ['01'])
+ substrs=['01'])
self.expect("frame variable foo.E", matching=False,
- substrs = ['b8cca70a'])
+ substrs=['b8cca70a'])
- summary = lldb.SBTypeSummary.CreateWithSummaryString("the hello world you'll never see")
+ summary = lldb.SBTypeSummary.CreateWithSummaryString(
+ "the hello world you'll never see")
summary.SetSummaryString('hello world')
new_category = self.dbg.GetCategory("foobar")
- self.assertFalse(new_category.IsValid(), "getting a non-existing category worked")
+ self.assertFalse(
+ new_category.IsValid(),
+ "getting a non-existing category worked")
new_category = self.dbg.CreateCategory("foobar")
new_category.enabled = True
- new_category.AddTypeSummary(lldb.SBTypeNameSpecifier("^.*t$",True),summary)
+ new_category.AddTypeSummary(
+ lldb.SBTypeNameSpecifier(
+ "^.*t$", True), summary)
self.expect("frame variable foo.A",
- substrs = ['hello world'])
+ substrs=['hello world'])
self.expect("frame variable foo.E", matching=False,
- substrs = ['hello world'])
+ substrs=['hello world'])
self.expect("frame variable foo.B",
- substrs = ['hello world'])
+ substrs=['hello world'])
self.expect("frame variable foo.F",
- substrs = ['hello world'])
+ substrs=['hello world'])
new_category.enabled = False
self.expect("frame variable foo.A", matching=False,
- substrs = ['hello world'])
+ substrs=['hello world'])
self.expect("frame variable foo.E", matching=False,
- substrs = ['hello world'])
+ substrs=['hello world'])
self.expect("frame variable foo.B", matching=False,
- substrs = ['hello world'])
+ substrs=['hello world'])
self.expect("frame variable foo.F", matching=False,
- substrs = ['hello world'])
+ substrs=['hello world'])
self.dbg.DeleteCategory(new_category.GetName())
self.expect("frame variable foo.A", matching=False,
- substrs = ['hello world'])
+ substrs=['hello world'])
self.expect("frame variable foo.E", matching=False,
- substrs = ['hello world'])
+ substrs=['hello world'])
self.expect("frame variable foo.B", matching=False,
- substrs = ['hello world'])
+ substrs=['hello world'])
self.expect("frame variable foo.F", matching=False,
- substrs = ['hello world'])
+ substrs=['hello world'])
filter = lldb.SBTypeFilter(0)
filter.AppendExpressionPath("A")
filter.AppendExpressionPath("D")
- self.assertTrue(filter.GetNumberOfExpressionPaths() == 2, "filter with two items does not have two items")
+ self.assertTrue(
+ filter.GetNumberOfExpressionPaths() == 2,
+ "filter with two items does not have two items")
- category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"),filter)
+ category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"), filter)
self.expect("frame variable foo",
- substrs = ['A = 1', 'D = 6.28'])
+ substrs=['A = 1', 'D = 6.28'])
self.expect("frame variable foo", matching=False,
- substrs = ['B = ', 'C = ', 'E = ', 'F = '])
+ substrs=['B = ', 'C = ', 'E = ', 'F = '])
- category.DeleteTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct",True))
+ category.DeleteTypeFilter(
+ lldb.SBTypeNameSpecifier(
+ "JustAStruct", True))
self.expect("frame variable foo",
- substrs = ['A = 1', 'D = 6.28'])
+ substrs=['A = 1', 'D = 6.28'])
self.expect("frame variable foo", matching=False,
- substrs = ['B = ', 'C = ', 'E = ', 'F = '])
+ substrs=['B = ', 'C = ', 'E = ', 'F = '])
- category.DeleteTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct",False))
+ category.DeleteTypeFilter(
+ lldb.SBTypeNameSpecifier(
+ "JustAStruct", False))
self.expect("frame variable foo",
- substrs = ['A = 1', 'D = 6.28'])
+ substrs=['A = 1', 'D = 6.28'])
self.expect("frame variable foo", matching=True,
- substrs = ['B = ', 'C = ', 'E = ', 'F = '])
+ substrs=['B = ', 'C = ', 'E = ', 'F = '])
self.runCmd("command script import --allow-reload ./synth.py")
self.expect("frame variable foo", matching=False,
- substrs = ['X = 1'])
+ substrs=['X = 1'])
self.dbg.GetCategory("JASSynth").SetEnabled(True)
self.expect("frame variable foo", matching=True,
- substrs = ['X = 1'])
+ substrs=['X = 1'])
self.dbg.GetCategory("CCCSynth").SetEnabled(True)
- self.expect("frame variable ccc", matching=True,
- substrs = ['CCC object with leading value (int) a = 111', 'a = 111', 'b = 222', 'c = 333'])
+ self.expect(
+ "frame variable ccc",
+ matching=True,
+ substrs=[
+ 'CCC object with leading value (int) a = 111',
+ 'a = 111',
+ 'b = 222',
+ 'c = 333'])
- foo_var = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
+ foo_var = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable('foo')
self.assertTrue(foo_var.IsValid(), 'could not find foo')
- self.assertTrue(foo_var.GetDeclaration().IsValid(), 'foo declaration is invalid')
-
- self.assertTrue(foo_var.GetNumChildren() == 2, 'synthetic value has wrong number of child items (synth)')
- self.assertTrue(foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 1, 'foo_synth.X has wrong value (synth)')
- self.assertFalse(foo_var.GetChildMemberWithName('B').IsValid(), 'foo_synth.B is valid but should not (synth)')
+ self.assertTrue(
+ foo_var.GetDeclaration().IsValid(),
+ 'foo declaration is invalid')
+
+ self.assertTrue(
+ foo_var.GetNumChildren() == 2,
+ 'synthetic value has wrong number of child items (synth)')
+ self.assertTrue(
+ foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 1,
+ 'foo_synth.X has wrong value (synth)')
+ self.assertFalse(
+ foo_var.GetChildMemberWithName('B').IsValid(),
+ 'foo_synth.B is valid but should not (synth)')
self.dbg.GetCategory("JASSynth").SetEnabled(False)
- foo_var = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
+ foo_var = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable('foo')
self.assertTrue(foo_var.IsValid(), 'could not find foo')
- self.assertFalse(foo_var.GetNumChildren() == 2, 'still seeing synthetic value')
+ self.assertFalse(
+ foo_var.GetNumChildren() == 2,
+ 'still seeing synthetic value')
filter = lldb.SBTypeFilter(0)
filter.AppendExpressionPath("A")
filter.AppendExpressionPath("D")
- category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"),filter)
+ category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"), filter)
self.expect("frame variable foo",
- substrs = ['A = 1', 'D = 6.28'])
+ substrs=['A = 1', 'D = 6.28'])
- foo_var = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
+ foo_var = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable('foo')
self.assertTrue(foo_var.IsValid(), 'could not find foo')
- self.assertTrue(foo_var.GetNumChildren() == 2, 'synthetic value has wrong number of child items (filter)')
- self.assertTrue(foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 0, 'foo_synth.X has wrong value (filter)')
- self.assertTrue(foo_var.GetChildMemberWithName('A').GetValueAsUnsigned() == 1, 'foo_synth.A has wrong value (filter)')
+ self.assertTrue(
+ foo_var.GetNumChildren() == 2,
+ 'synthetic value has wrong number of child items (filter)')
+ self.assertTrue(
+ foo_var.GetChildMemberWithName('X').GetValueAsUnsigned() == 0,
+ 'foo_synth.X has wrong value (filter)')
+ self.assertTrue(
+ foo_var.GetChildMemberWithName('A').GetValueAsUnsigned() == 1,
+ 'foo_synth.A has wrong value (filter)')
- self.assertTrue(filter.ReplaceExpressionPathAtIndex(0,"C"), "failed to replace an expression path in filter")
+ self.assertTrue(filter.ReplaceExpressionPathAtIndex(
+ 0, "C"), "failed to replace an expression path in filter")
self.expect("frame variable foo",
- substrs = ['A = 1', 'D = 6.28'])
- category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"),filter)
+ substrs=['A = 1', 'D = 6.28'])
+ category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"), filter)
self.expect("frame variable foo",
- substrs = ["C = 'e'", 'D = 6.28'])
- category.AddTypeFilter(lldb.SBTypeNameSpecifier("FooType"),filter)
- filter.ReplaceExpressionPathAtIndex(1,"F")
+ substrs=["C = 'e'", 'D = 6.28'])
+ category.AddTypeFilter(lldb.SBTypeNameSpecifier("FooType"), filter)
+ filter.ReplaceExpressionPathAtIndex(1, "F")
self.expect("frame variable foo",
- substrs = ["C = 'e'", 'D = 6.28'])
- category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"),filter)
+ substrs=["C = 'e'", 'D = 6.28'])
+ category.AddTypeFilter(lldb.SBTypeNameSpecifier("JustAStruct"), filter)
self.expect("frame variable foo",
- substrs = ["C = 'e'", 'F = 0'])
+ substrs=["C = 'e'", 'F = 0'])
self.expect("frame variable bar",
- substrs = ["C = 'e'", 'D = 6.28'])
+ substrs=["C = 'e'", 'D = 6.28'])
- foo_var = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
+ foo_var = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame().FindVariable('foo')
self.assertTrue(foo_var.IsValid(), 'could not find foo')
- self.assertTrue(foo_var.GetChildMemberWithName('C').GetValueAsUnsigned() == ord('e'), 'foo_synth.C has wrong value (filter)')
-
- chosen = self.dbg.GetFilterForType(lldb.SBTypeNameSpecifier("JustAStruct"))
- self.assertTrue(chosen.count == 2, "wrong filter found for JustAStruct")
- self.assertTrue(chosen.GetExpressionPathAtIndex(0) == 'C', "wrong item at index 0 for JustAStruct")
- self.assertTrue(chosen.GetExpressionPathAtIndex(1) == 'F', "wrong item at index 1 for JustAStruct")
-
- self.assertFalse(category.DeleteTypeFilter(lldb.SBTypeNameSpecifier("NoSuchType")),"deleting a non-existing filter worked")
- self.assertFalse(category.DeleteTypeSummary(lldb.SBTypeNameSpecifier("NoSuchType")),"deleting a non-existing summary worked")
- self.assertFalse(category.DeleteTypeFormat(lldb.SBTypeNameSpecifier("NoSuchType")),"deleting a non-existing format worked")
- self.assertFalse(category.DeleteTypeSynthetic(lldb.SBTypeNameSpecifier("NoSuchType")),"deleting a non-existing synthetic worked")
-
- self.assertFalse(category.DeleteTypeFilter(lldb.SBTypeNameSpecifier("")),"deleting a filter for '' worked")
- self.assertFalse(category.DeleteTypeSummary(lldb.SBTypeNameSpecifier("")),"deleting a summary for '' worked")
- self.assertFalse(category.DeleteTypeFormat(lldb.SBTypeNameSpecifier("")),"deleting a format for '' worked")
- self.assertFalse(category.DeleteTypeSynthetic(lldb.SBTypeNameSpecifier("")),"deleting a synthetic for '' worked")
+ self.assertTrue(
+ foo_var.GetChildMemberWithName('C').GetValueAsUnsigned() == ord('e'),
+ 'foo_synth.C has wrong value (filter)')
+
+ chosen = self.dbg.GetFilterForType(
+ lldb.SBTypeNameSpecifier("JustAStruct"))
+ self.assertTrue(
+ chosen.count == 2,
+ "wrong filter found for JustAStruct")
+ self.assertTrue(
+ chosen.GetExpressionPathAtIndex(0) == 'C',
+ "wrong item at index 0 for JustAStruct")
+ self.assertTrue(
+ chosen.GetExpressionPathAtIndex(1) == 'F',
+ "wrong item at index 1 for JustAStruct")
+
+ self.assertFalse(
+ category.DeleteTypeFilter(
+ lldb.SBTypeNameSpecifier("NoSuchType")),
+ "deleting a non-existing filter worked")
+ self.assertFalse(
+ category.DeleteTypeSummary(
+ lldb.SBTypeNameSpecifier("NoSuchType")),
+ "deleting a non-existing summary worked")
+ self.assertFalse(
+ category.DeleteTypeFormat(
+ lldb.SBTypeNameSpecifier("NoSuchType")),
+ "deleting a non-existing format worked")
+ self.assertFalse(
+ category.DeleteTypeSynthetic(
+ lldb.SBTypeNameSpecifier("NoSuchType")),
+ "deleting a non-existing synthetic worked")
+
+ self.assertFalse(
+ category.DeleteTypeFilter(
+ lldb.SBTypeNameSpecifier("")),
+ "deleting a filter for '' worked")
+ self.assertFalse(
+ category.DeleteTypeSummary(
+ lldb.SBTypeNameSpecifier("")),
+ "deleting a summary for '' worked")
+ self.assertFalse(
+ category.DeleteTypeFormat(
+ lldb.SBTypeNameSpecifier("")),
+ "deleting a format for '' worked")
+ self.assertFalse(
+ category.DeleteTypeSynthetic(
+ lldb.SBTypeNameSpecifier("")),
+ "deleting a synthetic for '' worked")
try:
- self.assertFalse(category.AddTypeSummary(lldb.SBTypeNameSpecifier("NoneSuchType"), None), "adding a summary valued None worked")
+ self.assertFalse(
+ category.AddTypeSummary(
+ lldb.SBTypeNameSpecifier("NoneSuchType"),
+ None),
+ "adding a summary valued None worked")
except:
- pass
+ pass
else:
- self.assertFalse(True, "adding a summary valued None worked")
+ self.assertFalse(True, "adding a summary valued None worked")
try:
- self.assertFalse(category.AddTypeFilter(lldb.SBTypeNameSpecifier("NoneSuchType"), None), "adding a filter valued None worked")
+ self.assertFalse(
+ category.AddTypeFilter(
+ lldb.SBTypeNameSpecifier("NoneSuchType"),
+ None),
+ "adding a filter valued None worked")
except:
- pass
+ pass
else:
- self.assertFalse(True, "adding a filter valued None worked")
+ self.assertFalse(True, "adding a filter valued None worked")
try:
- self.assertFalse(category.AddTypeSynthetic(lldb.SBTypeNameSpecifier("NoneSuchType"), None), "adding a synthetic valued None worked")
+ self.assertFalse(
+ category.AddTypeSynthetic(
+ lldb.SBTypeNameSpecifier("NoneSuchType"),
+ None),
+ "adding a synthetic valued None worked")
except:
- pass
+ pass
else:
- self.assertFalse(True, "adding a synthetic valued None worked")
+ self.assertFalse(True, "adding a synthetic valued None worked")
try:
- self.assertFalse(category.AddTypeFormat(lldb.SBTypeNameSpecifier("NoneSuchType"), None), "adding a format valued None worked")
+ self.assertFalse(
+ category.AddTypeFormat(
+ lldb.SBTypeNameSpecifier("NoneSuchType"),
+ None),
+ "adding a format valued None worked")
except:
- pass
+ pass
else:
- self.assertFalse(True, "adding a format valued None worked")
-
+ self.assertFalse(True, "adding a format valued None worked")
- self.assertFalse(category.AddTypeSummary(lldb.SBTypeNameSpecifier("EmptySuchType"), lldb.SBTypeSummary()), "adding a summary without value worked")
- self.assertFalse(category.AddTypeFilter(lldb.SBTypeNameSpecifier("EmptySuchType"), lldb.SBTypeFilter()), "adding a filter without value worked")
- self.assertFalse(category.AddTypeSynthetic(lldb.SBTypeNameSpecifier("EmptySuchType"), lldb.SBTypeSynthetic()), "adding a synthetic without value worked")
- self.assertFalse(category.AddTypeFormat(lldb.SBTypeNameSpecifier("EmptySuchType"), lldb.SBTypeFormat()), "adding a format without value worked")
-
- self.assertFalse(category.AddTypeSummary(lldb.SBTypeNameSpecifier(""), lldb.SBTypeSummary.CreateWithSummaryString("")), "adding a summary for an invalid type worked")
- self.assertFalse(category.AddTypeFilter(lldb.SBTypeNameSpecifier(""), lldb.SBTypeFilter(0)), "adding a filter for an invalid type worked")
- self.assertFalse(category.AddTypeSynthetic(lldb.SBTypeNameSpecifier(""), lldb.SBTypeSynthetic.CreateWithClassName("")), "adding a synthetic for an invalid type worked")
- self.assertFalse(category.AddTypeFormat(lldb.SBTypeNameSpecifier(""), lldb.SBTypeFormat(lldb.eFormatHex)), "adding a format for an invalid type worked")
+ self.assertFalse(
+ category.AddTypeSummary(
+ lldb.SBTypeNameSpecifier("EmptySuchType"),
+ lldb.SBTypeSummary()),
+ "adding a summary without value worked")
+ self.assertFalse(
+ category.AddTypeFilter(
+ lldb.SBTypeNameSpecifier("EmptySuchType"),
+ lldb.SBTypeFilter()),
+ "adding a filter without value worked")
+ self.assertFalse(
+ category.AddTypeSynthetic(
+ lldb.SBTypeNameSpecifier("EmptySuchType"),
+ lldb.SBTypeSynthetic()),
+ "adding a synthetic without value worked")
+ self.assertFalse(
+ category.AddTypeFormat(
+ lldb.SBTypeNameSpecifier("EmptySuchType"),
+ lldb.SBTypeFormat()),
+ "adding a format without value worked")
+
+ self.assertFalse(
+ category.AddTypeSummary(
+ lldb.SBTypeNameSpecifier(""),
+ lldb.SBTypeSummary.CreateWithSummaryString("")),
+ "adding a summary for an invalid type worked")
+ self.assertFalse(
+ category.AddTypeFilter(
+ lldb.SBTypeNameSpecifier(""),
+ lldb.SBTypeFilter(0)),
+ "adding a filter for an invalid type worked")
+ self.assertFalse(
+ category.AddTypeSynthetic(
+ lldb.SBTypeNameSpecifier(""),
+ lldb.SBTypeSynthetic.CreateWithClassName("")),
+ "adding a synthetic for an invalid type worked")
+ self.assertFalse(
+ category.AddTypeFormat(
+ lldb.SBTypeNameSpecifier(""),
+ lldb.SBTypeFormat(
+ lldb.eFormatHex)),
+ "adding a format for an invalid type worked")
new_category = self.dbg.CreateCategory("newbar")
- new_category.AddTypeSummary(lldb.SBTypeNameSpecifier("JustAStruct"),
- lldb.SBTypeSummary.CreateWithScriptCode("return 'hello scripted world';"))
+ new_category.AddTypeSummary(
+ lldb.SBTypeNameSpecifier("JustAStruct"),
+ lldb.SBTypeSummary.CreateWithScriptCode("return 'hello scripted world';"))
self.expect("frame variable foo", matching=False,
- substrs = ['hello scripted world'])
+ substrs=['hello scripted world'])
new_category.enabled = True
self.expect("frame variable foo", matching=True,
- substrs = ['hello scripted world'])
+ substrs=['hello scripted world'])
self.expect("frame variable foo_ptr", matching=True,
- substrs = ['hello scripted world'])
- new_category.AddTypeSummary(lldb.SBTypeNameSpecifier("JustAStruct"),
- lldb.SBTypeSummary.CreateWithScriptCode("return 'hello scripted world';",
- lldb.eTypeOptionSkipPointers))
+ substrs=['hello scripted world'])
+ new_category.AddTypeSummary(
+ lldb.SBTypeNameSpecifier("JustAStruct"),
+ lldb.SBTypeSummary.CreateWithScriptCode(
+ "return 'hello scripted world';",
+ lldb.eTypeOptionSkipPointers))
self.expect("frame variable foo", matching=True,
- substrs = ['hello scripted world'])
+ substrs=['hello scripted world'])
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
+ frame = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame()
foo_ptr = frame.FindVariable("foo_ptr")
summary = foo_ptr.GetTypeSummary()
- self.assertFalse(summary.IsValid(), "summary found for foo* when none was planned")
+ self.assertFalse(
+ summary.IsValid(),
+ "summary found for foo* when none was planned")
self.expect("frame variable foo_ptr", matching=False,
- substrs = ['hello scripted world'])
+ substrs=['hello scripted world'])
- new_category.AddTypeSummary(lldb.SBTypeNameSpecifier("JustAStruct"),
- lldb.SBTypeSummary.CreateWithSummaryString("hello static world",
- lldb.eTypeOptionNone))
+ new_category.AddTypeSummary(
+ lldb.SBTypeNameSpecifier("JustAStruct"),
+ lldb.SBTypeSummary.CreateWithSummaryString(
+ "hello static world",
+ lldb.eTypeOptionNone))
summary = foo_ptr.GetTypeSummary()
- self.assertTrue(summary.IsValid(), "no summary found for foo* when one was in place")
- self.assertTrue(summary.GetData() == "hello static world", "wrong summary found for foo*")
+ self.assertTrue(
+ summary.IsValid(),
+ "no summary found for foo* when one was in place")
+ self.assertTrue(
+ summary.GetData() == "hello static world",
+ "wrong summary found for foo*")
self.expect("frame variable e1", substrs=["I am an empty Empty1 {}"])
self.expect("frame variable e2", substrs=["I am an empty Empty2"])
- self.expect("frame variable e2", substrs=["I am an empty Empty2 {}"], matching=False)
-
- self.assertTrue(self.dbg.GetCategory(lldb.eLanguageTypeObjC) is not None, "ObjC category is None")
+ self.expect(
+ "frame variable e2",
+ substrs=["I am an empty Empty2 {}"],
+ matching=False)
+
+ self.assertTrue(
+ self.dbg.GetCategory(
+ lldb.eLanguageTypeObjC) is not None,
+ "ObjC category is None")
@add_test_categories(['pyapi'])
def test_force_synth_off(self):
"""Test that one can have the public API return non-synthetic SBValues if desired"""
- self.build(dictionary={'EXE':'no_synth'})
+ self.build(dictionary={'EXE': 'no_synth'})
self.setTearDownCleanup()
self.runCmd("file no_synth", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -326,22 +466,31 @@ class SBFormattersAPITestCase(TestBase):
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
+ frame = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame()
int_vector = frame.FindVariable("int_vector")
if self.TraceOn():
- print(int_vector)
- self.assertTrue(int_vector.GetNumChildren() == 0, 'synthetic vector is empty')
+ print(int_vector)
+ self.assertTrue(
+ int_vector.GetNumChildren() == 0,
+ 'synthetic vector is empty')
self.runCmd('settings set target.enable-synthetic-value false')
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
+ frame = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame()
int_vector = frame.FindVariable("int_vector")
if self.TraceOn():
- print(int_vector)
- self.assertFalse(int_vector.GetNumChildren() == 0, '"physical" vector is not empty')
+ print(int_vector)
+ self.assertFalse(
+ int_vector.GetNumChildren() == 0,
+ '"physical" vector is not empty')
self.runCmd('settings set target.enable-synthetic-value true')
- frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame()
+ frame = self.dbg.GetSelectedTarget().GetProcess(
+ ).GetSelectedThread().GetSelectedFrame()
int_vector = frame.FindVariable("int_vector")
if self.TraceOn():
- print(int_vector)
- self.assertTrue(int_vector.GetNumChildren() == 0, 'synthetic vector is still empty')
+ print(int_vector)
+ self.assertTrue(
+ int_vector.GetNumChildren() == 0,
+ 'synthetic vector is still empty')
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/synth.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/synth.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/synth.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/formatters/synth.py Tue Sep 6 15:57:50 2016
@@ -1,23 +1,28 @@
import lldb
+
class jasSynthProvider:
- def __init__(self, valobj, dict):
- self.valobj = valobj;
- def num_children(self):
- return 2;
- def get_child_at_index(self, index):
- child = None
- if index == 0:
- child = self.valobj.GetChildMemberWithName('A');
- if index == 1:
- child = self.valobj.CreateValueFromExpression('X', '(int)1')
- return child;
- def get_child_index(self, name):
- if name == 'A':
- return 0;
- if name == 'X':
- return 1;
- return None;
+
+ def __init__(self, valobj, dict):
+ self.valobj = valobj
+
+ def num_children(self):
+ return 2
+
+ def get_child_at_index(self, index):
+ child = None
+ if index == 0:
+ child = self.valobj.GetChildMemberWithName('A')
+ if index == 1:
+ child = self.valobj.CreateValueFromExpression('X', '(int)1')
+ return child
+
+ def get_child_index(self, name):
+ if name == 'A':
+ return 0
+ if name == 'X':
+ return 1
+ return None
def ccc_summary(sbvalue, internal_dict):
@@ -25,11 +30,14 @@ def ccc_summary(sbvalue, internal_dict):
# This tests that the SBValue.GetNonSyntheticValue() actually returns a
# non-synthetic value. If it does not, then sbvalue.GetChildMemberWithName("a")
# in the following statement will call the 'get_child_index' method of the
- # synthetic child provider CCCSynthProvider below (which raises an exception).
- return "CCC object with leading value " + str(sbvalue.GetChildMemberWithName("a"))
+ # synthetic child provider CCCSynthProvider below (which raises an
+ # exception).
+ return "CCC object with leading value " + \
+ str(sbvalue.GetChildMemberWithName("a"))
class CCCSynthProvider(object):
+
def __init__(self, sbvalue, internal_dict):
self._sbvalue = sbvalue
@@ -53,6 +61,7 @@ def empty1_summary(sbvalue, internal_dic
class Empty1SynthProvider(object):
+
def __init__(self, sbvalue, internal_dict):
self._sbvalue = sbvalue
@@ -68,6 +77,7 @@ def empty2_summary(sbvalue, internal_dic
class Empty2SynthProvider(object):
+
def __init__(self, sbvalue, internal_dict):
self._sbvalue = sbvalue
@@ -78,28 +88,30 @@ class Empty2SynthProvider(object):
return None
-def __lldb_init_module(debugger,dict):
- debugger.CreateCategory("JASSynth").AddTypeSynthetic(lldb.SBTypeNameSpecifier("JustAStruct"),
+def __lldb_init_module(debugger, dict):
+ debugger.CreateCategory("JASSynth").AddTypeSynthetic(
+ lldb.SBTypeNameSpecifier("JustAStruct"),
lldb.SBTypeSynthetic.CreateWithClassName("synth.jasSynthProvider"))
- cat = lldb.debugger.CreateCategory("CCCSynth")
- cat.AddTypeSynthetic(
- lldb.SBTypeNameSpecifier("CCC"),
- lldb.SBTypeSynthetic.CreateWithClassName("synth.CCCSynthProvider",
+ cat = lldb.debugger.CreateCategory("CCCSynth")
+ cat.AddTypeSynthetic(
+ lldb.SBTypeNameSpecifier("CCC"),
+ lldb.SBTypeSynthetic.CreateWithClassName("synth.CCCSynthProvider",
+ lldb.eTypeOptionCascade))
+ cat.AddTypeSummary(
+ lldb.SBTypeNameSpecifier("CCC"),
+ lldb.SBTypeSummary.CreateWithFunctionName("synth.ccc_summary",
lldb.eTypeOptionCascade))
- cat.AddTypeSummary(
- lldb.SBTypeNameSpecifier("CCC"),
- lldb.SBTypeSummary.CreateWithFunctionName("synth.ccc_summary",
- lldb.eTypeOptionCascade))
- cat.AddTypeSynthetic(
- lldb.SBTypeNameSpecifier("Empty1"),
- lldb.SBTypeSynthetic.CreateWithClassName("synth.Empty1SynthProvider"))
- cat.AddTypeSummary(
- lldb.SBTypeNameSpecifier("Empty1"),
- lldb.SBTypeSummary.CreateWithFunctionName("synth.empty1_summary"))
- cat.AddTypeSynthetic(
- lldb.SBTypeNameSpecifier("Empty2"),
- lldb.SBTypeSynthetic.CreateWithClassName("synth.Empty2SynthProvider"))
- cat.AddTypeSummary(
- lldb.SBTypeNameSpecifier("Empty2"),
- lldb.SBTypeSummary.CreateWithFunctionName("synth.empty2_summary",
- lldb.eTypeOptionHideEmptyAggregates))
+ cat.AddTypeSynthetic(
+ lldb.SBTypeNameSpecifier("Empty1"),
+ lldb.SBTypeSynthetic.CreateWithClassName("synth.Empty1SynthProvider"))
+ cat.AddTypeSummary(
+ lldb.SBTypeNameSpecifier("Empty1"),
+ lldb.SBTypeSummary.CreateWithFunctionName("synth.empty1_summary"))
+ cat.AddTypeSynthetic(
+ lldb.SBTypeNameSpecifier("Empty2"),
+ lldb.SBTypeSynthetic.CreateWithClassName("synth.Empty2SynthProvider"))
+ cat.AddTypeSummary(
+ lldb.SBTypeNameSpecifier("Empty2"),
+ lldb.SBTypeSummary.CreateWithFunctionName(
+ "synth.empty2_summary",
+ lldb.eTypeOptionHideEmptyAggregates))
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py Tue Sep 6 15:57:50 2016
@@ -6,14 +6,15 @@ And other SBFrame API tests.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class FrameAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -37,7 +38,8 @@ class FrameAPITestCase(TestBase):
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
process = target.GetProcess()
self.assertTrue(process.GetState() == lldb.eStateStopped,
@@ -50,7 +52,8 @@ class FrameAPITestCase(TestBase):
from six import StringIO as SixStringIO
session = SixStringIO()
while process.GetState() == lldb.eStateStopped:
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
# Inspect at most 3 frames.
numFrames = min(3, thread.GetNumFrames())
@@ -76,27 +79,35 @@ class FrameAPITestCase(TestBase):
val.GetName(),
val.GetValue()))
print("%s(%s)" % (name, ", ".join(argList)), file=session)
-
+
# Also check the generic pc & stack pointer. We can't test their absolute values,
- # but they should be valid. Uses get_GPRs() from the lldbutil module.
+ # but they should be valid. Uses get_GPRs() from the lldbutil
+ # module.
gpr_reg_set = lldbutil.get_GPRs(frame)
pc_value = gpr_reg_set.GetChildMemberWithName("pc")
- self.assertTrue (pc_value, "We should have a valid PC.")
+ self.assertTrue(pc_value, "We should have a valid PC.")
pc_value_int = int(pc_value.GetValue(), 0)
# Make sure on arm targets we dont mismatch PC value on the basis of thumb bit.
- # Frame PC will not have thumb bit set in case of a thumb instruction as PC.
+ # Frame PC will not have thumb bit set in case of a thumb
+ # instruction as PC.
if self.getArchitecture() in ['arm']:
pc_value_int &= ~1
- self.assertTrue (pc_value_int == frame.GetPC(), "PC gotten as a value should equal frame's GetPC")
+ self.assertTrue(
+ pc_value_int == frame.GetPC(),
+ "PC gotten as a value should equal frame's GetPC")
sp_value = gpr_reg_set.GetChildMemberWithName("sp")
- self.assertTrue (sp_value, "We should have a valid Stack Pointer.")
- self.assertTrue (int(sp_value.GetValue(), 0) == frame.GetSP(), "SP gotten as a value should equal frame's GetSP")
+ self.assertTrue(
+ sp_value, "We should have a valid Stack Pointer.")
+ self.assertTrue(int(sp_value.GetValue(), 0) == frame.GetSP(
+ ), "SP gotten as a value should equal frame's GetSP")
print("---", file=session)
process.Continue()
# At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
+ self.assertTrue(
+ process.GetState() == lldb.eStateExited,
+ PROCESS_EXITED)
# Expect to find 'a' on the call stacks two times.
self.assertTrue(callsOfA == 2,
@@ -109,8 +120,8 @@ class FrameAPITestCase(TestBase):
print(session.getvalue())
self.expect(session.getvalue(), "Argugment values displayed correctly",
exe=False,
- substrs = ["a((int)val=1, (char)ch='A')",
- "a((int)val=3, (char)ch='A')"])
+ substrs=["a((int)val=1, (char)ch='A')",
+ "a((int)val=3, (char)ch='A')"])
@add_test_categories(['pyapi'])
def test_frame_api_boundary_condition(self):
@@ -130,13 +141,15 @@ class FrameAPITestCase(TestBase):
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
process = target.GetProcess()
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
frame = thread.GetFrameAtIndex(0)
if self.TraceOn():
@@ -170,13 +183,15 @@ class FrameAPITestCase(TestBase):
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
process = target.GetProcess()
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
frameEntered = thread.GetFrameAtIndex(0)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py Tue Sep 6 15:57:50 2016
@@ -5,20 +5,22 @@ Test that SBFrame::GetVariables() calls
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 lldbplatform
from lldbsuite.test import lldbutil
+
def get_names_from_value_list(value_list):
names = list()
for value in value_list:
names.append(value.GetName())
return names
+
class TestGetVariables(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -35,12 +37,16 @@ class TestGetVariables(TestBase):
if name in copy_names:
copy_names.remove(name)
else:
- self.assertTrue(False, "didn't find '%s' in %s" % (name, copy_names))
- self.assertEqual(len(copy_names), 0, "%s: we didn't find variables: %s in value list (%s)" % (description, copy_names, actual_names))
+ self.assertTrue(
+ False, "didn't find '%s' in %s" %
+ (name, copy_names))
+ self.assertEqual(
+ len(copy_names), 0, "%s: we didn't find variables: %s in value list (%s)" %
+ (description, copy_names, actual_names))
+
+ def test(self):
+ self.build()
- def test (self):
- self.build ()
-
# Set debugger into synchronous mode
self.dbg.SetAsync(False)
@@ -48,36 +54,42 @@ class TestGetVariables(TestBase):
exe = os.path.join(os.getcwd(), "a.out")
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
-
+
line1 = line_number(self.source, '// breakpoint 1')
line2 = line_number(self.source, '// breakpoint 2')
line3 = line_number(self.source, '// breakpoint 3')
- breakpoint1 = target.BreakpointCreateByLocation (self.source, line1);
- breakpoint2 = target.BreakpointCreateByLocation (self.source, line2);
- breakpoint3 = target.BreakpointCreateByLocation (self.source, line3);
+ breakpoint1 = target.BreakpointCreateByLocation(self.source, line1)
+ breakpoint2 = target.BreakpointCreateByLocation(self.source, line2)
+ breakpoint3 = target.BreakpointCreateByLocation(self.source, line3)
self.assertTrue(breakpoint1.GetNumLocations() >= 1, PROCESS_IS_VALID)
self.assertTrue(breakpoint2.GetNumLocations() >= 1, PROCESS_IS_VALID)
self.assertTrue(breakpoint3.GetNumLocations() >= 1, PROCESS_IS_VALID)
- # Register our shared libraries for remote targets so they get automatically uploaded
+ # Register our shared libraries for remote targets so they get
+ # automatically uploaded
arguments = None
- environment = None
+ environment = None
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (arguments, environment, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ arguments, environment, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
-
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint1)
- self.assertEqual(len(threads), 1, "There should be a thread stopped at breakpoint 1")
-
+
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint1)
+ self.assertEqual(
+ len(threads),
+ 1,
+ "There should be a thread stopped at breakpoint 1")
+
thread = threads[0]
self.assertTrue(thread.IsValid(), "Thread must be valid")
frame = thread.GetFrameAtIndex(0)
self.assertTrue(frame.IsValid(), "Frame must be valid")
-
- arg_names = ['argc', 'argv']
+
+ arg_names = ['argc', 'argv']
local_names = ['i', 'j', 'k']
static_names = ['static_var', 'g_global_var', 'g_static_var']
breakpoint1_locals = ['i']
@@ -95,96 +107,190 @@ class TestGetVariables(TestBase):
ignore_scope = False
# Verify if we ask for only arguments that we got what we expect
- vars = frame.GetVariables(args_yes, locals_no, statics_no, ignore_scope)
- self.assertEqual(vars.GetSize(), num_args, "There should be %i arguments, but we are reporting %i" % (num_args, vars.GetSize()))
+ vars = frame.GetVariables(
+ args_yes, locals_no, statics_no, ignore_scope)
+ self.assertEqual(
+ vars.GetSize(),
+ num_args,
+ "There should be %i arguments, but we are reporting %i" %
+ (num_args,
+ vars.GetSize()))
self.verify_variable_names("check names of arguments", vars, arg_names)
- self.assertEqual(len(arg_names), num_args, "make sure verify_variable_names() didn't mutate list")
+ self.assertEqual(
+ len(arg_names),
+ num_args,
+ "make sure verify_variable_names() didn't mutate list")
# Verify if we ask for only locals that we got what we expect
- vars = frame.GetVariables(args_no, locals_yes, statics_no, ignore_scope)
- self.assertEqual(vars.GetSize(), num_locals, "There should be %i local variables, but we are reporting %i" % (num_locals, vars.GetSize()))
+ vars = frame.GetVariables(
+ args_no, locals_yes, statics_no, ignore_scope)
+ self.assertEqual(
+ vars.GetSize(),
+ num_locals,
+ "There should be %i local variables, but we are reporting %i" %
+ (num_locals,
+ vars.GetSize()))
self.verify_variable_names("check names of locals", vars, local_names)
# Verify if we ask for only statics that we got what we expect
- vars = frame.GetVariables(args_no, locals_no, statics_yes, ignore_scope)
+ vars = frame.GetVariables(
+ args_no, locals_no, statics_yes, ignore_scope)
print('statics: ', str(vars))
- self.assertEqual(vars.GetSize(), num_statics, "There should be %i static variables, but we are reporting %i" % (num_statics, vars.GetSize()))
- self.verify_variable_names("check names of statics", vars, static_names)
+ self.assertEqual(
+ vars.GetSize(),
+ num_statics,
+ "There should be %i static variables, but we are reporting %i" %
+ (num_statics,
+ vars.GetSize()))
+ self.verify_variable_names(
+ "check names of statics", vars, static_names)
# Verify if we ask for arguments and locals that we got what we expect
- vars = frame.GetVariables(args_yes, locals_yes, statics_no, ignore_scope)
+ vars = frame.GetVariables(
+ args_yes, locals_yes, statics_no, ignore_scope)
desc = 'arguments + locals'
names = arg_names + local_names
count = len(names)
- self.assertEqual(vars.GetSize(), count, "There should be %i %s (%s) but we are reporting %i (%s)" % (count, desc, names, vars.GetSize(), get_names_from_value_list(vars)))
+ self.assertEqual(
+ vars.GetSize(),
+ count,
+ "There should be %i %s (%s) but we are reporting %i (%s)" %
+ (count,
+ desc,
+ names,
+ vars.GetSize(),
+ get_names_from_value_list(vars)))
self.verify_variable_names("check names of %s" % (desc), vars, names)
# Verify if we ask for arguments and statics that we got what we expect
- vars = frame.GetVariables(args_yes, locals_no, statics_yes, ignore_scope)
+ vars = frame.GetVariables(
+ args_yes, locals_no, statics_yes, ignore_scope)
desc = 'arguments + statics'
names = arg_names + static_names
count = len(names)
- self.assertEqual(vars.GetSize(), count, "There should be %i %s (%s) but we are reporting %i (%s)" % (count, desc, names, vars.GetSize(), get_names_from_value_list(vars)))
+ self.assertEqual(
+ vars.GetSize(),
+ count,
+ "There should be %i %s (%s) but we are reporting %i (%s)" %
+ (count,
+ desc,
+ names,
+ vars.GetSize(),
+ get_names_from_value_list(vars)))
self.verify_variable_names("check names of %s" % (desc), vars, names)
# Verify if we ask for locals and statics that we got what we expect
- vars = frame.GetVariables(args_no, locals_yes, statics_yes, ignore_scope)
+ vars = frame.GetVariables(
+ args_no, locals_yes, statics_yes, ignore_scope)
desc = 'locals + statics'
names = local_names + static_names
count = len(names)
- self.assertEqual(vars.GetSize(), count, "There should be %i %s (%s) but we are reporting %i (%s)" % (count, desc, names, vars.GetSize(), get_names_from_value_list(vars)))
+ self.assertEqual(
+ vars.GetSize(),
+ count,
+ "There should be %i %s (%s) but we are reporting %i (%s)" %
+ (count,
+ desc,
+ names,
+ vars.GetSize(),
+ get_names_from_value_list(vars)))
self.verify_variable_names("check names of %s" % (desc), vars, names)
- # Verify if we ask for arguments, locals and statics that we got what we expect
- vars = frame.GetVariables(args_yes, locals_yes, statics_yes, ignore_scope)
+ # Verify if we ask for arguments, locals and statics that we got what
+ # we expect
+ vars = frame.GetVariables(
+ args_yes, locals_yes, statics_yes, ignore_scope)
desc = 'arguments + locals + statics'
names = arg_names + local_names + static_names
count = len(names)
- self.assertEqual(vars.GetSize(), count, "There should be %i %s (%s) but we are reporting %i (%s)" % (count, desc, names, vars.GetSize(), get_names_from_value_list(vars)))
+ self.assertEqual(
+ vars.GetSize(),
+ count,
+ "There should be %i %s (%s) but we are reporting %i (%s)" %
+ (count,
+ desc,
+ names,
+ vars.GetSize(),
+ get_names_from_value_list(vars)))
self.verify_variable_names("check names of %s" % (desc), vars, names)
# Verify if we ask for in scope locals that we got what we expect
- vars = frame.GetVariables(args_no, locals_yes, statics_no, in_scopy_only)
+ vars = frame.GetVariables(
+ args_no, locals_yes, statics_no, in_scopy_only)
desc = 'in scope locals at breakpoint 1'
names = ['i']
count = len(names)
- self.assertEqual(vars.GetSize(), count, "There should be %i %s (%s) but we are reporting %i (%s)" % (count, desc, names, vars.GetSize(), get_names_from_value_list(vars)))
+ self.assertEqual(
+ vars.GetSize(),
+ count,
+ "There should be %i %s (%s) but we are reporting %i (%s)" %
+ (count,
+ desc,
+ names,
+ vars.GetSize(),
+ get_names_from_value_list(vars)))
self.verify_variable_names("check names of %s" % (desc), vars, names)
-
+
# Continue to breakpoint 2
process.Continue()
-
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint2)
- self.assertEqual(len(threads), 1, "There should be a thread stopped at breakpoint 2")
-
+
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint2)
+ self.assertEqual(
+ len(threads),
+ 1,
+ "There should be a thread stopped at breakpoint 2")
+
thread = threads[0]
self.assertTrue(thread.IsValid(), "Thread must be valid")
frame = thread.GetFrameAtIndex(0)
self.assertTrue(frame.IsValid(), "Frame must be valid")
# Verify if we ask for in scope locals that we got what we expect
- vars = frame.GetVariables(args_no, locals_yes, statics_no, in_scopy_only)
+ vars = frame.GetVariables(
+ args_no, locals_yes, statics_no, in_scopy_only)
desc = 'in scope locals at breakpoint 2'
names = ['i', 'j']
count = len(names)
- self.assertEqual(vars.GetSize(), count, "There should be %i %s (%s) but we are reporting %i (%s)" % (count, desc, names, vars.GetSize(), get_names_from_value_list(vars)))
+ self.assertEqual(
+ vars.GetSize(),
+ count,
+ "There should be %i %s (%s) but we are reporting %i (%s)" %
+ (count,
+ desc,
+ names,
+ vars.GetSize(),
+ get_names_from_value_list(vars)))
self.verify_variable_names("check names of %s" % (desc), vars, names)
# Continue to breakpoint 3
process.Continue()
-
- threads = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint3)
- self.assertEqual(len(threads), 1, "There should be a thread stopped at breakpoint 3")
-
+
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint3)
+ self.assertEqual(
+ len(threads),
+ 1,
+ "There should be a thread stopped at breakpoint 3")
+
thread = threads[0]
self.assertTrue(thread.IsValid(), "Thread must be valid")
frame = thread.GetFrameAtIndex(0)
self.assertTrue(frame.IsValid(), "Frame must be valid")
# Verify if we ask for in scope locals that we got what we expect
- vars = frame.GetVariables(args_no, locals_yes, statics_no, in_scopy_only)
+ vars = frame.GetVariables(
+ args_no, locals_yes, statics_no, in_scopy_only)
desc = 'in scope locals at breakpoint 3'
names = ['i', 'j', 'k']
count = len(names)
- self.assertEqual(vars.GetSize(), count, "There should be %i %s (%s) but we are reporting %i (%s)" % (count, desc, names, vars.GetSize(), get_names_from_value_list(vars)))
+ self.assertEqual(
+ vars.GetSize(),
+ count,
+ "There should be %i %s (%s) but we are reporting %i (%s)" %
+ (count,
+ desc,
+ names,
+ vars.GetSize(),
+ get_names_from_value_list(vars)))
self.verify_variable_names("check names of %s" % (desc), vars, names)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Testlldb Python SBFrame APIs IsInlined()
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class InlinedFrameAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,8 +23,10 @@ class InlinedFrameAPITestCase(TestBase):
TestBase.setUp(self)
# Find the line number to of function 'c'.
self.source = 'inlines.c'
- self.first_stop = line_number(self.source, '// This should correspond to the first break stop.')
- self.second_stop = line_number(self.source, '// This should correspond to the second break stop.')
+ self.first_stop = line_number(
+ self.source, '// This should correspond to the first break stop.')
+ self.second_stop = line_number(
+ self.source, '// This should correspond to the second break stop.')
@add_test_categories(['pyapi'])
def test_stop_at_outer_inline(self):
@@ -43,7 +46,8 @@ class InlinedFrameAPITestCase(TestBase):
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
process = target.GetProcess()
self.assertTrue(process.GetState() == lldb.eStateStopped,
@@ -52,7 +56,8 @@ class InlinedFrameAPITestCase(TestBase):
import lldbsuite.test.lldbutil as lldbutil
stack_traces1 = lldbutil.print_stacktraces(process, string_buffer=True)
if self.TraceOn():
- print("Full stack traces when first stopped on the breakpoint 'inner_inline':")
+ print(
+ "Full stack traces when first stopped on the breakpoint 'inner_inline':")
print(stack_traces1)
# The first breakpoint should correspond to an inlined call frame.
@@ -61,23 +66,32 @@ class InlinedFrameAPITestCase(TestBase):
#
# outer_inline (argc);
#
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
frame0 = thread.GetFrameAtIndex(0)
if frame0.IsInlined():
filename = frame0.GetLineEntry().GetFileSpec().GetFilename()
self.assertTrue(filename == self.source)
- self.expect(stack_traces1, "First stop at %s:%d" % (self.source, self.first_stop), exe=False,
- substrs = ['%s:%d' % (self.source, self.first_stop)])
+ self.expect(
+ stack_traces1, "First stop at %s:%d" %
+ (self.source, self.first_stop), exe=False, substrs=[
+ '%s:%d' %
+ (self.source, self.first_stop)])
# Expect to break again for the second time.
process.Continue()
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- stack_traces2 = lldbutil.print_stacktraces(process, string_buffer=True)
+ stack_traces2 = lldbutil.print_stacktraces(
+ process, string_buffer=True)
if self.TraceOn():
- print("Full stack traces when stopped on the breakpoint 'inner_inline' for the second time:")
+ print(
+ "Full stack traces when stopped on the breakpoint 'inner_inline' for the second time:")
print(stack_traces2)
- self.expect(stack_traces2, "Second stop at %s:%d" % (self.source, self.second_stop), exe=False,
- substrs = ['%s:%d' % (self.source, self.second_stop)])
+ self.expect(
+ stack_traces2, "Second stop at %s:%d" %
+ (self.source, self.second_stop), exe=False, substrs=[
+ '%s:%d' %
+ (self.source, self.second_stop)])
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestDisasmAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestDisasmAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestDisasmAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestDisasmAPI.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Test retrieval of SBAddress from functio
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class DisasmAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,8 +22,10 @@ class DisasmAPITestCase(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 for breakpoint 1 here.')
- self.line2 = line_number('main.c', '// Find the line number for breakpoint 2 here.')
+ self.line1 = line_number(
+ 'main.c', '// Find the line number for breakpoint 1 here.')
+ self.line2 = line_number(
+ 'main.c', '// Find the line number for breakpoint 2 here.')
@add_test_categories(['pyapi'])
def test(self):
@@ -47,13 +50,17 @@ class DisasmAPITestCase(TestBase):
VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.line1.
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
self.assertTrue(lineEntry.GetLine() == self.line1)
@@ -62,7 +69,8 @@ class DisasmAPITestCase(TestBase):
#print("address1:", address1)
# Now call SBTarget.ResolveSymbolContextForAddress() with address1.
- context1 = target.ResolveSymbolContextForAddress(address1, lldb.eSymbolContextEverything)
+ context1 = target.ResolveSymbolContextForAddress(
+ address1, lldb.eSymbolContextEverything)
self.assertTrue(context1)
if self.TraceOn():
@@ -71,13 +79,17 @@ class DisasmAPITestCase(TestBase):
# Continue the inferior, the breakpoint 2 should be hit.
process.Continue()
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
self.assertTrue(lineEntry.GetLine() == self.line2)
- # Verify that the symbol and the function has the same address range per function 'a'.
+ # Verify that the symbol and the function has the same address range
+ # per function 'a'.
symbol = context1.GetSymbol()
function = frame0.GetFunction()
self.assertTrue(symbol and function)
@@ -108,5 +120,6 @@ class DisasmAPITestCase(TestBase):
from lldbsuite.test.lldbutil import get_description
desc1 = get_description(sa1)
desc2 = get_description(sa2)
- self.assertTrue(desc1 and desc2 and desc1 == desc2,
- "SBAddress.GetDescription() API of sa1 and sa2 should return the same string")
+ self.assertTrue(
+ desc1 and desc2 and desc1 == desc2,
+ "SBAddress.GetDescription() API of sa1 and sa2 should return the same string")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Test newly added SBSymbol and SBAddress
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SymbolAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,8 +22,10 @@ class SymbolAPITestCase(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 for breakpoint 1 here.')
- self.line2 = line_number('main.c', '// Find the line number for breakpoint 2 here.')
+ self.line1 = line_number(
+ 'main.c', '// Find the line number for breakpoint 1 here.')
+ self.line2 = line_number(
+ 'main.c', '// Find the line number for breakpoint 2 here.')
@add_test_categories(['pyapi'])
def test(self):
@@ -47,35 +50,45 @@ class SymbolAPITestCase(TestBase):
VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.line1.
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
symbol_line1 = frame0.GetSymbol()
# We should have a symbol type of code.
self.assertTrue(symbol_line1.GetType() == lldb.eSymbolTypeCode)
addr_line1 = symbol_line1.GetStartAddress()
# And a section type of code, too.
- self.assertTrue(addr_line1.GetSection().GetSectionType() == lldb.eSectionTypeCode)
+ self.assertTrue(addr_line1.GetSection().GetSectionType()
+ == lldb.eSectionTypeCode)
# Continue the inferior, the breakpoint 2 should be hit.
process.Continue()
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
symbol_line2 = frame0.GetSymbol()
# We should have a symbol type of code.
self.assertTrue(symbol_line2.GetType() == lldb.eSymbolTypeCode)
addr_line2 = symbol_line2.GetStartAddress()
# And a section type of code, too.
- self.assertTrue(addr_line2.GetSection().GetSectionType() == lldb.eSectionTypeCode)
+ self.assertTrue(addr_line2.GetSection().GetSectionType()
+ == lldb.eSectionTypeCode)
# Now verify that both addresses point to the same module.
if self.TraceOn():
print("UUID:", addr_line1.GetModule().GetUUIDString())
- self.assertTrue(addr_line1.GetModule().GetUUIDString() == addr_line2.GetModule().GetUUIDString())
+ self.assertTrue(addr_line1.GetModule().GetUUIDString()
+ == addr_line2.GetModule().GetUUIDString())
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py Tue Sep 6 15:57:50 2016
@@ -3,7 +3,6 @@
from __future__ import print_function
-
import os
import sys
import time
@@ -13,10 +12,11 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class HelloWorldTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
-
+
def setUp(self):
# Call super's setUp().
TestBase.setUp(self)
@@ -58,7 +58,8 @@ class HelloWorldTestCase(TestBase):
# rdar://problem/8364687
# SBTarget.Launch() issue (or is there some race condition)?
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
# The following isn't needed anymore, rdar://8364687 is fixed.
#
# Apply some dances after LaunchProcess() in order to break at "main".
@@ -68,7 +69,8 @@ class HelloWorldTestCase(TestBase):
process = target.GetProcess()
self.assertTrue(process, PROCESS_IS_VALID)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
# The breakpoint should have a hit count of 1.
@@ -100,8 +102,8 @@ class HelloWorldTestCase(TestBase):
import lldbsuite.test.lldbutil as lldbutil
stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
self.expect(stacktraces, exe=False,
- substrs = ['main.c:%d' % self.line2,
- '(int)argc=3'])
+ substrs=['main.c:%d' % self.line2,
+ '(int)argc=3'])
@add_test_categories(['pyapi'])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24600")
@@ -121,7 +123,8 @@ class HelloWorldTestCase(TestBase):
listener = lldb.SBListener("my.attach.listener")
error = lldb.SBError()
- # Pass 'False' since we don't want to wait for new instance of "hello_world" to be launched.
+ # Pass 'False' since we don't want to wait for new instance of
+ # "hello_world" to be launched.
name = os.path.basename(self.exe)
# While we're at it, make sure that passing a None as the process name
@@ -135,12 +138,14 @@ class HelloWorldTestCase(TestBase):
self.assertTrue(error.Success() and process, PROCESS_IS_VALID)
# Verify that after attach, our selected target indeed matches name.
- self.expect(self.dbg.GetSelectedTarget().GetExecutable().GetFilename(), exe=False,
- startstr = name)
+ self.expect(
+ self.dbg.GetSelectedTarget().GetExecutable().GetFilename(),
+ exe=False,
+ startstr=name)
# Let's check the stack traces of the attached process.
import lldbsuite.test.lldbutil as lldbutil
stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
self.expect(stacktraces, exe=False,
- substrs = ['main.c:%d' % self.line2,
- '(int)argc=3'])
+ substrs=['main.c:%d' % self.line2,
+ '(int)argc=3'])
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/interpreter/TestCommandInterpreterAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/interpreter/TestCommandInterpreterAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/interpreter/TestCommandInterpreterAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/interpreter/TestCommandInterpreterAPI.py Tue Sep 6 15:57:50 2016
@@ -3,13 +3,13 @@
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class CommandInterpreterAPICase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -72,4 +72,4 @@ class CommandInterpreterAPICase(TestBase
lldbutil.state_type_to_str(process.GetState()))
if self.TraceOn():
- lldbutil.print_stacktraces(process)
+ lldbutil.print_stacktraces(process)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,13 @@ Test utility functions for the frame obj
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class FrameUtilsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -36,7 +36,8 @@ class FrameUtilsTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.LaunchProcess() failed")
@@ -44,17 +45,19 @@ class FrameUtilsTestCase(TestBase):
PROCESS_STOPPED)
import lldbsuite.test.lldbutil as lldbutil
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue (thread)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(thread)
frame0 = thread.GetFrameAtIndex(0)
- self.assertTrue (frame0)
+ self.assertTrue(frame0)
frame1 = thread.GetFrameAtIndex(1)
- self.assertTrue (frame1)
+ self.assertTrue(frame1)
parent = lldbutil.get_parent_frame(frame0)
self.assertTrue(parent and parent.GetFrameID() == frame1.GetFrameID())
frame0_args = lldbutil.get_args_as_string(frame0)
parent_args = lldbutil.get_args_as_string(parent)
- self.assertTrue(frame0_args and parent_args and "(int)val=1" in frame0_args)
+ self.assertTrue(
+ frame0_args and parent_args and "(int)val=1" in frame0_args)
if self.TraceOn():
lldbutil.print_stacktrace(thread)
print("Current frame: %s" % frame0_args)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Test the iteration protocol for some lld
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class LLDBIteratorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,7 +22,8 @@ class LLDBIteratorTestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line numbers to break inside main().
- self.line1 = line_number('main.cpp', '// Set break point at this line.')
+ self.line1 = line_number(
+ 'main.cpp', '// Set break point at this line.')
self.line2 = line_number('main.cpp', '// And that line.')
@add_test_categories(['pyapi'])
@@ -37,7 +39,8 @@ class LLDBIteratorTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.LaunchProcess() failed")
@@ -55,8 +58,9 @@ class LLDBIteratorTestCase(TestBase):
if self.TraceOn():
print("yours[%d]='%s'" % (i, get_description(yours[i])))
print("mine[%d]='%s'" % (i, get_description(mine[i])))
- self.assertTrue(yours[i] == mine[i],
- "UUID+FileSpec of yours[{0}] and mine[{0}] matches".format(i))
+ self.assertTrue(
+ yours[i] == mine[i],
+ "UUID+FileSpec of yours[{0}] and mine[{0}] matches".format(i))
@add_test_categories(['pyapi'])
def test_lldb_iter_breakpoint(self):
@@ -103,7 +107,8 @@ class LLDBIteratorTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.LaunchProcess() failed")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Test the iteration protocol for frame re
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class RegistersIteratorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -21,7 +22,8 @@ class RegistersIteratorTestCase(TestBase
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break inside main().
- self.line1 = line_number('main.cpp', '// Set break point at this line.')
+ self.line1 = line_number(
+ 'main.cpp', '// Set break point at this line.')
@add_test_categories(['pyapi'])
@expectedFailureAll(oslist=["windows"])
@@ -37,7 +39,8 @@ class RegistersIteratorTestCase(TestBase
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.LaunchProcess() failed")
@@ -46,14 +49,17 @@ class RegistersIteratorTestCase(TestBase
for thread in process:
if thread.GetStopReason() == lldb.eStopReasonBreakpoint:
for frame in thread:
- # Dump the registers of this frame using lldbutil.get_GPRs() and friends.
+ # Dump the registers of this frame using
+ # lldbutil.get_GPRs() and friends.
if self.TraceOn():
print(frame)
REGs = lldbutil.get_GPRs(frame)
num = len(REGs)
if self.TraceOn():
- print("\nNumber of general purpose registers: %d" % num)
+ print(
+ "\nNumber of general purpose registers: %d" %
+ num)
for reg in REGs:
self.assertTrue(reg)
if self.TraceOn():
@@ -72,11 +78,15 @@ class RegistersIteratorTestCase(TestBase
if self.platformIsDarwin():
num = len(REGs)
if self.TraceOn():
- print("\nNumber of exception state registers: %d" % num)
+ print(
+ "\nNumber of exception state registers: %d" %
+ num)
for reg in REGs:
self.assertTrue(reg)
if self.TraceOn():
- print("%s => %s" % (reg.GetName(), reg.GetValue()))
+ print(
+ "%s => %s" %
+ (reg.GetName(), reg.GetValue()))
else:
self.assertIsNone(REGs)
@@ -86,7 +96,8 @@ class RegistersIteratorTestCase(TestBase
REGs = lldbutil.get_registers(frame, kind)
self.assertTrue(REGs)
- REGs = lldbutil.get_registers(frame, "Exception State Registers")
+ REGs = lldbutil.get_registers(
+ frame, "Exception State Registers")
if self.platformIsDarwin():
self.assertIsNotNone(REGs)
else:
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Test SBprocess and SBThread APIs with pr
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ThreadsStackTracesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,11 +24,12 @@ class ThreadsStackTracesTestCase(TestBas
# Find the line number to break inside main().
self.line = line_number('main.cpp', '// Set break point at this line.')
- @expectedFailureAll("llvm.org/pr23043", ["linux"], archs=["i386"]) # We are unable to produce a backtrace of the main thread when the thread is blocked in fgets
-
- #The __thread_start function in libc doesn't contain any epilogue and prologue instructions
- #hence unwinding fail when we are stopped in __thread_start
- @expectedFailureAll(triple = 'mips*')
+ # We are unable to produce a backtrace of the main thread when the thread
+ # is blocked in fgets
+ @expectedFailureAll("llvm.org/pr23043", ["linux"], archs=["i386"])
+ # The __thread_start function in libc doesn't contain any epilogue and prologue instructions
+ # hence unwinding fail when we are stopped in __thread_start
+ @expectedFailureAll(triple='mips*')
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
@expectedFlakeyAndroid("llvm.org/26492", archs=["arm"])
@expectedFlakeyLinux("llvm.org/pr27687")
@@ -44,7 +46,8 @@ class ThreadsStackTracesTestCase(TestBas
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (["abc", "xyz"], None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ ["abc", "xyz"], None, self.get_process_working_directory())
if not process:
self.fail("SBTarget.LaunchProcess() failed")
@@ -57,4 +60,4 @@ class ThreadsStackTracesTestCase(TestBas
stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
self.expect(stacktraces, exe=False,
- substrs = ['(int)argc=3'])
+ substrs=['(int)argc=3'])
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py Tue Sep 6 15:57:50 2016
@@ -5,8 +5,8 @@ Test some SBModule and SBSection APIs.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
@@ -14,12 +14,14 @@ from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
from lldbsuite.test.lldbutil import symbol_type_to_str
+
class ModuleAndSectionAPIsTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
- # Py3 asserts due to a bug in SWIG. A fix for this was upstreamed into SWIG 3.0.8.
- @skipIf(py_version=['>=', (3,0)], swig_version=['<', (3,0,8)])
+ # Py3 asserts due to a bug in SWIG. A fix for this was upstreamed into
+ # SWIG 3.0.8.
+ @skipIf(py_version=['>=', (3, 0)], swig_version=['<', (3, 0, 8)])
@add_test_categories(['pyapi'])
def test_module_and_section(self):
"""Test module and section APIs."""
@@ -47,18 +49,29 @@ class ModuleAndSectionAPIsTestCase(TestB
INDENT2 = INDENT * 2
for sec in exe_module.section_iter():
print(sec)
- print(INDENT + "Number of subsections: %d" % sec.GetNumSubSections())
+ print(
+ INDENT +
+ "Number of subsections: %d" %
+ sec.GetNumSubSections())
if sec.GetNumSubSections() == 0:
for sym in exe_module.symbol_in_section_iter(sec):
print(INDENT + str(sym))
- print(INDENT + "symbol type: %s" % symbol_type_to_str(sym.GetType()))
+ print(
+ INDENT +
+ "symbol type: %s" %
+ symbol_type_to_str(
+ sym.GetType()))
else:
for subsec in sec:
print(INDENT + str(subsec))
# Now print the symbols belonging to the subsection....
for sym in exe_module.symbol_in_section_iter(subsec):
print(INDENT2 + str(sym))
- print(INDENT2 + "symbol type: %s" % symbol_type_to_str(sym.GetType()))
+ print(
+ INDENT2 +
+ "symbol type: %s" %
+ symbol_type_to_str(
+ sym.GetType()))
@add_test_categories(['pyapi'])
def test_module_and_section_boundary_condition(self):
@@ -128,4 +141,3 @@ class ModuleAndSectionAPIsTestCase(TestB
INDENT2 = INDENT * 2
for cu in exe_module.compile_unit_iter():
print(cu)
-
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/objc_type/TestObjCType.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/objc_type/TestObjCType.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/objc_type/TestObjCType.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/objc_type/TestObjCType.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Test SBType for ObjC classes.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ObjCSBTypeTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -38,22 +39,28 @@ class ObjCSBTypeTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
-
-
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
aBar = self.frame().FindVariable("aBar")
aBarType = aBar.GetType()
self.assertTrue(aBarType.IsValid(), "Bar should be a valid data type")
- self.assertTrue(aBarType.GetName() == "Bar *", "Bar has the right name")
-
- self.assertTrue(aBarType.GetNumberOfDirectBaseClasses() == 1, "Bar has a superclass")
+ self.assertTrue(
+ aBarType.GetName() == "Bar *",
+ "Bar has the right name")
+
+ self.assertTrue(
+ aBarType.GetNumberOfDirectBaseClasses() == 1,
+ "Bar has a superclass")
aFooType = aBarType.GetDirectBaseClassAtIndex(0)
self.assertTrue(aFooType.IsValid(), "Foo should be a valid data type")
@@ -62,4 +69,6 @@ class ObjCSBTypeTestCase(TestBase):
self.assertTrue(aBarType.GetNumberOfFields() == 1, "Bar has a field")
aBarField = aBarType.GetFieldAtIndex(0)
- self.assertTrue(aBarField.GetName() == "_iVar", "The field has the right name")
+ self.assertTrue(
+ aBarField.GetName() == "_iVar",
+ "The field has the right name")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,14 @@ Test SBProcess APIs, including ReadMemor
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.lldbutil import get_stopped_thread, state_type_to_str
+
class ProcessAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -20,7 +21,9 @@ class ProcessAPITestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to break inside main().
- self.line = line_number("main.cpp", "// Set break point at this line and check variable 'my_char'.")
+ self.line = line_number(
+ "main.cpp",
+ "// Set break point at this line and check variable 'my_char'.")
@add_test_categories(['pyapi'])
def test_read_memory(self):
@@ -35,10 +38,13 @@ class ProcessAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
frame = thread.GetFrameAtIndex(0)
# Get the SBValue for the global variable 'my_char'.
@@ -49,45 +55,55 @@ class ProcessAPITestCase(TestBase):
# expect to get a Python string as the result object!
error = lldb.SBError()
self.assertFalse(val.TypeIsPointerType())
- content = process.ReadMemory(val.AddressOf().GetValueAsUnsigned(), 1, error)
+ content = process.ReadMemory(
+ val.AddressOf().GetValueAsUnsigned(), 1, error)
if not error.Success():
self.fail("SBProcess.ReadMemory() failed")
if self.TraceOn():
print("memory content:", content)
- self.expect(content, "Result from SBProcess.ReadMemory() matches our expected output: 'x'",
- exe=False,
- startstr = b'x')
+ self.expect(
+ content,
+ "Result from SBProcess.ReadMemory() matches our expected output: 'x'",
+ exe=False,
+ startstr=b'x')
# Read (char *)my_char_ptr.
val = frame.FindValue("my_char_ptr", lldb.eValueTypeVariableGlobal)
self.DebugSBValue(val)
- cstring = process.ReadCStringFromMemory(val.GetValueAsUnsigned(), 256, error)
+ cstring = process.ReadCStringFromMemory(
+ val.GetValueAsUnsigned(), 256, error)
if not error.Success():
self.fail("SBProcess.ReadCStringFromMemory() failed")
if self.TraceOn():
print("cstring read is:", cstring)
- self.expect(cstring, "Result from SBProcess.ReadCStringFromMemory() matches our expected output",
- exe=False,
- startstr = 'Does it work?')
+ self.expect(
+ cstring,
+ "Result from SBProcess.ReadCStringFromMemory() matches our expected output",
+ exe=False,
+ startstr='Does it work?')
# Get the SBValue for the global variable 'my_cstring'.
val = frame.FindValue("my_cstring", lldb.eValueTypeVariableGlobal)
self.DebugSBValue(val)
# Due to the typemap magic (see lldb.swig), we pass in 256 to read at most 256 bytes
- # from the address, and expect to get a Python string as the result object!
+ # from the address, and expect to get a Python string as the result
+ # object!
self.assertFalse(val.TypeIsPointerType())
- cstring = process.ReadCStringFromMemory(val.AddressOf().GetValueAsUnsigned(), 256, error)
+ cstring = process.ReadCStringFromMemory(
+ val.AddressOf().GetValueAsUnsigned(), 256, error)
if not error.Success():
self.fail("SBProcess.ReadCStringFromMemory() failed")
if self.TraceOn():
print("cstring read is:", cstring)
- self.expect(cstring, "Result from SBProcess.ReadCStringFromMemory() matches our expected output",
- exe=False,
- startstr = 'lldb.SBProcess.ReadCStringFromMemory() works!')
+ self.expect(
+ cstring,
+ "Result from SBProcess.ReadCStringFromMemory() matches our expected output",
+ exe=False,
+ startstr='lldb.SBProcess.ReadCStringFromMemory() works!')
# Get the SBValue for the global variable 'my_uint32'.
val = frame.FindValue("my_uint32", lldb.eValueTypeVariableGlobal)
@@ -96,14 +112,16 @@ class ProcessAPITestCase(TestBase):
# Due to the typemap magic (see lldb.swig), we pass in 4 to read 4 bytes
# from the address, and expect to get an int as the result!
self.assertFalse(val.TypeIsPointerType())
- my_uint32 = process.ReadUnsignedFromMemory(val.AddressOf().GetValueAsUnsigned(), 4, error)
+ my_uint32 = process.ReadUnsignedFromMemory(
+ val.AddressOf().GetValueAsUnsigned(), 4, error)
if not error.Success():
self.fail("SBProcess.ReadCStringFromMemory() failed")
if self.TraceOn():
print("uint32 read is:", my_uint32)
if my_uint32 != 12345:
- self.fail("Result from SBProcess.ReadUnsignedFromMemory() does not match our expected output")
+ self.fail(
+ "Result from SBProcess.ReadUnsignedFromMemory() does not match our expected output")
@add_test_categories(['pyapi'])
def test_write_memory(self):
@@ -118,17 +136,21 @@ class ProcessAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
frame = thread.GetFrameAtIndex(0)
# Get the SBValue for the global variable 'my_char'.
val = frame.FindValue("my_char", lldb.eValueTypeVariableGlobal)
self.DebugSBValue(val)
- # If the variable does not have a load address, there's no sense continuing.
+ # If the variable does not have a load address, there's no sense
+ # continuing.
if not val.GetLocation().startswith("0x"):
return
@@ -136,7 +158,8 @@ class ProcessAPITestCase(TestBase):
location = int(val.GetLocation(), 16)
# The program logic makes the 'my_char' variable to have memory content as 'x'.
- # But we want to use the WriteMemory() API to assign 'a' to the variable.
+ # But we want to use the WriteMemory() API to assign 'a' to the
+ # variable.
# Now use WriteMemory() API to write 'a' into the global variable.
error = lldb.SBError()
@@ -153,9 +176,11 @@ class ProcessAPITestCase(TestBase):
if self.TraceOn():
print("memory content:", content)
- self.expect(content, "Result from SBProcess.ReadMemory() matches our expected output: 'a'",
- exe=False,
- startstr = b'a')
+ self.expect(
+ content,
+ "Result from SBProcess.ReadMemory() matches our expected output: 'a'",
+ exe=False,
+ startstr=b'a')
@add_test_categories(['pyapi'])
def test_access_my_int(self):
@@ -170,17 +195,21 @@ class ProcessAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
frame = thread.GetFrameAtIndex(0)
# Get the SBValue for the global variable 'my_int'.
val = frame.FindValue("my_int", lldb.eValueTypeVariableGlobal)
self.DebugSBValue(val)
- # If the variable does not have a load address, there's no sense continuing.
+ # If the variable does not have a load address, there's no sense
+ # continuing.
if not val.GetLocation().startswith("0x"):
return
@@ -204,7 +233,8 @@ class ProcessAPITestCase(TestBase):
return
# The program logic makes the 'my_int' variable to have int type and value of 0.
- # But we want to use the WriteMemory() API to assign 256 to the variable.
+ # But we want to use the WriteMemory() API to assign 256 to the
+ # variable.
# Now use WriteMemory() API to write 256 into the global variable.
error = lldb.SBError()
@@ -212,25 +242,31 @@ class ProcessAPITestCase(TestBase):
if not error.Success() or result != byteSize:
self.fail("SBProcess.WriteMemory() failed")
- # Make sure that the val we got originally updates itself to notice the change:
- self.expect(val.GetValue(),
- "SBProcess.ReadMemory() successfully writes (int)256 to the memory location for 'my_int'",
- exe=False,
- startstr = '256')
+ # Make sure that the val we got originally updates itself to notice the
+ # change:
+ self.expect(
+ val.GetValue(),
+ "SBProcess.ReadMemory() successfully writes (int)256 to the memory location for 'my_int'",
+ exe=False,
+ startstr='256')
- # And for grins, get the SBValue for the global variable 'my_int' again, to make sure that also tracks the new value:
+ # And for grins, get the SBValue for the global variable 'my_int'
+ # again, to make sure that also tracks the new value:
val = frame.FindValue("my_int", lldb.eValueTypeVariableGlobal)
- self.expect(val.GetValue(),
- "SBProcess.ReadMemory() successfully writes (int)256 to the memory location for 'my_int'",
- exe=False,
- startstr = '256')
+ self.expect(
+ val.GetValue(),
+ "SBProcess.ReadMemory() successfully writes (int)256 to the memory location for 'my_int'",
+ exe=False,
+ startstr='256')
- # Now read the memory content. The bytearray should have (byte)1 as the second element.
+ # Now read the memory content. The bytearray should have (byte)1 as
+ # the second element.
content = process.ReadMemory(location, byteSize, error)
if not error.Success():
self.fail("SBProcess.ReadMemory() failed")
- # The bytearray_to_int utility function expects a little endian bytearray.
+ # The bytearray_to_int utility function expects a little endian
+ # bytearray.
if byteOrder == lldb.eByteOrderBig:
content = bytearray(content, 'ascii')
content.reverse()
@@ -254,15 +290,19 @@ class ProcessAPITestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
if self.TraceOn():
print("process state:", state_type_to_str(process.GetState()))
self.assertTrue(process.GetState() != lldb.eStateConnected)
error = lldb.SBError()
- success = process.RemoteLaunch(None, None, None, None, None, None, 0, False, error)
- self.assertTrue(not success, "RemoteLaunch() should fail for process state != eStateConnected")
+ success = process.RemoteLaunch(
+ None, None, None, None, None, None, 0, False, error)
+ self.assertTrue(
+ not success,
+ "RemoteLaunch() should fail for process state != eStateConnected")
@add_test_categories(['pyapi'])
def test_get_num_supported_hardware_watchpoints(self):
@@ -278,10 +318,10 @@ class ProcessAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
- error = lldb.SBError();
+ error = lldb.SBError()
num = process.GetNumSupportedHardwareWatchpoints(error)
if self.TraceOn() and error.Success():
print("Number of supported hardware watchpoints: %d" % num)
-
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py Tue Sep 6 15:57:50 2016
@@ -3,13 +3,15 @@
from __future__ import print_function
-
-import os, sys, time
+import os
+import sys
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ProcessIOTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,16 +21,19 @@ class ProcessIOTestCase(TestBase):
TestBase.setUp(self)
# Get the full path to our executable to be debugged.
self.exe = os.path.join(os.getcwd(), "process_io")
- self.local_input_file = os.path.join(os.getcwd(), "input.txt")
+ self.local_input_file = os.path.join(os.getcwd(), "input.txt")
self.local_output_file = os.path.join(os.getcwd(), "output.txt")
- self.local_error_file = os.path.join(os.getcwd(), "error.txt")
+ self.local_error_file = os.path.join(os.getcwd(), "error.txt")
- self.input_file = os.path.join(self.get_process_working_directory(), "input.txt")
- self.output_file = os.path.join(self.get_process_working_directory(), "output.txt")
- self.error_file = os.path.join(self.get_process_working_directory(), "error.txt")
+ self.input_file = os.path.join(
+ self.get_process_working_directory(), "input.txt")
+ self.output_file = os.path.join(
+ self.get_process_working_directory(), "output.txt")
+ self.error_file = os.path.join(
+ self.get_process_working_directory(), "error.txt")
self.lines = ["Line 1", "Line 2", "Line 3"]
- @skipIfWindows # stdio manipulation unsupported on Windows
+ @skipIfWindows # stdio manipulation unsupported on Windows
@add_test_categories(['pyapi'])
@expectedFlakeyLinux(bugnumber="llvm.org/pr26437")
def test_stdin_by_api(self):
@@ -39,7 +44,7 @@ class ProcessIOTestCase(TestBase):
output = self.process.GetSTDOUT(1000)
self.check_process_output(output, output)
- @skipIfWindows # stdio manipulation unsupported on Windows
+ @skipIfWindows # stdio manipulation unsupported on Windows
@add_test_categories(['pyapi'])
@expectedFlakeyLinux(bugnumber="llvm.org/pr26437")
def test_stdin_redirection(self):
@@ -48,10 +53,10 @@ class ProcessIOTestCase(TestBase):
self.create_target()
self.redirect_stdin()
self.run_process(False)
- output = self.process.GetSTDOUT(1000)
+ output = self.process.GetSTDOUT(1000)
self.check_process_output(output, output)
- @skipIfWindows # stdio manipulation unsupported on Windows
+ @skipIfWindows # stdio manipulation unsupported on Windows
@add_test_categories(['pyapi'])
@expectedFlakeyLinux(bugnumber="llvm.org/pr26437")
def test_stdout_redirection(self):
@@ -64,7 +69,7 @@ class ProcessIOTestCase(TestBase):
error = self.process.GetSTDOUT(1000)
self.check_process_output(output, error)
- @skipIfWindows # stdio manipulation unsupported on Windows
+ @skipIfWindows # stdio manipulation unsupported on Windows
@add_test_categories(['pyapi'])
@expectedFlakeyLinux(bugnumber="llvm.org/pr26437")
def test_stderr_redirection(self):
@@ -77,7 +82,7 @@ class ProcessIOTestCase(TestBase):
error = self.read_error_file_and_delete()
self.check_process_output(output, error)
- @skipIfWindows # stdio manipulation unsupported on Windows
+ @skipIfWindows # stdio manipulation unsupported on Windows
@add_test_categories(['pyapi'])
@expectedFlakeyLinux(bugnumber="llvm.org/pr26437")
def test_stdout_stderr_redirection(self):
@@ -98,29 +103,35 @@ class ProcessIOTestCase(TestBase):
self.runCmd('platform get-file "{remote}" "{local}"'.format(
remote=target_file, local=local_file))
- self.assertTrue(os.path.exists(local_file), 'Make sure "{local}" file exists'.format(local=local_file))
+ self.assertTrue(
+ os.path.exists(local_file),
+ 'Make sure "{local}" file exists'.format(
+ local=local_file))
f = open(local_file, 'r')
contents = f.read()
f.close()
- #TODO: add 'platform delete-file' file command
- #if lldb.remote_platform:
+ # TODO: add 'platform delete-file' file command
+ # if lldb.remote_platform:
# self.runCmd('platform delete-file "{remote}"'.format(remote=target_file))
os.unlink(local_file)
return contents
def read_output_file_and_delete(self):
- return self.read_file_and_delete(self.output_file, self.local_output_file)
+ return self.read_file_and_delete(
+ self.output_file, self.local_output_file)
def read_error_file_and_delete(self):
- return self.read_file_and_delete(self.error_file, self.local_error_file)
+ return self.read_file_and_delete(
+ self.error_file, self.local_error_file)
def create_target(self):
'''Create the target and launch info that will be used by all tests'''
- self.target = self.dbg.CreateTarget(self.exe)
+ self.target = self.dbg.CreateTarget(self.exe)
self.launch_info = lldb.SBLaunchInfo([self.exe])
- self.launch_info.SetWorkingDirectory(self.get_process_working_directory())
-
+ self.launch_info.SetWorkingDirectory(
+ self.get_process_working_directory())
+
def redirect_stdin(self):
'''Redirect STDIN (file descriptor 0) to use our input.txt file
@@ -140,43 +151,49 @@ class ProcessIOTestCase(TestBase):
# clean slate for the next test case.
def cleanup():
os.unlink(self.local_input_file)
- #TODO: add 'platform delete-file' file command
- #if lldb.remote_platform:
+ # TODO: add 'platform delete-file' file command
+ # if lldb.remote_platform:
# self.runCmd('platform delete-file "{remote}"'.format(remote=self.input_file))
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.launch_info.AddOpenFileAction(0, self.input_file, True, False);
-
+ self.launch_info.AddOpenFileAction(0, self.input_file, True, False)
+
def redirect_stdout(self):
'''Redirect STDOUT (file descriptor 1) to use our output.txt file'''
- self.launch_info.AddOpenFileAction(1, self.output_file, False, True);
-
+ self.launch_info.AddOpenFileAction(1, self.output_file, False, True)
+
def redirect_stderr(self):
'''Redirect STDERR (file descriptor 2) to use our error.txt file'''
- self.launch_info.AddOpenFileAction(2, self.error_file, False, True);
-
+ self.launch_info.AddOpenFileAction(2, self.error_file, False, True)
+
def run_process(self, put_stdin):
'''Run the process to completion and optionally put lines to STDIN via the API if "put_stdin" is True'''
# Set the breakpoints
- self.breakpoint = self.target.BreakpointCreateBySourceRegex('Set breakpoint here', lldb.SBFileSpec("main.c"))
- self.assertTrue(self.breakpoint.GetNumLocations() > 0, VALID_BREAKPOINT)
+ self.breakpoint = self.target.BreakpointCreateBySourceRegex(
+ 'Set breakpoint here', lldb.SBFileSpec("main.c"))
+ self.assertTrue(
+ self.breakpoint.GetNumLocations() > 0,
+ VALID_BREAKPOINT)
# Launch the process, and do not stop at the entry point.
error = lldb.SBError()
# This should launch the process and it should exit by the time we get back
# because we have synchronous mode enabled
- self.process = self.target.Launch (self.launch_info, error)
+ self.process = self.target.Launch(self.launch_info, error)
- self.assertTrue(error.Success(), "Make sure process launched successfully")
+ self.assertTrue(
+ error.Success(),
+ "Make sure process launched successfully")
self.assertTrue(self.process, PROCESS_IS_VALID)
if self.TraceOn():
print("process launched.")
# Frame #0 should be at our breakpoint.
- threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, self.breakpoint)
-
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ self.process, self.breakpoint)
+
self.assertTrue(len(threads) == 1)
self.thread = threads[0]
self.frame = self.thread.frames[0]
@@ -189,13 +206,13 @@ class ProcessIOTestCase(TestBase):
if put_stdin:
for line in self.lines:
self.process.PutSTDIN(line + "\n")
-
+
# Let process continue so it will exit
self.process.Continue()
state = self.process.GetState()
self.assertTrue(state == lldb.eStateExited, PROCESS_IS_VALID)
-
- def check_process_output (self, output, error):
+
+ def check_process_output(self, output, error):
# Since we launched the process without specifying stdin/out/err,
# a pseudo terminal is used for stdout/err, and we are satisfied
# once "input line=>1" appears in stdout.
@@ -203,10 +220,14 @@ class ProcessIOTestCase(TestBase):
if self.TraceOn():
print("output = '%s'" % output)
print("error = '%s'" % error)
-
+
for line in self.lines:
check_line = 'input line to stdout: %s' % (line)
- self.assertTrue(check_line in output, "verify stdout line shows up in STDOUT")
+ self.assertTrue(
+ check_line in output,
+ "verify stdout line shows up in STDOUT")
for line in self.lines:
check_line = 'input line to stderr: %s' % (line)
- self.assertTrue(check_line in error, "verify stderr line shows up in STDERR")
+ self.assertTrue(
+ check_line in error,
+ "verify stderr line shows up in STDERR")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py Tue Sep 6 15:57:50 2016
@@ -5,12 +5,13 @@ Check that SBValue.GetValueAsSigned() do
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 Radar12481949DataFormatterTestCase(TestBase):
# test for rdar://problem/12481949
@@ -27,14 +28,15 @@ class Radar12481949DataFormatterTestCase
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
@@ -45,10 +47,22 @@ class Radar12481949DataFormatterTestCase
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
- self.assertTrue(self.frame().FindVariable("myvar").GetValueAsSigned() == -1, "GetValueAsSigned() says -1")
- self.assertTrue(self.frame().FindVariable("myvar").GetValueAsSigned() != 0xFFFFFFFF, "GetValueAsSigned() does not say 0xFFFFFFFF")
- self.assertTrue(self.frame().FindVariable("myvar").GetValueAsSigned() != 0xFFFFFFFFFFFFFFFF, "GetValueAsSigned() does not say 0xFFFFFFFFFFFFFFFF")
-
- self.assertTrue(self.frame().FindVariable("myvar").GetValueAsUnsigned() != -1, "GetValueAsUnsigned() does not say -1")
- self.assertTrue(self.frame().FindVariable("myvar").GetValueAsUnsigned() == 0xFFFFFFFF, "GetValueAsUnsigned() says 0xFFFFFFFF")
- self.assertTrue(self.frame().FindVariable("myvar").GetValueAsUnsigned() != 0xFFFFFFFFFFFFFFFF, "GetValueAsUnsigned() does not says 0xFFFFFFFFFFFFFFFF")
+ self.assertTrue(
+ self.frame().FindVariable("myvar").GetValueAsSigned() == -1,
+ "GetValueAsSigned() says -1")
+ self.assertTrue(
+ self.frame().FindVariable("myvar").GetValueAsSigned() != 0xFFFFFFFF,
+ "GetValueAsSigned() does not say 0xFFFFFFFF")
+ self.assertTrue(
+ self.frame().FindVariable("myvar").GetValueAsSigned() != 0xFFFFFFFFFFFFFFFF,
+ "GetValueAsSigned() does not say 0xFFFFFFFFFFFFFFFF")
+
+ self.assertTrue(
+ self.frame().FindVariable("myvar").GetValueAsUnsigned() != -1,
+ "GetValueAsUnsigned() does not say -1")
+ self.assertTrue(
+ self.frame().FindVariable("myvar").GetValueAsUnsigned() == 0xFFFFFFFF,
+ "GetValueAsUnsigned() says 0xFFFFFFFF")
+ self.assertTrue(
+ self.frame().FindVariable("myvar").GetValueAsUnsigned() != 0xFFFFFFFFFFFFFFFF,
+ "GetValueAsUnsigned() does not says 0xFFFFFFFFFFFFFFFF")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py Tue Sep 6 15:57:50 2016
@@ -3,7 +3,6 @@
from __future__ import print_function
-
from math import fabs
import os
import lldb
@@ -11,6 +10,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SBDataAPICase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,21 +26,23 @@ class SBDataAPICase(TestBase):
"""Test the SBData APIs."""
self.build()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
-
- lldbutil.run_break_set_by_file_and_line (self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
-
+
+ lldbutil.run_break_set_by_file_and_line(
+ self, "main.cpp", self.line, num_expected_locations=1, loc_exact=True)
+
self.runCmd("run", RUN_SUCCEEDED)
-
+
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'stop reason = breakpoint'])
-
+ substrs=['stopped',
+ 'stop reason = breakpoint'])
+
target = self.dbg.GetSelectedTarget()
-
+
process = target.GetProcess()
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
self.assertIsNotNone(thread)
frame = thread.GetSelectedFrame()
@@ -67,8 +69,17 @@ class SBDataAPICase(TestBase):
high = data.GetSignedInt16(error, offset)
self.assertTrue(error.Success())
offset += 2
- self.assertTrue ((low == 9 and high == 0) or (low == 0 and high == 9), 'foo[0].b == 9')
- self.assertTrue( fabs(data.GetFloat(error, offset) - 3.14) < 1, 'foo[0].c == 3.14')
+ self.assertTrue(
+ (low == 9 and high == 0) or (
+ low == 0 and high == 9),
+ 'foo[0].b == 9')
+ self.assertTrue(
+ fabs(
+ data.GetFloat(
+ error,
+ offset) -
+ 3.14) < 1,
+ 'foo[0].c == 3.14')
self.assertTrue(error.Success())
offset += 4
self.assert_data(data.GetUnsignedInt32, offset, 8)
@@ -90,18 +101,22 @@ class SBDataAPICase(TestBase):
offset += 4
self.assert_data(data.GetSignedInt32, offset, 7)
offset += 8
- self.assertTrue(data.GetUnsignedInt32(error, offset) == 0, 'do not read beyond end')
+ self.assertTrue(
+ data.GetUnsignedInt32(
+ error,
+ offset) == 0,
+ 'do not read beyond end')
self.assertTrue(not error.Success())
- error.Clear() # clear the error for the next test
+ error.Clear() # clear the error for the next test
star_foobar = foobar.Dereference()
self.assertTrue(star_foobar.IsValid())
-
+
data = star_foobar.GetData()
if self.TraceOn():
print(data)
-
+
offset = 0
self.assert_data(data.GetUnsignedInt32, offset, 1)
offset += 4
@@ -113,13 +128,16 @@ class SBDataAPICase(TestBase):
# http://llvm.org/bugs/show_bug.cgi?id=11579
# lldb::SBValue::CreateValueFromAddress does not verify SBType::GetPointerType succeeds
# This should not crash LLDB.
- nothing = foobar.CreateValueFromAddress("nothing", foobar_addr, star_foobar.GetType().GetBasicType(lldb.eBasicTypeInvalid))
+ nothing = foobar.CreateValueFromAddress(
+ "nothing", foobar_addr, star_foobar.GetType().GetBasicType(
+ lldb.eBasicTypeInvalid))
- new_foobar = foobar.CreateValueFromAddress("f00", foobar_addr, star_foobar.GetType())
+ new_foobar = foobar.CreateValueFromAddress(
+ "f00", foobar_addr, star_foobar.GetType())
self.assertTrue(new_foobar.IsValid())
if self.TraceOn():
print(new_foobar)
-
+
data = new_foobar.GetData()
if self.TraceOn():
@@ -127,7 +145,8 @@ class SBDataAPICase(TestBase):
self.assertTrue(data.uint32[0] == 8, 'then foo[1].a == 8')
self.assertTrue(data.uint32[1] == 7, 'then foo[1].b == 7')
- self.assertTrue(fabs(data.float[2] - 3.14) < 1, 'foo[1].c == 3.14') # exploiting that sizeof(uint32) == sizeof(float)
+ # exploiting that sizeof(uint32) == sizeof(float)
+ self.assertTrue(fabs(data.float[2] - 3.14) < 1, 'foo[1].c == 3.14')
self.runCmd("n")
@@ -136,7 +155,13 @@ class SBDataAPICase(TestBase):
offset += 4
self.assert_data(data.GetUnsignedInt32, offset, 7)
offset += 4
- self.assertTrue(fabs(data.GetFloat(error, offset) - 3.14) < 1, 'foo[1].c == 3.14')
+ self.assertTrue(
+ fabs(
+ data.GetFloat(
+ error,
+ offset) -
+ 3.14) < 1,
+ 'foo[1].c == 3.14')
self.assertTrue(error.Success())
data = new_foobar.GetData()
@@ -149,7 +174,13 @@ class SBDataAPICase(TestBase):
offset += 4
self.assert_data(data.GetUnsignedInt32, offset, 7)
offset += 4
- self.assertTrue(fabs(data.GetFloat(error, offset) - 6.28) < 1, 'foo[1].c == 6.28')
+ self.assertTrue(
+ fabs(
+ data.GetFloat(
+ error,
+ offset) -
+ 6.28) < 1,
+ 'foo[1].c == 6.28')
self.assertTrue(error.Success())
self.runCmd("n")
@@ -169,35 +200,61 @@ class SBDataAPICase(TestBase):
offset += 4
self.assert_data(data.GetUnsignedInt32, offset, 2)
offset += 4
- self.assertTrue(fabs(data.GetFloat(error, offset) - 3) < 1, 'barfoo[0].c == 3')
+ self.assertTrue(
+ fabs(
+ data.GetFloat(
+ error,
+ offset) -
+ 3) < 1,
+ 'barfoo[0].c == 3')
self.assertTrue(error.Success())
offset += 4
self.assert_data(data.GetUnsignedInt32, offset, 4)
offset += 4
self.assert_data(data.GetUnsignedInt32, offset, 5)
offset += 4
- self.assertTrue(fabs(data.GetFloat(error, offset) - 6) < 1, 'barfoo[1].c == 6')
+ self.assertTrue(
+ fabs(
+ data.GetFloat(
+ error,
+ offset) -
+ 6) < 1,
+ 'barfoo[1].c == 6')
self.assertTrue(error.Success())
- new_object = barfoo.CreateValueFromData("new_object",data,barfoo.GetType().GetBasicType(lldb.eBasicTypeInt))
+ new_object = barfoo.CreateValueFromData(
+ "new_object", data, barfoo.GetType().GetBasicType(
+ lldb.eBasicTypeInt))
if self.TraceOn():
print(new_object)
-
+
self.assertTrue(new_object.GetValue() == "1", 'new_object == 1')
if data.GetByteOrder() == lldb.eByteOrderBig:
- data.SetData(error, '\0\0\0A', data.GetByteOrder(), data.GetAddressByteSize())
+ data.SetData(
+ error,
+ '\0\0\0A',
+ data.GetByteOrder(),
+ data.GetAddressByteSize())
else:
- data.SetData(error, 'A\0\0\0', data.GetByteOrder(), data.GetAddressByteSize())
+ data.SetData(
+ error,
+ 'A\0\0\0',
+ data.GetByteOrder(),
+ data.GetAddressByteSize())
self.assertTrue(error.Success())
-
+
data2 = lldb.SBData()
- data2.SetData(error, 'BCD', data.GetByteOrder(), data.GetAddressByteSize())
+ data2.SetData(
+ error,
+ 'BCD',
+ data.GetByteOrder(),
+ data.GetAddressByteSize())
self.assertTrue(error.Success())
data.Append(data2)
-
+
if self.TraceOn():
print(data)
@@ -213,74 +270,160 @@ class SBDataAPICase(TestBase):
offset += 1
# check the new API calls introduced per LLVM llvm.org/prenhancement request
- # 11619 (Allow creating SBData values from arrays or primitives in Python)
+ # 11619 (Allow creating SBData values from arrays or primitives in
+ # Python)
hello_str = "hello!"
- data2 = lldb.SBData.CreateDataFromCString(process.GetByteOrder(),process.GetAddressByteSize(),hello_str)
+ data2 = lldb.SBData.CreateDataFromCString(
+ process.GetByteOrder(), process.GetAddressByteSize(), hello_str)
self.assertTrue(len(data2.uint8) == len(hello_str))
self.assertTrue(data2.uint8[0] == 104, 'h == 104')
self.assertTrue(data2.uint8[1] == 101, 'e == 101')
self.assertTrue(data2.uint8[2] == 108, 'l == 108')
- self.assert_data(data2.GetUnsignedInt8, 3, 108) # l
+ self.assert_data(data2.GetUnsignedInt8, 3, 108) # l
self.assertTrue(data2.uint8[4] == 111, 'o == 111')
- self.assert_data(data2.GetUnsignedInt8, 5, 33) # !
+ self.assert_data(data2.GetUnsignedInt8, 5, 33) # !
- uint_lists = [ [1,2,3,4,5], [int(i) for i in [1, 2, 3, 4, 5]] ]
- int_lists = [ [2, -2], [int(i) for i in [2, -2]] ]
+ uint_lists = [[1, 2, 3, 4, 5], [int(i) for i in [1, 2, 3, 4, 5]]]
+ int_lists = [[2, -2], [int(i) for i in [2, -2]]]
for l in uint_lists:
- data2 = lldb.SBData.CreateDataFromUInt64Array(process.GetByteOrder(), process.GetAddressByteSize(), l)
+ data2 = lldb.SBData.CreateDataFromUInt64Array(
+ process.GetByteOrder(), process.GetAddressByteSize(), l)
self.assert_data(data2.GetUnsignedInt64, 0, 1)
self.assert_data(data2.GetUnsignedInt64, 8, 2)
self.assert_data(data2.GetUnsignedInt64, 16, 3)
self.assert_data(data2.GetUnsignedInt64, 24, 4)
self.assert_data(data2.GetUnsignedInt64, 32, 5)
-
- self.assertTrue(data2.uint64s == [1,2,3,4,5], 'read_data_helper failure: data2 == [1,2,3,4,5]')
+
+ self.assertTrue(
+ data2.uint64s == [
+ 1,
+ 2,
+ 3,
+ 4,
+ 5],
+ 'read_data_helper failure: data2 == [1,2,3,4,5]')
for l in int_lists:
- data2 = lldb.SBData.CreateDataFromSInt32Array(process.GetByteOrder(), process.GetAddressByteSize(), l)
- self.assertTrue(data2.sint32[0:2] == [2,-2], 'signed32 data2 = [2,-2]')
-
- data2.Append(lldb.SBData.CreateDataFromSInt64Array(process.GetByteOrder(), process.GetAddressByteSize(), int_lists[0]))
+ data2 = lldb.SBData.CreateDataFromSInt32Array(
+ process.GetByteOrder(), process.GetAddressByteSize(), l)
+ self.assertTrue(
+ data2.sint32[
+ 0:2] == [
+ 2, -2], 'signed32 data2 = [2,-2]')
+
+ data2.Append(
+ lldb.SBData.CreateDataFromSInt64Array(
+ process.GetByteOrder(),
+ process.GetAddressByteSize(),
+ int_lists[0]))
self.assert_data(data2.GetSignedInt32, 0, 2)
self.assert_data(data2.GetSignedInt32, 4, -2)
- self.assertTrue(data2.sint64[1:3] == [2,-2], 'signed64 data2 = [2,-2]')
+ self.assertTrue(
+ data2.sint64[
+ 1:3] == [
+ 2, -2], 'signed64 data2 = [2,-2]')
for l in int_lists:
- data2 = lldb.SBData.CreateDataFromSInt64Array(process.GetByteOrder(), process.GetAddressByteSize(), l)
+ data2 = lldb.SBData.CreateDataFromSInt64Array(
+ process.GetByteOrder(), process.GetAddressByteSize(), l)
self.assert_data(data2.GetSignedInt64, 0, 2)
self.assert_data(data2.GetSignedInt64, 8, -2)
- self.assertTrue(data2.sint64[0:2] == [2,-2], 'signed64 data2 = [2,-2]')
+ self.assertTrue(
+ data2.sint64[
+ 0:2] == [
+ 2, -2], 'signed64 data2 = [2,-2]')
for l in uint_lists:
- data2 = lldb.SBData.CreateDataFromUInt32Array(process.GetByteOrder(), process.GetAddressByteSize(), l)
- self.assert_data(data2.GetUnsignedInt32,0, 1)
- self.assert_data(data2.GetUnsignedInt32,4, 2)
- self.assert_data(data2.GetUnsignedInt32,8, 3)
- self.assert_data(data2.GetUnsignedInt32,12, 4)
- self.assert_data(data2.GetUnsignedInt32,16, 5)
+ data2 = lldb.SBData.CreateDataFromUInt32Array(
+ process.GetByteOrder(), process.GetAddressByteSize(), l)
+ self.assert_data(data2.GetUnsignedInt32, 0, 1)
+ self.assert_data(data2.GetUnsignedInt32, 4, 2)
+ self.assert_data(data2.GetUnsignedInt32, 8, 3)
+ self.assert_data(data2.GetUnsignedInt32, 12, 4)
+ self.assert_data(data2.GetUnsignedInt32, 16, 5)
bool_list = [True, True, False, False, True, False]
- data2 = lldb.SBData.CreateDataFromSInt32Array(process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
- self.assertTrue(data2.sint32[0:6] == [1, 1, 0, 0, 1, 0], 'signed32 data2 = [1, 1, 0, 0, 1, 0]')
-
- data2 = lldb.SBData.CreateDataFromUInt32Array(process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
- self.assertTrue(data2.uint32[0:6] == [1, 1, 0, 0, 1, 0], 'unsigned32 data2 = [1, 1, 0, 0, 1, 0]')
-
- data2 = lldb.SBData.CreateDataFromSInt64Array(process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
- self.assertTrue(data2.sint64[0:6] == [1, 1, 0, 0, 1, 0], 'signed64 data2 = [1, 1, 0, 0, 1, 0]')
-
- data2 = lldb.SBData.CreateDataFromUInt64Array(process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
- self.assertTrue(data2.uint64[0:6] == [1, 1, 0, 0, 1, 0], 'signed64 data2 = [1, 1, 0, 0, 1, 0]')
-
- data2 = lldb.SBData.CreateDataFromDoubleArray(process.GetByteOrder(),process.GetAddressByteSize(),[3.14,6.28,2.71])
- self.assertTrue( fabs(data2.GetDouble(error,0) - 3.14) < 0.5, 'double data2[0] = 3.14')
- self.assertTrue(error.Success())
- self.assertTrue( fabs(data2.GetDouble(error,8) - 6.28) < 0.5, 'double data2[1] = 6.28')
- self.assertTrue(error.Success())
- self.assertTrue( fabs(data2.GetDouble(error,16) - 2.71) < 0.5, 'double data2[2] = 2.71')
+ data2 = lldb.SBData.CreateDataFromSInt32Array(
+ process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
+ self.assertTrue(
+ data2.sint32[
+ 0:6] == [
+ 1,
+ 1,
+ 0,
+ 0,
+ 1,
+ 0],
+ 'signed32 data2 = [1, 1, 0, 0, 1, 0]')
+
+ data2 = lldb.SBData.CreateDataFromUInt32Array(
+ process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
+ self.assertTrue(
+ data2.uint32[
+ 0:6] == [
+ 1,
+ 1,
+ 0,
+ 0,
+ 1,
+ 0],
+ 'unsigned32 data2 = [1, 1, 0, 0, 1, 0]')
+
+ data2 = lldb.SBData.CreateDataFromSInt64Array(
+ process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
+ self.assertTrue(
+ data2.sint64[
+ 0:6] == [
+ 1,
+ 1,
+ 0,
+ 0,
+ 1,
+ 0],
+ 'signed64 data2 = [1, 1, 0, 0, 1, 0]')
+
+ data2 = lldb.SBData.CreateDataFromUInt64Array(
+ process.GetByteOrder(), process.GetAddressByteSize(), bool_list)
+ self.assertTrue(
+ data2.uint64[
+ 0:6] == [
+ 1,
+ 1,
+ 0,
+ 0,
+ 1,
+ 0],
+ 'signed64 data2 = [1, 1, 0, 0, 1, 0]')
+
+ data2 = lldb.SBData.CreateDataFromDoubleArray(
+ process.GetByteOrder(), process.GetAddressByteSize(), [
+ 3.14, 6.28, 2.71])
+ self.assertTrue(
+ fabs(
+ data2.GetDouble(
+ error,
+ 0) -
+ 3.14) < 0.5,
+ 'double data2[0] = 3.14')
+ self.assertTrue(error.Success())
+ self.assertTrue(
+ fabs(
+ data2.GetDouble(
+ error,
+ 8) -
+ 6.28) < 0.5,
+ 'double data2[1] = 6.28')
+ self.assertTrue(error.Success())
+ self.assertTrue(
+ fabs(
+ data2.GetDouble(
+ error,
+ 16) -
+ 2.71) < 0.5,
+ 'double data2[2] = 2.71')
self.assertTrue(error.Success())
data2 = lldb.SBData()
@@ -294,50 +437,90 @@ class SBDataAPICase(TestBase):
self.assert_data(data2.GetUnsignedInt8, 4, 111)
self.assert_data(data2.GetUnsignedInt8, 5, 33)
- data2.SetDataFromUInt64Array([1,2,3,4,5])
+ data2.SetDataFromUInt64Array([1, 2, 3, 4, 5])
self.assert_data(data2.GetUnsignedInt64, 0, 1)
- self.assert_data(data2.GetUnsignedInt64, 8, 2)
+ self.assert_data(data2.GetUnsignedInt64, 8, 2)
self.assert_data(data2.GetUnsignedInt64, 16, 3)
self.assert_data(data2.GetUnsignedInt64, 24, 4)
self.assert_data(data2.GetUnsignedInt64, 32, 5)
- self.assertTrue(data2.uint64[0] == 1, 'read_data_helper failure: set data2[0] = 1')
- self.assertTrue(data2.uint64[1] == 2, 'read_data_helper failure: set data2[1] = 2')
- self.assertTrue(data2.uint64[2] == 3, 'read_data_helper failure: set data2[2] = 3')
- self.assertTrue(data2.uint64[3] == 4, 'read_data_helper failure: set data2[3] = 4')
- self.assertTrue(data2.uint64[4] == 5, 'read_data_helper failure: set data2[4] = 5')
-
- self.assertTrue(data2.uint64[0:2] == [1,2], 'read_data_helper failure: set data2[0:2] = [1,2]')
+ self.assertTrue(
+ data2.uint64[0] == 1,
+ 'read_data_helper failure: set data2[0] = 1')
+ self.assertTrue(
+ data2.uint64[1] == 2,
+ 'read_data_helper failure: set data2[1] = 2')
+ self.assertTrue(
+ data2.uint64[2] == 3,
+ 'read_data_helper failure: set data2[2] = 3')
+ self.assertTrue(
+ data2.uint64[3] == 4,
+ 'read_data_helper failure: set data2[3] = 4')
+ self.assertTrue(
+ data2.uint64[4] == 5,
+ 'read_data_helper failure: set data2[4] = 5')
+
+ self.assertTrue(
+ data2.uint64[
+ 0:2] == [
+ 1,
+ 2],
+ 'read_data_helper failure: set data2[0:2] = [1,2]')
data2.SetDataFromSInt32Array([2, -2])
self.assert_data(data2.GetSignedInt32, 0, 2)
self.assert_data(data2.GetSignedInt32, 4, -2)
-
+
data2.SetDataFromSInt64Array([2, -2])
self.assert_data(data2.GetSignedInt64, 0, 2)
self.assert_data(data2.GetSignedInt64, 8, -2)
-
- data2.SetDataFromUInt32Array([1,2,3,4,5])
+
+ data2.SetDataFromUInt32Array([1, 2, 3, 4, 5])
self.assert_data(data2.GetUnsignedInt32, 0, 1)
self.assert_data(data2.GetUnsignedInt32, 4, 2)
self.assert_data(data2.GetUnsignedInt32, 8, 3)
self.assert_data(data2.GetUnsignedInt32, 12, 4)
self.assert_data(data2.GetUnsignedInt32, 16, 5)
-
- self.assertTrue(data2.uint32[0] == 1, 'read_data_helper failure: set 32-bit data2[0] = 1')
- self.assertTrue(data2.uint32[1] == 2, 'read_data_helper failure: set 32-bit data2[1] = 2')
- self.assertTrue(data2.uint32[2] == 3, 'read_data_helper failure: set 32-bit data2[2] = 3')
- self.assertTrue(data2.uint32[3] == 4, 'read_data_helper failure: set 32-bit data2[3] = 4')
- self.assertTrue(data2.uint32[4] == 5, 'read_data_helper failure: set 32-bit data2[4] = 5')
-
- data2.SetDataFromDoubleArray([3.14,6.28,2.71])
- self.assertTrue( fabs(data2.GetDouble(error,0) - 3.14) < 0.5, 'set double data2[0] = 3.14')
- self.assertTrue( fabs(data2.GetDouble(error,8) - 6.28) < 0.5, 'set double data2[1] = 6.28')
- self.assertTrue( fabs(data2.GetDouble(error,16) - 2.71) < 0.5, 'set double data2[2] = 2.71')
-
- self.assertTrue( fabs(data2.double[0] - 3.14) < 0.5, 'read_data_helper failure: set double data2[0] = 3.14')
- self.assertTrue( fabs(data2.double[1] - 6.28) < 0.5, 'read_data_helper failure: set double data2[1] = 6.28')
- self.assertTrue( fabs(data2.double[2] - 2.71) < 0.5, 'read_data_helper failure: set double data2[2] = 2.71')
+
+ self.assertTrue(
+ data2.uint32[0] == 1,
+ 'read_data_helper failure: set 32-bit data2[0] = 1')
+ self.assertTrue(
+ data2.uint32[1] == 2,
+ 'read_data_helper failure: set 32-bit data2[1] = 2')
+ self.assertTrue(
+ data2.uint32[2] == 3,
+ 'read_data_helper failure: set 32-bit data2[2] = 3')
+ self.assertTrue(
+ data2.uint32[3] == 4,
+ 'read_data_helper failure: set 32-bit data2[3] = 4')
+ self.assertTrue(
+ data2.uint32[4] == 5,
+ 'read_data_helper failure: set 32-bit data2[4] = 5')
+
+ data2.SetDataFromDoubleArray([3.14, 6.28, 2.71])
+ self.assertTrue(fabs(data2.GetDouble(error, 0) - 3.14)
+ < 0.5, 'set double data2[0] = 3.14')
+ self.assertTrue(fabs(data2.GetDouble(error, 8) - 6.28)
+ < 0.5, 'set double data2[1] = 6.28')
+ self.assertTrue(fabs(data2.GetDouble(error, 16) - 2.71)
+ < 0.5, 'set double data2[2] = 2.71')
+
+ self.assertTrue(
+ fabs(
+ data2.double[0] -
+ 3.14) < 0.5,
+ 'read_data_helper failure: set double data2[0] = 3.14')
+ self.assertTrue(
+ fabs(
+ data2.double[1] -
+ 6.28) < 0.5,
+ 'read_data_helper failure: set double data2[1] = 6.28')
+ self.assertTrue(
+ fabs(
+ data2.double[2] -
+ 2.71) < 0.5,
+ 'read_data_helper failure: set double data2[2] = 2.71')
def assert_data(self, func, arg, expected):
""" Asserts func(SBError error, arg) == expected. """
@@ -346,8 +529,9 @@ class SBDataAPICase(TestBase):
if not error.Success():
stream = lldb.SBStream()
error.GetDescription(stream)
- self.assertTrue(error.Success(),
- "%s(error, %s) did not succeed: %s" % (func.__name__,
- arg,
- stream.GetData()))
- self.assertTrue(expected == result, "%s(error, %s) == %s != %s" % (func.__name__, arg, result, expected))
+ self.assertTrue(
+ error.Success(), "%s(error, %s) did not succeed: %s" %
+ (func.__name__, arg, stream.GetData()))
+ self.assertTrue(
+ expected == result, "%s(error, %s) == %s != %s" %
+ (func.__name__, arg, result, expected))
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py Tue Sep 6 15:57:50 2016
@@ -1,4 +1,6 @@
from lldbsuite.test import decorators
from lldbsuite.test import lldbinline
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows])
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/sbvalue_persist/TestSBValuePersist.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/sbvalue_persist/TestSBValuePersist.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/sbvalue_persist/TestSBValuePersist.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/sbvalue_persist/TestSBValuePersist.py Tue Sep 6 15:57:50 2016
@@ -3,13 +3,15 @@
from __future__ import print_function
-
-import os, sys, time
+import os
+import sys
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SBValuePersistTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,15 +24,15 @@ class SBValuePersistTestCase(TestBase):
self.setTearDownCleanup()
self.runCmd("file a.out", CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_source_regexp (self, "break here")
+ lldbutil.run_break_set_by_source_regexp(self, "break here")
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'])
+
# This is the function to remove the custom formats in order to have a
# clean slate for the next test case.
def cleanup():
@@ -49,7 +51,7 @@ class SBValuePersistTestCase(TestBase):
self.assertTrue(foo.IsValid(), "foo is not valid")
self.assertTrue(bar.IsValid(), "bar is not valid")
self.assertTrue(baz.IsValid(), "baz is not valid")
-
+
fooPersist = foo.Persist()
barPersist = bar.Persist()
bazPersist = baz.Persist()
@@ -58,18 +60,26 @@ class SBValuePersistTestCase(TestBase):
self.assertTrue(barPersist.IsValid(), "barPersist is not valid")
self.assertTrue(bazPersist.IsValid(), "bazPersist is not valid")
- self.assertTrue(fooPersist.GetValueAsUnsigned(0) == 10, "fooPersist != 10")
- self.assertTrue(barPersist.GetPointeeData().sint32[0] == 4, "barPersist != 4")
+ self.assertTrue(
+ fooPersist.GetValueAsUnsigned(0) == 10,
+ "fooPersist != 10")
+ self.assertTrue(
+ barPersist.GetPointeeData().sint32[0] == 4,
+ "barPersist != 4")
self.assertTrue(bazPersist.GetSummary() == '"85"', "bazPersist != 85")
-
+
self.runCmd("continue")
self.assertTrue(fooPersist.IsValid(), "fooPersist is not valid")
self.assertTrue(barPersist.IsValid(), "barPersist is not valid")
self.assertTrue(bazPersist.IsValid(), "bazPersist is not valid")
- self.assertTrue(fooPersist.GetValueAsUnsigned(0) == 10, "fooPersist != 10")
- self.assertTrue(barPersist.GetPointeeData().sint32[0] == 4, "barPersist != 4")
+ self.assertTrue(
+ fooPersist.GetValueAsUnsigned(0) == 10,
+ "fooPersist != 10")
+ self.assertTrue(
+ barPersist.GetPointeeData().sint32[0] == 4,
+ "barPersist != 4")
self.assertTrue(bazPersist.GetSummary() == '"85"', "bazPersist != 85")
-
- self.expect("expr *(%s)" % (barPersist.GetName()), substrs = ['= 4'])
+
+ self.expect("expr *(%s)" % (barPersist.GetName()), substrs=['= 4'])
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py Tue Sep 6 15:57:50 2016
@@ -9,6 +9,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SectionAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,7 +23,7 @@ class SectionAPITestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- # find the .data section of the main module
+ # find the .data section of the main module
mod = target.GetModuleAtIndex(0)
data_section = None
for s in mod.sections:
@@ -36,7 +37,7 @@ class SectionAPITestCase(TestBase):
sect_type = ss.GetSectionType()
if sect_type == lldb.eSectionTypeData:
data_section = ss
- break
+ break
self.assertIsNotNone(data_section)
self.assertEqual(data_section.target_byte_size, 1)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/signals/TestSignalsAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/signals/TestSignalsAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/signals/TestSignalsAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/signals/TestSignalsAPI.py Tue Sep 6 15:57:50 2016
@@ -5,19 +5,20 @@ Test SBProcess APIs, including ReadMemor
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
from lldbsuite.test.lldbutil import get_stopped_thread, state_type_to_str
+
class SignalsAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@add_test_categories(['pyapi'])
- @skipIfWindows # Windows doesn't have signals
+ @skipIfWindows # Windows doesn't have signals
def test_ignore_signal(self):
"""Test Python SBUnixSignals.Suppress/Stop/Notify() API."""
self.build()
@@ -27,15 +28,20 @@ class SignalsAPITestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- line = line_number("main.cpp", "// Set break point at this line and setup signal ignores.")
+ line = line_number(
+ "main.cpp",
+ "// Set break point at this line and setup signal ignores.")
breakpoint = target.BreakpointCreateByLocation("main.cpp", line)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
unix_signals = process.GetUnixSignals()
sigint = unix_signals.GetSignalNumberFromName("SIGINT")
@@ -44,5 +50,9 @@ class SignalsAPITestCase(TestBase):
unix_signals.SetShouldNotify(sigint, False)
process.Continue()
- self.assertTrue(process.state == lldb.eStateExited, "The process should have exited")
- self.assertTrue(process.GetExitStatus() == 0, "The process should have returned 0")
+ self.assertTrue(
+ process.state == lldb.eStateExited,
+ "The process should have exited")
+ self.assertTrue(
+ process.GetExitStatus() == 0,
+ "The process should have returned 0")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py Tue Sep 6 15:57:50 2016
@@ -5,7 +5,6 @@ Test SBSymbolContext APIs.
from __future__ import print_function
-
import os
import re
import time
@@ -15,6 +14,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SymbolContextAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,7 +23,8 @@ class SymbolContextAPITestCase(TestBase)
# Call super's setUp().
TestBase.setUp(self)
# Find the line number to of function 'c'.
- self.line = line_number('main.c', '// Find the line number of function "c" here.')
+ self.line = line_number(
+ 'main.c', '// Find the line number of function "c" here.')
@add_test_categories(['pyapi'])
@expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24778")
@@ -44,13 +45,16 @@ class SymbolContextAPITestCase(TestBase)
VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.line.
from lldbsuite.test.lldbutil import get_stopped_thread
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
frame0 = thread.GetFrameAtIndex(0)
self.assertTrue(frame0.GetLineEntry().GetLine() == self.line)
@@ -62,11 +66,17 @@ class SymbolContextAPITestCase(TestBase)
module = context.GetModule()
desc = lldbutil.get_description(module)
self.expect(desc, "The module should match", exe=False,
- substrs = [os.path.join(self.mydir, 'a.out')])
+ substrs=[os.path.join(self.mydir, 'a.out')])
compileUnit = context.GetCompileUnit()
- self.expect(str(compileUnit), "The compile unit should match", exe=False,
- substrs = [os.path.join(self.mydir, 'main.c')])
+ self.expect(
+ str(compileUnit),
+ "The compile unit should match",
+ exe=False,
+ substrs=[
+ os.path.join(
+ self.mydir,
+ 'main.c')])
function = context.GetFunction()
self.assertTrue(function)
@@ -78,15 +88,21 @@ class SymbolContextAPITestCase(TestBase)
lineEntry = context.GetLineEntry()
#print("line entry:", lineEntry)
- self.expect(lineEntry.GetFileSpec().GetDirectory(), "The line entry should have the correct directory",
- exe=False,
- substrs = [self.mydir])
- self.expect(lineEntry.GetFileSpec().GetFilename(), "The line entry should have the correct filename",
- exe=False,
- substrs = ['main.c'])
+ self.expect(
+ lineEntry.GetFileSpec().GetDirectory(),
+ "The line entry should have the correct directory",
+ exe=False,
+ substrs=[
+ self.mydir])
+ self.expect(
+ lineEntry.GetFileSpec().GetFilename(),
+ "The line entry should have the correct filename",
+ exe=False,
+ substrs=['main.c'])
self.assertTrue(lineEntry.GetLine() == self.line,
"The line entry's line number should match ")
symbol = context.GetSymbol()
- self.assertTrue(function.GetName() == symbol.GetName() and symbol.GetName() == 'c',
- "The symbol name should be 'c'")
+ self.assertTrue(
+ function.GetName() == symbol.GetName() and symbol.GetName() == 'c',
+ "The symbol name should be 'c'")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py Tue Sep 6 15:57:50 2016
@@ -11,6 +11,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SymbolContextTwoFilesTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -30,7 +31,10 @@ class SymbolContextTwoFilesTestCase(Test
for symbol_name in ["struct1::f()", "struct2::f()"]:
sc_list = module.FindFunctions(symbol_name, lldb.eSymbolTypeCode)
self.assertTrue(1, sc_list.GetSize())
- symbol_address = sc_list.GetContextAtIndex(0).GetSymbol().GetStartAddress()
+ symbol_address = sc_list.GetContextAtIndex(
+ 0).GetSymbol().GetStartAddress()
self.assertTrue(symbol_address.IsValid())
- sc_by_address = module.ResolveSymbolContextForAddress(symbol_address, lldb.eSymbolContextFunction)
- self.assertEqual(symbol_name, sc_by_address.GetFunction().GetName())
+ sc_by_address = module.ResolveSymbolContextForAddress(
+ symbol_address, lldb.eSymbolContextFunction)
+ self.assertEqual(symbol_name,
+ sc_by_address.GetFunction().GetName())
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py Tue Sep 6 15:57:50 2016
@@ -5,15 +5,16 @@ Test SBTarget APIs.
from __future__ import print_function
-
import unittest2
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TargetAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,11 +23,14 @@ class TargetAPITestCase(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 for breakpoint 1 here.')
- self.line2 = line_number('main.c', '// Find the line number for breakpoint 2 here.')
- self.line_main = line_number("main.c", "// Set a break at entry to main.")
+ self.line1 = line_number(
+ 'main.c', '// Find the line number for breakpoint 1 here.')
+ self.line2 = line_number(
+ 'main.c', '// Find the line number for breakpoint 2 here.')
+ self.line_main = line_number(
+ "main.c", "// Set a break at entry to main.")
- #rdar://problem/9700873
+ # rdar://problem/9700873
# Find global variable value fails for dwarf if inferior not started
# (Was CrashTracer: [USER] 1 crash in Python at _lldb.so: lldb_private::MemoryCache::Read + 94)
#
@@ -101,20 +105,20 @@ class TargetAPITestCase(TestBase):
target = self.create_simple_target('b.out')
# find the file address in the .data section of the main
- # module
+ # module
data_section = self.find_data_section(target)
data_section_addr = data_section.file_addr
# resolve the above address, and compare the address produced
- # by the resolution against the original address/section
+ # by the resolution against the original address/section
res_file_addr = target.ResolveFileAddress(data_section_addr)
self.assertTrue(res_file_addr.IsValid())
- self.assertEqual(data_section_addr, res_file_addr.file_addr)
+ self.assertEqual(data_section_addr, res_file_addr.file_addr)
data_section2 = res_file_addr.section
self.assertIsNotNone(data_section2)
- self.assertEqual(data_section.name, data_section2.name)
+ self.assertEqual(data_section.name, data_section2.name)
@add_test_categories(['pyapi'])
def test_read_memory(self):
@@ -123,18 +127,20 @@ class TargetAPITestCase(TestBase):
self.setTearDownCleanup(dictionary=d)
target = self.create_simple_target('b.out')
- breakpoint = target.BreakpointCreateByLocation("main.c", self.line_main)
+ breakpoint = target.BreakpointCreateByLocation(
+ "main.c", self.line_main)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Put debugger into synchronous mode so when we target.LaunchSimple returns
# it will guaranteed to be at the breakpoint
self.dbg.SetAsync(False)
-
+
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
# find the file address in the .data section of the main
- # module
+ # module
data_section = self.find_data_section(target)
sb_addr = lldb.SBAddress(data_section, 0)
error = lldb.SBError()
@@ -162,7 +168,7 @@ class TargetAPITestCase(TestBase):
sect_type = ss.GetSectionType()
if sect_type == lldb.eSectionTypeData:
data_section = ss
- break
+ break
self.assertIsNotNone(data_section)
return data_section
@@ -175,7 +181,7 @@ class TargetAPITestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- #rdar://problem/9700873
+ # rdar://problem/9700873
# Find global variable value fails for dwarf if inferior not started
# (Was CrashTracer: [USER] 1 crash in Python at _lldb.so: lldb_private::MemoryCache::Read + 94)
#
@@ -186,30 +192,37 @@ class TargetAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Make sure we hit our breakpoint:
- thread_list = lldbutil.get_threads_stopped_at_breakpoint (process, breakpoint)
- self.assertTrue (len(thread_list) == 1)
+ thread_list = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint)
+ self.assertTrue(len(thread_list) == 1)
- value_list = target.FindGlobalVariables('my_global_var_of_char_type', 3)
+ value_list = target.FindGlobalVariables(
+ 'my_global_var_of_char_type', 3)
self.assertTrue(value_list.GetSize() == 1)
my_global_var = value_list.GetValueAtIndex(0)
self.DebugSBValue(my_global_var)
self.assertTrue(my_global_var)
self.expect(my_global_var.GetName(), exe=False,
- startstr = "my_global_var_of_char_type")
+ startstr="my_global_var_of_char_type")
self.expect(my_global_var.GetTypeName(), exe=False,
- startstr = "char")
+ startstr="char")
self.expect(my_global_var.GetValue(), exe=False,
- startstr = "'X'")
+ startstr="'X'")
- # While we are at it, let's also exercise the similar SBModule.FindGlobalVariables() API.
+ # While we are at it, let's also exercise the similar
+ # SBModule.FindGlobalVariables() API.
for m in target.module_iter():
- if os.path.normpath(m.GetFileSpec().GetDirectory()) == os.getcwd() and m.GetFileSpec().GetFilename() == exe_name:
- value_list = m.FindGlobalVariables(target, 'my_global_var_of_char_type', 3)
+ if os.path.normpath(m.GetFileSpec().GetDirectory()) == os.getcwd(
+ ) and m.GetFileSpec().GetFilename() == exe_name:
+ value_list = m.FindGlobalVariables(
+ target, 'my_global_var_of_char_type', 3)
self.assertTrue(value_list.GetSize() == 1)
- self.assertTrue(value_list.GetValueAtIndex(0).GetValue() == "'X'")
+ self.assertTrue(
+ value_list.GetValueAtIndex(0).GetValue() == "'X'")
break
def find_functions(self, exe_name):
@@ -224,8 +237,9 @@ class TargetAPITestCase(TestBase):
self.assertTrue(list.GetSize() == 1)
for sc in list:
- self.assertTrue(sc.GetModule().GetFileSpec().GetFilename() == exe_name)
- self.assertTrue(sc.GetSymbol().GetName() == 'c')
+ self.assertTrue(
+ sc.GetModule().GetFileSpec().GetFilename() == exe_name)
+ self.assertTrue(sc.GetSymbol().GetName() == 'c')
def get_description(self):
"""Exercise SBTaget.GetDescription() API."""
@@ -237,21 +251,22 @@ class TargetAPITestCase(TestBase):
from lldbsuite.test.lldbutil import get_description
- # get_description() allows no option to mean lldb.eDescriptionLevelBrief.
+ # get_description() allows no option to mean
+ # lldb.eDescriptionLevelBrief.
desc = get_description(target)
#desc = get_description(target, option=lldb.eDescriptionLevelBrief)
if not desc:
self.fail("SBTarget.GetDescription() failed")
self.expect(desc, exe=False,
- substrs = ['a.out'])
+ substrs=['a.out'])
self.expect(desc, exe=False, matching=False,
- substrs = ['Target', 'Module', 'Breakpoint'])
+ substrs=['Target', 'Module', 'Breakpoint'])
desc = get_description(target, option=lldb.eDescriptionLevelFull)
if not desc:
self.fail("SBTarget.GetDescription() failed")
self.expect(desc, exe=False,
- substrs = ['a.out', 'Target', 'Module', 'Breakpoint'])
+ substrs=['a.out', 'Target', 'Module', 'Breakpoint'])
@not_remote_testsuite_ready
def launch_new_process_and_redirect_stdout(self):
@@ -263,28 +278,44 @@ class TargetAPITestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Add an extra twist of stopping the inferior in a breakpoint, and then continue till it's done.
- # We should still see the entire stdout redirected once the process is finished.
+ # We should still see the entire stdout redirected once the process is
+ # finished.
line = line_number('main.c', '// a(3) -> c(3)')
breakpoint = target.BreakpointCreateByLocation('main.c', line)
# Now launch the process, do not stop at entry point, and redirect stdout to "stdout.txt" file.
- # The inferior should run to completion after "process.Continue()" call.
- local_path = "stdout.txt";
+ # The inferior should run to completion after "process.Continue()"
+ # call.
+ local_path = "stdout.txt"
if lldb.remote_platform:
- stdout_path = lldbutil.append_to_process_working_directory("lldb-stdout-redirect.txt")
+ stdout_path = lldbutil.append_to_process_working_directory(
+ "lldb-stdout-redirect.txt")
else:
stdout_path = local_path
error = lldb.SBError()
- process = target.Launch (self.dbg.GetListener(), None, None, None, stdout_path, None, None, 0, False, error)
+ process = target.Launch(
+ self.dbg.GetListener(),
+ None,
+ None,
+ None,
+ stdout_path,
+ None,
+ None,
+ 0,
+ False,
+ error)
process.Continue()
#self.runCmd("process status")
if lldb.remote_platform:
# copy output file to host
- lldb.remote_platform.Get(lldb.SBFileSpec(stdout_path), lldb.SBFileSpec(local_path))
+ lldb.remote_platform.Get(
+ lldb.SBFileSpec(stdout_path),
+ lldb.SBFileSpec(local_path))
# The 'stdout.txt' file should now exist.
- self.assertTrue(os.path.isfile("stdout.txt"),
- "'stdout.txt' exists due to redirected stdout via SBTarget.Launch() API.")
+ self.assertTrue(
+ os.path.isfile("stdout.txt"),
+ "'stdout.txt' exists due to redirected stdout via SBTarget.Launch() API.")
# Read the output file produced by running the program.
with open('stdout.txt', 'r') as f:
@@ -298,8 +329,7 @@ class TargetAPITestCase(TestBase):
pass
self.expect(output, exe=False,
- substrs = ["a(1)", "b(2)", "a(3)"])
-
+ substrs=["a(1)", "b(2)", "a(3)"])
def resolve_symbol_context_with_address(self):
"""Exercise SBTaget.ResolveSymbolContextForAddress() API."""
@@ -322,13 +352,17 @@ class TargetAPITestCase(TestBase):
VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.line1.
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
#self.runCmd("process status")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
@@ -339,8 +373,11 @@ class TargetAPITestCase(TestBase):
# Continue the inferior, the breakpoint 2 should be hit.
process.Continue()
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
#self.runCmd("process status")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
@@ -351,9 +388,12 @@ class TargetAPITestCase(TestBase):
#print("address1:", address1)
#print("address2:", address2)
- # Now call SBTarget.ResolveSymbolContextForAddress() with the addresses from our line entry.
- context1 = target.ResolveSymbolContextForAddress(address1, lldb.eSymbolContextEverything)
- context2 = target.ResolveSymbolContextForAddress(address2, lldb.eSymbolContextEverything)
+ # Now call SBTarget.ResolveSymbolContextForAddress() with the addresses
+ # from our line entry.
+ context1 = target.ResolveSymbolContextForAddress(
+ address1, lldb.eSymbolContextEverything)
+ context2 = target.ResolveSymbolContextForAddress(
+ address2, lldb.eSymbolContextEverything)
self.assertTrue(context1 and context2)
#print("context1:", context1)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Test SBThread APIs.
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
from lldbsuite.test.lldbutil import get_stopped_thread, get_caller_symbol
+
class ThreadAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -62,12 +63,17 @@ class ThreadAPITestCase(TestBase):
# Call super's setUp().
TestBase.setUp(self)
# Find the line number within main.cpp to break inside main().
- self.break_line = line_number("main.cpp", "// Set break point at this line and check variable 'my_char'.")
- # Find the line numbers within main2.cpp for step_out_of_malloc_into_function_b() and step_over_3_times().
- self.step_out_of_malloc = line_number("main2.cpp", "// thread step-out of malloc into function b.")
- self.after_3_step_overs = line_number("main2.cpp", "// we should reach here after 3 step-over's.")
+ self.break_line = line_number(
+ "main.cpp", "// Set break point at this line and check variable 'my_char'.")
+ # Find the line numbers within main2.cpp for
+ # step_out_of_malloc_into_function_b() and step_over_3_times().
+ self.step_out_of_malloc = line_number(
+ "main2.cpp", "// thread step-out of malloc into function b.")
+ self.after_3_step_overs = line_number(
+ "main2.cpp", "// we should reach here after 3 step-over's.")
- # We'll use the test method name as the exe_name for executable comppiled from main2.cpp.
+ # We'll use the test method name as the exe_name for executable
+ # comppiled from main2.cpp.
self.exe_name = self.testMethodName
def get_process(self):
@@ -77,20 +83,25 @@ class ThreadAPITestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.break_line)
+ breakpoint = target.BreakpointCreateByLocation(
+ "main.cpp", self.break_line)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
self.runCmd("breakpoint list")
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
self.runCmd("process status")
proc_of_thread = thread.GetProcess()
#print("proc_of_thread:", proc_of_thread)
- self.assertTrue(proc_of_thread.GetProcessID() == process.GetProcessID())
+ self.assertTrue(proc_of_thread.GetProcessID()
+ == process.GetProcessID())
def get_stop_description(self):
"""Test Python SBThread.GetStopDescription() API."""
@@ -99,15 +110,19 @@ class ThreadAPITestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- breakpoint = target.BreakpointCreateByLocation("main.cpp", self.break_line)
+ breakpoint = target.BreakpointCreateByLocation(
+ "main.cpp", self.break_line)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
#self.runCmd("breakpoint list")
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
#self.runCmd("process status")
# Due to the typemap magic (see lldb.swig), we pass in an (int)length to GetStopDescription
@@ -115,7 +130,7 @@ class ThreadAPITestCase(TestBase):
# The 100 is just an arbitrary number specifying the buffer size.
stop_description = thread.GetStopDescription(100)
self.expect(stop_description, exe=False,
- startstr = 'breakpoint')
+ startstr='breakpoint')
def step_out_of_malloc_into_function_b(self, exe_name):
"""Test Python SBThread.StepOut() API to step out of a malloc call where the call site is at function b()."""
@@ -128,21 +143,26 @@ class ThreadAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
while True:
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint")
caller_symbol = get_caller_symbol(thread)
if not caller_symbol:
- self.fail("Test failed: could not locate the caller symbol of malloc")
+ self.fail(
+ "Test failed: could not locate the caller symbol of malloc")
# Our top frame may be an inlined function in malloc() (e.g., on
# FreeBSD). Apply a simple heuristic of stepping out until we find
# a non-malloc caller
while caller_symbol.startswith("malloc"):
thread.StepOut()
- self.assertTrue(thread.IsValid(), "Thread valid after stepping to outer malloc")
+ self.assertTrue(thread.IsValid(),
+ "Thread valid after stepping to outer malloc")
caller_symbol = get_caller_symbol(thread)
if caller_symbol == "b(int)":
@@ -155,8 +175,9 @@ class ThreadAPITestCase(TestBase):
thread.StepOut()
self.runCmd("thread backtrace")
- self.assertTrue(thread.GetFrameAtIndex(0).GetLineEntry().GetLine() == self.step_out_of_malloc,
- "step out of malloc into function b is successful")
+ self.assertTrue(
+ thread.GetFrameAtIndex(0).GetLineEntry().GetLine() == self.step_out_of_malloc,
+ "step out of malloc into function b is successful")
def step_over_3_times(self, exe_name):
"""Test Python SBThread.StepOver() API."""
@@ -165,19 +186,23 @@ class ThreadAPITestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- breakpoint = target.BreakpointCreateByLocation('main2.cpp', self.step_out_of_malloc)
+ breakpoint = target.BreakpointCreateByLocation(
+ 'main2.cpp', self.step_out_of_malloc)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
self.runCmd("breakpoint list")
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.step_out_of_malloc.
self.assertTrue(process.GetState() == lldb.eStateStopped)
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
self.runCmd("thread backtrace")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
@@ -188,7 +213,8 @@ class ThreadAPITestCase(TestBase):
thread.StepOver()
self.runCmd("thread backtrace")
- # Verify that we are stopped at the correct source line number in main2.cpp.
+ # Verify that we are stopped at the correct source line number in
+ # main2.cpp.
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
self.assertTrue(thread.GetStopReason() == lldb.eStopReasonPlanComplete)
@@ -206,19 +232,23 @@ class ThreadAPITestCase(TestBase):
target = self.dbg.CreateTarget(exe)
self.assertTrue(target, VALID_TARGET)
- breakpoint = target.BreakpointCreateByLocation('main2.cpp', self.step_out_of_malloc)
+ breakpoint = target.BreakpointCreateByLocation(
+ 'main2.cpp', self.step_out_of_malloc)
self.assertTrue(breakpoint, VALID_BREAKPOINT)
self.runCmd("breakpoint list")
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Frame #0 should be on self.step_out_of_malloc.
self.assertTrue(process.GetState() == lldb.eStateStopped)
thread = get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
self.runCmd("thread backtrace")
frame0 = thread.GetFrameAtIndex(0)
lineEntry = frame0.GetLineEntry()
@@ -234,7 +264,7 @@ class ThreadAPITestCase(TestBase):
# Disable the breakpoint.
self.assertTrue(target.DisableAllBreakpoints())
self.runCmd("breakpoint list")
-
+
thread.StepOver()
thread.StepOver()
thread.StepOver()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py Tue Sep 6 15:57:50 2016
@@ -5,7 +5,6 @@ Test SBType and SBTypeList API.
from __future__ import print_function
-
import os
import re
import time
@@ -15,6 +14,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TypeAndTypeListTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -45,20 +45,27 @@ class TypeAndTypeListTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
# Get the type 'Task'.
type_list = target.FindTypes('Task')
if self.TraceOn():
- print("Size of type_list from target.FindTypes('Task') query: %d" % type_list.GetSize())
- self.assertTrue(len(type_list) >= 1) # a second Task make be scared up by the Objective-C runtime
+ print(
+ "Size of type_list from target.FindTypes('Task') query: %d" %
+ type_list.GetSize())
+ # a second Task make be scared up by the Objective-C runtime
+ self.assertTrue(len(type_list) >= 1)
for type in type_list:
self.assertTrue(type)
self.DebugSBType(type)
@@ -69,9 +76,13 @@ class TypeAndTypeListTestCase(TestBase):
self.assertTrue(enum_member)
self.DebugSBType(enum_member.type)
elif field.name == "my_type_is_nameless":
- self.assertTrue(field.type.IsAnonymousType(), "my_type_is_nameless has an anonymous type")
+ self.assertTrue(
+ field.type.IsAnonymousType(),
+ "my_type_is_nameless has an anonymous type")
elif field.name == "my_type_is_named":
- self.assertFalse(field.type.IsAnonymousType(), "my_type_is_named has a named type")
+ self.assertFalse(
+ field.type.IsAnonymousType(),
+ "my_type_is_named has a named type")
# Pass an empty string. LLDB should not crash. :-)
fuzz_types = target.FindTypes(None)
@@ -87,7 +98,8 @@ class TypeAndTypeListTestCase(TestBase):
self.assertTrue(task_ref_type)
self.DebugSBType(task_ref_type)
- # Get the pointer type of 'Task', which is the same as task_head's type.
+ # Get the pointer type of 'Task', which is the same as task_head's
+ # type.
task_pointer_type = task_type.GetPointerType()
self.assertTrue(task_pointer_type)
self.DebugSBType(task_pointer_type)
@@ -114,6 +126,7 @@ class TypeAndTypeListTestCase(TestBase):
id_type = id.GetType()
self.DebugSBType(id_type)
- # SBType.GetBasicType() takes an enum 'BasicType' (lldb-enumerations.h).
+ # SBType.GetBasicType() takes an enum 'BasicType'
+ # (lldb-enumerations.h).
int_type = id_type.GetBasicType(lldb.eBasicTypeInt)
self.assertTrue(id_type == int_type)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py Tue Sep 6 15:57:50 2016
@@ -13,6 +13,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ValueAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -43,13 +44,17 @@ class ValueAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
# Get global variable 'days_of_week'.
@@ -93,10 +98,11 @@ class ValueAPITestCase(TestBase):
self.DebugSBValue(pointed)
# While we are at it, verify that 'my_int_ptr' points to 'g_my_int'.
- symbol = target.ResolveLoadAddress(int(pointed.GetLocation(), 0)).GetSymbol()
+ symbol = target.ResolveLoadAddress(
+ int(pointed.GetLocation(), 0)).GetSymbol()
self.assertTrue(symbol)
self.expect(symbol.GetName(), exe=False,
- startstr = 'g_my_int')
+ startstr='g_my_int')
# Get variable 'str_ptr'.
value = frame0.FindVariable('str_ptr')
@@ -119,7 +125,7 @@ class ValueAPITestCase(TestBase):
self.DebugSBValue(child)
self.expect(child.GetSummary(), exe=False,
- substrs = ['Friday'])
+ substrs=['Friday'])
# Now try to get at the same variable using GetValueForExpressionPath().
# These two SBValue objects should have the same value.
@@ -132,14 +138,31 @@ class ValueAPITestCase(TestBase):
val_i = target.EvaluateExpression('i')
val_s = target.EvaluateExpression('s')
val_a = target.EvaluateExpression('a')
- self.assertTrue(val_s.GetChildMemberWithName('a').AddressOf(), VALID_VARIABLE)
- self.assertTrue(val_a.Cast(val_i.GetType()).AddressOf(), VALID_VARIABLE)
-
- self.assertTrue(int(lldb.value(frame0.FindVariable('uinthex'))) == 3768803088, 'uinthex == 3768803088')
- self.assertTrue(int(lldb.value(frame0.FindVariable('sinthex'))) == -526164208, 'sinthex == -526164208')
-
- self.assertTrue(frame0.FindVariable('uinthex').GetValueAsUnsigned() == 3768803088, 'unsigned uinthex == 3768803088')
- self.assertTrue(frame0.FindVariable('sinthex').GetValueAsUnsigned() == 3768803088, 'unsigned sinthex == 3768803088')
-
- self.assertTrue(frame0.FindVariable('uinthex').GetValueAsSigned() == -526164208, 'signed uinthex == -526164208')
- self.assertTrue(frame0.FindVariable('sinthex').GetValueAsSigned() == -526164208, 'signed sinthex == -526164208')
+ self.assertTrue(
+ val_s.GetChildMemberWithName('a').AddressOf(),
+ VALID_VARIABLE)
+ self.assertTrue(
+ val_a.Cast(
+ val_i.GetType()).AddressOf(),
+ VALID_VARIABLE)
+
+ self.assertTrue(int(lldb.value(frame0.FindVariable('uinthex')))
+ == 3768803088, 'uinthex == 3768803088')
+ self.assertTrue(int(lldb.value(frame0.FindVariable('sinthex')))
+ == -526164208, 'sinthex == -526164208')
+
+ self.assertTrue(
+ frame0.FindVariable('uinthex').GetValueAsUnsigned() == 3768803088,
+ 'unsigned uinthex == 3768803088')
+ self.assertTrue(
+ frame0.FindVariable('sinthex').GetValueAsUnsigned() == 3768803088,
+ 'unsigned sinthex == 3768803088')
+
+ self.assertTrue(
+ frame0.FindVariable('uinthex').GetValueAsSigned() == -
+ 526164208,
+ 'signed uinthex == -526164208')
+ self.assertTrue(
+ frame0.FindVariable('sinthex').GetValueAsSigned() == -
+ 526164208,
+ 'signed sinthex == -526164208')
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Test some SBValue APIs.
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ChangeValueAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,8 +25,10 @@ class ChangeValueAPITestCase(TestBase):
self.exe_name = self.testMethodName
# Find the line number to of function 'c'.
self.line = line_number('main.c', '// Stop here and set values')
- self.check_line = line_number('main.c', '// Stop here and check values')
- self.end_line = line_number ('main.c', '// Set a breakpoint here at the end')
+ self.check_line = line_number(
+ 'main.c', '// Stop here and check values')
+ self.end_line = line_number(
+ 'main.c', '// Set a breakpoint here at the end')
@add_test_categories(['pyapi'])
@expectedFlakeyLinux("llvm.org/pr25652")
@@ -46,97 +49,126 @@ class ChangeValueAPITestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Create the breakpoint inside the function 'main'
- check_breakpoint = target.BreakpointCreateByLocation('main.c', self.check_line)
+ check_breakpoint = target.BreakpointCreateByLocation(
+ 'main.c', self.check_line)
self.assertTrue(check_breakpoint, VALID_BREAKPOINT)
# Create the breakpoint inside function 'main'.
- end_breakpoint = target.BreakpointCreateByLocation('main.c', self.end_line)
+ end_breakpoint = target.BreakpointCreateByLocation(
+ 'main.c', self.end_line)
self.assertTrue(end_breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
- self.assertTrue (frame0.IsValid(), "Got a valid frame.")
+ self.assertTrue(frame0.IsValid(), "Got a valid frame.")
# Get the val variable and change it:
error = lldb.SBError()
- val_value = frame0.FindVariable ("val")
- self.assertTrue (val_value.IsValid(), "Got the SBValue for val")
- actual_value = val_value.GetValueAsSigned (error, 0);
- self.assertTrue (error.Success(), "Got a value from val")
- self.assertTrue (actual_value == 100, "Got the right value from val")
-
- result = val_value.SetValueFromCString ("12345")
- self.assertTrue (result, "Setting val returned True.")
- actual_value = val_value.GetValueAsSigned (error, 0);
- self.assertTrue (error.Success(), "Got a changed value from val")
- self.assertTrue (actual_value == 12345, "Got the right changed value from val")
-
+ val_value = frame0.FindVariable("val")
+ self.assertTrue(val_value.IsValid(), "Got the SBValue for val")
+ actual_value = val_value.GetValueAsSigned(error, 0)
+ self.assertTrue(error.Success(), "Got a value from val")
+ self.assertTrue(actual_value == 100, "Got the right value from val")
+
+ result = val_value.SetValueFromCString("12345")
+ self.assertTrue(result, "Setting val returned True.")
+ actual_value = val_value.GetValueAsSigned(error, 0)
+ self.assertTrue(error.Success(), "Got a changed value from val")
+ self.assertTrue(
+ actual_value == 12345,
+ "Got the right changed value from val")
+
# Now check that we can set a structure element:
- mine_value = frame0.FindVariable ("mine")
- self.assertTrue (mine_value.IsValid(), "Got the SBValue for mine")
-
- mine_second_value = mine_value.GetChildMemberWithName ("second_val")
- self.assertTrue (mine_second_value.IsValid(), "Got second_val from mine")
- actual_value = mine_second_value.GetValueAsUnsigned (error, 0)
- self.assertTrue (error.Success(), "Got an unsigned value for second_val")
- self.assertTrue (actual_value == 5555)
-
- result = mine_second_value.SetValueFromCString ("98765")
- self.assertTrue (result, "Success setting mine.second_value.")
- actual_value = mine_second_value.GetValueAsSigned (error, 0);
- self.assertTrue (error.Success(), "Got a changed value from mine.second_val")
- self.assertTrue (actual_value == 98765, "Got the right changed value from mine.second_val")
-
+ mine_value = frame0.FindVariable("mine")
+ self.assertTrue(mine_value.IsValid(), "Got the SBValue for mine")
+
+ mine_second_value = mine_value.GetChildMemberWithName("second_val")
+ self.assertTrue(
+ mine_second_value.IsValid(),
+ "Got second_val from mine")
+ actual_value = mine_second_value.GetValueAsUnsigned(error, 0)
+ self.assertTrue(
+ error.Success(),
+ "Got an unsigned value for second_val")
+ self.assertTrue(actual_value == 5555)
+
+ result = mine_second_value.SetValueFromCString("98765")
+ self.assertTrue(result, "Success setting mine.second_value.")
+ actual_value = mine_second_value.GetValueAsSigned(error, 0)
+ self.assertTrue(
+ error.Success(),
+ "Got a changed value from mine.second_val")
+ self.assertTrue(actual_value == 98765,
+ "Got the right changed value from mine.second_val")
+
# Next do the same thing with the pointer version.
- ptr_value = frame0.FindVariable ("ptr")
- self.assertTrue (ptr_value.IsValid(), "Got the SBValue for ptr")
-
- ptr_second_value = ptr_value.GetChildMemberWithName ("second_val")
- self.assertTrue (ptr_second_value.IsValid(), "Got second_val from ptr")
- actual_value = ptr_second_value.GetValueAsUnsigned (error, 0)
- self.assertTrue (error.Success(), "Got an unsigned value for ptr->second_val")
- self.assertTrue (actual_value == 6666)
-
- result = ptr_second_value.SetValueFromCString ("98765")
- self.assertTrue (result, "Success setting ptr->second_value.")
- actual_value = ptr_second_value.GetValueAsSigned (error, 0);
- self.assertTrue (error.Success(), "Got a changed value from ptr->second_val")
- self.assertTrue (actual_value == 98765, "Got the right changed value from ptr->second_val")
-
+ ptr_value = frame0.FindVariable("ptr")
+ self.assertTrue(ptr_value.IsValid(), "Got the SBValue for ptr")
+
+ ptr_second_value = ptr_value.GetChildMemberWithName("second_val")
+ self.assertTrue(ptr_second_value.IsValid(), "Got second_val from ptr")
+ actual_value = ptr_second_value.GetValueAsUnsigned(error, 0)
+ self.assertTrue(
+ error.Success(),
+ "Got an unsigned value for ptr->second_val")
+ self.assertTrue(actual_value == 6666)
+
+ result = ptr_second_value.SetValueFromCString("98765")
+ self.assertTrue(result, "Success setting ptr->second_value.")
+ actual_value = ptr_second_value.GetValueAsSigned(error, 0)
+ self.assertTrue(
+ error.Success(),
+ "Got a changed value from ptr->second_val")
+ self.assertTrue(actual_value == 98765,
+ "Got the right changed value from ptr->second_val")
+
# gcc may set multiple locations for breakpoint
breakpoint.SetEnabled(False)
- # Now continue, grab the stdout and make sure we changed the real values as well...
- process.Continue();
+ # Now continue, grab the stdout and make sure we changed the real
+ # values as well...
+ process.Continue()
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
expected_value = "Val - 12345 Mine - 55, 98765, 55555555. Ptr - 66, 98765, 66666666"
stdout = process.GetSTDOUT(1000)
- self.assertTrue (expected_value in stdout, "STDOUT showed changed values.")
+ self.assertTrue(
+ expected_value in stdout,
+ "STDOUT showed changed values.")
- # Finally, change the stack pointer to 0, and we should not make it to our end breakpoint.
+ # Finally, change the stack pointer to 0, and we should not make it to
+ # our end breakpoint.
frame0 = thread.GetFrameAtIndex(0)
- self.assertTrue (frame0.IsValid(), "Second time: got a valid frame.")
- sp_value = frame0.FindValue ("sp", lldb.eValueTypeRegister);
- self.assertTrue (sp_value.IsValid(), "Got a stack pointer value")
+ self.assertTrue(frame0.IsValid(), "Second time: got a valid frame.")
+ sp_value = frame0.FindValue("sp", lldb.eValueTypeRegister)
+ self.assertTrue(sp_value.IsValid(), "Got a stack pointer value")
result = sp_value.SetValueFromCString("1")
- self.assertTrue (result, "Setting sp returned true.")
- actual_value = sp_value.GetValueAsUnsigned (error, 0)
- self.assertTrue (error.Success(), "Got a changed value for sp")
- self.assertTrue (actual_value == 1, "Got the right changed value for sp.")
-
+ self.assertTrue(result, "Setting sp returned true.")
+ actual_value = sp_value.GetValueAsUnsigned(error, 0)
+ self.assertTrue(error.Success(), "Got a changed value for sp")
+ self.assertTrue(
+ actual_value == 1,
+ "Got the right changed value for sp.")
+
# Boundary condition test the SBValue.CreateValueFromExpression() API.
# LLDB should not crash!
nosuchval = mine_value.CreateValueFromExpression(None, None)
@@ -144,7 +176,10 @@ class ChangeValueAPITestCase(TestBase):
process.Continue()
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread == None, "We should not have managed to hit our second breakpoint with sp == 1")
-
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread is None,
+ "We should not have managed to hit our second breakpoint with sp == 1")
+
process.Kill()
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py Tue Sep 6 15:57:50 2016
@@ -6,14 +6,15 @@ supports iteration till the end of list
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class ValueAsLinkedListTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -26,8 +27,9 @@ class ValueAsLinkedListTestCase(TestBase
# Find the line number to break at.
self.line = line_number('main.cpp', '// Break at this line')
- # Py3 asserts due to a bug in SWIG. A fix for this was upstreamed into SWIG 3.0.8.
- @skipIf(py_version=['>=', (3,0)], swig_version=['<', (3,0,8)])
+ # Py3 asserts due to a bug in SWIG. A fix for this was upstreamed into
+ # SWIG 3.0.8.
+ @skipIf(py_version=['>=', (3, 0)], swig_version=['<', (3, 0, 8)])
@add_test_categories(['pyapi'])
def test(self):
"""Exercise SBValue API linked_list_iter."""
@@ -45,13 +47,17 @@ class ValueAsLinkedListTestCase(TestBase
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Now launch the process, and do not stop at entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
self.assertTrue(process, PROCESS_IS_VALID)
# Get Frame #0.
self.assertTrue(process.GetState() == lldb.eStateStopped)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
- self.assertTrue(thread.IsValid(), "There should be a thread stopped due to breakpoint condition")
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
+ self.assertTrue(
+ thread.IsValid(),
+ "There should be a thread stopped due to breakpoint condition")
frame0 = thread.GetFrameAtIndex(0)
# Get variable 'task_head'.
@@ -66,7 +72,8 @@ class ValueAsLinkedListTestCase(TestBase
cvf = lldbutil.ChildVisitingFormatter(indent_child=2)
for t in task_head.linked_list_iter('next'):
self.assertTrue(t, VALID_VARIABLE)
- # Make sure that 'next' corresponds to an SBValue with pointer type.
+ # Make sure that 'next' corresponds to an SBValue with pointer
+ # type.
self.assertTrue(t.TypeIsPointerType())
if self.TraceOn():
print(cvf.format(t))
@@ -96,7 +103,8 @@ class ValueAsLinkedListTestCase(TestBase
list = []
for t in task_head.linked_list_iter('next', eol):
self.assertTrue(t, VALID_VARIABLE)
- # Make sure that 'next' corresponds to an SBValue with pointer type.
+ # Make sure that 'next' corresponds to an SBValue with pointer
+ # type.
self.assertTrue(t.TypeIsPointerType())
if self.TraceOn():
print(cvf.format(t))
@@ -106,7 +114,7 @@ class ValueAsLinkedListTestCase(TestBase
if self.TraceOn():
print("visited IDs:", list)
self.assertTrue(visitedIDs == list)
-
+
# Get variable 'empty_task_head'.
empty_task_head = frame0.FindVariable('empty_task_head')
self.assertTrue(empty_task_head, VALID_VARIABLE)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py Tue Sep 6 15:57:50 2016
@@ -3,14 +3,16 @@
from __future__ import print_function
-
-import os, sys, time
+import os
+import sys
+import time
import lldb
import time
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class HelloWorldTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,33 +31,41 @@ class HelloWorldTestCase(TestBase):
self.setTearDownCleanup(dictionary=self.d)
target = self.dbg.CreateTarget(self.exe)
- breakpoint = target.BreakpointCreateBySourceRegex("break here", lldb.SBFileSpec("main.c"))
+ breakpoint = target.BreakpointCreateBySourceRegex(
+ "break here", lldb.SBFileSpec("main.c"))
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'])
i = self.frame().FindVariable("i")
i_val = i.GetValueAsUnsigned(0)
c = self.frame().FindVariable("c")
- # Update any values from the SBValue objects so we can ask them if they changed after a continue
+ # Update any values from the SBValue objects so we can ask them if they
+ # changed after a continue
i.GetValueDidChange()
c.GetChildAtIndex(1).GetValueDidChange()
c.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange()
-
- if self.TraceOn(): self.runCmd("frame variable")
-
+
+ if self.TraceOn():
+ self.runCmd("frame variable")
+
self.runCmd("continue")
- if self.TraceOn(): self.runCmd("frame variable")
-
- self.assertTrue(i_val != i.GetValueAsUnsigned(0), "GetValue() is saying a lie")
- self.assertTrue(i.GetValueDidChange(), "GetValueDidChange() is saying a lie")
+ if self.TraceOn():
+ self.runCmd("frame variable")
+
+ self.assertTrue(
+ i_val != i.GetValueAsUnsigned(0),
+ "GetValue() is saying a lie")
+ self.assertTrue(
+ i.GetValueDidChange(),
+ "GetValueDidChange() is saying a lie")
# Check complex type
- self.assertTrue(c.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange() and
- not c.GetChildAtIndex(1).GetValueDidChange(), "GetValueDidChange() is saying a lie")
+ self.assertTrue(c.GetChildAtIndex(0).GetChildAtIndex(0).GetValueDidChange(
+ ) and not c.GetChildAtIndex(1).GetValueDidChange(), "GetValueDidChange() is saying a lie")
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Use lldb Python SBValue API to create a
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SetWatchpointAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,12 +24,17 @@ class SetWatchpointAPITestCase(TestBase)
# Our simple source filename.
self.source = 'main.c'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
@add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_watch_val(self):
"""Exercise SBValue.Watch() API to set a watchpoint."""
self.build()
@@ -45,18 +51,20 @@ class SetWatchpointAPITestCase(TestBase)
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
frame0 = thread.GetFrameAtIndex(0)
# Watch 'global' for read and write.
value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal)
- error = lldb.SBError();
+ error = lldb.SBError()
watchpoint = value.Watch(True, True, True, error)
self.assertTrue(value and watchpoint,
"Successfully found the variable and set a watchpoint")
@@ -68,28 +76,35 @@ class SetWatchpointAPITestCase(TestBase)
print(watchpoint)
- # Continue. Expect the program to stop due to the variable being written to.
+ # Continue. Expect the program to stop due to the variable being
+ # written to.
process.Continue()
if (self.TraceOn()):
lldbutil.print_stacktraces(process)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonWatchpoint)
self.assertTrue(thread, "The thread stopped due to watchpoint")
self.DebugSBValue(value)
- # Continue. Expect the program to stop due to the variable being read from.
+ # Continue. Expect the program to stop due to the variable being read
+ # from.
process.Continue()
if (self.TraceOn()):
lldbutil.print_stacktraces(process)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonWatchpoint)
self.assertTrue(thread, "The thread stopped due to watchpoint")
self.DebugSBValue(value)
- # Continue the process. We don't expect the program to be stopped again.
+ # Continue the process. We don't expect the program to be stopped
+ # again.
process.Continue()
# At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
+ self.assertTrue(
+ process.GetState() == lldb.eStateExited,
+ PROCESS_EXITED)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Use lldb Python SBWatchpoint API to set
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointIgnoreCountTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,12 +24,17 @@ class WatchpointIgnoreCountTestCase(Test
# Our simple source filename.
self.source = 'main.c'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
@add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
- @expectedFailureAll(archs=['s390x']) # Read-write watchpoints not supported on SystemZ
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Read-write watchpoints not supported on SystemZ
+ @expectedFailureAll(archs=['s390x'])
def test_set_watch_ignore_count(self):
"""Test SBWatchpoint.SetIgnoreCount() API."""
self.build()
@@ -45,18 +51,20 @@ class WatchpointIgnoreCountTestCase(Test
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
frame0 = thread.GetFrameAtIndex(0)
# Watch 'global' for read and write.
value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal)
- error = lldb.SBError();
+ error = lldb.SBError()
watchpoint = value.Watch(True, True, True, error)
self.assertTrue(value and watchpoint,
"Successfully found the variable and set a watchpoint")
@@ -82,7 +90,9 @@ class WatchpointIgnoreCountTestCase(Test
process.Continue()
# At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
+ self.assertTrue(
+ process.GetState() == lldb.eStateExited,
+ PROCESS_EXITED)
# Verify some vital statistics.
self.assertTrue(watchpoint)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py Tue Sep 6 15:57:50 2016
@@ -5,7 +5,6 @@ Use lldb Python SBTarget API to iterate
from __future__ import print_function
-
import os
import re
import time
@@ -15,6 +14,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class WatchpointIteratorTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -25,11 +25,15 @@ class WatchpointIteratorTestCase(TestBas
# Our simple source filename.
self.source = 'main.c'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
@add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watch_iter(self):
"""Exercise SBTarget.watchpoint_iter() API to iterate on the available watchpoints."""
self.build()
@@ -46,18 +50,20 @@ class WatchpointIteratorTestCase(TestBas
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
frame0 = thread.GetFrameAtIndex(0)
# Watch 'global' for read and write.
value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal)
- error = lldb.SBError();
+ error = lldb.SBError()
watchpoint = value.Watch(True, False, True, error)
self.assertTrue(value and watchpoint,
"Successfully found the variable and set a watchpoint")
@@ -73,7 +79,8 @@ class WatchpointIteratorTestCase(TestBas
watch_id = watchpoint.GetID()
self.assertTrue(watch_id != 0)
- # Continue. Expect the program to stop due to the variable being written to.
+ # Continue. Expect the program to stop due to the variable being
+ # written to.
process.Continue()
# Hide stdout if not running with '-t' option.
@@ -83,7 +90,8 @@ class WatchpointIteratorTestCase(TestBas
# Print the stack traces.
lldbutil.print_stacktraces(process)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonWatchpoint)
self.assertTrue(thread, "The thread stopped due to watchpoint")
self.DebugSBValue(value)
@@ -107,7 +115,9 @@ class WatchpointIteratorTestCase(TestBas
process.Continue()
# At this point, the inferior process should have exited.
- self.assertTrue(process.GetState() == lldb.eStateExited, PROCESS_EXITED)
+ self.assertTrue(
+ process.GetState() == lldb.eStateExited,
+ PROCESS_EXITED)
# Verify some vital statistics and exercise the iterator API.
for watchpoint in target.watchpoint_iter():
@@ -115,4 +125,3 @@ class WatchpointIteratorTestCase(TestBas
self.assertTrue(watchpoint.GetWatchSize() == 4)
self.assertTrue(watchpoint.GetHitCount() == 1)
print(watchpoint)
-
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,14 @@ Test watchpoint condition API.
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 WatchpointConditionAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -22,16 +23,23 @@ class WatchpointConditionAPITestCase(Tes
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# And the watchpoint variable declaration line number.
- self.decl = line_number(self.source, '// Watchpoint variable declaration.')
- # Build dictionary to have unique executable names for each test method.
+ self.decl = line_number(self.source,
+ '// Watchpoint variable declaration.')
+ # Build dictionary to have unique executable names for each test
+ # method.
self.exe_name = self.testMethodName
self.d = {'CXX_SOURCES': self.source, 'EXE': self.exe_name}
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["linux"], archs=["aarch64"], bugnumber="llvm.org/pr27710")
- @skipIfWindows # Watchpoints not supported on Windows, and this test hangs
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=["aarch64"],
+ bugnumber="llvm.org/pr27710")
+ @skipIfWindows # Watchpoints not supported on Windows, and this test hangs
def test_watchpoint_cond_api(self):
"""Test watchpoint condition API."""
self.build(dictionary=self.d)
@@ -49,18 +57,20 @@ class WatchpointConditionAPITestCase(Tes
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
frame0 = thread.GetFrameAtIndex(0)
# Watch 'global' for write.
value = frame0.FindValue('global', lldb.eValueTypeVariableGlobal)
- error = lldb.SBError();
+ error = lldb.SBError()
watchpoint = value.Watch(True, False, True, error)
self.assertTrue(value and watchpoint,
"Successfully found the variable and set a watchpoint")
@@ -69,7 +79,7 @@ class WatchpointConditionAPITestCase(Tes
# Now set the condition as "global==5".
watchpoint.SetCondition('global==5')
self.expect(watchpoint.GetCondition(), exe=False,
- startstr = 'global==5')
+ startstr='global==5')
# Hide stdout if not running with '-t' option.
if not self.TraceOn():
@@ -77,13 +87,15 @@ class WatchpointConditionAPITestCase(Tes
print(watchpoint)
- # Continue. Expect the program to stop due to the variable being written to.
+ # Continue. Expect the program to stop due to the variable being
+ # written to.
process.Continue()
if (self.TraceOn()):
lldbutil.print_stacktraces(process)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonWatchpoint)
self.assertTrue(thread, "The thread stopped due to watchpoint")
self.DebugSBValue(value)
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py Tue Sep 6 15:57:50 2016
@@ -5,7 +5,6 @@ Use lldb Python SBValue.WatchPointee() A
from __future__ import print_function
-
import os
import re
import time
@@ -15,6 +14,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SetWatchlocationAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -25,13 +25,17 @@ class SetWatchlocationAPITestCase(TestBa
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# This is for verifying that watch location works.
- self.violating_func = "do_bad_thing_with_location";
+ self.violating_func = "do_bad_thing_with_location"
@add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watch_location(self):
"""Exercise SBValue.WatchPointee() API to set a watchpoint."""
self.build()
@@ -48,22 +52,25 @@ class SetWatchlocationAPITestCase(TestBa
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
frame0 = thread.GetFrameAtIndex(0)
value = frame0.FindValue('g_char_ptr',
lldb.eValueTypeVariableGlobal)
- pointee = value.CreateValueFromAddress("pointee",
- value.GetValueAsUnsigned(0),
- value.GetType().GetPointeeType())
+ pointee = value.CreateValueFromAddress(
+ "pointee",
+ value.GetValueAsUnsigned(0),
+ value.GetType().GetPointeeType())
# Watch for write to *g_char_ptr.
- error = lldb.SBError();
+ error = lldb.SBError()
watchpoint = value.WatchPointee(True, False, True, error)
self.assertTrue(value and watchpoint,
"Successfully found the pointer and set a watchpoint")
@@ -76,18 +83,25 @@ class SetWatchlocationAPITestCase(TestBa
print(watchpoint)
- # Continue. Expect the program to stop due to the variable being written to.
+ # Continue. Expect the program to stop due to the variable being
+ # written to.
process.Continue()
if (self.TraceOn()):
lldbutil.print_stacktraces(process)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonWatchpoint)
self.assertTrue(thread, "The thread stopped due to watchpoint")
self.DebugSBValue(value)
self.DebugSBValue(pointee)
- self.expect(lldbutil.print_stacktrace(thread, string_buffer=True), exe=False,
- substrs = [self.violating_func])
+ self.expect(
+ lldbutil.print_stacktrace(
+ thread,
+ string_buffer=True),
+ exe=False,
+ substrs=[
+ self.violating_func])
# This finishes our test.
Modified: lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py Tue Sep 6 15:57:50 2016
@@ -5,14 +5,15 @@ Use lldb Python SBtarget.WatchAddress()
from __future__ import print_function
-
-import os, time
+import os
+import time
import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TargetWatchAddressAPITestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -23,13 +24,17 @@ class TargetWatchAddressAPITestCase(Test
# Our simple source filename.
self.source = 'main.cpp'
# Find the line number to break inside main().
- self.line = line_number(self.source, '// Set break point at this line.')
+ self.line = line_number(
+ self.source, '// Set break point at this line.')
# This is for verifying that watch location works.
- self.violating_func = "do_bad_thing_with_location";
+ self.violating_func = "do_bad_thing_with_location"
@add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr24446: WINDOWS XFAIL TRIAGE - Watchpoints not supported on Windows")
def test_watch_address(self):
"""Exercise SBTarget.WatchAddress() API to set a watchpoint."""
self.build()
@@ -46,23 +51,27 @@ class TargetWatchAddressAPITestCase(Test
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
frame0 = thread.GetFrameAtIndex(0)
value = frame0.FindValue('g_char_ptr',
lldb.eValueTypeVariableGlobal)
- pointee = value.CreateValueFromAddress("pointee",
- value.GetValueAsUnsigned(0),
- value.GetType().GetPointeeType())
+ pointee = value.CreateValueFromAddress(
+ "pointee",
+ value.GetValueAsUnsigned(0),
+ value.GetType().GetPointeeType())
# Watch for write to *g_char_ptr.
- error = lldb.SBError();
- watchpoint = target.WatchAddress(value.GetValueAsUnsigned(), 1, False, True, error)
+ error = lldb.SBError()
+ watchpoint = target.WatchAddress(
+ value.GetValueAsUnsigned(), 1, False, True, error)
self.assertTrue(value and watchpoint,
"Successfully found the pointer and set a watchpoint")
self.DebugSBValue(value)
@@ -74,26 +83,35 @@ class TargetWatchAddressAPITestCase(Test
print(watchpoint)
- # Continue. Expect the program to stop due to the variable being written to.
+ # Continue. Expect the program to stop due to the variable being
+ # written to.
process.Continue()
if (self.TraceOn()):
lldbutil.print_stacktraces(process)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonWatchpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonWatchpoint)
self.assertTrue(thread, "The thread stopped due to watchpoint")
self.DebugSBValue(value)
self.DebugSBValue(pointee)
- self.expect(lldbutil.print_stacktrace(thread, string_buffer=True), exe=False,
- substrs = [self.violating_func])
+ self.expect(
+ lldbutil.print_stacktrace(
+ thread,
+ string_buffer=True),
+ exe=False,
+ substrs=[
+ self.violating_func])
# This finishes our test.
@add_test_categories(['pyapi'])
- @expectedFailureAndroid(archs=['arm', 'aarch64']) # Watchpoints not supported
- @skipIf(archs=['mips', 'mipsel', 'mips64', 'mips64el']) # No size constraint on MIPS for watches
- @skipIf(archs=['s390x']) # Likewise on SystemZ
+ # Watchpoints not supported
+ @expectedFailureAndroid(archs=['arm', 'aarch64'])
+ # No size constraint on MIPS for watches
+ @skipIf(archs=['mips', 'mipsel', 'mips64', 'mips64el'])
+ @skipIf(archs=['s390x']) # Likewise on SystemZ
def test_watch_address_with_invalid_watch_size(self):
"""Exercise SBTarget.WatchAddress() API but pass an invalid watch_size."""
self.build()
@@ -110,23 +128,27 @@ class TargetWatchAddressAPITestCase(Test
VALID_BREAKPOINT)
# Now launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
# We should be stopped due to the breakpoint. Get frame #0.
process = target.GetProcess()
self.assertTrue(process.GetState() == lldb.eStateStopped,
PROCESS_STOPPED)
- thread = lldbutil.get_stopped_thread(process, lldb.eStopReasonBreakpoint)
+ thread = lldbutil.get_stopped_thread(
+ process, lldb.eStopReasonBreakpoint)
frame0 = thread.GetFrameAtIndex(0)
value = frame0.FindValue('g_char_ptr',
lldb.eValueTypeVariableGlobal)
- pointee = value.CreateValueFromAddress("pointee",
- value.GetValueAsUnsigned(0),
- value.GetType().GetPointeeType())
+ pointee = value.CreateValueFromAddress(
+ "pointee",
+ value.GetValueAsUnsigned(0),
+ value.GetType().GetPointeeType())
# Watch for write to *g_char_ptr.
- error = lldb.SBError();
- watchpoint = target.WatchAddress(value.GetValueAsUnsigned(), 365, False, True, error)
+ error = lldb.SBError()
+ watchpoint = target.WatchAddress(
+ value.GetValueAsUnsigned(), 365, False, True, error)
self.assertFalse(watchpoint)
self.expect(error.GetCString(), exe=False,
- substrs = ['watch size of %d is not supported' % 365])
+ substrs=['watch size of %d is not supported' % 365])
Modified: lldb/trunk/packages/Python/lldbsuite/test/redo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/redo.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/redo.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/redo.py Tue Sep 6 15:57:50 2016
@@ -17,7 +17,9 @@ for help.
from __future__ import print_function
-import os, sys, datetime
+import os
+import sys
+import datetime
import re
# If True, redo with no '-t' option for the test driver.
@@ -42,6 +44,7 @@ comp_specs = set()
# The "-A arch" for arch_specs.
arch_specs = set()
+
def usage():
print("""\
Usage: redo.py [-F filename_component] [-n] [session_dir] [-d]
@@ -60,6 +63,7 @@ possible session directories with names
2012-01-23-) and employs the one with the latest timestamp.""")
sys.exit(0)
+
def where(session_dir, test_dir):
"""Returns the full path to the session directory; None if non-existent."""
abspath = os.path.abspath(session_dir)
@@ -77,6 +81,8 @@ def where(session_dir, test_dir):
filter_pattern = re.compile("^\./dotest\.py.*-f (.*)$")
comp_pattern = re.compile(" -C ([^ ]+) ")
arch_pattern = re.compile(" -A ([^ ]+) ")
+
+
def redo(suffix, dir, names):
"""Visitor function for os.path.walk(path, visit, arg)."""
global redo_specs
@@ -108,10 +114,11 @@ def redo(suffix, dir, names):
comp_specs.add(comp.group(1))
arch = arch_pattern.search(line)
if arch:
- arch_specs.add(arch.group(1))
+ arch_specs.add(arch.group(1))
else:
continue
+
def main():
"""Read the session directory and run the failed test cases one by one."""
global no_trace
@@ -128,7 +135,8 @@ def main():
index = 1
while index < len(sys.argv):
- if sys.argv[index].startswith('-h') or sys.argv[index].startswith('--help'):
+ if sys.argv[index].startswith(
+ '-h') or sys.argv[index].startswith('--help'):
usage()
if sys.argv[index].startswith('-'):
@@ -185,8 +193,8 @@ def main():
for arch in arch_specs:
archs += "--arch %s " % (arch)
- command = "./dotest.py %s %s -v %s %s -f " % (compilers, archs, "" if no_trace else "-t", "-d" if do_delay else "")
-
+ command = "./dotest.py %s %s -v %s %s -f " % (
+ compilers, archs, "" if no_trace else "-t", "-d" if do_delay else "")
print("Running %s" % (command + filters))
os.system(command + filters)
Modified: lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/settings/TestSettings.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,15 @@ Test lldb settings command.
from __future__ import print_function
-
-import os, time, re
+import os
+import time
+import re
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SettingsCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -29,9 +31,9 @@ class SettingsCommandTestCase(TestBase):
"""Test that 'apropos' command should also search descriptions for the settings variables."""
self.expect("apropos 'environment variable'",
- substrs = ["target.env-vars",
- "environment variables",
- "executable's environment"])
+ substrs=["target.env-vars",
+ "environment variables",
+ "executable's environment"])
@no_debug_info_test
def test_append_target_env_vars(self):
@@ -44,7 +46,7 @@ class SettingsCommandTestCase(TestBase):
# Check it immediately!
self.expect('settings show target.env-vars',
- substrs = ['MY_ENV_VAR=YES'])
+ substrs=['MY_ENV_VAR=YES'])
@no_debug_info_test
def test_insert_before_and_after_target_run_args(self):
@@ -61,12 +63,12 @@ class SettingsCommandTestCase(TestBase):
self.runCmd('settings insert-after target.run-args 1 __A__')
# Check it immediately!
self.expect('settings show target.run-args',
- substrs = ['target.run-args',
- '[0]: "__a__"',
- '[1]: "a"',
- '[2]: "__A__"',
- '[3]: "b"',
- '[4]: "c"'])
+ substrs=['target.run-args',
+ '[0]: "__a__"',
+ '[1]: "a"',
+ '[2]: "__A__"',
+ '[3]: "b"',
+ '[4]: "c"'])
@no_debug_info_test
def test_replace_target_run_args(self):
@@ -81,10 +83,10 @@ class SettingsCommandTestCase(TestBase):
self.runCmd('settings replace target.run-args 0 A')
# Check it immediately!
self.expect('settings show target.run-args',
- substrs = ['target.run-args (arguments) =',
- '[0]: "A"',
- '[1]: "b"',
- '[2]: "c"'])
+ substrs=['target.run-args (arguments) =',
+ '[0]: "A"',
+ '[1]: "b"',
+ '[2]: "c"'])
@no_debug_info_test
def test_set_prompt(self):
@@ -95,11 +97,11 @@ class SettingsCommandTestCase(TestBase):
# Immediately test the setting.
self.expect("settings show prompt", SETTING_MSG("prompt"),
- startstr = 'prompt (string) = "lldb2 "')
+ startstr='prompt (string) = "lldb2 "')
# The overall display should also reflect the new setting.
self.expect("settings show", SETTING_MSG("prompt"),
- substrs = ['prompt (string) = "lldb2 "'])
+ substrs=['prompt (string) = "lldb2 "'])
# Use '-r' option to reset to the original default prompt.
self.runCmd("settings clear prompt")
@@ -112,13 +114,13 @@ class SettingsCommandTestCase(TestBase):
# Immediately test the setting.
self.expect("settings show term-width", SETTING_MSG("term-width"),
- startstr = "term-width (int) = 70")
+ startstr="term-width (int) = 70")
# The overall display should also reflect the new setting.
self.expect("settings show", SETTING_MSG("term-width"),
- substrs = ["term-width (int) = 70"])
+ substrs=["term-width (int) = 70"])
- #rdar://problem/10712130
+ # rdar://problem/10712130
def test_set_frame_format(self):
"""Test that 'set frame-format' with a backtick char in the format string works as well as fullpath."""
self.build()
@@ -127,30 +129,33 @@ class SettingsCommandTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
def cleanup():
- self.runCmd("settings set frame-format %s" % self.format_string, check=False)
+ self.runCmd(
+ "settings set frame-format %s" %
+ self.format_string, check=False)
# Execute the cleanup function during test case tear down.
self.addTearDownHook(cleanup)
self.runCmd("settings show frame-format")
m = re.match(
- '^frame-format \(format-string\) = "(.*)\"$',
- self.res.GetOutput())
+ '^frame-format \(format-string\) = "(.*)\"$',
+ self.res.GetOutput())
self.assertTrue(m, "Bad settings string")
self.format_string = m.group(1)
- # Change the default format to print function.name rather than function.name-with-args
+ # Change the default format to print function.name rather than
+ # function.name-with-args
format_string = "frame #${frame.index}: ${frame.pc}{ ${module.file.basename}`${function.name}{${function.pc-offset}}}{ at ${line.file.fullpath}:${line.number}}{, lang=${language}}\n"
self.runCmd("settings set frame-format %s" % format_string)
# Immediately test the setting.
self.expect("settings show frame-format", SETTING_MSG("frame-format"),
- substrs = [format_string])
+ substrs=[format_string])
self.runCmd("breakpoint set -n main")
self.runCmd("run")
self.expect("thread backtrace",
- substrs = ["`main", os.getcwd()])
+ substrs=["`main", os.getcwd()])
def test_set_auto_confirm(self):
"""Test that after 'set auto-confirm true', manual confirmation should not kick in."""
@@ -163,18 +168,18 @@ class SettingsCommandTestCase(TestBase):
# Immediately test the setting.
self.expect("settings show auto-confirm", SETTING_MSG("auto-confirm"),
- startstr = "auto-confirm (boolean) = true")
+ startstr="auto-confirm (boolean) = true")
# Now 'breakpoint delete' should just work fine without confirmation
# prompt from the command interpreter.
self.runCmd("breakpoint set -n main")
self.expect("breakpoint delete",
- startstr = "All breakpoints removed")
+ startstr="All breakpoints removed")
# Restore the original setting of auto-confirm.
self.runCmd("settings clear auto-confirm")
self.expect("settings show auto-confirm", SETTING_MSG("auto-confirm"),
- startstr = "auto-confirm (boolean) = false")
+ startstr="auto-confirm (boolean) = false")
@skipIf(archs=no_match(['x86_64', 'i386', 'i686']))
def test_disassembler_settings(self):
@@ -188,27 +193,27 @@ class SettingsCommandTestCase(TestBase):
self.runCmd("settings set target.x86-disassembly-flavor att")
self.runCmd("settings set target.use-hex-immediates false")
self.expect("disassemble -n numberfn",
- substrs = ["$90"])
+ substrs=["$90"])
self.runCmd("settings set target.use-hex-immediates true")
self.runCmd("settings set target.hex-immediate-style c")
self.expect("disassemble -n numberfn",
- substrs = ["$0x5a"])
+ substrs=["$0x5a"])
self.runCmd("settings set target.hex-immediate-style asm")
self.expect("disassemble -n numberfn",
- substrs = ["$5ah"])
+ substrs=["$5ah"])
# Intel syntax
self.runCmd("settings set target.x86-disassembly-flavor intel")
self.runCmd("settings set target.use-hex-immediates false")
self.expect("disassemble -n numberfn",
- substrs = ["90"])
+ substrs=["90"])
self.runCmd("settings set target.use-hex-immediates true")
self.runCmd("settings set target.hex-immediate-style c")
self.expect("disassemble -n numberfn",
- substrs = ["0x5a"])
+ substrs=["0x5a"])
self.runCmd("settings set target.hex-immediate-style asm")
self.expect("disassemble -n numberfn",
- substrs = ["5ah"])
+ substrs=["5ah"])
def test_run_args_and_env_vars(self):
"""Test that run-args and env-vars are passed to the launched process."""
@@ -233,13 +238,16 @@ class SettingsCommandTestCase(TestBase):
with open('output2.txt', 'r') as f:
output = f.read()
- self.expect(output, exe=False,
- substrs = ["argv[1] matches",
- "argv[2] matches",
- "argv[3] matches",
- "Environment variable 'MY_ENV_VAR' successfully passed."])
+ self.expect(
+ output,
+ exe=False,
+ substrs=[
+ "argv[1] matches",
+ "argv[2] matches",
+ "argv[3] matches",
+ "Environment variable 'MY_ENV_VAR' successfully passed."])
- @skipIfRemote # it doesn't make sense to send host env to remote target
+ @skipIfRemote # it doesn't make sense to send host env to remote target
def test_pass_host_env_vars(self):
"""Test that the host env vars are passed to the launched process."""
self.build()
@@ -248,8 +256,10 @@ class SettingsCommandTestCase(TestBase):
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
# By default, inherit-env is 'true'.
- self.expect('settings show target.inherit-env', "Default inherit-env is 'true'",
- startstr = "target.inherit-env (boolean) = true")
+ self.expect(
+ 'settings show target.inherit-env',
+ "Default inherit-env is 'true'",
+ startstr="target.inherit-env (boolean) = true")
# Set some host environment variables now.
os.environ["MY_HOST_ENV_VAR1"] = "VAR1"
@@ -269,9 +279,12 @@ class SettingsCommandTestCase(TestBase):
with open('output1.txt', 'r') as f:
output = f.read()
- self.expect(output, exe=False,
- substrs = ["The host environment variable 'MY_HOST_ENV_VAR1' successfully passed.",
- "The host environment variable 'MY_HOST_ENV_VAR2' successfully passed."])
+ self.expect(
+ output,
+ exe=False,
+ substrs=[
+ "The host environment variable 'MY_HOST_ENV_VAR1' successfully passed.",
+ "The host environment variable 'MY_HOST_ENV_VAR2' successfully passed."])
def test_set_error_output_path(self):
"""Test that setting target.error/output-path for the launched process works."""
@@ -291,11 +304,11 @@ class SettingsCommandTestCase(TestBase):
self.expect("settings show target.error-path",
SETTING_MSG("target.error-path"),
- substrs = ['target.error-path (file) = "stderr.txt"'])
+ substrs=['target.error-path (file) = "stderr.txt"'])
self.expect("settings show target.output-path",
SETTING_MSG("target.output-path"),
- substrs = ['target.output-path (file) = "stdout.txt"'])
+ substrs=['target.output-path (file) = "stdout.txt"'])
self.runCmd("run", RUN_SUCCEEDED)
@@ -303,7 +316,6 @@ class SettingsCommandTestCase(TestBase):
self.runCmd('platform get-file "stderr.txt" "stderr.txt"')
self.runCmd('platform get-file "stdout.txt" "stdout.txt"')
-
# The 'stderr.txt' file should now exist.
self.assertTrue(os.path.isfile("stderr.txt"),
"'stderr.txt' exists due to target.error-path.")
@@ -314,9 +326,9 @@ class SettingsCommandTestCase(TestBase):
message = "This message should go to standard error."
if lldbplatformutil.hasChattyStderr(self):
- self.expect(output, exe=False, substrs = [message])
+ self.expect(output, exe=False, substrs=[message])
else:
- self.expect(output, exe=False, startstr = message)
+ self.expect(output, exe=False, startstr=message)
# The 'stdout.txt' file should now exist.
self.assertTrue(os.path.isfile("stdout.txt"),
@@ -327,173 +339,221 @@ class SettingsCommandTestCase(TestBase):
output = f.read()
self.expect(output, exe=False,
- startstr = "This message should go to standard out.")
+ startstr="This message should go to standard out.")
@no_debug_info_test
def test_print_dictionary_setting(self):
- self.runCmd ("settings clear target.env-vars")
- self.runCmd ("settings set target.env-vars [\"MY_VAR\"]=some-value")
- self.expect ("settings show target.env-vars",
- substrs = [ "MY_VAR=some-value" ])
- self.runCmd ("settings clear target.env-vars")
+ self.runCmd("settings clear target.env-vars")
+ self.runCmd("settings set target.env-vars [\"MY_VAR\"]=some-value")
+ self.expect("settings show target.env-vars",
+ substrs=["MY_VAR=some-value"])
+ self.runCmd("settings clear target.env-vars")
@no_debug_info_test
def test_print_array_setting(self):
- self.runCmd ("settings clear target.run-args")
- self.runCmd ("settings set target.run-args gobbledy-gook")
- self.expect ("settings show target.run-args",
- substrs = [ '[0]: "gobbledy-gook"' ])
- self.runCmd ("settings clear target.run-args")
-
- @no_debug_info_test
- def test_settings_with_quotes (self):
- self.runCmd ("settings clear target.run-args")
- self.runCmd ("settings set target.run-args a b c")
- self.expect ("settings show target.run-args",
- substrs = [ '[0]: "a"',
- '[1]: "b"',
- '[2]: "c"' ])
- self.runCmd ("settings set target.run-args 'a b c'")
- self.expect ("settings show target.run-args",
- substrs = [ '[0]: "a b c"' ])
- self.runCmd ("settings clear target.run-args")
- self.runCmd ("settings clear target.env-vars")
- self.runCmd ('settings set target.env-vars ["MY_FILE"]="this is a file name with spaces.txt"')
- self.expect ("settings show target.env-vars",
- substrs = [ 'MY_FILE=this is a file name with spaces.txt' ])
- self.runCmd ("settings clear target.env-vars")
- # Test and make sure that setting "format-string" settings obeys quotes if they are provided
- self.runCmd ("settings set thread-format 'abc def' ")
- self.expect ("settings show thread-format", 'thread-format (format-string) = "abc def"')
- self.runCmd ('settings set thread-format "abc def" ')
- self.expect ("settings show thread-format", 'thread-format (format-string) = "abc def"')
- # Make sure when no quotes are provided that we maintain any trailing spaces
- self.runCmd ('settings set thread-format abc def ')
- self.expect ("settings show thread-format", 'thread-format (format-string) = "abc def "')
- self.runCmd ('settings clear thread-format')
+ self.runCmd("settings clear target.run-args")
+ self.runCmd("settings set target.run-args gobbledy-gook")
+ self.expect("settings show target.run-args",
+ substrs=['[0]: "gobbledy-gook"'])
+ self.runCmd("settings clear target.run-args")
+
+ @no_debug_info_test
+ def test_settings_with_quotes(self):
+ self.runCmd("settings clear target.run-args")
+ self.runCmd("settings set target.run-args a b c")
+ self.expect("settings show target.run-args",
+ substrs=['[0]: "a"',
+ '[1]: "b"',
+ '[2]: "c"'])
+ self.runCmd("settings set target.run-args 'a b c'")
+ self.expect("settings show target.run-args",
+ substrs=['[0]: "a b c"'])
+ self.runCmd("settings clear target.run-args")
+ self.runCmd("settings clear target.env-vars")
+ self.runCmd(
+ 'settings set target.env-vars ["MY_FILE"]="this is a file name with spaces.txt"')
+ self.expect("settings show target.env-vars",
+ substrs=['MY_FILE=this is a file name with spaces.txt'])
+ self.runCmd("settings clear target.env-vars")
+ # Test and make sure that setting "format-string" settings obeys quotes
+ # if they are provided
+ self.runCmd("settings set thread-format 'abc def' ")
+ self.expect("settings show thread-format",
+ 'thread-format (format-string) = "abc def"')
+ self.runCmd('settings set thread-format "abc def" ')
+ self.expect("settings show thread-format",
+ 'thread-format (format-string) = "abc def"')
+ # Make sure when no quotes are provided that we maintain any trailing
+ # spaces
+ self.runCmd('settings set thread-format abc def ')
+ self.expect("settings show thread-format",
+ 'thread-format (format-string) = "abc def "')
+ self.runCmd('settings clear thread-format')
@no_debug_info_test
- def test_settings_with_trailing_whitespace (self):
-
+ def test_settings_with_trailing_whitespace(self):
+
# boolean
- self.runCmd ("settings set target.skip-prologue true") # Set to known value
- self.runCmd ("settings set target.skip-prologue false ") # Set to new value with trailing whitespace
+ # Set to known value
+ self.runCmd("settings set target.skip-prologue true")
+ # Set to new value with trailing whitespace
+ self.runCmd("settings set target.skip-prologue false ")
# Make sure the setting was correctly set to "false"
- self.expect ("settings show target.skip-prologue", SETTING_MSG("target.skip-prologue"),
- startstr = "target.skip-prologue (boolean) = false")
+ self.expect(
+ "settings show target.skip-prologue",
+ SETTING_MSG("target.skip-prologue"),
+ startstr="target.skip-prologue (boolean) = false")
self.runCmd("settings clear target.skip-prologue", check=False)
# integer
- self.runCmd ("settings set term-width 70") # Set to known value
- self.runCmd ("settings set term-width 60 \t") # Set to new value with trailing whitespaces
- self.expect ("settings show term-width", SETTING_MSG("term-width"),
- startstr = "term-width (int) = 60")
+ self.runCmd("settings set term-width 70") # Set to known value
+ # Set to new value with trailing whitespaces
+ self.runCmd("settings set term-width 60 \t")
+ self.expect("settings show term-width", SETTING_MSG("term-width"),
+ startstr="term-width (int) = 60")
self.runCmd("settings clear term-width", check=False)
# string
- self.runCmd ("settings set target.arg0 abc") # Set to known value
- self.runCmd ("settings set target.arg0 cde\t ") # Set to new value with trailing whitespaces
- self.expect ("settings show target.arg0", SETTING_MSG("target.arg0"),
- startstr = 'target.arg0 (string) = "cde"')
+ self.runCmd("settings set target.arg0 abc") # Set to known value
+ # Set to new value with trailing whitespaces
+ self.runCmd("settings set target.arg0 cde\t ")
+ self.expect("settings show target.arg0", SETTING_MSG("target.arg0"),
+ startstr='target.arg0 (string) = "cde"')
self.runCmd("settings clear target.arg0", check=False)
# file
path1 = os.path.join(os.getcwd(), "path1.txt")
path2 = os.path.join(os.getcwd(), "path2.txt")
- self.runCmd ("settings set target.output-path %s" % path1) # Set to known value
- self.expect ("settings show target.output-path", SETTING_MSG("target.output-path"),
- startstr = 'target.output-path (file) = ', substrs=[path1])
- self.runCmd ("settings set target.output-path %s " % path2) # Set to new value with trailing whitespaces
- self.expect ("settings show target.output-path", SETTING_MSG("target.output-path"),
- startstr = 'target.output-path (file) = ', substrs=[path2])
+ self.runCmd(
+ "settings set target.output-path %s" %
+ path1) # Set to known value
+ self.expect(
+ "settings show target.output-path",
+ SETTING_MSG("target.output-path"),
+ startstr='target.output-path (file) = ',
+ substrs=[path1])
+ self.runCmd("settings set target.output-path %s " %
+ path2) # Set to new value with trailing whitespaces
+ self.expect(
+ "settings show target.output-path",
+ SETTING_MSG("target.output-path"),
+ startstr='target.output-path (file) = ',
+ substrs=[path2])
self.runCmd("settings clear target.output-path", check=False)
# enum
- self.runCmd ("settings set stop-disassembly-display never") # Set to known value
- self.runCmd ("settings set stop-disassembly-display always ") # Set to new value with trailing whitespaces
- self.expect ("settings show stop-disassembly-display", SETTING_MSG("stop-disassembly-display"),
- startstr = 'stop-disassembly-display (enum) = always')
- self.runCmd("settings clear stop-disassembly-display", check=False)
+ # Set to known value
+ self.runCmd("settings set stop-disassembly-display never")
+ # Set to new value with trailing whitespaces
+ self.runCmd("settings set stop-disassembly-display always ")
+ self.expect(
+ "settings show stop-disassembly-display",
+ SETTING_MSG("stop-disassembly-display"),
+ startstr='stop-disassembly-display (enum) = always')
+ self.runCmd("settings clear stop-disassembly-display", check=False)
# language
- self.runCmd ("settings set target.language c89") # Set to known value
- self.runCmd ("settings set target.language go ") # Set to new value with trailing whitespace
- self.expect ("settings show target.language", SETTING_MSG("target.language"),
- startstr = "target.language (language) = go")
+ # Set to known value
+ self.runCmd("settings set target.language c89")
+ # Set to new value with trailing whitespace
+ self.runCmd("settings set target.language go ")
+ self.expect(
+ "settings show target.language",
+ SETTING_MSG("target.language"),
+ startstr="target.language (language) = go")
self.runCmd("settings clear target.language", check=False)
# arguments
- self.runCmd ("settings set target.run-args 1 2 3") # Set to known value
- self.runCmd ("settings set target.run-args 3 4 5 ") # Set to new value with trailing whitespaces
- self.expect ("settings show target.run-args", SETTING_MSG("target.run-args"),
- substrs = [ 'target.run-args (arguments) =',
- '[0]: "3"',
- '[1]: "4"',
- '[2]: "5"' ])
- self.runCmd ("settings set target.run-args 1 2 3") # Set to known value
- self.runCmd ("settings set target.run-args 3 \ \ ") # Set to new value with trailing whitespaces
- self.expect ("settings show target.run-args", SETTING_MSG("target.run-args"),
- substrs = [ 'target.run-args (arguments) =',
- '[0]: "3"',
- '[1]: " "',
- '[2]: " "' ])
- self.runCmd("settings clear target.run-args", check=False)
+ self.runCmd("settings set target.run-args 1 2 3") # Set to known value
+ # Set to new value with trailing whitespaces
+ self.runCmd("settings set target.run-args 3 4 5 ")
+ self.expect(
+ "settings show target.run-args",
+ SETTING_MSG("target.run-args"),
+ substrs=[
+ 'target.run-args (arguments) =',
+ '[0]: "3"',
+ '[1]: "4"',
+ '[2]: "5"'])
+ self.runCmd("settings set target.run-args 1 2 3") # Set to known value
+ # Set to new value with trailing whitespaces
+ self.runCmd("settings set target.run-args 3 \ \ ")
+ self.expect(
+ "settings show target.run-args",
+ SETTING_MSG("target.run-args"),
+ substrs=[
+ 'target.run-args (arguments) =',
+ '[0]: "3"',
+ '[1]: " "',
+ '[2]: " "'])
+ self.runCmd("settings clear target.run-args", check=False)
# dictionaries
- self.runCmd ("settings clear target.env-vars") # Set to known value
- self.runCmd ("settings set target.env-vars A=B C=D\t ") # Set to new value with trailing whitespaces
- self.expect ("settings show target.env-vars", SETTING_MSG("target.env-vars"),
- substrs = [ 'target.env-vars (dictionary of strings) =',
- 'A=B',
- 'C=D'])
- self.runCmd("settings clear target.env-vars", check=False)
+ self.runCmd("settings clear target.env-vars") # Set to known value
+ # Set to new value with trailing whitespaces
+ self.runCmd("settings set target.env-vars A=B C=D\t ")
+ self.expect(
+ "settings show target.env-vars",
+ SETTING_MSG("target.env-vars"),
+ substrs=[
+ 'target.env-vars (dictionary of strings) =',
+ 'A=B',
+ 'C=D'])
+ self.runCmd("settings clear target.env-vars", check=False)
# regex
- self.runCmd ("settings clear target.process.thread.step-avoid-regexp") # Set to known value
- self.runCmd ("settings set target.process.thread.step-avoid-regexp foo\\ ") # Set to new value with trailing whitespaces
- self.expect ("settings show target.process.thread.step-avoid-regexp",
- SETTING_MSG("target.process.thread.step-avoid-regexp"),
- substrs = [ 'target.process.thread.step-avoid-regexp (regex) = foo\\ '])
- self.runCmd("settings clear target.process.thread.step-avoid-regexp", check=False)
+ # Set to known value
+ self.runCmd("settings clear target.process.thread.step-avoid-regexp")
+ # Set to new value with trailing whitespaces
+ self.runCmd(
+ "settings set target.process.thread.step-avoid-regexp foo\\ ")
+ self.expect(
+ "settings show target.process.thread.step-avoid-regexp",
+ SETTING_MSG("target.process.thread.step-avoid-regexp"),
+ substrs=['target.process.thread.step-avoid-regexp (regex) = foo\\ '])
+ self.runCmd(
+ "settings clear target.process.thread.step-avoid-regexp",
+ check=False)
# format-string
- self.runCmd ("settings clear disassembly-format") # Set to known value
- self.runCmd ("settings set disassembly-format foo ") # Set to new value with trailing whitespaces
- self.expect ("settings show disassembly-format",
- SETTING_MSG("disassembly-format"),
- substrs = [ 'disassembly-format (format-string) = "foo "'])
+ self.runCmd("settings clear disassembly-format") # Set to known value
+ # Set to new value with trailing whitespaces
+ self.runCmd("settings set disassembly-format foo ")
+ self.expect("settings show disassembly-format",
+ SETTING_MSG("disassembly-format"),
+ substrs=['disassembly-format (format-string) = "foo "'])
self.runCmd("settings clear disassembly-format", check=False)
@no_debug_info_test
- def test_all_settings_exist (self):
- self.expect ("settings show",
- substrs = [ "auto-confirm",
- "frame-format",
- "notify-void",
- "prompt",
- "script-lang",
- "stop-disassembly-count",
- "stop-disassembly-display",
- "stop-line-count-after",
- "stop-line-count-before",
- "term-width",
- "thread-format",
- "use-external-editor",
- "target.default-arch",
- "target.move-to-nearest-code",
- "target.expr-prefix",
- "target.language",
- "target.prefer-dynamic-value",
- "target.enable-synthetic-value",
- "target.skip-prologue",
- "target.source-map",
- "target.exec-search-paths",
- "target.max-children-count",
- "target.max-string-summary-length",
- "target.breakpoints-use-platform-avoid-list",
- "target.run-args",
- "target.env-vars",
- "target.inherit-env",
- "target.input-path",
- "target.output-path",
- "target.error-path",
- "target.disable-aslr",
- "target.disable-stdio",
- "target.x86-disassembly-flavor",
- "target.use-hex-immediates",
- "target.hex-immediate-style",
- "target.process.disable-memory-cache",
- "target.process.extra-startup-command",
- "target.process.thread.step-avoid-regexp",
- "target.process.thread.trace-thread"])
+ def test_all_settings_exist(self):
+ self.expect("settings show",
+ substrs=["auto-confirm",
+ "frame-format",
+ "notify-void",
+ "prompt",
+ "script-lang",
+ "stop-disassembly-count",
+ "stop-disassembly-display",
+ "stop-line-count-after",
+ "stop-line-count-before",
+ "term-width",
+ "thread-format",
+ "use-external-editor",
+ "target.default-arch",
+ "target.move-to-nearest-code",
+ "target.expr-prefix",
+ "target.language",
+ "target.prefer-dynamic-value",
+ "target.enable-synthetic-value",
+ "target.skip-prologue",
+ "target.source-map",
+ "target.exec-search-paths",
+ "target.max-children-count",
+ "target.max-string-summary-length",
+ "target.breakpoints-use-platform-avoid-list",
+ "target.run-args",
+ "target.env-vars",
+ "target.inherit-env",
+ "target.input-path",
+ "target.output-path",
+ "target.error-path",
+ "target.disable-aslr",
+ "target.disable-stdio",
+ "target.x86-disassembly-flavor",
+ "target.use-hex-immediates",
+ "target.hex-immediate-style",
+ "target.process.disable-memory-cache",
+ "target.process.extra-startup-command",
+ "target.process.thread.step-avoid-regexp",
+ "target.process.thread.trace-thread"])
Modified: lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/settings/quoting/TestQuoting.py Tue Sep 6 15:57:50 2016
@@ -5,7 +5,6 @@ Test quoting of arguments to lldb comman
from __future__ import print_function
-
import os
import re
import time
@@ -15,6 +14,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SettingsCommandTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
Modified: lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/source-manager/TestSourceManager.py Tue Sep 6 15:57:50 2016
@@ -12,12 +12,12 @@ o test_modify_source_file_while_debuggin
from __future__ import print_function
-
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class SourceManagerTestCase(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -39,7 +39,8 @@ class SourceManagerTestCase(TestBase):
self.assertTrue(target, VALID_TARGET)
# Launch the process, and do not stop at the entry point.
- process = target.LaunchSimple (None, None, self.get_process_working_directory())
+ process = target.LaunchSimple(
+ None, None, self.get_process_working_directory())
#
# Exercise Python APIs to display source lines.
@@ -52,19 +53,19 @@ class SourceManagerTestCase(TestBase):
stream = lldb.SBStream()
source_mgr.DisplaySourceLinesWithLineNumbers(filespec,
self.line,
- 2, # context before
- 2, # context after
- "=>", # prefix for current line
+ 2, # context before
+ 2, # context after
+ "=>", # prefix for current line
stream)
- # 2
+ # 2
# 3 int main(int argc, char const *argv[]) {
# => 4 printf("Hello world.\n"); // Set break point at this line.
# 5 return 0;
# 6 }
self.expect(stream.GetData(), "Source code displayed correctly",
exe=False,
- patterns = ['=> %d.*Hello world' % self.line])
+ patterns=['=> %d.*Hello world' % self.line])
# Boundary condition testings for SBStream(). LLDB should not crash!
stream.Print(None)
@@ -88,19 +89,23 @@ class SourceManagerTestCase(TestBase):
system([["ls"]])
system([["ls", "hidden"]])
- # Set source remapping with invalid replace path and verify we get an error
- self.expect("settings set target.source-map /a/b/c/d/e /q/r/s/t/u", error=True,
- substrs = ['''error: the replacement path doesn't exist: "/q/r/s/t/u"'''])
-
+ # Set source remapping with invalid replace path and verify we get an
+ # error
+ self.expect(
+ "settings set target.source-map /a/b/c/d/e /q/r/s/t/u",
+ error=True,
+ substrs=['''error: the replacement path doesn't exist: "/q/r/s/t/u"'''])
+
# Set target.source-map settings.
- self.runCmd("settings set target.source-map %s %s" % (os.getcwd(), os.path.join(os.getcwd(), "hidden")))
+ self.runCmd("settings set target.source-map %s %s" %
+ (os.getcwd(), os.path.join(os.getcwd(), "hidden")))
# And verify that the settings work.
self.expect("settings show target.source-map",
- substrs = [os.getcwd(), os.path.join(os.getcwd(), "hidden")])
+ substrs=[os.getcwd(), os.path.join(os.getcwd(), "hidden")])
# Display main() and verify that the source mapping has been kicked in.
self.expect("source list -n main", SOURCE_DISPLAYED_CORRECTLY,
- substrs = ['Hello world'])
+ substrs=['Hello world'])
def test_modify_source_file_while_debugging(self):
"""Modify a source file while debugging the executable."""
@@ -108,19 +113,23 @@ class SourceManagerTestCase(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=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',
- 'main.c:%d' % self.line,
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'main.c:%d' % self.line,
+ 'stop reason = breakpoint'])
# Display some source code.
- self.expect("source list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
- substrs = ['Hello world'])
+ self.expect(
+ "source list -f main.c -l %d" %
+ self.line,
+ SOURCE_DISPLAYED_CORRECTLY,
+ substrs=['Hello world'])
# The '-b' option shows the line table locations from the debug information
# that indicates valid places to set source level breakpoints.
@@ -158,8 +167,9 @@ class SourceManagerTestCase(TestBase):
# Touch the file just to be sure.
os.utime('main.c', None)
if self.TraceOn():
- print("os.path.getmtime() after restore:", os.path.getmtime('main.c'))
-
+ print(
+ "os.path.getmtime() after restore:",
+ os.path.getmtime('main.c'))
# Modify the source code file.
with io.open('main.c', 'w', newline='\n') as f:
@@ -167,28 +177,35 @@ class SourceManagerTestCase(TestBase):
f.write(new_content)
if self.TraceOn():
print("new content:", new_content)
- print("os.path.getmtime() after writing new content:", os.path.getmtime('main.c'))
+ print(
+ "os.path.getmtime() after writing new content:",
+ os.path.getmtime('main.c'))
# Add teardown hook to restore the file to the original content.
self.addTearDownHook(restore_file)
# Display the source code again. We should see the updated line.
- self.expect("source list -f main.c -l %d" % self.line, SOURCE_DISPLAYED_CORRECTLY,
- substrs = ['Hello lldb'])
+ self.expect(
+ "source list -f main.c -l %d" %
+ self.line,
+ SOURCE_DISPLAYED_CORRECTLY,
+ substrs=['Hello lldb'])
def test_set_breakpoint_with_absolute_path(self):
self.build()
- self.runCmd("settings set target.source-map %s %s" % (os.getcwd(), os.path.join(os.getcwd(), "hidden")))
+ self.runCmd("settings set target.source-map %s %s" %
+ (os.getcwd(), os.path.join(os.getcwd(), "hidden")))
exe = os.path.join(os.getcwd(), "a.out")
main = os.path.join(os.getcwd(), "hidden", "main.c")
self.runCmd("file " + exe, CURRENT_EXECUTABLE_SET)
- lldbutil.run_break_set_by_file_and_line (self, main, self.line, num_expected_locations=1, loc_exact=False)
-
+ lldbutil.run_break_set_by_file_and_line(
+ self, main, self.line, num_expected_locations=1, loc_exact=False)
+
self.runCmd("run", RUN_SUCCEEDED)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
- substrs = ['stopped',
- 'main.c:%d' % self.line,
- 'stop reason = breakpoint'])
+ substrs=['stopped',
+ 'main.c:%d' % self.line,
+ 'stop reason = breakpoint'])
Modified: lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/terminal/TestSTTYBeforeAndAfter.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,13 @@ Test that 'stty -a' displays the same ou
from __future__ import print_function
-
import os
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestSTTYBeforeAndAfter(TestBase):
mydir = TestBase.compute_mydir(__file__)
@@ -24,13 +24,16 @@ class TestSTTYBeforeAndAfter(TestBase):
cls.RemoveTempFile("child_send2.txt")
cls.RemoveTempFile("child_read2.txt")
- @expectedFailureAll(hostoslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @expectedFailureAll(
+ hostoslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@no_debug_info_test
def test_stty_dash_a_before_and_afetr_invoking_lldb_command(self):
"""Test that 'stty -a' displays the same output before and after running the lldb command."""
import pexpect
if not which('expect'):
- self.skipTest("The 'expect' program cannot be located, skip the test")
+ self.skipTest(
+ "The 'expect' program cannot be located, skip the test")
# The expect prompt.
expect_prompt = "expect[0-9.]+> "
Modified: lldb/trunk/packages/Python/lldbsuite/test/test_categories.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/test_categories.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/test_categories.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/test_categories.py Tue Sep 6 15:57:50 2016
@@ -20,20 +20,20 @@ debug_info_categories = [
all_categories = {
'dataformatters': 'Tests related to the type command and the data formatters subsystem',
- 'dwarf' : 'Tests that can be run with DWARF debug information',
- 'dwo' : 'Tests that can be run with DWO debug information',
- 'dsym' : 'Tests that can be run with DSYM debug information',
- 'gmodules' : 'Tests that can be run with -gmodules debug information',
- 'expression' : 'Tests related to the expression parser',
- 'objc' : 'Tests related to the Objective-C programming language support',
- 'pyapi' : 'Tests related to the Python API',
- 'basic_process' : 'Basic process execution sniff tests.',
- 'cmdline' : 'Tests related to the LLDB command-line interface',
- 'dyntype' : 'Tests related to dynamic type support',
- 'stresstest' : 'Tests related to stressing lldb limits',
- 'flakey' : 'Flakey test cases, i.e. tests that do not reliably pass at each execution',
- 'lldb-mi' : 'lldb-mi tests'
-}
+ 'dwarf': 'Tests that can be run with DWARF debug information',
+ 'dwo': 'Tests that can be run with DWO debug information',
+ 'dsym': 'Tests that can be run with DSYM debug information',
+ 'gmodules': 'Tests that can be run with -gmodules debug information',
+ 'expression': 'Tests related to the expression parser',
+ 'objc': 'Tests related to the Objective-C programming language support',
+ 'pyapi': 'Tests related to the Python API',
+ 'basic_process': 'Basic process execution sniff tests.',
+ 'cmdline': 'Tests related to the LLDB command-line interface',
+ 'dyntype': 'Tests related to dynamic type support',
+ 'stresstest': 'Tests related to stressing lldb limits',
+ 'flakey': 'Flakey test cases, i.e. tests that do not reliably pass at each execution',
+ 'lldb-mi': 'lldb-mi tests'}
+
def unique_string_match(yourentry, list):
candidate = None
@@ -63,11 +63,13 @@ def is_supported_on_platform(category, p
# allow gmodules on compilers that support it and not on ones that don't.
# However, I didn't see an easy way for all the callers of this to know
# the compiler being used for a test invocation. As we tend to run with
- # a single compiler per test run, this shouldn't be a major issue.
+ # a single compiler per test run, this shouldn't be a major
+ # issue.
return False
return True
return True
+
def validate(categories, exact_match):
"""
For each category in categories, ensure that it's a valid category (if exact_match is false,
@@ -80,10 +82,14 @@ def validate(categories, exact_match):
origCategory = category
if category not in all_categories and not exact_match:
category = unique_string_match(category, all_categories)
- if (category not in all_categories) or category == None:
- print("fatal error: category '" + origCategory + "' is not a valid category")
+ if (category not in all_categories) or category is None:
+ print(
+ "fatal error: category '" +
+ origCategory +
+ "' is not a valid category")
print("if you have added a new category, please edit test_categories.py, adding your new category to all_categories")
- print("else, please specify one or more of the following: " + str(list(all_categories.keys())))
+ print("else, please specify one or more of the following: " +
+ str(list(all_categories.keys())))
sys.exit(1)
result.append(category)
return result
Modified: lldb/trunk/packages/Python/lldbsuite/test/test_result.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/test_result.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/test_result.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/test_result.py Tue Sep 6 15:57:50 2016
@@ -23,6 +23,7 @@ from . import configuration
from lldbsuite.test_event.event_builder import EventBuilder
from lldbsuite.test_event import build_exception
+
class LLDBTestResult(unittest2.TextTestResult):
"""
Enforce a singleton pattern to allow introspection of test progress.
@@ -39,11 +40,15 @@ class LLDBTestResult(unittest2.TextTestR
def getTerminalSize():
import os
env = os.environ
+
def ioctl_GWINSZ(fd):
try:
- import fcntl, termios, struct, os
+ import fcntl
+ import termios
+ import struct
+ import os
cr = struct.unpack('hh', fcntl.ioctl(fd, termios.TIOCGWINSZ,
- '1234'))
+ '1234'))
except:
return
return cr
@@ -78,15 +83,18 @@ class LLDBTestResult(unittest2.TextTestR
def _config_string(self, test):
compiler = getattr(test, "getCompiler", None)
arch = getattr(test, "getArchitecture", None)
- return "%s-%s" % (compiler() if compiler else "", arch() if arch else "")
+ return "%s-%s" % (compiler() if compiler else "",
+ arch() if arch else "")
def _exc_info_to_string(self, err, test):
"""Overrides superclass TestResult's method in order to append
our test config info string to the exception info string."""
if hasattr(test, "getArchitecture") and hasattr(test, "getCompiler"):
- return '%sConfig=%s-%s' % (super(LLDBTestResult, self)._exc_info_to_string(err, test),
- test.getArchitecture(),
- test.getCompiler())
+ return '%sConfig=%s-%s' % (super(LLDBTestResult,
+ self)._exc_info_to_string(err,
+ test),
+ test.getArchitecture(),
+ test.getCompiler())
else:
return super(LLDBTestResult, self)._exc_info_to_string(err, test)
@@ -103,23 +111,29 @@ class LLDBTestResult(unittest2.TextTestR
"""
test_categories = []
test_method = getattr(test, test._testMethodName)
- if test_method != None and hasattr(test_method, "categories"):
+ if test_method is not None and hasattr(test_method, "categories"):
test_categories.extend(test_method.categories)
test_categories.extend(test.getCategories())
return test_categories
- def hardMarkAsSkipped(self,test):
+ def hardMarkAsSkipped(self, test):
getattr(test, test._testMethodName).__func__.__unittest_skip__ = True
- getattr(test, test._testMethodName).__func__.__unittest_skip_why__ = "test case does not fall in any category of interest for this run"
+ getattr(
+ test,
+ test._testMethodName).__func__.__unittest_skip_why__ = "test case does not fall in any category of interest for this run"
def startTest(self, test):
- if configuration.shouldSkipBecauseOfCategories(self.getCategoriesForTest(test)):
+ if configuration.shouldSkipBecauseOfCategories(
+ self.getCategoriesForTest(test)):
self.hardMarkAsSkipped(test)
- configuration.setCrashInfoHook("%s at %s" % (str(test),inspect.getfile(test.__class__)))
+ configuration.setCrashInfoHook(
+ "%s at %s" %
+ (str(test), inspect.getfile(
+ test.__class__)))
self.counter += 1
- #if self.counter == 4:
+ # if self.counter == 4:
# import crashinfo
# crashinfo.testCrashReporterDescription(None)
test.test_number = self.counter
@@ -133,7 +147,9 @@ class LLDBTestResult(unittest2.TextTestR
def addSuccess(self, test):
super(LLDBTestResult, self).addSuccess(test)
if configuration.parsable:
- self.stream.write("PASS: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
+ self.stream.write(
+ "PASS: LLDB (%s) :: %s\n" %
+ (self._config_string(test), str(test)))
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_success(test))
@@ -150,7 +166,6 @@ class LLDBTestResult(unittest2.TextTestR
else:
return inspect.getsourcefile(test.__class__)
-
def _saveBuildErrorTuple(self, test, err):
# Adjust the error description so it prints the build command and build error
# rather than an uninformative Python backtrace.
@@ -172,7 +187,9 @@ class LLDBTestResult(unittest2.TextTestR
if method:
method()
if configuration.parsable:
- self.stream.write("FAIL: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
+ self.stream.write(
+ "FAIL: LLDB (%s) :: %s\n" %
+ (self._config_string(test), str(test)))
if self.results_formatter:
# Handle build errors as a separate event type
if self._isBuildError(err):
@@ -188,7 +205,9 @@ class LLDBTestResult(unittest2.TextTestR
if method:
method()
if configuration.parsable:
- self.stream.write("CLEANUP ERROR: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
+ self.stream.write(
+ "CLEANUP ERROR: LLDB (%s) :: %s\n" %
+ (self._config_string(test), str(test)))
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_cleanup_error(
@@ -201,19 +220,21 @@ class LLDBTestResult(unittest2.TextTestR
if method:
method()
if configuration.parsable:
- self.stream.write("FAIL: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
+ self.stream.write(
+ "FAIL: LLDB (%s) :: %s\n" %
+ (self._config_string(test), str(test)))
if configuration.useCategories:
test_categories = self.getCategoriesForTest(test)
for category in test_categories:
if category in configuration.failuresPerCategory:
- configuration.failuresPerCategory[category] = configuration.failuresPerCategory[category] + 1
+ configuration.failuresPerCategory[
+ category] = configuration.failuresPerCategory[category] + 1
else:
configuration.failuresPerCategory[category] = 1
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_failure(test, err))
-
def addExpectedFailure(self, test, err, bugnumber):
configuration.sdir_has_content = True
super(LLDBTestResult, self).addExpectedFailure(test, err, bugnumber)
@@ -221,11 +242,13 @@ class LLDBTestResult(unittest2.TextTestR
if method:
method(err, bugnumber)
if configuration.parsable:
- self.stream.write("XFAIL: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
+ self.stream.write(
+ "XFAIL: LLDB (%s) :: %s\n" %
+ (self._config_string(test), str(test)))
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_expected_failure(
- test, err, bugnumber))
+ test, err, bugnumber))
def addSkip(self, test, reason):
configuration.sdir_has_content = True
@@ -234,7 +257,9 @@ class LLDBTestResult(unittest2.TextTestR
if method:
method()
if configuration.parsable:
- self.stream.write("UNSUPPORTED: LLDB (%s) :: %s (%s) \n" % (self._config_string(test), str(test), reason))
+ self.stream.write(
+ "UNSUPPORTED: LLDB (%s) :: %s (%s) \n" %
+ (self._config_string(test), str(test), reason))
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_skip(test, reason))
@@ -246,7 +271,9 @@ class LLDBTestResult(unittest2.TextTestR
if method:
method(bugnumber)
if configuration.parsable:
- self.stream.write("XPASS: LLDB (%s) :: %s\n" % (self._config_string(test), str(test)))
+ self.stream.write(
+ "XPASS: LLDB (%s) :: %s\n" %
+ (self._config_string(test), str(test)))
if self.results_formatter:
self.results_formatter.handle_event(
EventBuilder.event_for_unexpected_success(
Modified: lldb/trunk/packages/Python/lldbsuite/test/test_runner/process_control.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/test_runner/process_control.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/test_runner/process_control.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/test_runner/process_control.py Tue Sep 6 15:57:50 2016
@@ -23,6 +23,7 @@ import threading
class CommunicatorThread(threading.Thread):
"""Provides a thread class that communicates with a subprocess."""
+
def __init__(self, process, event, output_file):
super(CommunicatorThread, self).__init__()
# Don't let this thread prevent shutdown.
@@ -100,6 +101,7 @@ class ProcessHelper(object):
@see ProcessHelper.process_helper()
"""
+
def __init__(self):
super(ProcessHelper, self).__init__()
@@ -281,6 +283,7 @@ class UnixProcessHelper(ProcessHelper):
This implementation supports anything that looks Posix-y
(e.g. Darwin, Linux, *BSD, etc.)
"""
+
def __init__(self):
super(UnixProcessHelper, self).__init__()
@@ -302,7 +305,7 @@ class UnixProcessHelper(ProcessHelper):
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
- universal_newlines=True, # Elicits automatic byte -> string decoding in Py3
+ universal_newlines=True, # Elicits automatic byte -> string decoding in Py3
close_fds=True,
preexec_fn=preexec_func)
@@ -412,8 +415,10 @@ class UnixProcessHelper(ProcessHelper):
signal_name = signal_names_by_number.get(signo, "")
return (signo, signal_name)
+
class WindowsProcessHelper(ProcessHelper):
"""Provides a Windows implementation of the ProcessHelper class."""
+
def __init__(self):
super(WindowsProcessHelper, self).__init__()
@@ -429,7 +434,7 @@ class WindowsProcessHelper(ProcessHelper
stdin=subprocess.PIPE,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
- universal_newlines=True, # Elicits automatic byte -> string decoding in Py3
+ universal_newlines=True, # Elicits automatic byte -> string decoding in Py3
creationflags=creation_flags)
def was_hard_terminate(self, returncode):
@@ -447,6 +452,7 @@ class ProcessDriver(object):
way. The on_process_exited method is informed if the exit was natural
or if it was due to a timeout.
"""
+
def __init__(self, soft_terminate_timeout=10.0):
super(ProcessDriver, self).__init__()
self.process_helper = ProcessHelper.process_helper()
Modified: lldb/trunk/packages/Python/lldbsuite/test/test_runner/test/test_process_control.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/test_runner/test/test_process_control.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/test_runner/test/test_process_control.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/test_runner/test/test_process_control.py Tue Sep 6 15:57:50 2016
@@ -27,6 +27,7 @@ from test_runner import process_control
class TestInferiorDriver(process_control.ProcessDriver):
+
def __init__(self, soft_terminate_timeout=None):
super(TestInferiorDriver, self).__init__(
soft_terminate_timeout=soft_terminate_timeout)
@@ -58,6 +59,7 @@ class TestInferiorDriver(process_control
class ProcessControlTests(unittest.TestCase):
+
@classmethod
def _suppress_soft_terminate(cls, command):
# Do the right thing for your platform here.
@@ -79,7 +81,8 @@ class ProcessControlTests(unittest.TestC
# Base command.
script_name = "{}/inferior.py".format(os.path.dirname(__file__))
if not os.path.exists(script_name):
- raise Exception("test inferior python script not found: {}".format(script_name))
+ raise Exception(
+ "test inferior python script not found: {}".format(script_name))
command = ([sys.executable, script_name])
if ignore_soft_terminate:
@@ -97,6 +100,7 @@ class ProcessControlTests(unittest.TestC
class ProcessControlNoTimeoutTests(ProcessControlTests):
"""Tests the process_control module."""
+
def test_run_completes(self):
"""Test that running completes and gets expected stdout/stderr."""
driver = TestInferiorDriver()
@@ -115,6 +119,7 @@ class ProcessControlNoTimeoutTests(Proce
class ProcessControlTimeoutTests(ProcessControlTests):
+
def test_run_completes(self):
"""Test that running completes and gets expected return code."""
driver = TestInferiorDriver()
@@ -124,7 +129,7 @@ class ProcessControlTimeoutTests(Process
"{}s".format(timeout_seconds),
False)
self.assertTrue(
- driver.completed_event.wait(2*timeout_seconds),
+ driver.completed_event.wait(2 * timeout_seconds),
"process failed to complete")
self.assertEqual(driver.returncode, 0)
@@ -141,13 +146,13 @@ class ProcessControlTimeoutTests(Process
# Sleep twice as long as the timeout interval. This
# should force a timeout.
self.inferior_command(
- options="--sleep {}".format(timeout_seconds*2)),
+ options="--sleep {}".format(timeout_seconds * 2)),
"{}s".format(timeout_seconds),
with_core)
# We should complete, albeit with a timeout.
self.assertTrue(
- driver.completed_event.wait(2*timeout_seconds),
+ driver.completed_event.wait(2 * timeout_seconds),
"process failed to complete")
# Ensure we received a timeout.
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiExit.py Tue Sep 6 15:57:50 2016
@@ -9,16 +9,19 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiExitTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_gdb_exit(self):
"""Test that '-gdb-exit' terminates local debug session and exits."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -37,12 +40,14 @@ class MiExitTestCase(lldbmi_testcase.MiT
import pexpect
self.expect(pexpect.EOF)
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_quit(self):
"""Test that 'quit' exits immediately."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -60,12 +65,14 @@ class MiExitTestCase(lldbmi_testcase.MiT
import pexpect
self.expect(pexpect.EOF)
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_q(self):
"""Test that 'q' exits immediately."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiFile.py Tue Sep 6 15:57:50 2016
@@ -5,22 +5,22 @@ Test lldb-mi -file-xxx commands.
from __future__ import print_function
-
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiFileTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_file_exec_and_symbols_file(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols exe."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that -file-exec-and-symbols works for filename
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -31,12 +31,12 @@ class MiFileTestCase(lldbmi_testcase.MiT
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_file_exec_and_symbols_absolute_path(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols fullpath/exe."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that -file-exec-and-symbols works for absolute path
import os
@@ -49,12 +49,12 @@ class MiFileTestCase(lldbmi_testcase.MiT
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_file_exec_and_symbols_relative_path(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols relpath/exe."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that -file-exec-and-symbols works for relative path
path = "./%s" % self.myexe
@@ -66,12 +66,12 @@ class MiFileTestCase(lldbmi_testcase.MiT
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_file_exec_and_symbols_unknown_path(self):
"""Test that 'lldb-mi --interpreter' works for -file-exec-and-symbols badpath/exe."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that -file-exec-and-symbols fails on unknown path
path = "unknown_dir/%s" % self.myexe
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiGdbSetShow.py Tue Sep 6 15:57:50 2016
@@ -5,23 +5,25 @@ Test lldb-mi -gdb-set and -gdb-show comm
from __future__ import print_function
-
import unittest2
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_gdb_set_target_async_default(self):
"""Test that 'lldb-mi --interpreter' switches to async mode by default."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Switch to sync mode
self.runCmd("-gdb-set target-async off")
@@ -35,13 +37,15 @@ class MiGdbSetShowTestCase(lldbmi_testca
self.runCmd("-gdb-show target-async")
self.expect("\^done,value=\"on\"")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFlakeyLinux("llvm.org/pr26028") # Fails in ~1% of cases
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFlakeyLinux("llvm.org/pr26028") # Fails in ~1% of cases
def test_lldbmi_gdb_set_target_async_on(self):
"""Test that 'lldb-mi --interpreter' can execute commands in async mode."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Switch to sync mode
self.runCmd("-gdb-set target-async off")
@@ -64,13 +68,17 @@ class MiGdbSetShowTestCase(lldbmi_testca
self.expect("\*running")
self.expect("@\"argc=1")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureAll(oslist=["linux"], bugnumber="Failing in ~11/600 dosep runs (build 3120-3122)")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="Failing in ~11/600 dosep runs (build 3120-3122)")
def test_lldbmi_gdb_set_target_async_off(self):
"""Test that 'lldb-mi --interpreter' can execute commands in sync mode."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that -gdb-set can switch to sync mode
self.runCmd("-gdb-set target-async off")
@@ -84,28 +92,32 @@ class MiGdbSetShowTestCase(lldbmi_testca
# Test that program is executed in async mode
self.runCmd("-exec-run")
- unexpected = [ "\*running" ] # "\*running" is async notification
- it = self.expect(unexpected + [ "@\"argc=1\\\\r\\\\n" ])
+ unexpected = ["\*running"] # "\*running" is async notification
+ it = self.expect(unexpected + ["@\"argc=1\\\\r\\\\n"])
if it < len(unexpected):
self.fail("unexpected found: %s" % unexpected[it])
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_gdb_show_target_async(self):
"""Test that 'lldb-mi --interpreter' in async mode by default."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that default target-async value is "on"
self.runCmd("-gdb-show target-async")
self.expect("\^done,value=\"on\"")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_gdb_show_language(self):
"""Test that 'lldb-mi --interpreter' can get current language."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -122,36 +134,41 @@ class MiGdbSetShowTestCase(lldbmi_testca
self.runCmd("-gdb-show language")
self.expect("\^done,value=\"c\+\+\"")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@unittest2.expectedFailure("-gdb-set ignores unknown properties")
def test_lldbmi_gdb_set_unknown(self):
"""Test that 'lldb-mi --interpreter' fails when setting an unknown property."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that -gdb-set fails if property is unknown
self.runCmd("-gdb-set unknown some_value")
self.expect("\^error")
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
@unittest2.expectedFailure("-gdb-show ignores unknown properties")
def test_lldbmi_gdb_show_unknown(self):
"""Test that 'lldb-mi --interpreter' fails when showing an unknown property."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that -gdb-show fails if property is unknown
self.runCmd("-gdb-show unknown")
self.expect("\^error")
-
- @expectedFailureAll(oslist=["windows"], bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @expectedFailureAll(
+ oslist=["windows"],
+ bugnumber="llvm.org/pr22274: need a pexpect replacement for windows")
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_gdb_set_ouptut_radix(self):
"""Test that 'lldb-mi --interpreter' works for -gdb-set output-radix."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -162,31 +179,32 @@ class MiGdbSetShowTestCase(lldbmi_testca
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
- self.expect("\^running");
+ self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Setup variable
- self.runCmd("-var-create var_a * a");
- self.expect("\^done,name=\"var_a\",numchild=\"0\",value=\"10\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+ self.runCmd("-var-create var_a * a")
+ self.expect(
+ "\^done,name=\"var_a\",numchild=\"0\",value=\"10\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
# Test default output
- self.runCmd("-var-evaluate-expression var_a");
- self.expect("\^done,value=\"10\"");
+ self.runCmd("-var-evaluate-expression var_a")
+ self.expect("\^done,value=\"10\"")
# Test hex output
- self.runCmd("-gdb-set output-radix 16");
- self.expect("\^done");
- self.runCmd("-var-evaluate-expression var_a");
- self.expect("\^done,value=\"0xa\"");
+ self.runCmd("-gdb-set output-radix 16")
+ self.expect("\^done")
+ self.runCmd("-var-evaluate-expression var_a")
+ self.expect("\^done,value=\"0xa\"")
# Test octal output
- self.runCmd("-gdb-set output-radix 8");
- self.expect("\^done");
- self.runCmd("-var-evaluate-expression var_a");
- self.expect("\^done,value=\"012\"");
+ self.runCmd("-gdb-set output-radix 8")
+ self.expect("\^done")
+ self.runCmd("-var-evaluate-expression var_a")
+ self.expect("\^done,value=\"012\"")
# Test decimal output
- self.runCmd("-gdb-set output-radix 10");
- self.expect("\^done");
- self.runCmd("-var-evaluate-expression var_a");
- self.expect("\^done,value=\"10\"");
+ self.runCmd("-gdb-set output-radix 10")
+ self.expect("\^done")
+ self.runCmd("-var-evaluate-expression var_a")
+ self.expect("\^done,value=\"10\"")
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiLibraryLoaded.py Tue Sep 6 15:57:50 2016
@@ -5,22 +5,22 @@ Test lldb-mi =library-loaded notificatio
from __future__ import print_function
-
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiLibraryLoadedTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_library_loaded(self):
"""Test that 'lldb-mi --interpreter' shows the =library-loaded notifications."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -29,7 +29,30 @@ class MiLibraryLoadedTestCase(lldbmi_tes
# Test =library-loaded
import os
path = os.path.join(os.getcwd(), self.myexe)
- symbols_path = os.path.join(path + ".dSYM", "Contents", "Resources", "DWARF", self.myexe)
- def add_slashes(x): return x.replace("\\", "\\\\").replace("\"", "\\\"").replace("\'", "\\\'").replace("\0", "\\\0")
- self.expect([ "=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"1\",symbols-path=\"%s\",loaded_addr=\"-\",size=\"[0-9]+\"" % (add_slashes(path), add_slashes(path), add_slashes(path), add_slashes(symbols_path)),
- "=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"0\",loaded_addr=\"-\",size=\"[0-9]+\"" % (add_slashes(path), add_slashes(path), add_slashes(path)) ])
+ symbols_path = os.path.join(
+ path + ".dSYM",
+ "Contents",
+ "Resources",
+ "DWARF",
+ self.myexe)
+
+ def add_slashes(x): return x.replace(
+ "\\",
+ "\\\\").replace(
+ "\"",
+ "\\\"").replace(
+ "\'",
+ "\\\'").replace(
+ "\0",
+ "\\\0")
+ self.expect(
+ [
+ "=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"1\",symbols-path=\"%s\",loaded_addr=\"-\",size=\"[0-9]+\"" %
+ (add_slashes(path),
+ add_slashes(path),
+ add_slashes(path),
+ add_slashes(symbols_path)),
+ "=library-loaded,id=\"%s\",target-name=\"%s\",host-name=\"%s\",symbols-loaded=\"0\",loaded_addr=\"-\",size=\"[0-9]+\"" %
+ (add_slashes(path),
+ add_slashes(path),
+ add_slashes(path))])
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/TestMiPrompt.py Tue Sep 6 15:57:50 2016
@@ -5,52 +5,53 @@ Test that the lldb-mi driver prints prom
from __future__ import print_function
-
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiPromptTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_prompt(self):
"""Test that 'lldb-mi --interpreter' echos '(gdb)' after commands and events."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that lldb-mi is ready after unknown command
self.runCmd("-unknown-command")
- self.expect("\^error,msg=\"Driver\. Received command '-unknown-command'\. It was not handled\. Command 'unknown-command' not in Command Factory\"")
- self.expect(self.child_prompt, exactly = True)
+ self.expect(
+ "\^error,msg=\"Driver\. Received command '-unknown-command'\. It was not handled\. Command 'unknown-command' not in Command Factory\"")
+ self.expect(self.child_prompt, exactly=True)
# Test that lldb-mi is ready after -file-exec-and-symbols
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Test that lldb-mi is ready after -break-insert
self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Test that lldb-mi is ready after -exec-run
self.runCmd("-exec-run")
self.expect("\*running")
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Test that lldb-mi is ready after BP hit
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Test that lldb-mi is ready after -exec-continue
self.runCmd("-exec-continue")
self.expect("\^running")
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Test that lldb-mi is ready after program exited
self.expect("\*stopped,reason=\"exited-normally\"")
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/breakpoint/TestMiBreak.py Tue Sep 6 15:57:50 2016
@@ -11,68 +11,79 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiBreakTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@expectedFlakeyLinux("llvm.org/pr24717")
def test_lldbmi_break_insert_function_pending(self):
"""Test that 'lldb-mi --interpreter' works for pending function breakpoints."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
self.runCmd("-break-insert -f printf")
- #FIXME function name is unknown on Darwin, fullname should be ??, line is -1
- #self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"printf\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
- self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"\?\?\",file=\"\?\?\",fullname=\"\?\?/\?\?\",line=\"0\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
- #FIXME function name is unknown on Darwin, fullname should be ??, line -1
- #self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"printf\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
- self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"\?\?\",file=\"\?\?\",fullname=\"\?\?/\?\?\",line=\"0\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
+ # FIXME function name is unknown on Darwin, fullname should be ??, line is -1
+ # self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"printf\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
+ self.expect(
+ "\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"\?\?\",file=\"\?\?\",fullname=\"\?\?/\?\?\",line=\"0\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
+ # FIXME function name is unknown on Darwin, fullname should be ??, line -1
+ # self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"printf\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"0xffffffffffffffff\",func=\"\?\?\",file=\"\?\?\",fullname=\"\?\?/\?\?\",line=\"0\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
self.runCmd("-exec-run")
self.expect("\^running")
- self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",pending=\[\"printf\"\],times=\"0\",original-location=\"printf\"}")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_break_insert_function(self):
"""Test that 'lldb-mi --interpreter' works for function breakpoints."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
self.runCmd("-break-insert -f main")
- self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
- self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
+ self.expect(
+ "\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
self.runCmd("-exec-run")
self.expect("\^running")
- self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",pending=\[\"main\"\],times=\"0\",original-location=\"main\"}")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Test that -break-insert can set non-pending BP
self.runCmd("-break-insert printf")
- #FIXME function name is unknown on Darwin
- #self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
- self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
- #FIXME function name is unknown on Darwin
- #self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
- self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
# FIXME function name is unknown on Darwin
- #self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
- self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
+ # self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
+ self.expect(
+ "\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
+ # FIXME function name is unknown on Darwin
+ # self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
+ # FIXME function name is unknown on Darwin
+ # self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"printf\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\",times=\"0\",original-location=\"printf\"}")
# Test that -break-insert fails if non-pending BP can't be resolved
self.runCmd("-break-insert unknown_func")
- self.expect("\^error,msg=\"Command 'break-insert'. Breakpoint location 'unknown_func' not found\"")
+ self.expect(
+ "\^error,msg=\"Command 'break-insert'. Breakpoint location 'unknown_func' not found\"")
# Test that non-pending BP was set correctly
self.runCmd("-exec-continue")
@@ -84,28 +95,28 @@ class MiBreakTestCase(lldbmi_testcase.Mi
self.expect("\^done,bkpt={number=\"4\"")
self.runCmd("-break-insert main.cpp:ns::foo1")
self.expect("\^done,bkpt={number=\"5\"")
- #FIXME: quotes on filenames aren't handled correctly in lldb-mi.
+ # FIXME: quotes on filenames aren't handled correctly in lldb-mi.
#self.runCmd("-break-insert \"main.cpp\":main")
- #self.expect("\^done,bkpt={number=\"6\"")
+ # self.expect("\^done,bkpt={number=\"6\"")
# We should hit BP #5 on 'main.cpp:ns::foo1'
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\".*bkptno=\"5\"")
- #FIXME: this test is disabled due to lldb bug llvm.org/pr24271.
+ # FIXME: this test is disabled due to lldb bug llvm.org/pr24271.
# Test that we can set a BP using the global namespace token
#self.runCmd("-break-insert ::main")
- #self.expect("\^done,bkpt={number=\"7\"")
+ # self.expect("\^done,bkpt={number=\"7\"")
#self.runCmd("-break-insert main.cpp:::main")
- #self.expect("\^done,bkpt={number=\"8\"")
+ # self.expect("\^done,bkpt={number=\"8\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_break_insert_file_line_pending(self):
"""Test that 'lldb-mi --interpreter' works for pending file:line breakpoints."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
@@ -114,19 +125,27 @@ class MiBreakTestCase(lldbmi_testcase.Mi
# pending BP
line = line_number('main.cpp', '// BP_return')
self.runCmd("-break-insert -f main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"%d\",pending=\[\"main.cpp:%d\"\],times=\"0\",original-location=\"main.cpp:%d\"}" % (line, line, line))
- self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"%d\",pending=\[\"main.cpp:%d\"\],times=\"0\",original-location=\"main.cpp:%d\"}" % (line, line, line))
+ self.expect(
+ "\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"%d\",pending=\[\"main.cpp:%d\"\],times=\"0\",original-location=\"main.cpp:%d\"}" %
+ (line,
+ line,
+ line))
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"%d\",pending=\[\"main.cpp:%d\"\],times=\"0\",original-location=\"main.cpp:%d\"}" %
+ (line,
+ line,
+ line))
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_break_insert_file_line(self):
"""Test that 'lldb-mi --interpreter' works for file:line breakpoints."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
@@ -141,24 +160,29 @@ class MiBreakTestCase(lldbmi_testcase.Mi
# Test that -break-insert can set non-pending BP
line = line_number('main.cpp', '// BP_return')
self.runCmd("-break-insert main.cpp:%d" % line)
- self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"%d\",times=\"0\",original-location=\"main.cpp:%d\"}" % (line, line))
- self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"%d\",times=\"0\",original-location=\"main.cpp:%d\"}" % (line, line))
+ self.expect(
+ "\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"%d\",times=\"0\",original-location=\"main.cpp:%d\"}" %
+ (line, line))
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"%d\",times=\"0\",original-location=\"main.cpp:%d\"}" %
+ (line, line))
# Test that -break-insert fails if non-pending BP can't be resolved
self.runCmd("-break-insert unknown_file:1")
- self.expect("\^error,msg=\"Command 'break-insert'. Breakpoint location 'unknown_file:1' not found\"")
+ self.expect(
+ "\^error,msg=\"Command 'break-insert'. Breakpoint location 'unknown_file:1' not found\"")
# Test that non-pending BP was set correctly
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_break_insert_file_line_absolute_path(self):
"""Test that 'lldb-mi --interpreter' works for file:line breakpoints."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
@@ -180,19 +204,21 @@ class MiBreakTestCase(lldbmi_testcase.Mi
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_break_insert_settings(self):
"""Test that 'lldb-mi --interpreter' can set breakpoints accoridng to global options."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- # Set target.move-to-nearest-code=off and try to set BP #1 that shouldn't be hit
- self.runCmd("-interpreter-exec console \"settings set target.move-to-nearest-code off\"")
+ # Set target.move-to-nearest-code=off and try to set BP #1 that
+ # shouldn't be hit
+ self.runCmd(
+ "-interpreter-exec console \"settings set target.move-to-nearest-code off\"")
self.expect("\^done")
line = line_number('main.cpp', '// BP_before_main')
self.runCmd("-break-insert -f main.cpp:%d" % line)
@@ -201,17 +227,23 @@ class MiBreakTestCase(lldbmi_testcase.Mi
# Test that non-pending BP will not be set on non-existing line if target.move-to-nearest-code=off
# Note: this increases the BP number by 1 even though BP #2 is invalid.
self.runCmd("-break-insert main.cpp:%d" % line)
- self.expect("\^error,msg=\"Command 'break-insert'. Breakpoint location 'main.cpp:%d' not found\"" % line)
-
- # Set target.move-to-nearest-code=on and target.skip-prologue=on and set BP #3
- self.runCmd("-interpreter-exec console \"settings set target.move-to-nearest-code on\"")
- self.runCmd("-interpreter-exec console \"settings set target.skip-prologue on\"")
+ self.expect(
+ "\^error,msg=\"Command 'break-insert'. Breakpoint location 'main.cpp:%d' not found\"" %
+ line)
+
+ # Set target.move-to-nearest-code=on and target.skip-prologue=on and
+ # set BP #3
+ self.runCmd(
+ "-interpreter-exec console \"settings set target.move-to-nearest-code on\"")
+ self.runCmd(
+ "-interpreter-exec console \"settings set target.skip-prologue on\"")
self.expect("\^done")
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"3\"")
# Set target.skip-prologue=off and set BP #4
- self.runCmd("-interpreter-exec console \"settings set target.skip-prologue off\"")
+ self.runCmd(
+ "-interpreter-exec console \"settings set target.skip-prologue off\"")
self.expect("\^done")
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"4\"")
@@ -219,74 +251,92 @@ class MiBreakTestCase(lldbmi_testcase.Mi
# Test that BP #4 is located before BP #3
self.runCmd("-exec-run")
self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"4\"")
+ self.expect(
+ "\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"4\"")
# Test that BP #3 is hit
self.runCmd("-exec-continue")
self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"3\"")
+ self.expect(
+ "\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"3\"")
- # Test that the target.language=pascal setting works and that BP #5 is NOT set
- self.runCmd("-interpreter-exec console \"settings set target.language c\"")
+ # Test that the target.language=pascal setting works and that BP #5 is
+ # NOT set
+ self.runCmd(
+ "-interpreter-exec console \"settings set target.language c\"")
self.expect("\^done")
self.runCmd("-break-insert ns.foo1")
self.expect("\^error")
# Test that the target.language=c++ setting works and that BP #6 is hit
- self.runCmd("-interpreter-exec console \"settings set target.language c++\"")
+ self.runCmd(
+ "-interpreter-exec console \"settings set target.language c++\"")
self.expect("\^done")
self.runCmd("-break-insert ns::foo1")
self.expect("\^done,bkpt={number=\"6\"")
self.runCmd("-exec-continue")
self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"6\"")
+ self.expect(
+ "\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"6\"")
# Test that BP #1 and #2 weren't set by running to program exit
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_break_enable_disable(self):
"""Test that 'lldb-mi --interpreter' works for enabling / disabling breakpoints."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
self.runCmd("-break-insert main")
- self.expect("\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\"")
- self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"main\"}")
+ self.expect(
+ "\^done,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\"")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"main\"}")
self.runCmd("-exec-run")
self.expect("\^running")
- self.expect("=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"main\"}")
- self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"1\"")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"1\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"main\"}")
+ self.expect(
+ "\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"1\"")
self.runCmd("-break-insert ns::foo1")
- self.expect("\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo1\(\)\"")
- self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo1\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo1\"}")
+ self.expect(
+ "\^done,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo1\(\)\"")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo1\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo1\"}")
self.runCmd("-break-insert ns::foo2")
- self.expect("\^done,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo2\(\)\"")
- self.expect("=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}")
+ self.expect(
+ "\^done,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo2\(\)\"")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}")
# disable the 2nd breakpoint
self.runCmd("-break-disable 2")
self.expect("\^done")
- self.expect("=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo1\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo1\"}")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"2\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo1\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo1\"}")
# disable the 3rd breakpoint and re-enable
self.runCmd("-break-disable 3")
self.expect("\^done")
- self.expect("=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"n\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}")
self.runCmd("-break-enable 3")
self.expect("\^done")
- self.expect("=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}")
+ self.expect(
+ "=breakpoint-modified,bkpt={number=\"3\",type=\"breakpoint\",disp=\"keep\",enabled=\"y\",addr=\"(?!0xffffffffffffffff)0x[0-9a-f]+\",func=\"ns::foo2\(\)\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\",times=\"0\",original-location=\"ns::foo2\"}")
self.runCmd("-exec-continue")
self.expect("\^running")
- self.expect("\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"3\"")
+ self.expect(
+ "\*stopped,reason=\"breakpoint-hit\",disp=\"del\",bkptno=\"3\"")
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/control/TestMiExec.py Tue Sep 6 15:57:50 2016
@@ -5,23 +5,25 @@ Test lldb-mi -exec-xxx commands.
from __future__ import print_function
-
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiExecTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureAll(oslist=["linux"], bugnumber="llvm.org/pr25000: lldb-mi does not receive broadcasted notification from Core/Process about process stopped")
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="llvm.org/pr25000: lldb-mi does not receive broadcasted notification from Core/Process about process stopped")
def test_lldbmi_exec_run(self):
"""Test that 'lldb-mi --interpreter' can stop at entry."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -30,20 +32,22 @@ class MiExecTestCase(lldbmi_testcase.MiT
# Test that program is stopped at entry
self.runCmd("-exec-run --start")
self.expect("\^running")
- self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.*?thread-id=\"1\",stopped-threads=\"all\"")
+ self.expect(
+ "\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.*?thread-id=\"1\",stopped-threads=\"all\"")
# Test that lldb-mi is ready to execute next commands
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_abort(self):
"""Test that 'lldb-mi --interpreter' works for -exec-abort."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that -exec-abort fails on invalid process
self.runCmd("-exec-abort")
- self.expect("\^error,msg=\"Command 'exec-abort'\. Invalid process during debug session\"")
+ self.expect(
+ "\^error,msg=\"Command 'exec-abort'\. Invalid process during debug session\"")
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -83,19 +87,20 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.expect("\^done")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_arguments_set(self):
"""Test that 'lldb-mi --interpreter' can pass args using -exec-arguments."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Set arguments
- self.runCmd("-exec-arguments --arg1 \"2nd arg\" third_arg fourth=\"4th arg\"")
+ self.runCmd(
+ "-exec-arguments --arg1 \"2nd arg\" third_arg fourth=\"4th arg\"")
self.expect("\^done")
# Run to main
@@ -109,7 +114,7 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.runCmd("-data-evaluate-expression argc")
self.expect("\^done,value=\"5\"")
#self.runCmd("-data-evaluate-expression argv[1]")
- #self.expect("\^done,value=\"--arg1\"")
+ # self.expect("\^done,value=\"--arg1\"")
self.runCmd("-interpreter-exec command \"print argv[1]\"")
self.expect("\"--arg1\"")
#self.runCmd("-data-evaluate-expression argv[2]")
@@ -117,7 +122,7 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.runCmd("-interpreter-exec command \"print argv[2]\"")
self.expect("\"2nd arg\"")
#self.runCmd("-data-evaluate-expression argv[3]")
- #self.expect("\^done,value=\"third_arg\"")
+ # self.expect("\^done,value=\"third_arg\"")
self.runCmd("-interpreter-exec command \"print argv[3]\"")
self.expect("\"third_arg\"")
#self.runCmd("-data-evaluate-expression argv[4]")
@@ -125,12 +130,12 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.runCmd("-interpreter-exec command \"print argv[4]\"")
self.expect("\"fourth=\\\\\\\"4th arg\\\\\\\"\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_arguments_reset(self):
"""Test that 'lldb-mi --interpreter' can reset previously set args using -exec-arguments."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -153,12 +158,12 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.runCmd("-data-evaluate-expression argc")
self.expect("\^done,value=\"1\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_next(self):
"""Test that 'lldb-mi --interpreter' works for stepping."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -176,22 +181,26 @@ class MiExecTestCase(lldbmi_testcase.MiT
# Test -exec-next
self.runCmd("-exec-next --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\"")
# Test that --thread is optional
self.runCmd("-exec-next --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
# Test that --frame is optional
self.runCmd("-exec-next --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"31\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"31\"")
# Test that both --thread and --frame are optional
self.runCmd("-exec-next")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"32\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"32\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-next --thread 0")
@@ -204,13 +213,15 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.runCmd("-exec-next --frame 10")
#self.expect("\^error: Frame index 10 is out of range")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureAll(archs=["i[3-6]86"], bugnumber="xfail to get buildbot green, failing config: i386 binary running on ubuntu 14.04 x86_64")
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ archs=["i[3-6]86"],
+ bugnumber="xfail to get buildbot green, failing config: i386 binary running on ubuntu 14.04 x86_64")
def test_lldbmi_exec_next_instruction(self):
"""Test that 'lldb-mi --interpreter' works for instruction stepping."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -229,25 +240,29 @@ class MiExecTestCase(lldbmi_testcase.MiT
# Test -exec-next-instruction
self.runCmd("-exec-next-instruction --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"28\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"28\"")
# Test that --thread is optional
self.runCmd("-exec-next-instruction --frame 0")
self.expect("\^running")
# Depending on compiler, it can stop at different line
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(28|29)\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(28|29)\"")
# Test that --frame is optional
self.runCmd("-exec-next-instruction --thread 1")
self.expect("\^running")
# Depending on compiler, it can stop at different line
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(29|30)\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(29|30)\"")
# Test that both --thread and --frame are optional
self.runCmd("-exec-next-instruction")
self.expect("\^running")
# Depending on compiler, it can stop at different line
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(29|30|31)\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"(29|30|31)\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-next-instruction --thread 0")
@@ -260,12 +275,12 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.runCmd("-exec-next-instruction --frame 10")
#self.expect("\^error: Frame index 10 is out of range")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_step(self):
"""Test that 'lldb-mi --interpreter' works for stepping into."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -283,39 +298,45 @@ class MiExecTestCase(lldbmi_testcase.MiT
# Test that -exec-step steps into (or not) printf depending on debug info
# Note that message is different in Darwin and Linux:
# Darwin: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"main\",args=[{name=\"argc\",value=\"1\"},{name=\"argv\",value="0x[0-9a-f]+\"}],file=\"main.cpp\",fullname=\".+main.cpp\",line=\"\d\"},thread-id=\"1\",stopped-threads=\"all\"
- # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
+ # Linux:
+ # "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
self.runCmd("-exec-step --thread 1 --frame 0")
self.expect("\^running")
- it = self.expect([ "\*stopped,reason=\"end-stepping-range\".+?func=\"main\"",
- "\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\"" ])
+ it = self.expect(["\*stopped,reason=\"end-stepping-range\".+?func=\"main\"",
+ "\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\""])
# Exit from printf if needed
if it == 1:
self.runCmd("-exec-finish")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
# Test that -exec-step steps into g_MyFunction and back out
# (and that --thread is optional)
self.runCmd("-exec-step --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
# Use -exec-finish here to make sure that control reaches the caller.
# -exec-step can keep us in the g_MyFunction for gcc
self.runCmd("-exec-finish --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"30\"")
# Test that -exec-step steps into s_MyFunction
# (and that --frame is optional)
self.runCmd("-exec-step --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\".*?s_MyFunction.*?\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?func=\".*?s_MyFunction.*?\"")
# Test that -exec-step steps into g_MyFunction from inside
# s_MyFunction (and that both --thread and --frame are optional)
self.runCmd("-exec-step")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-step --thread 0")
@@ -328,12 +349,12 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.runCmd("-exec-step --frame 10")
#self.expect("\^error: Frame index 10 is out of range")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_step_instruction(self):
"""Test that 'lldb-mi --interpreter' works for instruction stepping into."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -352,7 +373,8 @@ class MiExecTestCase(lldbmi_testcase.MiT
# Test that -exec-next steps over printf
self.runCmd("-exec-next --thread 1 --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?main\.cpp\",line=\"29\"")
# Test that -exec-step-instruction steps over non branching
# instruction
@@ -364,19 +386,22 @@ class MiExecTestCase(lldbmi_testcase.MiT
# instruction (and that --thread is optional)
self.runCmd("-exec-step-instruction --frame 0")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
# Test that -exec-step-instruction steps over non branching
# (and that --frame is optional)
self.runCmd("-exec-step-instruction --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
# Test that -exec-step-instruction steps into g_MyFunction
# (and that both --thread and --frame are optional)
self.runCmd("-exec-step-instruction")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?func=\"g_MyFunction.*?\"")
# Test that an invalid --thread is handled
self.runCmd("-exec-step-instruction --thread 0")
@@ -389,12 +414,12 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.runCmd("-exec-step-instruction --frame 10")
#self.expect("\^error: Frame index 10 is out of range")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_exec_finish(self):
"""Test that 'lldb-mi --interpreter' works for -exec-finish."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -429,7 +454,8 @@ class MiExecTestCase(lldbmi_testcase.MiT
# s_MyFunction (and that --frame is optional)
self.runCmd("-exec-finish --thread 1")
self.expect("\^running")
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\".*?s_MyFunction.*?\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?func=\".*?s_MyFunction.*?\"")
# Test that -exec-finish returns from s_MyFunction
# (and that both --thread and --frame are optional)
@@ -455,7 +481,7 @@ class MiExecTestCase(lldbmi_testcase.MiT
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- ## Test that -exec-finish returns from printf
+ # Test that -exec-finish returns from printf
self.runCmd("-exec-finish --thread 1 --frame 0")
self.expect("\^running")
self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/data/TestMiData.py Tue Sep 6 15:57:50 2016
@@ -5,23 +5,23 @@ Test lldb-mi -data-xxx commands.
from __future__ import print_function
-
import unittest2
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiDataTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_disassemble(self):
"""Test that 'lldb-mi --interpreter' works for -data-disassemble."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -36,16 +36,23 @@ class MiDataTestCase(lldbmi_testcase.MiT
# Get an address for disassembling: use main
self.runCmd("-data-evaluate-expression main")
- self.expect("\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"")
+ self.expect(
+ "\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"")
addr = int(self.child.after.split("\"")[1].split(" ")[0], 16)
# Test -data-disassemble: try to disassemble some address
- self.runCmd("-data-disassemble -s %#x -e %#x -- 0" % (addr, addr + 0x10))
- self.expect("\^done,asm_insns=\[{address=\"0x0*%x\",func-name=\"main\",offset=\"0\",size=\"[1-9]+\",inst=\".+?\"}," % addr)
-
+ self.runCmd(
+ "-data-disassemble -s %#x -e %#x -- 0" %
+ (addr, addr + 0x10))
+ self.expect(
+ "\^done,asm_insns=\[{address=\"0x0*%x\",func-name=\"main\",offset=\"0\",size=\"[1-9]+\",inst=\".+?\"}," %
+ addr)
+
# Test -data-disassemble without "--"
self.runCmd("-data-disassemble -s %#x -e %#x 0" % (addr, addr + 0x10))
- self.expect("\^done,asm_insns=\[{address=\"0x0*%x\",func-name=\"main\",offset=\"0\",size=\"[1-9]+\",inst=\".+?\"}," % addr)
+ self.expect(
+ "\^done,asm_insns=\[{address=\"0x0*%x\",func-name=\"main\",offset=\"0\",size=\"[1-9]+\",inst=\".+?\"}," %
+ addr)
# Run to hello_world
self.runCmd("-break-insert -f hello_world")
@@ -56,27 +63,31 @@ class MiDataTestCase(lldbmi_testcase.MiT
# Get an address for disassembling: use hello_world
self.runCmd("-data-evaluate-expression hello_world")
- self.expect("\^done,value=\"0x[0-9a-f]+ \(a.out`hello_world\(\) at main.cpp:[0-9]+\)\"")
+ self.expect(
+ "\^done,value=\"0x[0-9a-f]+ \(a.out`hello_world\(\) at main.cpp:[0-9]+\)\"")
addr = int(self.child.after.split("\"")[1].split(" ")[0], 16)
# Test -data-disassemble: try to disassemble some address
- self.runCmd("-data-disassemble -s %#x -e %#x -- 0" % (addr, addr + 0x10))
+ self.runCmd(
+ "-data-disassemble -s %#x -e %#x -- 0" %
+ (addr, addr + 0x10))
# This matches a line similar to:
# Darwin: {address="0x0000000100000f18",func-name="hello_world()",offset="8",size="7",inst="leaq 0x65(%rip), %rdi; \"Hello, World!\\n\""},
# Linux: {address="0x0000000000400642",func-name="hello_world()",offset="18",size="5",inst="callq 0x4004d0; symbol stub for: printf"}
# To match the escaped characters in the ouptut, we must use four backslashes per matches backslash
# See https://docs.python.org/2/howto/regex.html#the-backslash-plague
- self.expect([ "{address=\"0x[0-9a-f]+\",func-name=\"hello_world\(\)\",offset=\"[0-9]+\",size=\"[0-9]+\",inst=\".+?; \\\\\"Hello, World!\\\\\\\\n\\\\\"\"}",
- "{address=\"0x[0-9a-f]+\",func-name=\"hello_world\(\)\",offset=\"[0-9]+\",size=\"[0-9]+\",inst=\".+?; symbol stub for: printf\"}" ])
+ self.expect(["{address=\"0x[0-9a-f]+\",func-name=\"hello_world\(\)\",offset=\"[0-9]+\",size=\"[0-9]+\",inst=\".+?; \\\\\"Hello, World!\\\\\\\\n\\\\\"\"}",
+ "{address=\"0x[0-9a-f]+\",func-name=\"hello_world\(\)\",offset=\"[0-9]+\",size=\"[0-9]+\",inst=\".+?; symbol stub for: printf\"}"])
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @unittest2.skip("-data-evaluate-expression doesn't work on globals") #FIXME: the global case worked before refactoring
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ # FIXME: the global case worked before refactoring
+ @unittest2.skip("-data-evaluate-expression doesn't work on globals")
def test_lldbmi_data_read_memory_bytes_global(self):
"""Test that -data-read-memory-bytes can access global buffers."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -97,7 +108,9 @@ class MiDataTestCase(lldbmi_testcase.MiT
# Test that -data-read-memory-bytes works for char[] type (global)
self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
- self.expect("\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" % (addr, addr + size))
+ self.expect(
+ "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" %
+ (addr, addr + size))
# Get address of static char[]
self.runCmd("-data-evaluate-expression &s_CharArray")
@@ -107,14 +120,16 @@ class MiDataTestCase(lldbmi_testcase.MiT
# Test that -data-read-memory-bytes works for static char[] type
self.runCmd("-data-read-memory-bytes %#x %d" % (addr, size))
- self.expect("\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" % (addr, addr + size))
+ self.expect(
+ "\^done,memory=\[{begin=\"0x0*%x\",offset=\"0x0+\",end=\"0x0*%x\",contents=\"1112131400\"}\]" %
+ (addr, addr + size))
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_read_memory_bytes_local(self):
"""Test that -data-read-memory-bytes can access local buffers."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd('-file-exec-and-symbols %s' % self.myexe)
@@ -136,44 +151,65 @@ class MiDataTestCase(lldbmi_testcase.MiT
# Test that an unquoted hex literal address works
self.runCmd('-data-read-memory-bytes %#x %d' % (addr, size))
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
+ self.expect(
+ r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' %
+ (addr, addr + size))
# Test that a double-quoted hex literal address works
self.runCmd('-data-read-memory-bytes "%#x" %d' % (addr, size))
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
+ self.expect(
+ r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' %
+ (addr, addr + size))
# Test that unquoted expressions work
self.runCmd('-data-read-memory-bytes &array %d' % size)
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
+ self.expect(
+ r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' %
+ (addr, addr + size))
- # This doesn't work, and perhaps that makes sense, but it does work on GDB
+ # This doesn't work, and perhaps that makes sense, but it does work on
+ # GDB
self.runCmd('-data-read-memory-bytes array 4')
self.expect(r'\^error')
#self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
self.runCmd('-data-read-memory-bytes &array[2] 2')
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="0304"\}\]' % (addr + 2, addr + size))
+ self.expect(
+ r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="0304"\}\]' %
+ (addr + 2, addr + size))
self.runCmd('-data-read-memory-bytes first_element_ptr %d' % size)
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
+ self.expect(
+ r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' %
+ (addr, addr + size))
# Test that double-quoted expressions work
self.runCmd('-data-read-memory-bytes "&array" %d' % size)
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
+ self.expect(
+ r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' %
+ (addr, addr + size))
self.runCmd('-data-read-memory-bytes "&array[0] + 1" 3')
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="020304"\}\]' % (addr + 1, addr + size))
+ self.expect(
+ r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="020304"\}\]' %
+ (addr + 1, addr + size))
self.runCmd('-data-read-memory-bytes "first_element_ptr + 1" 3')
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="020304"\}\]' % (addr + 1, addr + size))
+ self.expect(
+ r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="020304"\}\]' %
+ (addr + 1, addr + size))
# Test the -o (offset) option
self.runCmd('-data-read-memory-bytes -o 1 &array 3')
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="020304"\}\]' % (addr + 1, addr + size))
+ self.expect(
+ r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="020304"\}\]' %
+ (addr + 1, addr + size))
# Test the --thread option
self.runCmd('-data-read-memory-bytes --thread 1 &array 4')
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
+ self.expect(
+ r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' %
+ (addr, addr + size))
# Test the --thread option with an invalid value
self.runCmd('-data-read-memory-bytes --thread 999 &array 4')
@@ -181,22 +217,29 @@ class MiDataTestCase(lldbmi_testcase.MiT
# Test the --frame option (current frame)
self.runCmd('-data-read-memory-bytes --frame 0 &array 4')
- self.expect(r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' % (addr, addr + size))
+ self.expect(
+ r'\^done,memory=\[\{begin="0x0*%x",offset="0x0+",end="0x0*%x",contents="01020304"\}\]' %
+ (addr, addr + size))
# Test the --frame option (outer frame)
self.runCmd('-data-read-memory-bytes --frame 1 &array 4')
- self.expect(r'\^done,memory=\[\{begin="0x[0-9a-f]+",offset="0x0+",end="0x[0-9a-f]+",contents="05060708"\}\]')
+ self.expect(
+ r'\^done,memory=\[\{begin="0x[0-9a-f]+",offset="0x0+",end="0x[0-9a-f]+",contents="05060708"\}\]')
# Test the --frame option with an invalid value
self.runCmd('-data-read-memory-bytes --frame 999 &array 4')
self.expect(r'\^error')
# Test all the options at once
- self.runCmd('-data-read-memory-bytes --thread 1 --frame 1 -o 2 &array 2')
- self.expect(r'\^done,memory=\[\{begin="0x[0-9a-f]+",offset="0x0+",end="0x[0-9a-f]+",contents="0708"\}\]')
-
- # Test that an expression that references undeclared variables doesn't work
- self.runCmd('-data-read-memory-bytes "&undeclared_array1 + undeclared_array2[1]" 2')
+ self.runCmd(
+ '-data-read-memory-bytes --thread 1 --frame 1 -o 2 &array 2')
+ self.expect(
+ r'\^done,memory=\[\{begin="0x[0-9a-f]+",offset="0x0+",end="0x[0-9a-f]+",contents="0708"\}\]')
+
+ # Test that an expression that references undeclared variables doesn't
+ # work
+ self.runCmd(
+ '-data-read-memory-bytes "&undeclared_array1 + undeclared_array2[1]" 2')
self.expect(r'\^error')
# Test that the address argument is required
@@ -207,23 +250,25 @@ class MiDataTestCase(lldbmi_testcase.MiT
self.runCmd('-data-read-memory-bytes &array')
self.expect(r'\^error')
- # Test that the address and count arguments are required when other options are present
+ # Test that the address and count arguments are required when other
+ # options are present
self.runCmd('-data-read-memory-bytes --thread 1')
self.expect(r'\^error')
self.runCmd('-data-read-memory-bytes --thread 1 --frame 0')
self.expect(r'\^error')
- # Test that the count argument is required when other options are present
+ # Test that the count argument is required when other options are
+ # present
self.runCmd('-data-read-memory-bytes --thread 1 &array')
self.expect(r'\^error')
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_list_register_names(self):
"""Test that 'lldb-mi --interpreter' works for -data-list-register-names."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -244,12 +289,12 @@ class MiDataTestCase(lldbmi_testcase.MiT
self.runCmd("-data-list-register-names 0")
self.expect("\^done,register-names=\[\".+?\"\]")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_list_register_values(self):
"""Test that 'lldb-mi --interpreter' works for -data-list-register-values."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -264,18 +309,20 @@ class MiDataTestCase(lldbmi_testcase.MiT
# Test -data-list-register-values: try to get all registers
self.runCmd("-data-list-register-values x")
- self.expect("\^done,register-values=\[{number=\"0\",value=\"0x[0-9a-f]+\"")
+ self.expect(
+ "\^done,register-values=\[{number=\"0\",value=\"0x[0-9a-f]+\"")
# Test -data-list-register-values: try to get specified registers
self.runCmd("-data-list-register-values x 0")
- self.expect("\^done,register-values=\[{number=\"0\",value=\"0x[0-9a-f]+\"}\]")
+ self.expect(
+ "\^done,register-values=\[{number=\"0\",value=\"0x[0-9a-f]+\"}\]")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_info_line(self):
"""Test that 'lldb-mi --interpreter' works for -data-info-line."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -290,38 +337,46 @@ class MiDataTestCase(lldbmi_testcase.MiT
# Get the address of main and its line
self.runCmd("-data-evaluate-expression main")
- self.expect("\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"")
+ self.expect(
+ "\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"")
addr = int(self.child.after.split("\"")[1].split(" ")[0], 16)
line = line_number('main.cpp', '// FUNC_main')
# Test that -data-info-line works for address
self.runCmd("-data-info-line *%#x" % addr)
- self.expect("\^done,start=\"0x0*%x\",end=\"0x[0-9a-f]+\",file=\".+?main.cpp\",line=\"%d\"" % (addr, line))
+ self.expect(
+ "\^done,start=\"0x0*%x\",end=\"0x[0-9a-f]+\",file=\".+?main.cpp\",line=\"%d\"" %
+ (addr, line))
# Test that -data-info-line works for file:line
self.runCmd("-data-info-line main.cpp:%d" % line)
- self.expect("\^done,start=\"0x0*%x\",end=\"0x[0-9a-f]+\",file=\".+?main.cpp\",line=\"%d\"" % (addr, line))
+ self.expect(
+ "\^done,start=\"0x0*%x\",end=\"0x[0-9a-f]+\",file=\".+?main.cpp\",line=\"%d\"" %
+ (addr, line))
# Test that -data-info-line fails when invalid address is specified
self.runCmd("-data-info-line *0x0")
- self.expect("\^error,msg=\"Command 'data-info-line'\. Error: The LineEntry is absent or has an unknown format\.\"")
+ self.expect(
+ "\^error,msg=\"Command 'data-info-line'\. Error: The LineEntry is absent or has an unknown format\.\"")
# Test that -data-info-line fails when file is unknown
self.runCmd("-data-info-line unknown_file:1")
- self.expect("\^error,msg=\"Command 'data-info-line'\. Error: The LineEntry is absent or has an unknown format\.\"")
+ self.expect(
+ "\^error,msg=\"Command 'data-info-line'\. Error: The LineEntry is absent or has an unknown format\.\"")
# Test that -data-info-line fails when line has invalid format
self.runCmd("-data-info-line main.cpp:bad_line")
- self.expect("\^error,msg=\"error: invalid line number string 'bad_line'")
+ self.expect(
+ "\^error,msg=\"error: invalid line number string 'bad_line'")
self.runCmd("-data-info-line main.cpp:0")
self.expect("\^error,msg=\"error: zero is an invalid line number")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_data_evaluate_expression(self):
"""Test that 'lldb-mi --interpreter' works for -data-evaluate-expression."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -334,6 +389,7 @@ class MiDataTestCase(lldbmi_testcase.MiT
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Check 2d array
+ # Check 2d array
self.runCmd("-data-evaluate-expression array2d")
- self.expect("\^done,value=\"\{\[0\] = \{\[0\] = 1, \[1\] = 2, \[2\] = 3\}, \[1\] = \{\[0\] = 4, \[1\] = 5, \[2\] = 6\}\}\"")
+ self.expect(
+ "\^done,value=\"\{\[0\] = \{\[0\] = 1, \[1\] = 2, \[2\] = 3\}, \[1\] = \{\[0\] = 4, \[1\] = 5, \[2\] = 6\}\}\"")
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiCliSupport.py Tue Sep 6 15:57:50 2016
@@ -5,22 +5,22 @@ Test lldb-mi can interpret CLI commands
from __future__ import print_function
-
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiCliSupportTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_target_create(self):
"""Test that 'lldb-mi --interpreter' can create target by 'target create' command."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that "target create" loads executable
self.runCmd("target create \"%s\"" % self.myexe)
@@ -33,13 +33,13 @@ class MiCliSupportTestCase(lldbmi_testca
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_breakpoint_set(self):
"""Test that 'lldb-mi --interpreter' can set breakpoint by 'breakpoint set' command."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -56,17 +56,18 @@ class MiCliSupportTestCase(lldbmi_testca
self.expect("=breakpoint-modified,bkpt={number=\"1\"")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_settings_set_target_run_args_before(self):
"""Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command before than target was created."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that "settings set target.run-args" passes arguments to executable
- #FIXME: --arg1 causes an error
- self.runCmd("setting set target.run-args arg1 \"2nd arg\" third_arg fourth=\"4th arg\"")
+ # FIXME: --arg1 causes an error
+ self.runCmd(
+ "setting set target.run-args arg1 \"2nd arg\" third_arg fourth=\"4th arg\"")
self.expect("\^done")
# Load executable
@@ -80,21 +81,22 @@ class MiCliSupportTestCase(lldbmi_testca
# Test that arguments were passed properly
self.expect("@\"argc=5\\\\r\\\\n\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_settings_set_target_run_args_after(self):
"""Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command after than target was created."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Test that "settings set target.run-args" passes arguments to executable
- #FIXME: --arg1 causes an error
- self.runCmd("setting set target.run-args arg1 \"2nd arg\" third_arg fourth=\"4th arg\"")
+ # FIXME: --arg1 causes an error
+ self.runCmd(
+ "setting set target.run-args arg1 \"2nd arg\" third_arg fourth=\"4th arg\"")
self.expect("\^done")
# Run
@@ -104,13 +106,13 @@ class MiCliSupportTestCase(lldbmi_testca
# Test that arguments were passed properly
self.expect("@\"argc=5\\\\r\\\\n\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_process_launch(self):
"""Test that 'lldb-mi --interpreter' can launch process by "process launch" command."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -127,13 +129,13 @@ class MiCliSupportTestCase(lldbmi_testca
# Test that breakpoint hit
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_thread_step_in(self):
"""Test that 'lldb-mi --interpreter' can step in by "thread step-in" command."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -149,21 +151,23 @@ class MiCliSupportTestCase(lldbmi_testca
# Test that "thread step-in" steps into (or not) printf depending on debug info
# Note that message is different in Darwin and Linux:
# Darwin: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"main\",args=[{name=\"argc\",value=\"1\"},{name=\"argv\",value="0x[0-9a-f]+\"}],file=\"main.cpp\",fullname=\".+main.cpp\",line=\"\d\"},thread-id=\"1\",stopped-threads=\"all\"
- # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
+ # Linux:
+ # "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
self.runCmd("thread step-in")
self.expect("\^done")
- it = self.expect([ "@\"argc=1\\\\r\\\\n\"",
- "\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\"" ])
+ it = self.expect(["@\"argc=1\\\\r\\\\n\"",
+ "\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\""])
if it == 0:
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_thread_step_over(self):
"""Test that 'lldb-mi --interpreter' can step over by "thread step-over" command."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -182,13 +186,13 @@ class MiCliSupportTestCase(lldbmi_testca
self.expect("@\"argc=1\\\\r\\\\n\"")
self.expect("\*stopped,reason=\"end-stepping-range\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_thread_continue(self):
"""Test that 'lldb-mi --interpreter' can continue execution by "thread continue" command."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/interpreter/TestMiInterpreterExec.py Tue Sep 6 15:57:50 2016
@@ -5,25 +5,27 @@ Test lldb-mi -interpreter-exec command.
from __future__ import print_function
-
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiInterpreterExecTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_target_create(self):
"""Test that 'lldb-mi --interpreter' can create target by 'target create' command."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that "target create" loads executable
- self.runCmd("-interpreter-exec console \"target create \\\"%s\\\"\"" % self.myexe)
+ self.runCmd(
+ "-interpreter-exec console \"target create \\\"%s\\\"\"" %
+ self.myexe)
self.expect("\^done")
# Test that executable was loaded properly
@@ -33,12 +35,12 @@ class MiInterpreterExecTestCase(lldbmi_t
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_breakpoint_set(self):
"""Test that 'lldb-mi --interpreter' can set breakpoint by 'breakpoint set' command."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -55,17 +57,18 @@ class MiInterpreterExecTestCase(lldbmi_t
self.expect("=breakpoint-modified,bkpt={number=\"1\"")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@expectedFlakeyLinux(bugnumber="llvm.org/pr25470")
def test_lldbmi_settings_set_target_run_args_before(self):
"""Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command before than target was created."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that "settings set target.run-args" passes arguments to executable
- #FIXME: --arg1 causes an error
- self.runCmd("-interpreter-exec console \"setting set target.run-args arg1 \\\"2nd arg\\\" third_arg fourth=\\\"4th arg\\\"\"")
+ # FIXME: --arg1 causes an error
+ self.runCmd(
+ "-interpreter-exec console \"setting set target.run-args arg1 \\\"2nd arg\\\" third_arg fourth=\\\"4th arg\\\"\"")
self.expect("\^done")
# Load executable
@@ -87,21 +90,24 @@ class MiInterpreterExecTestCase(lldbmi_t
# Test that program exited normally
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureAll(oslist=["linux"], bugnumber="Failing in ~9/600 dosep runs (build 3120-3122)")
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="Failing in ~9/600 dosep runs (build 3120-3122)")
def test_lldbmi_settings_set_target_run_args_after(self):
"""Test that 'lldb-mi --interpreter' can set target arguments by 'setting set target.run-args' command after than target was created."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Test that "settings set target.run-args" passes arguments to executable
- #FIXME: --arg1 causes an error
- self.runCmd("-interpreter-exec console \"setting set target.run-args arg1 \\\"2nd arg\\\" third_arg fourth=\\\"4th arg\\\"\"")
+ # FIXME: --arg1 causes an error
+ self.runCmd(
+ "-interpreter-exec console \"setting set target.run-args arg1 \\\"2nd arg\\\" third_arg fourth=\\\"4th arg\\\"\"")
self.expect("\^done")
# Run to BP_printf
@@ -109,7 +115,7 @@ class MiInterpreterExecTestCase(lldbmi_t
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
- self.expect("\^running");
+ self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Run to BP_return
@@ -117,7 +123,7 @@ class MiInterpreterExecTestCase(lldbmi_t
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"2\"")
self.runCmd("-exec-continue")
- self.expect("\^running");
+ self.expect("\^running")
# Test that arguments were passed properly
self.expect("@\"argc=5\\\\r\\\\n\"")
@@ -130,12 +136,12 @@ class MiInterpreterExecTestCase(lldbmi_t
# Hit BP_return
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_process_launch(self):
"""Test that 'lldb-mi --interpreter' can launch process by "process launch" command."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -152,12 +158,12 @@ class MiInterpreterExecTestCase(lldbmi_t
# Test that breakpoint hit
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_thread_step_in(self):
"""Test that 'lldb-mi --interpreter' can step in by "thread step-in" command."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -173,20 +179,22 @@ class MiInterpreterExecTestCase(lldbmi_t
# Test that "thread step-in" steps into (or not) printf depending on debug info
# Note that message is different in Darwin and Linux:
# Darwin: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"main\",args=[{name=\"argc\",value=\"1\"},{name=\"argv\",value="0x[0-9a-f]+\"}],file=\"main.cpp\",fullname=\".+main.cpp\",line=\"\d\"},thread-id=\"1\",stopped-threads=\"all\"
- # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
+ # Linux:
+ # "*stopped,reason=\"end-stepping-range\",frame={addr="0x[0-9a-f]+\",func=\"__printf\",args=[{name=\"format\",value=\"0x[0-9a-f]+\"}],file=\"printf.c\",fullname=\".+printf.c\",line="\d+"},thread-id=\"1\",stopped-threads=\"all\"
self.runCmd("-interpreter-exec console \"thread step-in\"")
self.expect("\^done")
- it = self.expect([ "@\"argc=1\\\\r\\\\n\"",
- "\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\"" ])
+ it = self.expect(["@\"argc=1\\\\r\\\\n\"",
+ "\*stopped,reason=\"end-stepping-range\".+?func=\"(?!main).+?\""])
if it == 0:
- self.expect("\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
+ self.expect(
+ "\*stopped,reason=\"end-stepping-range\".+?func=\"main\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_thread_step_over(self):
"""Test that 'lldb-mi --interpreter' can step over by "thread step-over" command."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -205,13 +213,13 @@ class MiInterpreterExecTestCase(lldbmi_t
self.expect("@\"argc=1\\\\r\\\\n\"")
self.expect("\*stopped,reason=\"end-stepping-range\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@expectedFlakeyLinux("llvm.org/pr25470")
def test_lldbmi_thread_continue(self):
"""Test that 'lldb-mi --interpreter' can continue execution by "thread continue" command."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/lldbmi_testcase.py Tue Sep 6 15:57:50 2016
@@ -5,9 +5,9 @@ Base class for lldb-mi test cases.
from __future__ import print_function
-
from lldbsuite.test.lldbtest import *
+
class MiTestCaseBase(Base):
mydir = None
@@ -43,7 +43,7 @@ class MiTestCaseBase(Base):
self.child.setecho(True)
self.child.logfile_read = open(self.mylog, "w")
# wait until lldb-mi has started up and is ready to go
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
def runCmd(self, cmd):
self.child.sendline(cmd)
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/signal/TestMiSignal.py Tue Sep 6 15:57:50 2016
@@ -5,22 +5,22 @@ Test that the lldb-mi handles signals pr
from __future__ import print_function
-
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiSignalTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions
def test_lldbmi_stopped_when_interrupt(self):
"""Test that 'lldb-mi --interpreter' interrupt and resume a looping app."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -41,23 +41,25 @@ class MiSignalTestCase(lldbmi_testcase.M
# Test that -exec-interrupt can interrupt an execution
self.runCmd("-exec-interrupt")
- self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",.+?thread-id=\"1\",stopped-threads=\"all\"")
+ self.expect(
+ "\*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",.+?thread-id=\"1\",stopped-threads=\"all\"")
# Continue (to loop forever)
self.runCmd("-exec-continue")
self.expect("\^running")
# Test that Ctrl+C can interrupt an execution
- self.child.sendintr() #FIXME: here uses self.child directly
- self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",.*thread-id=\"1\",stopped-threads=\"all\"")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ self.child.sendintr() # FIXME: here uses self.child directly
+ self.expect(
+ "\*stopped,reason=\"signal-received\",signal-name=\"SIGINT\",signal-meaning=\"Interrupt\",.*thread-id=\"1\",stopped-threads=\"all\"")
+
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Fails on FreeBSD apparently due to thread race conditions
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_stopped_when_stopatentry_local(self):
"""Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (local)."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -70,9 +72,12 @@ class MiSignalTestCase(lldbmi_testcase.M
# Test that *stopped is printed
# Note that message is different in Darwin and Linux:
# Darwin: "*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",frame={level=\"0\",addr=\"0x[0-9a-f]+\",func=\"_dyld_start\",file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
- # Linux: "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"??\",args=[],file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
- self.expect([ "\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"_dyld_start\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\},thread-id=\"1\",stopped-threads=\"all\"",
- "\*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"\?\?\",args=\[\],file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"" ])
+ # Linux:
+ # "*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"??\",args=[],file=\"??\",fullname=\"??\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\"
+ self.expect(
+ [
+ "\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"_dyld_start\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\},thread-id=\"1\",stopped-threads=\"all\"",
+ "\*stopped,reason=\"end-stepping-range\",frame={addr=\"0x[0-9a-f]+\",func=\"\?\?\",args=\[\],file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"},thread-id=\"1\",stopped-threads=\"all\""])
# Run to main to make sure we have not exited the application
self.runCmd("-break-insert -f main")
@@ -81,7 +86,7 @@ class MiSignalTestCase(lldbmi_testcase.M
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
@skipUnlessDarwin
def test_lldbmi_stopped_when_stopatentry_remote(self):
"""Test that 'lldb-mi --interpreter' notifies after it was stopped on entry (remote)."""
@@ -93,19 +98,25 @@ class MiSignalTestCase(lldbmi_testcase.M
self.skipTest("debugserver exe not found")
hostname = "localhost"
import random
- port = 12000 + random.randint(0,3999) # the same as GdbRemoteTestCaseBase.get_next_port
+ # the same as GdbRemoteTestCaseBase.get_next_port
+ port = 12000 + random.randint(0, 3999)
import pexpect
- debugserver_child = pexpect.spawn("%s %s:%d" % (debugserver_exe, hostname, port))
- self.addTearDownHook(lambda: debugserver_child.terminate(force = True))
+ debugserver_child = pexpect.spawn(
+ "%s %s:%d" %
+ (debugserver_exe, hostname, port))
+ self.addTearDownHook(lambda: debugserver_child.terminate(force=True))
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Connect to debugserver
- self.runCmd("-interpreter-exec command \"platform select remote-macosx --sysroot /\"")
+ self.runCmd(
+ "-interpreter-exec command \"platform select remote-macosx --sysroot /\"")
self.expect("\^done")
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- self.runCmd("-interpreter-exec command \"process connect connect://%s:%d\"" % (hostname, port))
+ self.runCmd(
+ "-interpreter-exec command \"process connect connect://%s:%d\"" %
+ (hostname, port))
self.expect("\^done")
# Run with stop-at-entry flag
@@ -113,19 +124,20 @@ class MiSignalTestCase(lldbmi_testcase.M
self.expect("\^done")
# Test that *stopped is printed
- self.expect("\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.+?thread-id=\"1\",stopped-threads=\"all\"")
+ self.expect(
+ "\*stopped,reason=\"signal-received\",signal-name=\"SIGSTOP\",signal-meaning=\"Stop\",.+?thread-id=\"1\",stopped-threads=\"all\"")
# Exit
self.runCmd("-gdb-exit")
self.expect("\^exit")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_stopped_when_segfault_local(self):
"""Test that 'lldb-mi --interpreter' notifies after it was stopped when segfault occurred (local)."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -147,9 +159,11 @@ class MiSignalTestCase(lldbmi_testcase.M
# Test that *stopped is printed
# Note that message is different in Darwin and Linux:
# Darwin: "*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS (code=1, address=0x0)\",thread-id=\"1\",stopped-threads=\"all\""
- # Linux: "*stopped,reason=\"exception-received\",exception=\"invalid address (fault address: 0x0)\",thread-id=\"1\",stopped-threads=\"all\""
- self.expect([ "\*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS \(code=1, address=0x0\)\",thread-id=\"1\",stopped-threads=\"all\"",
- "\*stopped,reason=\"exception-received\",exception=\"invalid address \(fault address: 0x0\)\",thread-id=\"1\",stopped-threads=\"all\"" ])
+ # Linux: "*stopped,reason=\"exception-received\",exception=\"invalid
+ # address (fault address:
+ # 0x0)\",thread-id=\"1\",stopped-threads=\"all\""
+ self.expect(["\*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS \(code=1, address=0x0\)\",thread-id=\"1\",stopped-threads=\"all\"",
+ "\*stopped,reason=\"exception-received\",exception=\"invalid address \(fault address: 0x0\)\",thread-id=\"1\",stopped-threads=\"all\""])
@skipUnlessDarwin
def test_lldbmi_stopped_when_segfault_remote(self):
@@ -162,27 +176,34 @@ class MiSignalTestCase(lldbmi_testcase.M
self.skipTest("debugserver exe not found")
hostname = "localhost"
import random
- port = 12000 + random.randint(0,3999) # the same as GdbRemoteTestCaseBase.get_next_port
+ # the same as GdbRemoteTestCaseBase.get_next_port
+ port = 12000 + random.randint(0, 3999)
import pexpect
- debugserver_child = pexpect.spawn("%s %s:%d" % (debugserver_exe, hostname, port))
- self.addTearDownHook(lambda: debugserver_child.terminate(force = True))
+ debugserver_child = pexpect.spawn(
+ "%s %s:%d" %
+ (debugserver_exe, hostname, port))
+ self.addTearDownHook(lambda: debugserver_child.terminate(force=True))
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Connect to debugserver
- self.runCmd("-interpreter-exec command \"platform select remote-macosx --sysroot /\"")
+ self.runCmd(
+ "-interpreter-exec command \"platform select remote-macosx --sysroot /\"")
self.expect("\^done")
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
- self.runCmd("-interpreter-exec command \"process connect connect://%s:%d\"" % (hostname, port))
+ self.runCmd(
+ "-interpreter-exec command \"process connect connect://%s:%d\"" %
+ (hostname, port))
self.expect("\^done")
# Run to main
self.runCmd("-break-insert -f main")
self.expect("\^done,bkpt={number=\"1\"")
- #FIXME -exec-run doesn't work
- self.runCmd("-interpreter-exec command \"process launch\"") #FIXME: self.runCmd("-exec-run")
- self.expect("\^done") #FIXME: self.expect("\^running")
+ # FIXME -exec-run doesn't work
+ # FIXME: self.runCmd("-exec-run")
+ self.runCmd("-interpreter-exec command \"process launch\"")
+ self.expect("\^done") # FIXME: self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Set do_segfault=1 and run (to cause a segfault error)
@@ -192,7 +213,8 @@ class MiSignalTestCase(lldbmi_testcase.M
self.expect("\^running")
# Test that *stopped is printed
- self.expect("\*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS \(code=1, address=0x0\)\",thread-id=\"1\",stopped-threads=\"all\"")
+ self.expect(
+ "\*stopped,reason=\"exception-received\",exception=\"EXC_BAD_ACCESS \(code=1, address=0x0\)\",thread-id=\"1\",stopped-threads=\"all\"")
# Exit
self.runCmd("-gdb-exit")
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/stack/TestMiStack.py Tue Sep 6 15:57:50 2016
@@ -5,22 +5,22 @@ Test lldb-mi -stack-xxx commands.
from __future__ import print_function
-
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiStackTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_list_arguments(self):
"""Test that 'lldb-mi --interpreter' can shows arguments."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -33,55 +33,66 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- # Test that -stack-list-arguments lists empty stack arguments if range is empty
+ # Test that -stack-list-arguments lists empty stack arguments if range
+ # is empty
self.runCmd("-stack-list-arguments 0 1 0")
self.expect("\^done,stack-args=\[\]")
# Test that -stack-list-arguments lists stack arguments without values
# (and that low-frame and high-frame are optional)
self.runCmd("-stack-list-arguments 0")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[name=\"argc\",name=\"argv\"\]}")
+ self.expect(
+ "\^done,stack-args=\[frame={level=\"0\",args=\[name=\"argc\",name=\"argv\"\]}")
self.runCmd("-stack-list-arguments --no-values")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[name=\"argc\",name=\"argv\"\]}")
+ self.expect(
+ "\^done,stack-args=\[frame={level=\"0\",args=\[name=\"argc\",name=\"argv\"\]}")
# Test that -stack-list-arguments lists stack arguments with all values
self.runCmd("-stack-list-arguments 1 0 0")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}\]")
+ self.expect(
+ "\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}\]")
self.runCmd("-stack-list-arguments --all-values 0 0")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}\]")
+ self.expect(
+ "\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",value=\"1\"},{name=\"argv\",value=\".*\"}\]}\]")
- # Test that -stack-list-arguments lists stack arguments with simple values
+ # Test that -stack-list-arguments lists stack arguments with simple
+ # values
self.runCmd("-stack-list-arguments 2 0 1")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",type=\"int\",value=\"1\"},{name=\"argv\",type=\"const char \*\*\",value=\".*\"}\]}")
+ self.expect(
+ "\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",type=\"int\",value=\"1\"},{name=\"argv\",type=\"const char \*\*\",value=\".*\"}\]}")
self.runCmd("-stack-list-arguments --simple-values 0 1")
- self.expect("\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",type=\"int\",value=\"1\"},{name=\"argv\",type=\"const char \*\*\",value=\".*\"}\]}")
+ self.expect(
+ "\^done,stack-args=\[frame={level=\"0\",args=\[{name=\"argc\",type=\"int\",value=\"1\"},{name=\"argv\",type=\"const char \*\*\",value=\".*\"}\]}")
- # Test that an invalid low-frame is handled
+ # Test that an invalid low-frame is handled
# FIXME: -1 is treated as unsigned int
self.runCmd("-stack-list-arguments 0 -1 0")
- #self.expect("\^error")
+ # self.expect("\^error")
self.runCmd("-stack-list-arguments 0 0")
- self.expect("\^error,msg=\"Command 'stack-list-arguments'\. Thread frame range invalid\"")
+ self.expect(
+ "\^error,msg=\"Command 'stack-list-arguments'\. Thread frame range invalid\"")
# Test that an invalid high-frame is handled
# FIXME: -1 is treated as unsigned int
self.runCmd("-stack-list-arguments 0 0 -1")
- #self.expect("\^error")
+ # self.expect("\^error")
# Test that a missing low-frame or high-frame is handled
self.runCmd("-stack-list-arguments 0 0")
- self.expect("\^error,msg=\"Command 'stack-list-arguments'\. Thread frame range invalid\"")
+ self.expect(
+ "\^error,msg=\"Command 'stack-list-arguments'\. Thread frame range invalid\"")
- # Test that an invalid low-frame is handled
+ # Test that an invalid low-frame is handled
self.runCmd("-stack-list-arguments 0 0")
- self.expect("\^error,msg=\"Command 'stack-list-arguments'\. Thread frame range invalid\"")
+ self.expect(
+ "\^error,msg=\"Command 'stack-list-arguments'\. Thread frame range invalid\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_list_locals(self):
"""Test that 'lldb-mi --interpreter' can shows local variables."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -111,16 +122,20 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test -stack-list-locals: use 1 or --all-values
self.runCmd("-stack-list-locals 1")
- self.expect("\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
+ self.expect(
+ "\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
self.runCmd("-stack-list-locals --all-values")
- self.expect("\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
+ self.expect(
+ "\^done,locals=\[{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
# Test -stack-list-locals: use 2 or --simple-values
self.runCmd("-stack-list-locals 2")
- self.expect("\^done,locals=\[{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]")
+ self.expect(
+ "\^done,locals=\[{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]")
self.runCmd("-stack-list-locals --simple-values")
- self.expect("\^done,locals=\[{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]")
-
+ self.expect(
+ "\^done,locals=\[{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]")
+
# Test struct local variable:
# Run to BP_local_struct_test
line = line_number('main.cpp', '// BP_local_struct_test')
@@ -129,7 +144,7 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
+
# Test -stack-list-locals: use 0 or --no-values
self.runCmd("-stack-list-locals 0")
self.expect("\^done,locals=\[name=\"var_c\"\]")
@@ -138,16 +153,18 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test -stack-list-locals: use 1 or --all-values
self.runCmd("-stack-list-locals 1")
- self.expect("\^done,locals=\[{name=\"var_c\",value=\"{var_a = 10, var_b = 97 'a', inner_ = {var_d = 30}}\"}\]")
+ self.expect(
+ "\^done,locals=\[{name=\"var_c\",value=\"{var_a = 10, var_b = 97 'a', inner_ = {var_d = 30}}\"}\]")
self.runCmd("-stack-list-locals --all-values")
- self.expect("\^done,locals=\[{name=\"var_c\",value=\"{var_a = 10, var_b = 97 'a', inner_ = {var_d = 30}}\"}\]")
+ self.expect(
+ "\^done,locals=\[{name=\"var_c\",value=\"{var_a = 10, var_b = 97 'a', inner_ = {var_d = 30}}\"}\]")
# Test -stack-list-locals: use 2 or --simple-values
self.runCmd("-stack-list-locals 2")
self.expect("\^done,locals=\[{name=\"var_c\",type=\"my_type\"}\]")
self.runCmd("-stack-list-locals --simple-values")
self.expect("\^done,locals=\[{name=\"var_c\",type=\"my_type\"}\]")
-
+
# Test array local variable:
# Run to BP_local_array_test
line = line_number('main.cpp', '// BP_local_array_test')
@@ -156,7 +173,7 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
+
# Test -stack-list-locals: use 0 or --no-values
self.runCmd("-stack-list-locals 0")
self.expect("\^done,locals=\[name=\"array\"\]")
@@ -165,16 +182,18 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test -stack-list-locals: use 1 or --all-values
self.runCmd("-stack-list-locals 1")
- self.expect("\^done,locals=\[{name=\"array\",value=\"{\[0\] = 100, \[1\] = 200, \[2\] = 300}\"}\]")
+ self.expect(
+ "\^done,locals=\[{name=\"array\",value=\"{\[0\] = 100, \[1\] = 200, \[2\] = 300}\"}\]")
self.runCmd("-stack-list-locals --all-values")
- self.expect("\^done,locals=\[{name=\"array\",value=\"{\[0\] = 100, \[1\] = 200, \[2\] = 300}\"}\]")
+ self.expect(
+ "\^done,locals=\[{name=\"array\",value=\"{\[0\] = 100, \[1\] = 200, \[2\] = 300}\"}\]")
# Test -stack-list-locals: use 2 or --simple-values
self.runCmd("-stack-list-locals 2")
self.expect("\^done,locals=\[{name=\"array\",type=\"int \[3\]\"}\]")
self.runCmd("-stack-list-locals --simple-values")
self.expect("\^done,locals=\[{name=\"array\",type=\"int \[3\]\"}\]")
-
+
# Test pointers as local variable:
# Run to BP_local_pointer_test
line = line_number('main.cpp', '// BP_local_pointer_test')
@@ -183,26 +202,32 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
+
# Test -stack-list-locals: use 0 or --no-values
self.runCmd("-stack-list-locals 0")
- self.expect("\^done,locals=\[name=\"test_str\",name=\"var_e\",name=\"ptr\"\]")
+ self.expect(
+ "\^done,locals=\[name=\"test_str\",name=\"var_e\",name=\"ptr\"\]")
self.runCmd("-stack-list-locals --no-values")
- self.expect("\^done,locals=\[name=\"test_str\",name=\"var_e\",name=\"ptr\"\]")
+ self.expect(
+ "\^done,locals=\[name=\"test_str\",name=\"var_e\",name=\"ptr\"\]")
# Test -stack-list-locals: use 1 or --all-values
self.runCmd("-stack-list-locals 1")
- self.expect("\^done,locals=\[{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]")
+ self.expect(
+ "\^done,locals=\[{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]")
self.runCmd("-stack-list-locals --all-values")
- self.expect("\^done,locals=\[{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]")
+ self.expect(
+ "\^done,locals=\[{name=\"test_str\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",value=\"24\"},{name=\"ptr\",value=\".*?\"}\]")
# Test -stack-list-locals: use 2 or --simple-values
self.runCmd("-stack-list-locals 2")
- self.expect("\^done,locals=\[{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]")
+ self.expect(
+ "\^done,locals=\[{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]")
self.runCmd("-stack-list-locals --simple-values")
- self.expect("\^done,locals=\[{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]")
-
- # Test -stack-list-locals in a function with catch clause,
+ self.expect(
+ "\^done,locals=\[{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]")
+
+ # Test -stack-list-locals in a function with catch clause,
# having unnamed parameter
# Run to BP_catch_unnamed
line = line_number('main.cpp', '// BP_catch_unnamed')
@@ -215,12 +240,13 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test -stack-list-locals: use --no-values
self.runCmd("-stack-list-locals --no-values")
self.expect("\^done,locals=\[name=\"i\",name=\"j\"\]")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_list_variables(self):
"""Test that 'lldb-mi --interpreter' can shows local variables and arguments."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -244,22 +270,28 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test -stack-list-variables: use 0 or --no-values
self.runCmd("-stack-list-variables 0")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"c\"},{arg=\"1\",name=\"d\"},{name=\"a\"},{name=\"b\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"c\"},{arg=\"1\",name=\"d\"},{name=\"a\"},{name=\"b\"}\]")
self.runCmd("-stack-list-variables --no-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"c\"},{arg=\"1\",name=\"d\"},{name=\"a\"},{name=\"b\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"c\"},{arg=\"1\",name=\"d\"},{name=\"a\"},{name=\"b\"}\]")
# Test -stack-list-variables: use 1 or --all-values
self.runCmd("-stack-list-variables 1")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"c\",value=\"30\"},{arg=\"1\",name=\"d\",value=\"40\"},{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"c\",value=\"30\"},{arg=\"1\",name=\"d\",value=\"40\"},{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
self.runCmd("-stack-list-variables --all-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"c\",value=\"30\"},{arg=\"1\",name=\"d\",value=\"40\"},{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"c\",value=\"30\"},{arg=\"1\",name=\"d\",value=\"40\"},{name=\"a\",value=\"10\"},{name=\"b\",value=\"20\"}\]")
# Test -stack-list-variables: use 2 or --simple-values
self.runCmd("-stack-list-variables 2")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"c\",type=\"int\",value=\"30\"},{arg=\"1\",name=\"d\",type=\"int\",value=\"40\"},{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"c\",type=\"int\",value=\"30\"},{arg=\"1\",name=\"d\",type=\"int\",value=\"40\"},{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]")
self.runCmd("-stack-list-variables --simple-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"c\",type=\"int\",value=\"30\"},{arg=\"1\",name=\"d\",type=\"int\",value=\"40\"},{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]")
-
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"c\",type=\"int\",value=\"30\"},{arg=\"1\",name=\"d\",type=\"int\",value=\"40\"},{name=\"a\",type=\"int\",value=\"10\"},{name=\"b\",type=\"int\",value=\"20\"}\]")
+
# Test struct local variable:
# Run to BP_local_struct_test
line = line_number('main.cpp', '// BP_local_struct_test_with_args')
@@ -268,25 +300,31 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
+
# Test -stack-list-variables: use 0 or --no-values
self.runCmd("-stack-list-variables 0")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\"},{name=\"var_c\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"var_e\"},{name=\"var_c\"}\]")
self.runCmd("-stack-list-variables --no-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\"},{name=\"var_c\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"var_e\"},{name=\"var_c\"}\]")
# Test -stack-list-variables: use 1 or --all-values
self.runCmd("-stack-list-variables 1")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\",value=\"{var_a = 20, var_b = 98 'b', inner_ = {var_d = 40}}\"},{name=\"var_c\",value=\"{var_a = 10, var_b = 97 'a', inner_ = {var_d = 30}}\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"var_e\",value=\"{var_a = 20, var_b = 98 'b', inner_ = {var_d = 40}}\"},{name=\"var_c\",value=\"{var_a = 10, var_b = 97 'a', inner_ = {var_d = 30}}\"}\]")
self.runCmd("-stack-list-variables --all-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\",value=\"{var_a = 20, var_b = 98 'b', inner_ = {var_d = 40}}\"},{name=\"var_c\",value=\"{var_a = 10, var_b = 97 'a', inner_ = {var_d = 30}}\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"var_e\",value=\"{var_a = 20, var_b = 98 'b', inner_ = {var_d = 40}}\"},{name=\"var_c\",value=\"{var_a = 10, var_b = 97 'a', inner_ = {var_d = 30}}\"}\]")
# Test -stack-list-variables: use 2 or --simple-values
self.runCmd("-stack-list-variables 2")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\",type=\"my_type\"},{name=\"var_c\",type=\"my_type\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"var_e\",type=\"my_type\"},{name=\"var_c\",type=\"my_type\"}\]")
self.runCmd("-stack-list-variables --simple-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"var_e\",type=\"my_type\"},{name=\"var_c\",type=\"my_type\"}\]")
-
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"var_e\",type=\"my_type\"},{name=\"var_c\",type=\"my_type\"}\]")
+
# Test array local variable:
# Run to BP_local_array_test
line = line_number('main.cpp', '// BP_local_array_test_with_args')
@@ -295,25 +333,31 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
+
# Test -stack-list-variables: use 0 or --no-values
self.runCmd("-stack-list-variables 0")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\"},{name=\"array\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"other_array\"},{name=\"array\"}\]")
self.runCmd("-stack-list-variables --no-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\"},{name=\"array\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"other_array\"},{name=\"array\"}\]")
# Test -stack-list-variables: use 1 or --all-values
self.runCmd("-stack-list-variables 1")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\",value=\".*?\"},{name=\"array\",value=\"{\[0\] = 100, \[1\] = 200, \[2\] = 300}\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"other_array\",value=\".*?\"},{name=\"array\",value=\"{\[0\] = 100, \[1\] = 200, \[2\] = 300}\"}\]")
self.runCmd("-stack-list-variables --all-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\",value=\".*?\"},{name=\"array\",value=\"{\[0\] = 100, \[1\] = 200, \[2\] = 300}\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"other_array\",value=\".*?\"},{name=\"array\",value=\"{\[0\] = 100, \[1\] = 200, \[2\] = 300}\"}\]")
# Test -stack-list-variables: use 2 or --simple-values
self.runCmd("-stack-list-variables 2")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\",type=\"int \*\",value=\".*?\"},{name=\"array\",type=\"int \[3\]\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"other_array\",type=\"int \*\",value=\".*?\"},{name=\"array\",type=\"int \[3\]\"}\]")
self.runCmd("-stack-list-variables --simple-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"other_array\",type=\"int \*\",value=\".*?\"},{name=\"array\",type=\"int \[3\]\"}\]")
-
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"other_array\",type=\"int \*\",value=\".*?\"},{name=\"array\",type=\"int \[3\]\"}\]")
+
# Test pointers as local variable:
# Run to BP_local_pointer_test
line = line_number('main.cpp', '// BP_local_pointer_test_with_args')
@@ -322,12 +366,14 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.runCmd("-exec-continue")
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
+
# Test -stack-list-variables: use 0 or --no-values
self.runCmd("-stack-list-variables 0")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\"},{arg=\"1\",name=\"arg_ptr\"},{name=\"test_str\"},{name=\"var_e\"},{name=\"ptr\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"arg_str\"},{arg=\"1\",name=\"arg_ptr\"},{name=\"test_str\"},{name=\"var_e\"},{name=\"ptr\"}\]")
self.runCmd("-stack-list-variables --no-values")
- self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\"},{arg=\"1\",name=\"arg_ptr\"},{name=\"test_str\"},{name=\"var_e\"},{name=\"ptr\"}\]")
+ self.expect(
+ "\^done,variables=\[{arg=\"1\",name=\"arg_str\"},{arg=\"1\",name=\"arg_ptr\"},{name=\"test_str\"},{name=\"var_e\"},{name=\"ptr\"}\]")
# Test -stack-list-variables: use 1 or --all-values
self.runCmd("-stack-list-variables 1")
@@ -340,13 +386,13 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\",type=\"const char \*\",value=\".*?String.*?\"},{arg=\"1\",name=\"arg_ptr\",type=\"int \*\",value=\".*?\"},{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]")
self.runCmd("-stack-list-variables --simple-values")
self.expect("\^done,variables=\[{arg=\"1\",name=\"arg_str\",type=\"const char \*\",value=\".*?String.*?\"},{arg=\"1\",name=\"arg_ptr\",type=\"int \*\",value=\".*?\"},{name=\"test_str\",type=\"const char \*\",value=\".*?Rakaposhi.*?\"},{name=\"var_e\",type=\"int\",value=\"24\"},{name=\"ptr\",type=\"int \*\",value=\".*?\"}\]")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_info_depth(self):
"""Test that 'lldb-mi --interpreter' can shows depth of the stack."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -365,26 +411,27 @@ class MiStackTestCase(lldbmi_testcase.Mi
self.expect("\^done,depth=\"[1-9]\"")
# Test that max-depth restricts check of stack depth
- #FIXME: max-depth argument is ignored
+ # FIXME: max-depth argument is ignored
self.runCmd("-stack-info-depth 1")
- #self.expect("\^done,depth=\"1\"")
+ # self.expect("\^done,depth=\"1\"")
# Test that invalid max-depth argument is handled
- #FIXME: max-depth argument is ignored
+ # FIXME: max-depth argument is ignored
self.runCmd("-stack-info-depth -1")
- #self.expect("\^error")
+ # self.expect("\^error")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
@skipUnlessDarwin
def test_lldbmi_stack_info_frame(self):
"""Test that 'lldb-mi --interpreter' can show information about current frame."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Test that -stack-info-frame fails when program isn't running
self.runCmd("-stack-info-frame")
- self.expect("\^error,msg=\"Command 'stack-info-frame'\. Invalid process during debug session\"")
+ self.expect(
+ "\^error,msg=\"Command 'stack-info-frame'\. Invalid process during debug session\"")
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -399,7 +446,8 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test that -stack-info-frame works when program was stopped on BP
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
+ self.expect(
+ "\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
# Select frame #1
self.runCmd("-stack-select-frame 1")
@@ -407,19 +455,20 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test that -stack-info-frame works when specified frame was selected
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+?\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\}")
+ self.expect(
+ "\^done,frame=\{level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+?\",file=\"\?\?\",fullname=\"\?\?\",line=\"-1\"\}")
# Test that -stack-info-frame fails when an argument is specified
- #FIXME: unknown argument is ignored
+ # FIXME: unknown argument is ignored
self.runCmd("-stack-info-frame unknown_arg")
- #self.expect("\^error")
+ # self.expect("\^error")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_list_frames(self):
"""Test that 'lldb-mi --interpreter' can lists the frames on the stack."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -434,14 +483,15 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test stack frame: get frame #0 info
self.runCmd("-stack-list-frames 0 0")
- self.expect("\^done,stack=\[frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}\]")
+ self.expect(
+ "\^done,stack=\[frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}\]")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_stack_select_frame(self):
"""Test that 'lldb-mi --interpreter' can choose current frame."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -456,15 +506,18 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test that -stack-select-frame requires 1 mandatory argument
self.runCmd("-stack-select-frame")
- self.expect("\^error,msg=\"Command 'stack-select-frame'\. Command Args\. Validation failed. Mandatory args not found: frame_id\"")
+ self.expect(
+ "\^error,msg=\"Command 'stack-select-frame'\. Command Args\. Validation failed. Mandatory args not found: frame_id\"")
# Test that -stack-select-frame fails on invalid frame number
self.runCmd("-stack-select-frame 99")
- self.expect("\^error,msg=\"Command 'stack-select-frame'\. Frame ID invalid\"")
+ self.expect(
+ "\^error,msg=\"Command 'stack-select-frame'\. Frame ID invalid\"")
# Test that current frame is #0
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
+ self.expect(
+ "\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
# Test that -stack-select-frame can select the selected frame
self.runCmd("-stack-select-frame 0")
@@ -472,7 +525,8 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test that current frame is still #0
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
+ self.expect(
+ "\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
# Test that -stack-select-frame can select frame #1 (parent frame)
self.runCmd("-stack-select-frame 1")
@@ -481,9 +535,11 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test that current frame is #1
# Note that message is different in Darwin and Linux:
# Darwin: "^done,frame={level=\"1\",addr=\"0x[0-9a-f]+\",func=\"start\",file=\"??\",fullname=\"??\",line=\"-1\"}"
- # Linux: "^done,frame={level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+\",file=\".+\",fullname=\".+\",line=\"\d+\"}"
+ # Linux:
+ # "^done,frame={level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+\",file=\".+\",fullname=\".+\",line=\"\d+\"}"
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\"\}")
+ self.expect(
+ "\^done,frame=\{level=\"1\",addr=\"0x[0-9a-f]+\",func=\".+?\",file=\".+?\",fullname=\".+?\",line=\"(-1|\d+)\"\}")
# Test that -stack-select-frame can select frame #0 (child frame)
self.runCmd("-stack-select-frame 0")
@@ -491,4 +547,5 @@ class MiStackTestCase(lldbmi_testcase.Mi
# Test that current frame is #0 and it has the same information
self.runCmd("-stack-info-frame")
- self.expect("\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
+ self.expect(
+ "\^done,frame=\{level=\"0\",addr=\"0x[0-9a-f]+\",func=\"main\",file=\"main\.cpp\",fullname=\".+?main\.cpp\",line=\"\d+\"\}")
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/startup_options/TestMiStartupOptions.py Tue Sep 6 15:57:50 2016
@@ -9,23 +9,24 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiStartupOptionsTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_file(self):
"""Test that 'lldb-mi --interpreter %s' loads executable file."""
- self.spawnLldbMi(args = "%s" % self.myexe)
+ self.spawnLldbMi(args="%s" % self.myexe)
# Test that the executable is loaded when file was specified
self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
self.expect("\^done")
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Run to main
self.runCmd("-break-insert -f main")
@@ -39,25 +40,27 @@ class MiStartupOptionsTestCase(lldbmi_te
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_unknown_file(self):
"""Test that 'lldb-mi --interpreter %s' fails on unknown executable file."""
# Prepare path to executable
path = "unknown_file"
- self.spawnLldbMi(args = "%s" % path)
+ self.spawnLldbMi(args="%s" % path)
# Test that the executable isn't loaded when unknown file was specified
self.expect("-file-exec-and-symbols \"%s\"" % path)
- self.expect("\^error,msg=\"Command 'file-exec-and-symbols'. Target binary '%s' is invalid. error: unable to find executable for '%s'\"" % (path, path))
+ self.expect(
+ "\^error,msg=\"Command 'file-exec-and-symbols'. Target binary '%s' is invalid. error: unable to find executable for '%s'\"" %
+ (path, path))
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_absolute_path(self):
"""Test that 'lldb-mi --interpreter %s' loads executable which is specified via absolute path."""
@@ -65,69 +68,74 @@ class MiStartupOptionsTestCase(lldbmi_te
import os
path = os.path.join(os.getcwd(), self.myexe)
- self.spawnLldbMi(args = "%s" % path)
+ self.spawnLldbMi(args="%s" % path)
- # Test that the executable is loaded when file was specified using absolute path
+ # Test that the executable is loaded when file was specified using
+ # absolute path
self.expect("-file-exec-and-symbols \"%s\"" % path)
self.expect("\^done")
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_relative_path(self):
"""Test that 'lldb-mi --interpreter %s' loads executable which is specified via relative path."""
# Prepare path to executable
path = "./%s" % self.myexe
- self.spawnLldbMi(args = "%s" % path)
+ self.spawnLldbMi(args="%s" % path)
- # Test that the executable is loaded when file was specified using relative path
+ # Test that the executable is loaded when file was specified using
+ # relative path
self.expect("-file-exec-and-symbols \"%s\"" % path)
self.expect("\^done")
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Run
self.runCmd("-exec-run")
self.expect("\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_executable_option_unknown_path(self):
"""Test that 'lldb-mi --interpreter %s' fails on executable file which is specified via unknown path."""
# Prepare path to executable
path = "unknown_dir/%s" % self.myexe
- self.spawnLldbMi(args = "%s" % path)
+ self.spawnLldbMi(args="%s" % path)
- # Test that the executable isn't loaded when file was specified using unknown path
+ # Test that the executable isn't loaded when file was specified using
+ # unknown path
self.expect("-file-exec-and-symbols \"%s\"" % path)
- self.expect("\^error,msg=\"Command 'file-exec-and-symbols'. Target binary '%s' is invalid. error: unable to find executable for '%s'\"" % (path, path))
+ self.expect(
+ "\^error,msg=\"Command 'file-exec-and-symbols'. Target binary '%s' is invalid. error: unable to find executable for '%s'\"" %
+ (path, path))
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_source_option_start_script(self):
"""Test that 'lldb-mi --interpreter' can execute user's commands after initial commands were executed."""
# Prepared source file
sourceFile = "start_script"
- self.spawnLldbMi(args = "--source %s" % sourceFile)
+ self.spawnLldbMi(args="--source %s" % sourceFile)
# After '-file-exec-and-symbols a.out'
self.expect("-file-exec-and-symbols %s" % self.myexe)
@@ -153,23 +161,23 @@ class MiStartupOptionsTestCase(lldbmi_te
self.expect("\*stopped,reason=\"breakpoint-hit\"")
# Test that lldb-mi is ready after execution of --source start_script
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Try to evaluate 'a' expression
self.runCmd("-data-evaluate-expression a")
self.expect("\^done,value=\"10\"")
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_source_option_start_script_exit(self):
"""Test that 'lldb-mi --interpreter' can execute a prepared file which passed via --source option."""
# Prepared source file
sourceFile = "start_script_exit"
- self.spawnLldbMi(args = "--source %s" % sourceFile)
+ self.spawnLldbMi(args="--source %s" % sourceFile)
# After '-file-exec-and-symbols a.out'
self.expect("-file-exec-and-symbols %s" % self.myexe)
@@ -203,15 +211,15 @@ class MiStartupOptionsTestCase(lldbmi_te
self.expect("\^exit")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_source_option_start_script_error(self):
"""Test that 'lldb-mi --interpreter' stops execution of initial commands in case of error."""
# Prepared source file
sourceFile = "start_script_error"
- self.spawnLldbMi(args = "--source %s" % sourceFile)
+ self.spawnLldbMi(args="--source %s" % sourceFile)
# After '-file-exec-and-symbols a.out'
self.expect("-file-exec-and-symbols %s" % self.myexe)
@@ -222,22 +230,22 @@ class MiStartupOptionsTestCase(lldbmi_te
self.expect("\^error")
# Test that lldb-mi is ready after execution of --source start_script
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_log_option(self):
"""Test that 'lldb-mi --log' creates a log file in the current directory."""
-
+
logDirectory = "."
- self.spawnLldbMi(args = "%s --log" % self.myexe)
+ self.spawnLldbMi(args="%s --log" % self.myexe)
# Test that the executable is loaded when file was specified
self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
self.expect("\^done")
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Run
self.runCmd("-exec-run")
@@ -245,7 +253,8 @@ class MiStartupOptionsTestCase(lldbmi_te
self.expect("\*stopped,reason=\"exited-normally\"")
# Check log file is created
- import glob,os
+ import glob
+ import os
logFile = glob.glob(logDirectory + "/lldb-mi-*.log")
if not logFile:
@@ -255,23 +264,25 @@ class MiStartupOptionsTestCase(lldbmi_te
for f in logFile:
os.remove(f)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_log_directory_option(self):
"""Test that 'lldb-mi --log --log-dir' creates a log file in the directory specified by --log-dir."""
-
+
# Create log in temp directory
import tempfile
logDirectory = tempfile.gettempdir()
- self.spawnLldbMi(args = "%s --log --log-dir=%s" % (self.myexe,logDirectory))
+ self.spawnLldbMi(
+ args="%s --log --log-dir=%s" %
+ (self.myexe, logDirectory))
# Test that the executable is loaded when file was specified
self.expect("-file-exec-and-symbols \"%s\"" % self.myexe)
self.expect("\^done")
# Test that lldb-mi is ready when executable was loaded
- self.expect(self.child_prompt, exactly = True)
+ self.expect(self.child_prompt, exactly=True)
# Run
self.runCmd("-exec-run")
@@ -279,12 +290,13 @@ class MiStartupOptionsTestCase(lldbmi_te
self.expect("\*stopped,reason=\"exited-normally\"")
# Check log file is created
- import glob,os
+ import glob
+ import os
logFile = glob.glob(logDirectory + "/lldb-mi-*.log")
if not logFile:
- self.fail("log file not found")
-
+ self.fail("log file not found")
+
# Delete log
for f in logFile:
os.remove(f)
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/symbol/TestMiSymbol.py Tue Sep 6 15:57:50 2016
@@ -5,23 +5,25 @@ Test lldb-mi -symbol-xxx commands.
from __future__ import print_function
-
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiSymbolTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureAll(oslist=["linux"], bugnumber="new failure after r256863")
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="new failure after r256863")
def test_lldbmi_symbol_list_lines_file(self):
"""Test that 'lldb-mi --interpreter' works for -symbol-list-lines when file exists."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -36,22 +38,31 @@ class MiSymbolTestCase(lldbmi_testcase.M
# Get address of main and its line
self.runCmd("-data-evaluate-expression main")
- self.expect("\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"")
+ self.expect(
+ "\^done,value=\"0x[0-9a-f]+ \(a.out`main at main.cpp:[0-9]+\)\"")
addr = int(self.child.after.split("\"")[1].split(" ")[0], 16)
line = line_number('main.cpp', '// FUNC_main')
# Test that -symbol-list-lines works on valid data
self.runCmd("-symbol-list-lines main.cpp")
- self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (addr, line))
+ self.expect(
+ "\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" %
+ (addr, line))
# Test that -symbol-list-lines doesn't include lines from other sources
# by checking the first and last line, and making sure the other lines
# are between 30 and 39.
- sline = line_number('symbol_list_lines_inline_test2.cpp', '// FUNC_gfunc2')
- eline = line_number('symbol_list_lines_inline_test2.cpp', '// END_gfunc2')
+ sline = line_number(
+ 'symbol_list_lines_inline_test2.cpp',
+ '// FUNC_gfunc2')
+ eline = line_number(
+ 'symbol_list_lines_inline_test2.cpp',
+ '// END_gfunc2')
self.runCmd("-symbol-list-lines symbol_list_lines_inline_test2.cpp")
- self.expect("\^done,lines=\[\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*,\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*\]" % (sline, eline))
- ##FIXME: This doesn't work for symbol_list_lines_inline_test.cpp due to clang bug llvm.org/pr24716 (fixed in newer versions of clang)
+ self.expect(
+ "\^done,lines=\[\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*,\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"3\d\"\})*\]" %
+ (sline, eline))
+ # FIXME: This doesn't work for symbol_list_lines_inline_test.cpp due to clang bug llvm.org/pr24716 (fixed in newer versions of clang)
##sline = line_number('symbol_list_lines_inline_test.cpp', '// FUNC_gfunc')
##eline = line_number('symbol_list_lines_inline_test.cpp', '// STRUCT_s')
##self.runCmd("-symbol-list-lines symbol_list_lines_inline_test.cpp")
@@ -62,22 +73,31 @@ class MiSymbolTestCase(lldbmi_testcase.M
sline = line_number('symbol_list_lines_inline_test.h', '// FUNC_ifunc')
eline = line_number('symbol_list_lines_inline_test.h', '// FUNC_mfunc')
self.runCmd("-symbol-list-lines symbol_list_lines_inline_test.h")
- self.expect("\^done,lines=\[\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d\"\})*(,\{pc=\"0x[0-9a-f]+\",line=\"1\d\"\})*,\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"2\d\"\})*\]" % (sline, eline))
+ self.expect(
+ "\^done,lines=\[\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d\"\})*(,\{pc=\"0x[0-9a-f]+\",line=\"1\d\"\})*,\{pc=\"0x[0-9a-f]+\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"2\d\"\})*\]" %
+ (sline, eline))
# Test that -symbol-list-lines fails when file doesn't exist
self.runCmd("-symbol-list-lines unknown_file")
- self.expect("\^error,message=\"error: No source filenames matched 'unknown_file'\. \"")
+ self.expect(
+ "\^error,message=\"error: No source filenames matched 'unknown_file'\. \"")
- # Test that -symbol-list-lines fails when file is specified using relative path
+ # Test that -symbol-list-lines fails when file is specified using
+ # relative path
self.runCmd("-symbol-list-lines ./main.cpp")
- self.expect("\^error,message=\"error: No source filenames matched '\./main\.cpp'\. \"")
+ self.expect(
+ "\^error,message=\"error: No source filenames matched '\./main\.cpp'\. \"")
- # Test that -symbol-list-lines works when file is specified using absolute path
+ # Test that -symbol-list-lines works when file is specified using
+ # absolute path
import os
path = os.path.join(os.getcwd(), "main.cpp")
self.runCmd("-symbol-list-lines \"%s\"" % path)
- self.expect("\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" % (addr, line))
+ self.expect(
+ "\^done,lines=\[\{pc=\"0x0*%x\",line=\"%d\"\}(,\{pc=\"0x[0-9a-f]+\",line=\"\d+\"\})+\]" %
+ (addr, line))
# Test that -symbol-list-lines fails when file doesn't exist
self.runCmd("-symbol-list-lines unknown_dir/main.cpp")
- self.expect("\^error,message=\"error: No source filenames matched 'unknown_dir/main\.cpp'\. \"")
+ self.expect(
+ "\^error,message=\"error: No source filenames matched 'unknown_dir/main\.cpp'\. \"")
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/syntax/TestMiSyntax.py Tue Sep 6 15:57:50 2016
@@ -5,22 +5,22 @@ Test that the lldb-mi driver understands
from __future__ import print_function
-
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiSyntaxTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_tokens(self):
"""Test that 'lldb-mi --interpreter' prints command tokens."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("000-file-exec-and-symbols %s" % self.myexe)
@@ -38,8 +38,8 @@ class MiSyntaxTestCase(lldbmi_testcase.M
self.expect("0000000000000000000003\^running")
self.expect("\*stopped,reason=\"exited-normally\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_specialchars(self):
"""Test that 'lldb-mi --interpreter' handles complicated strings."""
@@ -48,10 +48,12 @@ class MiSyntaxTestCase(lldbmi_testcase.M
os.symlink(self.myexe, complicated_myexe)
self.addTearDownHook(lambda: os.unlink(complicated_myexe))
- self.spawnLldbMi(args = "\"%s\"" % complicated_myexe)
+ self.spawnLldbMi(args="\"%s\"" % complicated_myexe)
# Test that the executable was loaded
- self.expect("-file-exec-and-symbols \"%s\"" % complicated_myexe, exactly = True)
+ self.expect(
+ "-file-exec-and-symbols \"%s\"" %
+ complicated_myexe, exactly=True)
self.expect("\^done")
# Check that it was loaded correctly
@@ -61,13 +63,15 @@ class MiSyntaxTestCase(lldbmi_testcase.M
self.expect("\^running")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @expectedFailureAll(oslist=["linux"], bugnumber="Failing in ~6/600 dosep runs (build 3120-3122)")
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @expectedFailureAll(
+ oslist=["linux"],
+ bugnumber="Failing in ~6/600 dosep runs (build 3120-3122)")
def test_lldbmi_process_output(self):
"""Test that 'lldb-mi --interpreter' wraps process output correctly."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/target/TestMiTarget.py Tue Sep 6 15:57:50 2016
@@ -9,117 +9,121 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiTargetTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # cannot attach to process on linux
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # cannot attach to process on linux
def test_lldbmi_target_attach_wait_for(self):
"""Test that 'lldb-mi --interpreter' works for -target-attach -n <name> --waitfor."""
-
+
# Build target executable with unique name
exeName = self.testMethodName
d = {'EXE': exeName}
self.buildProgram("test_attach.cpp", exeName)
self.addTearDownCleanup(dictionary=d)
-
- self.spawnLldbMi(args = None)
-
+
+ self.spawnLldbMi(args=None)
+
# Load executable
- # FIXME: -file-exec-and-sybmols is not required for target attach, but the test will not pass without this
+ # FIXME: -file-exec-and-sybmols is not required for target attach, but
+ # the test will not pass without this
self.runCmd("-file-exec-and-symbols %s" % exeName)
self.expect("\^done")
-
+
# Set up attach
self.runCmd("-target-attach -n %s --waitfor" % exeName)
- time.sleep(4) # Give attach time to setup
-
+ time.sleep(4) # Give attach time to setup
+
# Start target process
- self.spawnSubprocess(os.path.join(os.path.dirname(__file__), exeName));
+ self.spawnSubprocess(os.path.join(os.path.dirname(__file__), exeName))
self.addTearDownHook(self.cleanupSubprocesses)
self.expect("\^done")
-
+
# Set breakpoint on printf
line = line_number('test_attach.cpp', '// BP_i++')
self.runCmd("-break-insert -f test_attach.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
-
+
# Continue to breakpoint
self.runCmd("-exec-continue")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
+
# Detach
self.runCmd("-target-detach")
self.expect("\^done")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # cannot attach to process on linux
+
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # cannot attach to process on linux
def test_lldbmi_target_attach_name(self):
"""Test that 'lldb-mi --interpreter' works for -target-attach -n <name>."""
-
+
# Build target executable with unique name
exeName = self.testMethodName
d = {'EXE': exeName}
self.buildProgram("test_attach.cpp", exeName)
self.addTearDownCleanup(dictionary=d)
-
+
# Start target process
- targetProcess = self.spawnSubprocess(os.path.join(os.path.dirname(__file__), exeName));
+ targetProcess = self.spawnSubprocess(
+ os.path.join(os.path.dirname(__file__), exeName))
self.addTearDownHook(self.cleanupSubprocesses)
-
- self.spawnLldbMi(args = None)
-
+
+ self.spawnLldbMi(args=None)
+
# Set up atatch
self.runCmd("-target-attach -n %s" % exeName)
self.expect("\^done")
-
+
# Set breakpoint on printf
line = line_number('test_attach.cpp', '// BP_i++')
self.runCmd("-break-insert -f test_attach.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
-
+
# Continue to breakpoint
self.runCmd("-exec-continue")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
+
# Detach
self.runCmd("-target-detach")
self.expect("\^done")
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # cannot attach to process on linux
+
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # cannot attach to process on linux
def test_lldbmi_target_attach_pid(self):
"""Test that 'lldb-mi --interpreter' works for -target-attach <pid>."""
-
+
# Build target executable with unique name
exeName = self.testMethodName
d = {'EXE': exeName}
self.buildProgram("test_attach.cpp", exeName)
self.addTearDownCleanup(dictionary=d)
-
+
# Start target process
- targetProcess = self.spawnSubprocess(os.path.join(os.path.dirname(__file__), exeName));
+ targetProcess = self.spawnSubprocess(
+ os.path.join(os.path.dirname(__file__), exeName))
self.addTearDownHook(self.cleanupSubprocesses)
-
- self.spawnLldbMi(args = None)
-
+
+ self.spawnLldbMi(args=None)
+
# Set up atatch
self.runCmd("-target-attach %d" % targetProcess.pid)
self.expect("\^done")
-
+
# Set breakpoint on printf
line = line_number('test_attach.cpp', '// BP_i++')
self.runCmd("-break-insert -f test_attach.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
-
+
# Continue to breakpoint
self.runCmd("-exec-continue")
self.expect("\*stopped,reason=\"breakpoint-hit\"")
-
+
# Detach
self.runCmd("-target-detach")
self.expect("\^done")
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/threadinfo/TestMiThreadInfo.py Tue Sep 6 15:57:50 2016
@@ -9,16 +9,17 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiThreadInfoTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows # pthreads not supported on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # pthreads not supported on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_thread_info(self):
"""Test that -thread-info prints thread info and the current-thread-id"""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -33,7 +34,7 @@ class MiThreadInfoTestCase(lldbmi_testca
self.expect("\*stopped,reason=\"breakpoint-hit\"")
self.runCmd("-thread-info")
- self.expect("\^done,threads=\[\{id=\"1\",(.*)\},\{id=\"2\",(.*)\],current-thread-id=\"2\"")
+ self.expect(
+ "\^done,threads=\[\{id=\"1\",(.*)\},\{id=\"2\",(.*)\],current-thread-id=\"2\"")
self.runCmd("-gdb-quit")
-
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiGdbSetShowPrint.py Tue Sep 6 15:57:50 2016
@@ -1,4 +1,4 @@
-#coding=utf8
+# coding=utf8
"""
Test lldb-mi -gdb-set and -gdb-show commands for 'print option-name'.
"""
@@ -6,12 +6,12 @@ Test lldb-mi -gdb-set and -gdb-show comm
from __future__ import print_function
-
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiGdbSetShowTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,28 +19,34 @@ class MiGdbSetShowTestCase(lldbmi_testca
# evaluates array when char-array-as-string is off
def eval_and_check_array(self, var, typ, length):
self.runCmd("-var-create - * %s" % var)
- self.expect('\^done,name="var\d+",numchild="%d",value="\[%d\]",type="%s \[%d\]",thread-id="1",has_more="0"' % (length, length, typ, length))
+ self.expect(
+ '\^done,name="var\d+",numchild="%d",value="\[%d\]",type="%s \[%d\]",thread-id="1",has_more="0"' %
+ (length, length, typ, length))
# evaluates any type which can be represented as string of characters
def eval_and_match_string(self, var, value, typ):
- value=value.replace("\\", "\\\\").replace("\"", "\\\"")
+ value = value.replace("\\", "\\\\").replace("\"", "\\\"")
self.runCmd("-var-create - * " + var)
- self.expect('\^done,name="var\d+",numchild="[0-9]+",value="%s",type="%s",thread-id="1",has_more="0"' % (value, typ))
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ self.expect(
+ '\^done,name="var\d+",numchild="[0-9]+",value="%s",type="%s",thread-id="1",has_more="0"' %
+ (value, typ))
+
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_gdb_set_show_print_char_array_as_string(self):
"""Test that 'lldb-mi --interpreter' can print array of chars as string."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Run to BP_gdb_set_show_print_char_array_as_string_test
- line = line_number('main.cpp', '// BP_gdb_set_show_print_char_array_as_string_test')
+ line = line_number(
+ 'main.cpp',
+ '// BP_gdb_set_show_print_char_array_as_string_test')
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
@@ -51,23 +57,38 @@ class MiGdbSetShowTestCase(lldbmi_testca
self.runCmd("-gdb-show print char-array-as-string")
self.expect("\^done,value=\"off\"")
- # Test that a char* is expanded to string when print char-array-as-string is "off"
- self.eval_and_match_string("cp", r'0x[0-9a-f]+ \"\\t\\\"hello\\\"\\n\"', r'const char \*')
-
- # Test that a char[] isn't expanded to string when print char-array-as-string is "off"
- self.eval_and_check_array("ca", "const char", 10);
-
- # Test that a char16_t* is expanded to string when print char-array-as-string is "off"
- self.eval_and_match_string("u16p", r'0x[0-9a-f]+ u\"\\t\\\"hello\\\"\\n\"', r'const char16_t \*')
-
- # Test that a char16_t[] isn't expanded to string when print char-array-as-string is "off"
- self.eval_and_check_array("u16a", "const char16_t", 10);
-
- # Test that a char32_t* is expanded to string when print char-array-as-string is "off"
- self.eval_and_match_string("u32p", r'0x[0-9a-f]+ U\"\\t\\\"hello\\\"\\n\"', r'const char32_t \*')
-
- # Test that a char32_t[] isn't expanded to string when print char-array-as-string is "off"
- self.eval_and_check_array("u32a", "const char32_t", 10);
+ # Test that a char* is expanded to string when print
+ # char-array-as-string is "off"
+ self.eval_and_match_string(
+ "cp",
+ r'0x[0-9a-f]+ \"\\t\\\"hello\\\"\\n\"',
+ r'const char \*')
+
+ # Test that a char[] isn't expanded to string when print
+ # char-array-as-string is "off"
+ self.eval_and_check_array("ca", "const char", 10)
+
+ # Test that a char16_t* is expanded to string when print
+ # char-array-as-string is "off"
+ self.eval_and_match_string(
+ "u16p",
+ r'0x[0-9a-f]+ u\"\\t\\\"hello\\\"\\n\"',
+ r'const char16_t \*')
+
+ # Test that a char16_t[] isn't expanded to string when print
+ # char-array-as-string is "off"
+ self.eval_and_check_array("u16a", "const char16_t", 10)
+
+ # Test that a char32_t* is expanded to string when print
+ # char-array-as-string is "off"
+ self.eval_and_match_string(
+ "u32p",
+ r'0x[0-9a-f]+ U\"\\t\\\"hello\\\"\\n\"',
+ r'const char32_t \*')
+
+ # Test that a char32_t[] isn't expanded to string when print
+ # char-array-as-string is "off"
+ self.eval_and_check_array("u32a", "const char32_t", 10)
# Test that -gdb-set can set print char-array-as-string flag
self.runCmd("-gdb-set print char-array-as-string on")
@@ -77,52 +98,94 @@ class MiGdbSetShowTestCase(lldbmi_testca
self.runCmd("-gdb-show print char-array-as-string")
self.expect("\^done,value=\"on\"")
- # Test that a char* with escape chars is expanded to string when print char-array-as-string is "on"
- self.eval_and_match_string("cp", r'0x[0-9a-f]+ \"\\t\\\"hello\\\"\\n\"', r'const char \*')
-
- # Test that a char[] with escape chars is expanded to string when print char-array-as-string is "on"
- self.eval_and_match_string("ca", r'\"\\t\\\"hello\\\"\\n\"', r'const char \[10\]')
-
- # Test that a char16_t* with escape chars is expanded to string when print char-array-as-string is "on"
- self.eval_and_match_string("u16p", r'0x[0-9a-f]+ u\"\\t\\\"hello\\\"\\n\"', r'const char16_t \*')
-
- # Test that a char16_t[] with escape chars is expanded to string when print char-array-as-string is "on"
- self.eval_and_match_string("u16a", r'u\"\\t\\\"hello\\\"\\n\"', r'const char16_t \[10\]')
-
- # Test that a char32_t* with escape chars is expanded to string when print char-array-as-string is "on"
- self.eval_and_match_string("u32p", r'0x[0-9a-f]+ U\"\\t\\\"hello\\\"\\n\"', r'const char32_t \*')
-
- # Test that a char32_t[] with escape chars is expanded to string when print char-array-as-string is "on"
- self.eval_and_match_string("u32a", r'U\"\\t\\\"hello\\\"\\n\"', r'const char32_t \[10\]')
+ # Test that a char* with escape chars is expanded to string when print
+ # char-array-as-string is "on"
+ self.eval_and_match_string(
+ "cp",
+ r'0x[0-9a-f]+ \"\\t\\\"hello\\\"\\n\"',
+ r'const char \*')
+
+ # Test that a char[] with escape chars is expanded to string when print
+ # char-array-as-string is "on"
+ self.eval_and_match_string(
+ "ca",
+ r'\"\\t\\\"hello\\\"\\n\"',
+ r'const char \[10\]')
+
+ # Test that a char16_t* with escape chars is expanded to string when
+ # print char-array-as-string is "on"
+ self.eval_and_match_string(
+ "u16p",
+ r'0x[0-9a-f]+ u\"\\t\\\"hello\\\"\\n\"',
+ r'const char16_t \*')
+
+ # Test that a char16_t[] with escape chars is expanded to string when
+ # print char-array-as-string is "on"
+ self.eval_and_match_string(
+ "u16a",
+ r'u\"\\t\\\"hello\\\"\\n\"',
+ r'const char16_t \[10\]')
+
+ # Test that a char32_t* with escape chars is expanded to string when
+ # print char-array-as-string is "on"
+ self.eval_and_match_string(
+ "u32p",
+ r'0x[0-9a-f]+ U\"\\t\\\"hello\\\"\\n\"',
+ r'const char32_t \*')
+
+ # Test that a char32_t[] with escape chars is expanded to string when
+ # print char-array-as-string is "on"
+ self.eval_and_match_string(
+ "u32a",
+ r'U\"\\t\\\"hello\\\"\\n\"',
+ r'const char32_t \[10\]')
# Test russian unicode strings
- self.eval_and_match_string("u16p_rus", r'0x[0-9a-f]+ u\"\\\\Ðламо-ÑквеÑ\"', r'const char16_t \*')
- self.eval_and_match_string("u16a_rus", r'u\"\\\\ÐейвÑÑ\"', r'const char16_t \[8\]')
- self.eval_and_match_string("u32p_rus", r'0x[0-9a-f]+ U\"\\\\ЧайнаÑаÑн\"', r'const char32_t \*')
- self.eval_and_match_string("u32a_rus", r'U\"\\\\ÐогпаÑÑ\"', r'const char32_t \[9\]')
+ self.eval_and_match_string(
+ "u16p_rus",
+ r'0x[0-9a-f]+ u\"\\\\Ðламо-ÑквеÑ\"',
+ r'const char16_t \*')
+ self.eval_and_match_string(
+ "u16a_rus",
+ r'u\"\\\\ÐейвÑÑ\"',
+ r'const char16_t \[8\]')
+ self.eval_and_match_string(
+ "u32p_rus",
+ r'0x[0-9a-f]+ U\"\\\\ЧайнаÑаÑн\"',
+ r'const char32_t \*')
+ self.eval_and_match_string(
+ "u32a_rus",
+ r'U\"\\\\ÐогпаÑÑ\"',
+ r'const char32_t \[9\]')
- # Test that -gdb-set print char-array-as-string fails if "on"/"off" isn't specified
+ # Test that -gdb-set print char-array-as-string fails if "on"/"off"
+ # isn't specified
self.runCmd("-gdb-set print char-array-as-string")
- self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
+ self.expect(
+ "\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
- # Test that -gdb-set print char-array-as-string fails when option is unknown
+ # Test that -gdb-set print char-array-as-string fails when option is
+ # unknown
self.runCmd("-gdb-set print char-array-as-string unknown")
- self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
+ self.expect(
+ "\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows
@expectedFailureAll(compiler="gcc", bugnumber="llvm.org/pr23357")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_gdb_set_show_print_expand_aggregates(self):
"""Test that 'lldb-mi --interpreter' can expand aggregates everywhere."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Run to BP_gdb_set_show_print_expand_aggregates
- line = line_number('main.cpp', '// BP_gdb_set_show_print_expand_aggregates')
+ line = line_number(
+ 'main.cpp',
+ '// BP_gdb_set_show_print_expand_aggregates')
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
@@ -133,16 +196,21 @@ class MiGdbSetShowTestCase(lldbmi_testca
self.runCmd("-gdb-show print expand-aggregates")
self.expect("\^done,value=\"off\"")
- # Test that composite type isn't expanded when print expand-aggregates is "off"
+ # Test that composite type isn't expanded when print expand-aggregates
+ # is "off"
self.runCmd("-var-create var1 * complx")
- self.expect("\^done,name=\"var1\",numchild=\"3\",value=\"{\.\.\.}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var1\",numchild=\"3\",value=\"{\.\.\.}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
- # Test that composite type[] isn't expanded when print expand-aggregates is "off"
+ # Test that composite type[] isn't expanded when print
+ # expand-aggregates is "off"
self.eval_and_check_array("complx_array", "complex_type", 2)
- # Test that a struct with a char first element is not formatted as a string
+ # Test that a struct with a char first element is not formatted as a
+ # string
self.runCmd("-var-create - * &nstr")
- self.expect("\^done,name=\"var\d+\",numchild=\"2\",value=\"0x[0-9a-f]+\",type=\"not_str \*\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var\d+\",numchild=\"2\",value=\"0x[0-9a-f]+\",type=\"not_str \*\",thread-id=\"1\",has_more=\"0\"")
# Test that -gdb-set can set print expand-aggregates flag
self.runCmd("-gdb-set print expand-aggregates on")
@@ -152,36 +220,46 @@ class MiGdbSetShowTestCase(lldbmi_testca
self.runCmd("-gdb-show print expand-aggregates")
self.expect("\^done,value=\"on\"")
- # Test that composite type is expanded when print expand-aggregates is "on"
+ # Test that composite type is expanded when print expand-aggregates is
+ # "on"
self.runCmd("-var-create var3 * complx")
- self.expect("\^done,name=\"var3\",numchild=\"3\",value=\"{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var3\",numchild=\"3\",value=\"{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
- # Test that composite type[] is expanded when print expand-aggregates is "on"
+ # Test that composite type[] is expanded when print expand-aggregates
+ # is "on"
self.runCmd("-var-create var4 * complx_array")
- self.expect("\^done,name=\"var4\",numchild=\"2\",value=\"{\[0\] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, \[1\] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var4\",numchild=\"2\",value=\"{\[0\] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, \[1\] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
- # Test that -gdb-set print expand-aggregates fails if "on"/"off" isn't specified
+ # Test that -gdb-set print expand-aggregates fails if "on"/"off" isn't
+ # specified
self.runCmd("-gdb-set print expand-aggregates")
- self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
+ self.expect(
+ "\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
- # Test that -gdb-set print expand-aggregates fails when option is unknown
+ # Test that -gdb-set print expand-aggregates fails when option is
+ # unknown
self.runCmd("-gdb-set print expand-aggregates unknown")
- self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
+ self.expect(
+ "\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows
@expectedFailureAll(compiler="gcc", bugnumber="llvm.org/pr23357")
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_gdb_set_show_print_aggregate_field_names(self):
"""Test that 'lldb-mi --interpreter' can expand aggregates everywhere."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
self.expect("\^done")
# Run to BP_gdb_set_show_print_aggregate_field_names
- line = line_number('main.cpp', '// BP_gdb_set_show_print_aggregate_field_names')
+ line = line_number(
+ 'main.cpp',
+ '// BP_gdb_set_show_print_aggregate_field_names')
self.runCmd("-break-insert main.cpp:%d" % line)
self.expect("\^done,bkpt={number=\"1\"")
self.runCmd("-exec-run")
@@ -196,13 +274,17 @@ class MiGdbSetShowTestCase(lldbmi_testca
self.runCmd("-gdb-set print expand-aggregates on")
self.expect("\^done")
- # Test that composite type is expanded with field name when print aggregate-field-names is "on"
+ # Test that composite type is expanded with field name when print
+ # aggregate-field-names is "on"
self.runCmd("-var-create var1 * complx")
- self.expect("\^done,name=\"var1\",numchild=\"3\",value=\"{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var1\",numchild=\"3\",value=\"{i = 3, inner = {l = 3}, complex_ptr = 0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
- # Test that composite type[] is expanded with field name when print aggregate-field-names is "on"
+ # Test that composite type[] is expanded with field name when print
+ # aggregate-field-names is "on"
self.runCmd("-var-create var2 * complx_array")
- self.expect("\^done,name=\"var2\",numchild=\"2\",value=\"{\[0\] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, \[1\] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var2\",numchild=\"2\",value=\"{\[0\] = {i = 4, inner = {l = 4}, complex_ptr = 0x[0-9a-f]+}, \[1\] = {i = 5, inner = {l = 5}, complex_ptr = 0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
# Test that -gdb-set can set print aggregate-field-names flag
self.runCmd("-gdb-set print aggregate-field-names off")
@@ -212,18 +294,26 @@ class MiGdbSetShowTestCase(lldbmi_testca
self.runCmd("-gdb-show print aggregate-field-names")
self.expect("\^done,value=\"off\"")
- # Test that composite type is expanded without field name when print aggregate-field-names is "off"
+ # Test that composite type is expanded without field name when print
+ # aggregate-field-names is "off"
self.runCmd("-var-create var3 * complx")
- self.expect("\^done,name=\"var3\",numchild=\"3\",value=\"{3,\{3\},0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var3\",numchild=\"3\",value=\"{3,\{3\},0x[0-9a-f]+}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
- # Test that composite type[] is expanded without field name when print aggregate-field-names is "off"
+ # Test that composite type[] is expanded without field name when print
+ # aggregate-field-names is "off"
self.runCmd("-var-create var4 * complx_array")
- self.expect("\^done,name=\"var4\",numchild=\"2\",value=\"{{4,\{4\},0x[0-9a-f]+},{5,\{5\},0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var4\",numchild=\"2\",value=\"{{4,\{4\},0x[0-9a-f]+},{5,\{5\},0x[0-9a-f]+}}\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
- # Test that -gdb-set print aggregate-field-names fails if "on"/"off" isn't specified
+ # Test that -gdb-set print aggregate-field-names fails if "on"/"off"
+ # isn't specified
self.runCmd("-gdb-set print aggregate-field-names")
- self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
+ self.expect(
+ "\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
- # Test that -gdb-set print aggregate-field-names fails when option is unknown
+ # Test that -gdb-set print aggregate-field-names fails when option is
+ # unknown
self.runCmd("-gdb-set print aggregate-field-names unknown")
- self.expect("\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
+ self.expect(
+ "\^error,msg=\"The request ''print' expects option-name and \"on\" or \"off\"' failed.\"")
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-mi/variable/TestMiVar.py Tue Sep 6 15:57:50 2016
@@ -5,22 +5,22 @@ Test lldb-mi -var-xxx commands.
from __future__ import print_function
-
import lldbmi_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class MiVarTestCase(lldbmi_testcase.MiTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_eval(self):
"""Test that 'lldb-mi --interpreter' works for evaluating."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -36,15 +36,18 @@ class MiVarTestCase(lldbmi_testcase.MiTe
# Print non-existant variable
self.runCmd("-var-create var1 * undef")
- self.expect("\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"")
+ self.expect(
+ "\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"")
self.runCmd("-data-evaluate-expression undef")
- self.expect("\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"")
+ self.expect(
+ "\^error,msg=\"error: use of undeclared identifier \'undef\'\\\\n\"")
# Print global "g_MyVar", modify, delete and create again
self.runCmd("-data-evaluate-expression g_MyVar")
self.expect("\^done,value=\"3\"")
self.runCmd("-var-create var2 * g_MyVar")
- self.expect("\^done,name=\"var2\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var2\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
self.runCmd("-var-evaluate-expression var2")
self.expect("\^done,value=\"3\"")
self.runCmd("-var-show-attributes var2")
@@ -57,17 +60,20 @@ class MiVarTestCase(lldbmi_testcase.MiTe
self.runCmd("-data-evaluate-expression \"g_MyVar=30\"")
self.expect("\^done,value=\"30\"")
self.runCmd("-var-update --all-values var2")
- #self.expect("\^done,changelist=\[\{name=\"var2\",value=\"30\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work
+ # self.expect("\^done,changelist=\[\{name=\"var2\",value=\"30\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
+ # #FIXME -var-update doesn't work
self.runCmd("-var-delete var2")
self.expect("\^done")
self.runCmd("-var-create var2 * g_MyVar")
- self.expect("\^done,name=\"var2\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var2\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
# Print static "s_MyVar", modify, delete and create again
self.runCmd("-data-evaluate-expression s_MyVar")
self.expect("\^done,value=\"30\"")
self.runCmd("-var-create var3 * s_MyVar")
- self.expect("\^done,name=\"var3\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var3\",numchild=\"0\",value=\"30\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
self.runCmd("-var-evaluate-expression var3")
self.expect("\^done,value=\"30\"")
self.runCmd("-var-show-attributes var3")
@@ -77,17 +83,20 @@ class MiVarTestCase(lldbmi_testcase.MiTe
self.runCmd("-data-evaluate-expression \"s_MyVar=3\"")
self.expect("\^done,value=\"3\"")
self.runCmd("-var-update --all-values var3")
- #self.expect("\^done,changelist=\[\{name=\"var3\",value=\"3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work
+ # self.expect("\^done,changelist=\[\{name=\"var3\",value=\"3\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
+ # #FIXME -var-update doesn't work
self.runCmd("-var-delete var3")
self.expect("\^done")
self.runCmd("-var-create var3 * s_MyVar")
- self.expect("\^done,name=\"var3\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var3\",numchild=\"0\",value=\"3\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
# Print local "b", modify, delete and create again
self.runCmd("-data-evaluate-expression b")
self.expect("\^done,value=\"20\"")
self.runCmd("-var-create var4 * b")
- self.expect("\^done,name=\"var4\",numchild=\"0\",value=\"20\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var4\",numchild=\"0\",value=\"20\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
self.runCmd("-var-evaluate-expression var4")
self.expect("\^done,value=\"20\"")
self.runCmd("-var-show-attributes var4")
@@ -97,44 +106,55 @@ class MiVarTestCase(lldbmi_testcase.MiTe
self.runCmd("-data-evaluate-expression \"b=2\"")
self.expect("\^done,value=\"2\"")
self.runCmd("-var-update --all-values var4")
- #self.expect("\^done,changelist=\[\{name=\"var4\",value=\"2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]") #FIXME -var-update doesn't work
+ # self.expect("\^done,changelist=\[\{name=\"var4\",value=\"2\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
+ # #FIXME -var-update doesn't work
self.runCmd("-var-delete var4")
self.expect("\^done")
self.runCmd("-var-create var4 * b")
- self.expect("\^done,name=\"var4\",numchild=\"0\",value=\"2\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var4\",numchild=\"0\",value=\"2\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
# Print temp "a + b"
self.runCmd("-data-evaluate-expression \"a + b\"")
self.expect("\^done,value=\"12\"")
self.runCmd("-var-create var5 * \"a + b\"")
- self.expect("\^done,name=\"var5\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var5\",numchild=\"0\",value=\"12\",type=\"int\",thread-id=\"1\",has_more=\"0\"")
self.runCmd("-var-evaluate-expression var5")
self.expect("\^done,value=\"12\"")
self.runCmd("-var-show-attributes var5")
- self.expect("\^done,status=\"editable\"") #FIXME editable or not?
+ self.expect("\^done,status=\"editable\"") # FIXME editable or not?
self.runCmd("-var-list-children var5")
self.expect("\^done,numchild=\"0\",has_more=\"0\"")
# Print argument "argv[0]"
self.runCmd("-data-evaluate-expression \"argv[0]\"")
- self.expect("\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" % self.myexe)
+ self.expect(
+ "\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" %
+ self.myexe)
self.runCmd("-var-create var6 * \"argv[0]\"")
- self.expect("\^done,name=\"var6\",numchild=\"1\",value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\",type=\"const char \*\",thread-id=\"1\",has_more=\"0\"" % self.myexe)
+ self.expect(
+ "\^done,name=\"var6\",numchild=\"1\",value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\",type=\"const char \*\",thread-id=\"1\",has_more=\"0\"" %
+ self.myexe)
self.runCmd("-var-evaluate-expression var6")
- self.expect("\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" % self.myexe)
+ self.expect(
+ "\^done,value=\"0x[0-9a-f]+ \\\\\\\".*?%s\\\\\\\"\"" %
+ self.myexe)
self.runCmd("-var-show-attributes var6")
self.expect("\^done,status=\"editable\"")
self.runCmd("-var-list-children --all-values var6")
# FIXME: The name below is not correct. It should be "var.*argv[0]".
- self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var6\.\*\$[0-9]+\",exp=\"\*\$[0-9]+\",numchild=\"0\",type=\"const char\",thread-id=\"4294967295\",value=\"47 '/'\",has_more=\"0\"\}\],has_more=\"0\"") #FIXME -var-list-children shows invalid thread-id
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ # FIXME -var-list-children shows invalid thread-id
+ self.expect(
+ "\^done,numchild=\"1\",children=\[child=\{name=\"var6\.\*\$[0-9]+\",exp=\"\*\$[0-9]+\",numchild=\"0\",type=\"const char\",thread-id=\"4294967295\",value=\"47 '/'\",has_more=\"0\"\}\],has_more=\"0\"")
+
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_var_update(self):
"""Test that 'lldb-mi --interpreter' works for -var-update."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -150,11 +170,14 @@ class MiVarTestCase(lldbmi_testcase.MiTe
# Setup variables
self.runCmd("-var-create var_l * l")
- self.expect("\^done,name=\"var_l\",numchild=\"0\",value=\"1\",type=\"long\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var_l\",numchild=\"0\",value=\"1\",type=\"long\",thread-id=\"1\",has_more=\"0\"")
self.runCmd("-var-create var_complx * complx")
- self.expect("\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
self.runCmd("-var-create var_complx_array * complx_array")
- self.expect("\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
# Go to BP_var_update_test_l
line = line_number('main.cpp', '// BP_var_update_test_l')
@@ -166,7 +189,8 @@ class MiVarTestCase(lldbmi_testcase.MiTe
# Test that var_l was updated
self.runCmd("-var-update --all-values var_l")
- self.expect("\^done,changelist=\[\{name=\"var_l\",value=\"0\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
+ self.expect(
+ "\^done,changelist=\[\{name=\"var_l\",value=\"0\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
# Go to BP_var_update_test_complx
line = line_number('main.cpp', '// BP_var_update_test_complx')
@@ -178,7 +202,8 @@ class MiVarTestCase(lldbmi_testcase.MiTe
# Test that var_complx was updated
self.runCmd("-var-update --all-values var_complx")
- self.expect("\^done,changelist=\[\{name=\"var_complx\",value=\"\{\.\.\.\}\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
+ self.expect(
+ "\^done,changelist=\[\{name=\"var_complx\",value=\"\{\.\.\.\}\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
# Go to BP_var_update_test_complx_array
line = line_number('main.cpp', '// BP_var_update_test_complx_array')
@@ -190,14 +215,15 @@ class MiVarTestCase(lldbmi_testcase.MiTe
# Test that var_complex_array was updated
self.runCmd("-var-update --all-values var_complx_array")
- self.expect("\^done,changelist=\[\{name=\"var_complx_array\",value=\"\[2\]\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
+ self.expect(
+ "\^done,changelist=\[\{name=\"var_complx_array\",value=\"\[2\]\",in_scope=\"true\",type_changed=\"false\",has_more=\"0\"\}\]")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
def test_lldbmi_var_create_register(self):
"""Test that 'lldb-mi --interpreter' works for -var-create $regname."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -218,26 +244,29 @@ class MiVarTestCase(lldbmi_testcase.MiTe
# Create variable for register 0
# Note that message is different in Darwin and Linux:
# Darwin: "^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned long\",thread-id=\"1\",has_more=\"0\"
- # Linux: "^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned int\",thread-id=\"1\",has_more=\"0\"
+ # Linux:
+ # "^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned
+ # int\",thread-id=\"1\",has_more=\"0\"
self.runCmd("-var-create var_reg * $%s" % register_name)
- self.expect("\^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned (long|int)\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var_reg\",numchild=\"0\",value=\"0x[0-9a-f]+\",type=\"unsigned (long|int)\",thread-id=\"1\",has_more=\"0\"")
# Assign value to variable
self.runCmd("-var-assign var_reg \"6\"")
- #FIXME: the output has different format for 32bit and 64bit values
+ # FIXME: the output has different format for 32bit and 64bit values
self.expect("\^done,value=\"0x0*?6\"")
# Assert register 0 updated
self.runCmd("-data-list-register-values d 0")
self.expect("\^done,register-values=\[{number=\"0\",value=\"6\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi tests working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi tests working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_var_list_children(self):
"""Test that 'lldb-mi --interpreter' works for -var-list-children."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -253,13 +282,17 @@ class MiVarTestCase(lldbmi_testcase.MiTe
# Create variable
self.runCmd("-var-create var_complx * complx")
- self.expect("\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var_complx\",numchild=\"3\",value=\"\{\.\.\.\}\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"")
self.runCmd("-var-create var_complx_array * complx_array")
- self.expect("\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var_complx_array\",numchild=\"2\",value=\"\[2\]\",type=\"complex_type \[2\]\",thread-id=\"1\",has_more=\"0\"")
self.runCmd("-var-create var_pcomplx * pcomplx")
- self.expect("\^done,name=\"var_pcomplx\",numchild=\"2\",value=\"\{\.\.\.\}\",type=\"pcomplex_type\",thread-id=\"1\",has_more=\"0\"")
+ self.expect(
+ "\^done,name=\"var_pcomplx\",numchild=\"2\",value=\"\{\.\.\.\}\",type=\"pcomplex_type\",thread-id=\"1\",has_more=\"0\"")
- # Test that -var-evaluate-expression can evaluate the children of created varobj
+ # Test that -var-evaluate-expression can evaluate the children of
+ # created varobj
self.runCmd("-var-list-children var_complx")
self.runCmd("-var-evaluate-expression var_complx.i")
self.expect("\^done,value=\"3\"")
@@ -284,35 +317,46 @@ class MiVarTestCase(lldbmi_testcase.MiTe
self.runCmd("-var-list-children --all-values var_complx")
self.expect("\^done,numchild=\"3\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",value=\"3\",has_more=\"0\"\},child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\},child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",value=\"0x[0-9a-f]+\",has_more=\"0\"\}\],has_more=\"0\"")
self.runCmd("-var-list-children --simple-values var_complx_array")
- self.expect("\^done,numchild=\"2\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
+ self.expect(
+ "\^done,numchild=\"2\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
self.runCmd("-var-list-children 0 var_pcomplx")
self.expect("\^done,numchild=\"2\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\},child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
# Test that -var-list-children lists children without values
self.runCmd("-var-list-children 0 var_complx 0 1")
- self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
+ self.expect(
+ "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
self.runCmd("-var-list-children --no-values var_complx 0 1")
- self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
+ self.expect(
+ "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.i\",exp=\"i\",numchild=\"0\",type=\"int\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
self.runCmd("-var-list-children --no-values var_complx_array 0 1")
- self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
+ self.expect(
+ "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx_array\.\[0\]\",exp=\"\[0\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
self.runCmd("-var-list-children --no-values var_pcomplx 0 1")
- self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
+ self.expect(
+ "\^done,numchild=\"1\",children=\[child=\{name=\"var_pcomplx\.complex_type\",exp=\"complex_type\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"1\"")
# Test that -var-list-children lists children with all values
self.runCmd("-var-list-children 1 var_complx 1 2")
- self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"")
+ self.expect(
+ "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"")
self.runCmd("-var-list-children --all-values var_complx 1 2")
- self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"")
+ self.expect(
+ "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.inner\",exp=\"inner\",numchild=\"1\",type=\"complex_type::\(anonymous struct\)\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"1\"")
self.runCmd("-var-list-children --all-values var_complx_array 1 2")
- self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"0\"")
+ self.expect(
+ "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx_array\.\[1\]\",exp=\"\[1\]\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"0\"")
self.runCmd("-var-list-children --all-values var_pcomplx 1 2")
- self.expect("\^done,numchild=\"1\",children=\[child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"0\"")
+ self.expect(
+ "\^done,numchild=\"1\",children=\[child={name=\"var_pcomplx\.complx\",exp=\"complx\",numchild=\"3\",type=\"complex_type\",thread-id=\"1\",value=\"\{\.\.\.\}\",has_more=\"0\"\}\],has_more=\"0\"")
# Test that -var-list-children lists children with simple values
self.runCmd("-var-list-children 2 var_complx 2 4")
- self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
+ self.expect(
+ "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
self.runCmd("-var-list-children --simple-values var_complx 2 4")
- self.expect("\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
+ self.expect(
+ "\^done,numchild=\"1\",children=\[child=\{name=\"var_complx\.complex_ptr\",exp=\"complex_ptr\",numchild=\"3\",type=\"complex_type \*\",thread-id=\"1\",has_more=\"0\"\}\],has_more=\"0\"")
self.runCmd("-var-list-children --simple-values var_complx_array 2 4")
self.expect("\^done,numchild=\"0\",has_more=\"0\"")
self.runCmd("-var-list-children --simple-values var_pcomplx 2 4")
@@ -330,15 +374,16 @@ class MiVarTestCase(lldbmi_testcase.MiTe
# Test that a missing low-frame or high-frame is handled
self.runCmd("-var-list-children 0 var_complx 0")
- self.expect("\^error,msg=\"Command 'var-list-children'. Variable children range invalid\"")
+ self.expect(
+ "\^error,msg=\"Command 'var-list-children'. Variable children range invalid\"")
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_var_create_for_stl_types(self):
"""Test that 'lldb-mi --interpreter' print summary for STL types."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -354,15 +399,16 @@ class MiVarTestCase(lldbmi_testcase.MiTe
# Test for std::string
self.runCmd("-var-create - * std_string")
- self.expect('\^done,name="var\d+",numchild="[0-9]+",value="\\\\"hello\\\\"",type="std::[\S]*?string",thread-id="1",has_more="0"')
-
- @skipIfWindows #llvm.org/pr24452: Get lldb-mi working on Windows
- @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
- @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
+ self.expect(
+ '\^done,name="var\d+",numchild="[0-9]+",value="\\\\"hello\\\\"",type="std::[\S]*?string",thread-id="1",has_more="0"')
+
+ @skipIfWindows # llvm.org/pr24452: Get lldb-mi working on Windows
+ @skipIfFreeBSD # llvm.org/pr22411: Failure presumably due to known thread races
+ @skipIfLinux # llvm.org/pr22841: lldb-mi tests fail on all Linux buildbots
def test_lldbmi_var_create_for_unnamed_objects(self):
"""Test that 'lldb-mi --interpreter' can expand unnamed structures and unions."""
- self.spawnLldbMi(args = None)
+ self.spawnLldbMi(args=None)
# Load executable
self.runCmd("-file-exec-and-symbols %s" % self.myexe)
@@ -378,15 +424,16 @@ class MiVarTestCase(lldbmi_testcase.MiTe
# Evaluate struct_with_unions type and its children
self.runCmd("-var-create v0 * swu")
- self.expect('\^done,name="v0",numchild="2",value="\{\.\.\.\}",type="struct_with_unions",thread-id="1",has_more="0"')
-
+ self.expect(
+ '\^done,name="v0",numchild="2",value="\{\.\.\.\}",type="struct_with_unions",thread-id="1",has_more="0"')
+
self.runCmd("-var-list-children v0")
-
+
# inspect the first unnamed union
self.runCmd("-var-list-children v0.$0")
self.runCmd("-var-evaluate-expression v0.$0.u_i")
self.expect('\^done,value="1"')
-
+
# inspect the second unnamed union
self.runCmd("-var-list-children v0.$1")
self.runCmd("-var-evaluate-expression v0.$1.u1")
@@ -395,4 +442,3 @@ class MiVarTestCase(lldbmi_testcase.MiTe
self.runCmd("-var-list-children v0.$1.$1")
self.runCmd("-var-evaluate-expression v0.$1.$1.s1")
self.expect('\^done,value="-1"')
-
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAttach.py Tue Sep 6 15:57:50 2016
@@ -1,35 +1,40 @@
from __future__ import print_function
-
import gdbremote_testcase
import lldbgdbserverutils
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestGdbRemoteAttach(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
def attach_with_vAttach(self):
# Start the inferior, start the debug monitor, nothing is attached yet.
- procs = self.prep_debug_monitor_and_inferior(inferior_args=["sleep:60"])
+ procs = self.prep_debug_monitor_and_inferior(
+ inferior_args=["sleep:60"])
self.assertIsNotNone(procs)
# Make sure the target process has been launched.
inferior = procs.get("inferior")
self.assertIsNotNone(inferior)
self.assertTrue(inferior.pid > 0)
- self.assertTrue(lldbgdbserverutils.process_is_running(inferior.pid, True))
+ self.assertTrue(
+ lldbgdbserverutils.process_is_running(
+ inferior.pid, True))
# Add attach packets.
self.test_sequence.add_log_lines([
# Do the attach.
"read packet: $vAttach;{:x}#00".format(inferior.pid),
# Expect a stop notification from the attach.
- { "direction":"send", "regex":r"^\$T([0-9a-fA-F]{2})[^#]*#[0-9a-fA-F]{2}$", "capture":{1:"stop_signal_hex"} },
- ], True)
+ {"direction": "send",
+ "regex": r"^\$T([0-9a-fA-F]{2})[^#]*#[0-9a-fA-F]{2}$",
+ "capture": {1: "stop_signal_hex"}},
+ ], True)
self.add_process_info_collection_packets()
# Run the stream
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteAuxvSupport.py Tue Sep 6 15:57:50 2016
@@ -1,12 +1,12 @@
from __future__ import print_function
-
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestGdbRemoteAuxvSupport(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@@ -15,7 +15,8 @@ class TestGdbRemoteAuxvSupport(gdbremote
def has_auxv_support(self):
inferior_args = ["message:main entered", "sleep:5"]
- procs = self.prep_debug_monitor_and_inferior(inferior_args=inferior_args)
+ procs = self.prep_debug_monitor_and_inferior(
+ inferior_args=inferior_args)
# Don't do anything until we match the launched inferior main entry output.
# Then immediately interrupt the process.
@@ -25,8 +26,9 @@ class TestGdbRemoteAuxvSupport(gdbremote
# Start the inferior...
"read packet: $c#63",
# ... match output....
- { "type":"output_match", "regex":self.maybe_strict_output_regex(r"message:main entered\r\n") },
- ], True)
+ {"type": "output_match", "regex": self.maybe_strict_output_regex(
+ r"message:main entered\r\n")},
+ ], True)
# ... then interrupt.
self.add_interrupt_packets()
self.add_qSupported_packets()
@@ -35,7 +37,8 @@ class TestGdbRemoteAuxvSupport(gdbremote
self.assertIsNotNone(context)
features = self.parse_qSupported_response(context)
- return self.AUXV_SUPPORT_FEATURE_NAME in features and features[self.AUXV_SUPPORT_FEATURE_NAME] == "+"
+ return self.AUXV_SUPPORT_FEATURE_NAME in features and features[
+ self.AUXV_SUPPORT_FEATURE_NAME] == "+"
def get_raw_auxv_data(self):
# Start up llgs and inferior, and check for auxv support.
@@ -60,10 +63,20 @@ class TestGdbRemoteAuxvSupport(gdbremote
# Grab the auxv data.
self.reset_test_sequence()
- self.test_sequence.add_log_lines([
- "read packet: $qXfer:auxv:read::{:x},{:x}:#00".format(OFFSET, LENGTH),
- {"direction":"send", "regex":re.compile(r"^\$([^E])(.*)#[0-9a-fA-F]{2}$", re.MULTILINE|re.DOTALL), "capture":{1:"response_type", 2:"content_raw"} }
- ], True)
+ self.test_sequence.add_log_lines(
+ [
+ "read packet: $qXfer:auxv:read::{:x},{:x}:#00".format(
+ OFFSET,
+ LENGTH),
+ {
+ "direction": "send",
+ "regex": re.compile(
+ r"^\$([^E])(.*)#[0-9a-fA-F]{2}$",
+ re.MULTILINE | re.DOTALL),
+ "capture": {
+ 1: "response_type",
+ 2: "content_raw"}}],
+ True)
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
@@ -101,8 +114,9 @@ class TestGdbRemoteAuxvSupport(gdbremote
(word_size, auxv_data) = self.get_raw_auxv_data()
self.assertIsNotNone(auxv_data)
- # Ensure auxv data is a multiple of 2*word_size (there should be two unsigned long fields per auxv entry).
- self.assertEqual(len(auxv_data) % (2*word_size), 0)
+ # Ensure auxv data is a multiple of 2*word_size (there should be two
+ # unsigned long fields per auxv entry).
+ self.assertEqual(len(auxv_data) % (2 * word_size), 0)
# print("auxv contains {} entries".format(len(auxv_data) / (2*word_size)))
@debugserver_test
@@ -179,10 +193,12 @@ class TestGdbRemoteAuxvSupport(gdbremote
auxv_dict = self.build_auxv_dict(endian, word_size, auxv_data)
self.assertIsNotNone(auxv_dict)
- iterated_auxv_data = self.read_binary_data_in_chunks("qXfer:auxv:read::", 2*word_size)
+ iterated_auxv_data = self.read_binary_data_in_chunks(
+ "qXfer:auxv:read::", 2 * word_size)
self.assertIsNotNone(iterated_auxv_data)
- auxv_dict_iterated = self.build_auxv_dict(endian, word_size, iterated_auxv_data)
+ auxv_dict_iterated = self.build_auxv_dict(
+ endian, word_size, iterated_auxv_data)
self.assertIsNotNone(auxv_dict_iterated)
# Verify both types of data collection returned same content.
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteExpeditedRegisters.py Tue Sep 6 15:57:50 2016
@@ -1,13 +1,14 @@
from __future__ import print_function
-
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-class TestGdbRemoteExpeditedRegisters(gdbremote_testcase.GdbRemoteTestCaseBase):
+
+class TestGdbRemoteExpeditedRegisters(
+ gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@@ -19,8 +20,11 @@ class TestGdbRemoteExpeditedRegisters(gd
"read packet: $c#63",
# Immediately tell it to stop. We want to see what it reports.
"read packet: {}".format(chr(3)),
- {"direction":"send", "regex":r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", "capture":{1:"stop_result", 2:"key_vals_text"} },
- ], True)
+ {"direction": "send",
+ "regex": r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$",
+ "capture": {1: "stop_result",
+ 2: "key_vals_text"}},
+ ], True)
# Run the gdb remote command stream.
context = self.expect_gdbremote_sequence()
@@ -30,13 +34,16 @@ class TestGdbRemoteExpeditedRegisters(gd
key_vals_text = context.get("key_vals_text")
self.assertIsNotNone(key_vals_text)
- expedited_registers = self.extract_registers_from_stop_notification(key_vals_text)
+ expedited_registers = self.extract_registers_from_stop_notification(
+ key_vals_text)
self.assertIsNotNone(expedited_registers)
return expedited_registers
- def stop_notification_contains_generic_register(self, generic_register_name):
- # Generate a stop reply, parse out expedited registers from stop notification.
+ def stop_notification_contains_generic_register(
+ self, generic_register_name):
+ # Generate a stop reply, parse out expedited registers from stop
+ # notification.
expedited_registers = self.gather_expedited_registers()
self.assertIsNotNone(expedited_registers)
self.assertTrue(len(expedited_registers) > 0)
@@ -45,7 +52,8 @@ class TestGdbRemoteExpeditedRegisters(gd
reg_infos = self.gather_register_infos()
# Find the generic register.
- reg_info = self.find_generic_register_with_name(reg_infos, generic_register_name)
+ reg_info = self.find_generic_register_with_name(
+ reg_infos, generic_register_name)
self.assertIsNotNone(reg_info)
# Ensure the expedited registers contained it.
@@ -53,7 +61,8 @@ class TestGdbRemoteExpeditedRegisters(gd
# print("{} reg_info:{}".format(generic_register_name, reg_info))
def stop_notification_contains_any_registers(self):
- # Generate a stop reply, parse out expedited registers from stop notification.
+ # Generate a stop reply, parse out expedited registers from stop
+ # notification.
expedited_registers = self.gather_expedited_registers()
# Verify we have at least one expedited register.
self.assertTrue(len(expedited_registers) > 0)
@@ -73,15 +82,19 @@ class TestGdbRemoteExpeditedRegisters(gd
self.stop_notification_contains_any_registers()
def stop_notification_contains_no_duplicate_registers(self):
- # Generate a stop reply, parse out expedited registers from stop notification.
+ # Generate a stop reply, parse out expedited registers from stop
+ # notification.
expedited_registers = self.gather_expedited_registers()
# Verify no expedited register was specified multiple times.
for (reg_num, value) in list(expedited_registers.items()):
- if (type(value) == list) and (len(value) > 0):
- self.fail("expedited register number {} specified more than once ({} times)".format(reg_num, len(value)))
+ if (isinstance(value, list)) and (len(value) > 0):
+ self.fail(
+ "expedited register number {} specified more than once ({} times)".format(
+ reg_num, len(value)))
@debugserver_test
- def test_stop_notification_contains_no_duplicate_registers_debugserver(self):
+ def test_stop_notification_contains_no_duplicate_registers_debugserver(
+ self):
self.init_debugserver_test()
self.build()
self.set_inferior_startup_launch()
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py Tue Sep 6 15:57:50 2016
@@ -1,13 +1,13 @@
from __future__ import print_function
-
import gdbremote_testcase
import lldbgdbserverutils
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestGdbRemoteKill(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@@ -16,18 +16,20 @@ class TestGdbRemoteKill(gdbremote_testca
procs = self.prep_debug_monitor_and_inferior()
self.test_sequence.add_log_lines([
"read packet: $k#6b",
- {"direction":"send", "regex":r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" },
- ], True)
+ {"direction": "send", "regex": r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}"},
+ ], True)
if self.stub_sends_two_stop_notifications_on_kill:
- # Add an expectation for a second X result for stubs that send two of these.
+ # Add an expectation for a second X result for stubs that send two
+ # of these.
self.test_sequence.add_log_lines([
- {"direction":"send", "regex":r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}" },
- ], True)
+ {"direction": "send", "regex": r"^\$X[0-9a-fA-F]+([^#]*)#[0-9A-Fa-f]{2}"},
+ ], True)
self.expect_gdbremote_sequence()
- # Wait a moment for completed and now-detached inferior process to clear.
+ # Wait a moment for completed and now-detached inferior process to
+ # clear.
time.sleep(1)
if not lldb.remote_platform:
@@ -35,8 +37,11 @@ class TestGdbRemoteKill(gdbremote_testca
poll_result = procs["inferior"].poll()
self.assertIsNotNone(poll_result)
- # Where possible, verify at the system level that the process is not running.
- self.assertFalse(lldbgdbserverutils.process_is_running(procs["inferior"].pid, False))
+ # Where possible, verify at the system level that the process is not
+ # running.
+ self.assertFalse(
+ lldbgdbserverutils.process_is_running(
+ procs["inferior"].pid, False))
@debugserver_test
def test_attach_commandline_kill_after_initial_stop_debugserver(self):
@@ -51,4 +56,3 @@ class TestGdbRemoteKill(gdbremote_testca
self.build()
self.set_inferior_startup_attach()
self.attach_commandline_kill_after_initial_stop()
-
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteProcessInfo.py Tue Sep 6 15:57:50 2016
@@ -9,6 +9,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestGdbRemoteProcessInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@@ -52,7 +53,7 @@ class TestGdbRemoteProcessInfo(gdbremote
self.add_process_info_collection_packets()
# Run the stream
- context = self.expect_gdbremote_sequence(timeout_seconds = 8)
+ context = self.expect_gdbremote_sequence(timeout_seconds=8)
self.assertIsNotNone(context)
# Gather process info response
@@ -66,7 +67,8 @@ class TestGdbRemoteProcessInfo(gdbremote
self.assertEqual(reported_pid, procs["inferior"].pid)
@debugserver_test
- def test_attach_commandline_qProcessInfo_reports_correct_pid_debugserver(self):
+ def test_attach_commandline_qProcessInfo_reports_correct_pid_debugserver(
+ self):
self.init_debugserver_test()
self.build()
self.set_inferior_startup_attach()
@@ -120,13 +122,17 @@ class TestGdbRemoteProcessInfo(gdbremote
process_info = self.parse_process_info_response(context)
self.assertIsNotNone(process_info)
- # Ensure the expected keys are present and non-None within the process info.
+ # Ensure the expected keys are present and non-None within the process
+ # info.
missing_key_set = set()
for expected_key in expected_key_set:
if expected_key not in process_info:
missing_key_set.add(expected_key)
- self.assertEqual(missing_key_set, set(), "the listed keys are missing in the qProcessInfo result")
+ self.assertEqual(
+ missing_key_set,
+ set(),
+ "the listed keys are missing in the qProcessInfo result")
def qProcessInfo_does_not_contain_keys(self, absent_key_set):
procs = self.prep_debug_monitor_and_inferior()
@@ -146,7 +152,10 @@ class TestGdbRemoteProcessInfo(gdbremote
if unexpected_key in process_info:
unexpected_key_set.add(unexpected_key)
- self.assertEqual(unexpected_key_set, set(), "the listed keys were present but unexpected in qProcessInfo result")
+ self.assertEqual(
+ unexpected_key_set,
+ set(),
+ "the listed keys were present but unexpected in qProcessInfo result")
@skipUnlessDarwin
@debugserver_test
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteRegisterState.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteRegisterState.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteRegisterState.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteRegisterState.py Tue Sep 6 15:57:50 2016
@@ -1,12 +1,12 @@
from __future__ import print_function
-
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestGdbRemoteRegisterState(gdbremote_testcase.GdbRemoteTestCaseBase):
"""Test QSaveRegisterState/QRestoreRegisterState support."""
@@ -15,7 +15,8 @@ class TestGdbRemoteRegisterState(gdbremo
def grp_register_save_restore_works(self, with_suffix):
# Start up the process, use thread suffix, grab main thread id.
inferior_args = ["message:main entered", "sleep:5"]
- procs = self.prep_debug_monitor_and_inferior(inferior_args=inferior_args)
+ procs = self.prep_debug_monitor_and_inferior(
+ inferior_args=inferior_args)
self.add_process_info_collection_packets()
self.add_register_info_collection_packets()
@@ -26,8 +27,9 @@ class TestGdbRemoteRegisterState(gdbremo
# Start the inferior...
"read packet: $c#63",
# ... match output....
- { "type":"output_match", "regex":self.maybe_strict_output_regex(r"message:main entered\r\n") },
- ], True)
+ {"type": "output_match", "regex": self.maybe_strict_output_regex(
+ r"message:main entered\r\n")},
+ ], True)
# ... then interrupt.
self.add_interrupt_packets()
@@ -44,8 +46,10 @@ class TestGdbRemoteRegisterState(gdbremo
self.assertIsNotNone(reg_infos)
self.add_lldb_register_index(reg_infos)
- # Pull out the register infos that we think we can bit flip successfully.
- gpr_reg_infos = [reg_info for reg_info in reg_infos if self.is_bit_flippable_register(reg_info)]
+ # Pull out the register infos that we think we can bit flip
+ # successfully.
+ gpr_reg_infos = [
+ reg_info for reg_info in reg_infos if self.is_bit_flippable_register(reg_info)]
self.assertTrue(len(gpr_reg_infos) > 0)
# Gather thread info.
@@ -71,15 +75,18 @@ class TestGdbRemoteRegisterState(gdbremo
# print("saved register state id: {}".format(state_id))
# Remember initial register values.
- initial_reg_values = self.read_register_values(gpr_reg_infos, endian, thread_id=thread_id)
+ initial_reg_values = self.read_register_values(
+ gpr_reg_infos, endian, thread_id=thread_id)
# print("initial_reg_values: {}".format(initial_reg_values))
# Flip gpr register values.
- (successful_writes, failed_writes) = self.flip_all_bits_in_each_register_value(gpr_reg_infos, endian, thread_id=thread_id)
+ (successful_writes, failed_writes) = self.flip_all_bits_in_each_register_value(
+ gpr_reg_infos, endian, thread_id=thread_id)
# print("successful writes: {}, failed writes: {}".format(successful_writes, failed_writes))
self.assertTrue(successful_writes > 0)
- flipped_reg_values = self.read_register_values(gpr_reg_infos, endian, thread_id=thread_id)
+ flipped_reg_values = self.read_register_values(
+ gpr_reg_infos, endian, thread_id=thread_id)
# print("flipped_reg_values: {}".format(flipped_reg_values))
# Restore register values.
@@ -90,7 +97,8 @@ class TestGdbRemoteRegisterState(gdbremo
self.assertIsNotNone(context)
# Verify registers match initial register values.
- final_reg_values = self.read_register_values(gpr_reg_infos, endian, thread_id=thread_id)
+ final_reg_values = self.read_register_values(
+ gpr_reg_infos, endian, thread_id=thread_id)
# print("final_reg_values: {}".format(final_reg_values))
self.assertIsNotNone(final_reg_values)
self.assertEqual(final_reg_values, initial_reg_values)
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteSingleStep.py Tue Sep 6 15:57:50 2016
@@ -1,12 +1,12 @@
from __future__ import print_function
-
import gdbremote_testcase
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestGdbRemoteSingleStep(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@@ -16,13 +16,24 @@ class TestGdbRemoteSingleStep(gdbremote_
self.init_debugserver_test()
self.build()
self.set_inferior_startup_launch()
- self.single_step_only_steps_one_instruction(use_Hc_packet=True, step_instruction="s")
+ self.single_step_only_steps_one_instruction(
+ use_Hc_packet=True, step_instruction="s")
@llgs_test
- @expectedFailureAndroid(bugnumber="llvm.org/pr24739", archs=["arm", "aarch64"])
- @expectedFailureAll(oslist=["linux"], archs=["arm", "aarch64"], bugnumber="llvm.org/pr24739")
+ @expectedFailureAndroid(
+ bugnumber="llvm.org/pr24739",
+ archs=[
+ "arm",
+ "aarch64"])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ "arm",
+ "aarch64"],
+ bugnumber="llvm.org/pr24739")
def test_single_step_only_steps_one_instruction_with_s_llgs(self):
self.init_llgs_test()
self.build()
self.set_inferior_startup_launch()
- self.single_step_only_steps_one_instruction(use_Hc_packet=True, step_instruction="s")
+ self.single_step_only_steps_one_instruction(
+ use_Hc_packet=True, step_instruction="s")
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteThreadsInStopReply.py Tue Sep 6 15:57:50 2016
@@ -5,7 +5,9 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
-class TestGdbRemoteThreadsInStopReply(gdbremote_testcase.GdbRemoteTestCaseBase):
+
+class TestGdbRemoteThreadsInStopReply(
+ gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@@ -16,11 +18,12 @@ class TestGdbRemoteThreadsInStopReply(gd
def gather_stop_reply_threads(self, post_startup_log_lines, thread_count):
# Set up the inferior args.
- inferior_args=[]
+ inferior_args = []
for i in range(thread_count - 1):
inferior_args.append("thread:new")
inferior_args.append("sleep:10")
- procs = self.prep_debug_monitor_and_inferior(inferior_args=inferior_args)
+ procs = self.prep_debug_monitor_and_inferior(
+ inferior_args=inferior_args)
# Assumes test_sequence has anything added needed to setup the initial state.
# (Like optionally enabling QThreadsInStopReply.)
@@ -28,17 +31,25 @@ class TestGdbRemoteThreadsInStopReply(gd
self.test_sequence.add_log_lines(post_startup_log_lines, True)
self.test_sequence.add_log_lines([
"read packet: $c#63"
- ], True)
+ ], True)
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
# Give threads time to start up, then break.
time.sleep(1)
self.reset_test_sequence()
- self.test_sequence.add_log_lines([
- "read packet: {}".format(chr(3)),
- {"direction":"send", "regex":r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", "capture":{1:"stop_result", 2:"key_vals_text"} },
- ], True)
+ self.test_sequence.add_log_lines(
+ [
+ "read packet: {}".format(
+ chr(3)),
+ {
+ "direction": "send",
+ "regex": r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$",
+ "capture": {
+ 1: "stop_result",
+ 2: "key_vals_text"}},
+ ],
+ True)
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
@@ -49,11 +60,14 @@ class TestGdbRemoteThreadsInStopReply(gd
# Run, then stop the process, grab the stop reply content.
self.reset_test_sequence()
- self.test_sequence.add_log_lines([
- "read packet: $c#63",
- "read packet: {}".format(chr(3)),
- {"direction":"send", "regex":r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", "capture":{1:"stop_result", 2:"key_vals_text"} },
- ], True)
+ self.test_sequence.add_log_lines(["read packet: $c#63",
+ "read packet: {}".format(chr(3)),
+ {"direction": "send",
+ "regex": r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$",
+ "capture": {1: "stop_result",
+ 2: "key_vals_text"}},
+ ],
+ True)
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
@@ -66,13 +80,15 @@ class TestGdbRemoteThreadsInStopReply(gd
# Pull out threads from stop response.
stop_reply_threads_text = kv_dict.get("threads")
if stop_reply_threads_text:
- return [int(thread_id, 16) for thread_id in stop_reply_threads_text.split(",")]
+ return [int(thread_id, 16)
+ for thread_id in stop_reply_threads_text.split(",")]
else:
return []
def QListThreadsInStopReply_supported(self):
procs = self.prep_debug_monitor_and_inferior()
- self.test_sequence.add_log_lines(self.ENABLE_THREADS_IN_STOP_REPLY_ENTRIES, True)
+ self.test_sequence.add_log_lines(
+ self.ENABLE_THREADS_IN_STOP_REPLY_ENTRIES, True)
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
@@ -92,8 +108,10 @@ class TestGdbRemoteThreadsInStopReply(gd
self.QListThreadsInStopReply_supported()
def stop_reply_reports_multiple_threads(self, thread_count):
- # Gather threads from stop notification when QThreadsInStopReply is enabled.
- stop_reply_threads = self.gather_stop_reply_threads(self.ENABLE_THREADS_IN_STOP_REPLY_ENTRIES, thread_count)
+ # Gather threads from stop notification when QThreadsInStopReply is
+ # enabled.
+ stop_reply_threads = self.gather_stop_reply_threads(
+ self.ENABLE_THREADS_IN_STOP_REPLY_ENTRIES, thread_count)
self.assertEqual(len(stop_reply_threads), thread_count)
@debugserver_test
@@ -111,7 +129,8 @@ class TestGdbRemoteThreadsInStopReply(gd
self.stop_reply_reports_multiple_threads(5)
def no_QListThreadsInStopReply_supplies_no_threads(self, thread_count):
- # Gather threads from stop notification when QThreadsInStopReply is not enabled.
+ # Gather threads from stop notification when QThreadsInStopReply is not
+ # enabled.
stop_reply_threads = self.gather_stop_reply_threads(None, thread_count)
self.assertEqual(len(stop_reply_threads), 0)
@@ -130,8 +149,10 @@ class TestGdbRemoteThreadsInStopReply(gd
self.no_QListThreadsInStopReply_supplies_no_threads(5)
def stop_reply_reports_correct_threads(self, thread_count):
- # Gather threads from stop notification when QThreadsInStopReply is enabled.
- stop_reply_threads = self.gather_stop_reply_threads(self.ENABLE_THREADS_IN_STOP_REPLY_ENTRIES, thread_count)
+ # Gather threads from stop notification when QThreadsInStopReply is
+ # enabled.
+ stop_reply_threads = self.gather_stop_reply_threads(
+ self.ENABLE_THREADS_IN_STOP_REPLY_ENTRIES, thread_count)
self.assertEqual(len(stop_reply_threads), thread_count)
# Gather threads from q{f,s}ThreadInfo.
@@ -144,7 +165,7 @@ class TestGdbRemoteThreadsInStopReply(gd
threads = self.parse_threadinfo_packets(context)
self.assertIsNotNone(threads)
self.assertEqual(len(threads), thread_count)
-
+
# Ensure each thread in q{f,s}ThreadInfo appears in stop reply threads
for tid in threads:
self.assertTrue(tid in stop_reply_threads)
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_qThreadStopInfo.py Tue Sep 6 15:57:50 2016
@@ -1,7 +1,6 @@
from __future__ import print_function
-
import sys
import unittest2
@@ -10,6 +9,7 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestGdbRemote_qThreadStopInfo(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
@@ -17,27 +17,36 @@ class TestGdbRemote_qThreadStopInfo(gdbr
def gather_stop_replies_via_qThreadStopInfo(self, thread_count):
# Set up the inferior args.
- inferior_args=[]
+ inferior_args = []
for i in range(thread_count - 1):
inferior_args.append("thread:new")
inferior_args.append("sleep:10")
- procs = self.prep_debug_monitor_and_inferior(inferior_args=inferior_args)
+ procs = self.prep_debug_monitor_and_inferior(
+ inferior_args=inferior_args)
# Assumes test_sequence has anything added needed to setup the initial state.
# (Like optionally enabling QThreadsInStopReply.)
self.test_sequence.add_log_lines([
"read packet: $c#63"
- ], True)
+ ], True)
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
# Give threads time to start up, then break.
time.sleep(1)
self.reset_test_sequence()
- self.test_sequence.add_log_lines([
- "read packet: {}".format(chr(3)),
- {"direction":"send", "regex":r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", "capture":{1:"stop_result", 2:"key_vals_text"} },
- ], True)
+ self.test_sequence.add_log_lines(
+ [
+ "read packet: {}".format(
+ chr(3)),
+ {
+ "direction": "send",
+ "regex": r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$",
+ "capture": {
+ 1: "stop_result",
+ 2: "key_vals_text"}},
+ ],
+ True)
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
@@ -52,10 +61,17 @@ class TestGdbRemote_qThreadStopInfo(gdbr
for thread in threads:
# Run the qThreadStopInfo command.
self.reset_test_sequence()
- self.test_sequence.add_log_lines([
- "read packet: $qThreadStopInfo{:x}#00".format(thread),
- {"direction":"send", "regex":r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$", "capture":{1:"stop_result", 2:"key_vals_text"} },
- ], True)
+ self.test_sequence.add_log_lines(
+ [
+ "read packet: $qThreadStopInfo{:x}#00".format(thread),
+ {
+ "direction": "send",
+ "regex": r"^\$T([0-9a-fA-F]+)([^#]+)#[0-9a-fA-F]{2}$",
+ "capture": {
+ 1: "stop_result",
+ 2: "key_vals_text"}},
+ ],
+ True)
context = self.expect_gdbremote_sequence()
self.assertIsNotNone(context)
@@ -65,7 +81,8 @@ class TestGdbRemote_qThreadStopInfo(gdbr
kv_dict = self.parse_key_val_dict(key_vals_text)
self.assertIsNotNone(kv_dict)
- # Verify there is a thread and that it matches the expected thread id.
+ # Verify there is a thread and that it matches the expected thread
+ # id.
kv_thread = kv_dict.get("thread")
self.assertIsNotNone(kv_thread)
kv_thread_id = int(kv_thread, 16)
@@ -99,12 +116,17 @@ class TestGdbRemote_qThreadStopInfo(gdbr
self.set_inferior_startup_launch()
self.qThreadStopInfo_works_for_multiple_threads(self.THREAD_COUNT)
- def qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(self, thread_count):
+ def qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(
+ self, thread_count):
(stop_replies, _) = self.gather_stop_replies_via_qThreadStopInfo(thread_count)
self.assertIsNotNone(stop_replies)
- no_stop_reason_count = sum(1 for stop_reason in list(stop_replies.values()) if stop_reason == 0)
- with_stop_reason_count = sum(1 for stop_reason in list(stop_replies.values()) if stop_reason != 0)
+ no_stop_reason_count = sum(
+ 1 for stop_reason in list(
+ stop_replies.values()) if stop_reason == 0)
+ with_stop_reason_count = sum(
+ 1 for stop_reason in list(
+ stop_replies.values()) if stop_reason != 0)
# All but one thread should report no stop reason.
self.assertEqual(no_stop_reason_count, thread_count - 1)
@@ -113,20 +135,25 @@ class TestGdbRemote_qThreadStopInfo(gdbr
self.assertEqual(with_stop_reason_count, 1)
@debugserver_test
- def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_debugserver(self):
+ def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_debugserver(
+ self):
self.init_debugserver_test()
self.build()
self.set_inferior_startup_launch()
- self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(self.THREAD_COUNT)
+ self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(
+ self.THREAD_COUNT)
@llgs_test
- def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_llgs(self):
+ def test_qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt_llgs(
+ self):
self.init_llgs_test()
self.build()
self.set_inferior_startup_launch()
- self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(self.THREAD_COUNT)
+ self.qThreadStopInfo_only_reports_one_thread_stop_reason_during_interrupt(
+ self.THREAD_COUNT)
- def qThreadStopInfo_has_valid_thread_names(self, thread_count, expected_thread_name):
+ def qThreadStopInfo_has_valid_thread_names(
+ self, thread_count, expected_thread_name):
(_, thread_dicts) = self.gather_stop_replies_via_qThreadStopInfo(thread_count)
self.assertIsNotNone(thread_dicts)
@@ -143,7 +170,8 @@ class TestGdbRemote_qThreadStopInfo(gdbr
self.set_inferior_startup_launch()
self.qThreadStopInfo_has_valid_thread_names(self.THREAD_COUNT, "a.out")
- @skipUnlessPlatform(["linux"]) # test requires OS with set, equal thread names by default.
+ # test requires OS with set, equal thread names by default.
+ @skipUnlessPlatform(["linux"])
@llgs_test
def test_qThreadStopInfo_has_valid_thread_names_llgs(self):
self.init_llgs_test()
Modified: lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py (original)
+++ lldb/trunk/packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemote_vCont.py Tue Sep 6 15:57:50 2016
@@ -5,13 +5,15 @@ from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import lldbutil
+
class TestGdbRemote_vCont(gdbremote_testcase.GdbRemoteTestCaseBase):
mydir = TestBase.compute_mydir(__file__)
def vCont_supports_mode(self, mode, inferior_args=None):
# Setup the stub and set the gdb remote command stream.
- procs = self.prep_debug_monitor_and_inferior(inferior_args=inferior_args)
+ procs = self.prep_debug_monitor_and_inferior(
+ inferior_args=inferior_args)
self.add_vCont_query_packets()
# Run the gdb remote command stream.
@@ -86,33 +88,58 @@ class TestGdbRemote_vCont(gdbremote_test
self.vCont_supports_S()
@debugserver_test
- def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_debugserver(self):
+ def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_debugserver(
+ self):
self.init_debugserver_test()
self.build()
self.set_inferior_startup_launch()
- self.single_step_only_steps_one_instruction(use_Hc_packet=True, step_instruction="vCont;s")
+ self.single_step_only_steps_one_instruction(
+ use_Hc_packet=True, step_instruction="vCont;s")
@llgs_test
- @expectedFailureAndroid(bugnumber="llvm.org/pr24739", archs=["arm", "aarch64"])
- @expectedFailureAll(oslist=["linux"], archs=["arm", "aarch64"], bugnumber="llvm.org/pr24739")
+ @expectedFailureAndroid(
+ bugnumber="llvm.org/pr24739",
+ archs=[
+ "arm",
+ "aarch64"])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ "arm",
+ "aarch64"],
+ bugnumber="llvm.org/pr24739")
def test_single_step_only_steps_one_instruction_with_Hc_vCont_s_llgs(self):
self.init_llgs_test()
self.build()
self.set_inferior_startup_launch()
- self.single_step_only_steps_one_instruction(use_Hc_packet=True, step_instruction="vCont;s")
+ self.single_step_only_steps_one_instruction(
+ use_Hc_packet=True, step_instruction="vCont;s")
@debugserver_test
- def test_single_step_only_steps_one_instruction_with_vCont_s_thread_debugserver(self):
+ def test_single_step_only_steps_one_instruction_with_vCont_s_thread_debugserver(
+ self):
self.init_debugserver_test()
self.build()
self.set_inferior_startup_launch()
- self.single_step_only_steps_one_instruction(use_Hc_packet=False, step_instruction="vCont;s:{thread}")
+ self.single_step_only_steps_one_instruction(
+ use_Hc_packet=False, step_instruction="vCont;s:{thread}")
@llgs_test
- @expectedFailureAndroid(bugnumber="llvm.org/pr24739", archs=["arm", "aarch64"])
- @expectedFailureAll(oslist=["linux"], archs=["arm", "aarch64"], bugnumber="llvm.org/pr24739")
- def test_single_step_only_steps_one_instruction_with_vCont_s_thread_llgs(self):
+ @expectedFailureAndroid(
+ bugnumber="llvm.org/pr24739",
+ archs=[
+ "arm",
+ "aarch64"])
+ @expectedFailureAll(
+ oslist=["linux"],
+ archs=[
+ "arm",
+ "aarch64"],
+ bugnumber="llvm.org/pr24739")
+ def test_single_step_only_steps_one_instruction_with_vCont_s_thread_llgs(
+ self):
self.init_llgs_test()
self.build()
self.set_inferior_startup_launch()
- self.single_step_only_steps_one_instruction(use_Hc_packet=False, step_instruction="vCont;s:{thread}")
+ self.single_step_only_steps_one_instruction(
+ use_Hc_packet=False, step_instruction="vCont;s:{thread}")
More information about the lldb-commits
mailing list