aboutsummaryrefslogtreecommitdiff
path: root/packages/Python/lldbsuite/test/python_api
diff options
context:
space:
mode:
Diffstat (limited to 'packages/Python/lldbsuite/test/python_api')
-rw-r--r--packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py17
-rw-r--r--packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py75
-rw-r--r--packages/Python/lldbsuite/test/python_api/debugger/TestDebuggerAPI.py2
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py15
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_address.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_block.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpoint.py3
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointlocation.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_broadcaster.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_communication.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_compileunit.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_error.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_event.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_filespec.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_frame.py6
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_function.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_instruction.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_instructionlist.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_listener.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_module.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_section.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_stringlist.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbol.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbolcontext.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_target.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_thread.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_type.py3
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_value.py23
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_valuelist.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/default-constructor/sb_watchpoint.py1
-rw-r--r--packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py33
-rw-r--r--packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py16
-rw-r--r--packages/Python/lldbsuite/test/python_api/event/TestEvents.py111
-rw-r--r--packages/Python/lldbsuite/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py4
-rw-r--r--packages/Python/lldbsuite/test/python_api/findvalue_duplist/TestSBFrameFindValue.py57
-rw-r--r--packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py447
-rw-r--r--packages/Python/lldbsuite/test/python_api/formatters/synth.py96
-rw-r--r--packages/Python/lldbsuite/test/python_api/frame/TestFrames.py51
-rw-r--r--packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py210
-rw-r--r--packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py40
-rw-r--r--packages/Python/lldbsuite/test/python_api/function_symbol/TestDisasmAPI.py39
-rw-r--r--packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py37
-rw-r--r--packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py27
-rw-r--r--packages/Python/lldbsuite/test/python_api/interpreter/TestCommandInterpreterAPI.py4
-rw-r--r--packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py17
-rw-r--r--packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py19
-rw-r--r--packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py29
-rw-r--r--packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py21
-rw-r--r--packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py28
-rw-r--r--packages/Python/lldbsuite/test/python_api/objc_type/TestObjCType.py29
-rw-r--r--packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py140
-rw-r--r--packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py105
-rw-r--r--packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py36
-rw-r--r--packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py386
-rw-r--r--packages/Python/lldbsuite/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py8
-rw-r--r--packages/Python/lldbsuite/test/python_api/sbvalue_persist/TestSBValuePersist.py38
-rw-r--r--packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py5
-rw-r--r--packages/Python/lldbsuite/test/python_api/signals/TestSignalsAPI.py26
-rw-r--r--packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py46
-rw-r--r--packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py53
-rw-r--r--packages/Python/lldbsuite/test/python_api/symbol-context/two-files/decls.h16
-rw-r--r--packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file1.cpp24
-rw-r--r--packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file2.cpp7
-rw-r--r--packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py144
-rw-r--r--packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py90
-rw-r--r--packages/Python/lldbsuite/test/python_api/type/TestTypeList.py33
-rw-r--r--packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py57
-rw-r--r--packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py173
-rw-r--r--packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py28
-rw-r--r--packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py42
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py45
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py30
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py31
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py40
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py44
-rw-r--r--packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py79
79 files changed, 2155 insertions, 1055 deletions
diff --git a/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py b/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py
index a3dd91fe8802..39975632dcb6 100644
--- a/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/breakpoint/TestBreakpointAPI.py
@@ -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.")
diff --git a/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py b/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py
index 3d9309e26cec..a9e896f2579f 100644
--- a/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py
+++ b/packages/Python/lldbsuite/test/python_api/class_members/TestSBTypeClassMembers.py
@@ -5,14 +5,15 @@ Test SBType APIs to fetch member function types.
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,63 @@ 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.assertEquals(2,
+ Derived.GetNumberOfMemberFunctions(),
+ "Derived declares two methods")
+ self.assertEquals("int", Derived.GetMemberFunctionAtIndex(0).GetType(
+ ).GetFunctionReturnType().GetName(),
+ "Derived::dImpl returns int")
+
+ self.assertEquals(4,
+ Base.GetNumberOfMemberFunctions(),
+ "Base declares three methods")
+ self.assertEquals(3, Base.GetMemberFunctionAtIndex(3).GetType(
+ ).GetFunctionArgumentTypes().GetSize(),
+ "Base::sfunc takes three arguments")
+ self.assertEquals("sfunc", Base.GetMemberFunctionAtIndex(
+ 3).GetName(), "Base::sfunc not found")
+ self.assertEquals(lldb.eMemberFunctionKindStaticMethod,
+ Base.GetMemberFunctionAtIndex(3).GetKind(),
+ "Base::sfunc is a static")
+ self.assertEquals(0, Base.GetMemberFunctionAtIndex(2).GetType(
+ ).GetFunctionArgumentTypes().GetSize(),
+ "Base::dat takes no arguments")
+ self.assertEquals("char",
+ Base.GetMemberFunctionAtIndex(1).GetType().GetFunctionArgumentTypes(
+ ).GetTypeAtIndex(1).GetName(),
+ "Base::bar takes a second 'char' argument")
+ self.assertEquals("bar",
+ Base.GetMemberFunctionAtIndex(1).GetName(), "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.assertEquals(
+ 2, Thingy.GetNumberOfMemberFunctions(),
+ "Thingy declares two methods")
+
+ self.assertEquals("id", Thingy.GetMemberFunctionAtIndex(
+ 0).GetReturnType().GetName(), "Thingy::init returns an id")
+ self.assertEquals(2,
+ Thingy.GetMemberFunctionAtIndex(1).GetNumberOfArguments(),
+ "Thingy::foo takes two arguments")
+ self.assertEquals("int",
+ Thingy.GetMemberFunctionAtIndex(1).GetArgumentTypeAtIndex(
+ 0).GetName(), "Thingy::foo takes an int")
diff --git a/packages/Python/lldbsuite/test/python_api/debugger/TestDebuggerAPI.py b/packages/Python/lldbsuite/test/python_api/debugger/TestDebuggerAPI.py
index d8ac342f4754..1cd15646f97b 100644
--- a/packages/Python/lldbsuite/test/python_api/debugger/TestDebuggerAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/debugger/TestDebuggerAPI.py
@@ -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)
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
index 3e2ff2ffa9dd..4739df000853 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py
@@ -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(TestBase):
@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(TestBase):
@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(TestBase):
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
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_address.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_address.py
index f0e979543a4c..8f9665d3a73f 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_address.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_address.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetFileAddress()
obj.GetLoadAddress(lldb.SBTarget())
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_block.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_block.py
index 3eeb24b42734..00654ca1246c 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_block.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_block.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.IsInlined()
obj.GetInlinedName()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpoint.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpoint.py
index 2c05990edae0..3bdf5879d30d 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpoint.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpoint.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
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())
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointlocation.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointlocation.py
index 2251892643b3..26bf6f69c5de 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointlocation.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_breakpointlocation.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetAddress()
obj.GetLoadAddress()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_broadcaster.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_broadcaster.py
index 27539e855cdd..b2f5ab5b2c5c 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_broadcaster.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_broadcaster.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.BroadcastEventByType(lldb.eBreakpointEventTypeInvalidType, True)
obj.BroadcastEvent(lldb.SBEvent(), False)
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_communication.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_communication.py
index d4b90840657b..9793e9be20e3 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_communication.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_communication.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
broadcaster = obj.GetBroadcaster()
# Do fuzz testing on the broadcaster obj, it should not crash lldb.
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_compileunit.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_compileunit.py
index 92755ffa395d..0c27c94b752a 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_compileunit.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_compileunit.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetFileSpec()
obj.GetNumLineEntries()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py
index e7c188f09bad..77e45c861e8d 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_debugger.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.SetAsync(True)
obj.SetAsync(False)
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_error.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_error.py
index 7e069323bf3f..9c0f8d8e6d82 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_error.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_error.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetCString()
obj.Fail()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_event.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_event.py
index c64f9ba927c2..4c24c606fa21 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_event.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_event.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetDataFlavor()
obj.GetType()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_filespec.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_filespec.py
index 3aa9235b8a16..33b4d69cd6ae 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_filespec.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_filespec.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.Exists()
obj.ResolveExecutableLocation()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_frame.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_frame.py
index 41edaff02ed7..4637fc428d8c 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_frame.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_frame.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
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()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_function.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_function.py
index fb88d37ac19c..bd9c887e50fd 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_function.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_function.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetName()
obj.GetMangledName()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instruction.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instruction.py
index b961bc389e31..e0be4132fc09 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instruction.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instruction.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetAddress()
obj.GetByteSize()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instructionlist.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instructionlist.py
index 09d62f970480..8870bf5de472 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instructionlist.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_instructionlist.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetSize()
obj.GetInstructionAtIndex(0xffffffff)
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py
index d97f2517f4bc..9c89792791f7 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_lineentry.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetStartAddress()
obj.GetEndAddress()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_listener.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_listener.py
index 0747547b9cfd..5f0ebdae73b5 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_listener.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_listener.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.AddEvent(lldb.SBEvent())
obj.StartListeningForEvents(lldb.SBBroadcaster(), 0xffffffff)
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_module.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_module.py
index 0b9aa99167af..175550a5a0fc 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_module.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_module.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetFileSpec()
obj.GetPlatformFileSpec()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py
index 40132b199580..5a3e1e6903cf 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_process.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetTarget()
obj.GetByteOrder()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_section.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_section.py
index 899130abe27d..5e25e94d017f 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_section.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_section.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.IsValid()
obj.GetName()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_stringlist.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_stringlist.py
index 9d8242c9b27d..44111addba59 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_stringlist.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_stringlist.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.AppendString("another string")
obj.AppendString(None)
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbol.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbol.py
index 4a4c67a08804..d2d107a13c2a 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbol.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbol.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetName()
obj.GetMangledName()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbolcontext.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbolcontext.py
index 01b5b7b793ea..ac4392539db1 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbolcontext.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_symbolcontext.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetModule()
obj.GetCompileUnit()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_target.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_target.py
index 3b01be3e3440..af7f17b69e7b 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_target.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_target.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetProcess()
listener = lldb.SBListener()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_thread.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_thread.py
index b69b22ea6a9f..088972532f74 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_thread.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_thread.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetStopReason()
obj.GetStopReasonDataCount()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_type.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_type.py
index 5c801c1fbf2e..6016a9004ec2 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_type.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_type.py
@@ -5,10 +5,11 @@ Fuzz tests an object after the default construction to make sure it does not cra
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)
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_value.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_value.py
index 2bb8c58e2546..f283177425a7 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_value.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_value.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
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()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_valuelist.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_valuelist.py
index 32f12f93dd81..cbd9810c44ed 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_valuelist.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_valuelist.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.Append(lldb.SBValue())
obj.GetSize()
diff --git a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_watchpoint.py b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_watchpoint.py
index f462e62ff164..b30d3bb8014d 100644
--- a/packages/Python/lldbsuite/test/python_api/default-constructor/sb_watchpoint.py
+++ b/packages/Python/lldbsuite/test/python_api/default-constructor/sb_watchpoint.py
@@ -5,6 +5,7 @@ Fuzz tests an object after the default construction to make sure it does not cra
import sys
import lldb
+
def fuzz_obj(obj):
obj.GetID()
obj.IsValid()
diff --git a/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py b/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
index 311791cca014..97261c70ec96 100644
--- a/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
+++ b/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassembleRawData.py
@@ -5,14 +5,15 @@ Use lldb Python API to disassemble raw machine code bytes
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(TestBase):
"""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(TestBase):
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")
diff --git a/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py b/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py
index f991ab329a89..1e1e4d74f416 100644
--- a/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py
+++ b/packages/Python/lldbsuite/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py
@@ -5,25 +5,29 @@ Use lldb Python API to disassemble raw machine code bytes
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
+ @skipIf(triple='^mips')
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 +59,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")
diff --git a/packages/Python/lldbsuite/test/python_api/event/TestEvents.py b/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
index 1c23f50e9d4d..e9ea0bd00879 100644
--- a/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
+++ b/packages/Python/lldbsuite/test/python_api/event/TestEvents.py
@@ -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
diff --git a/packages/Python/lldbsuite/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py b/packages/Python/lldbsuite/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py
index 49bc148dd579..9b0c1f5eaef1 100644
--- a/packages/Python/lldbsuite/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py
+++ b/packages/Python/lldbsuite/test/python_api/exprpath_synthetic/TestExprPathSynthetic.py
@@ -1,4 +1,6 @@
from lldbsuite.test import decorators
from lldbsuite.test import lldbinline
-lldbinline.MakeInlineTest(__file__, globals(), [decorators.skipIfFreeBSD,decorators.skipIfLinux,decorators.skipIfWindows])
+lldbinline.MakeInlineTest(
+ __file__, globals(), [
+ decorators.skipIfFreeBSD, decorators.skipIfLinux, decorators.skipIfWindows])
diff --git a/packages/Python/lldbsuite/test/python_api/findvalue_duplist/TestSBFrameFindValue.py b/packages/Python/lldbsuite/test/python_api/findvalue_duplist/TestSBFrameFindValue.py
index 9c1fd1e7bef7..0a0ac2d05770 100644
--- a/packages/Python/lldbsuite/test/python_api/findvalue_duplist/TestSBFrameFindValue.py
+++ b/packages/Python/lldbsuite/test/python_api/findvalue_duplist/TestSBFrameFindValue.py
@@ -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()")
diff --git a/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py b/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py
index babae237b8ce..667bd58adcee 100644
--- a/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/formatters/TestFormattersSBAPI.py
@@ -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'])
-
- foo_var = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame().FindVariable('foo')
+ 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')
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(filter.ReplaceExpressionPathAtIndex(0,"C"), "failed to replace an expression path in 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.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(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(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")
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')
diff --git a/packages/Python/lldbsuite/test/python_api/formatters/synth.py b/packages/Python/lldbsuite/test/python_api/formatters/synth.py
index 5a30c9a94bb5..33a45e9c93de 100644
--- a/packages/Python/lldbsuite/test/python_api/formatters/synth.py
+++ b/packages/Python/lldbsuite/test/python_api/formatters/synth.py
@@ -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_dict):
class Empty1SynthProvider(object):
+
def __init__(self, sbvalue, internal_dict):
self._sbvalue = sbvalue
@@ -68,6 +77,7 @@ def empty2_summary(sbvalue, internal_dict):
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))
diff --git a/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py b/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
index 0b1e12b08fcb..06ca772073ac 100644
--- a/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
+++ b/packages/Python/lldbsuite/test/python_api/frame/TestFrames.py
@@ -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)
diff --git a/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py b/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py
index 914c3d25fd5d..86585d8d02e2 100644
--- a/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py
+++ b/packages/Python/lldbsuite/test/python_api/frame/get-variables/TestGetVariables.py
@@ -5,20 +5,22 @@ Test that SBFrame::GetVariables() calls work correctly.
from __future__ import print_function
-
-import os, time
+import os
+import time
import lldb
from lldbsuite.test.decorators import *
from lldbsuite.test.lldbtest import *
from lldbsuite.test import 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)
diff --git a/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py b/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py
index ee6c33f54314..caa2696be7cd 100644
--- a/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py
+++ b/packages/Python/lldbsuite/test/python_api/frame/inlines/TestInlinedFrame.py
@@ -5,14 +5,15 @@ Testlldb Python SBFrame APIs IsInlined() and GetFunctionName().
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)])
diff --git a/packages/Python/lldbsuite/test/python_api/function_symbol/TestDisasmAPI.py b/packages/Python/lldbsuite/test/python_api/function_symbol/TestDisasmAPI.py
index 9a763b89c27f..4511da94437b 100644
--- a/packages/Python/lldbsuite/test/python_api/function_symbol/TestDisasmAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/function_symbol/TestDisasmAPI.py
@@ -5,14 +5,15 @@ Test retrieval of SBAddress from function/symbol, disassembly, and SBAddress API
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")
diff --git a/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py b/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py
index 35d73e494270..9919375abb59 100644
--- a/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/function_symbol/TestSymbolAPI.py
@@ -5,14 +5,15 @@ Test newly added SBSymbol and SBAddress 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 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())
diff --git a/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py b/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
index a8beaa903293..44dd4a618507 100644
--- a/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
+++ b/packages/Python/lldbsuite/test/python_api/hello_world/TestHelloWorld.py
@@ -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'])
diff --git a/packages/Python/lldbsuite/test/python_api/interpreter/TestCommandInterpreterAPI.py b/packages/Python/lldbsuite/test/python_api/interpreter/TestCommandInterpreterAPI.py
index d39984adb732..7f5781f5cd8e 100644
--- a/packages/Python/lldbsuite/test/python_api/interpreter/TestCommandInterpreterAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/interpreter/TestCommandInterpreterAPI.py
@@ -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)
diff --git a/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py b/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py
index 09a5bc126571..bcbaa68ed928 100644
--- a/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py
+++ b/packages/Python/lldbsuite/test/python_api/lldbutil/frame/TestFrameUtils.py
@@ -5,13 +5,13 @@ Test utility functions for the frame object.
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)
diff --git a/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py b/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py
index 90f879d37610..ae7ec3dfc3cc 100644
--- a/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py
+++ b/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestLLDBIterator.py
@@ -5,14 +5,15 @@ Test the iteration protocol for some lldb container objects.
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")
diff --git a/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py b/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
index 84ef44d2dd73..49a78888ad89 100644
--- a/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
+++ b/packages/Python/lldbsuite/test/python_api/lldbutil/iter/TestRegistersIterator.py
@@ -5,14 +5,15 @@ Test the iteration protocol for frame registers.
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:
diff --git a/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py b/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py
index fafd05fd92c8..b447bb797a0f 100644
--- a/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py
+++ b/packages/Python/lldbsuite/test/python_api/lldbutil/process/TestPrintStackTraces.py
@@ -5,14 +5,15 @@ Test SBprocess and SBThread APIs with printing of the stack traces using lldbuti
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(TestBase):
# 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(TestBase):
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(TestBase):
stacktraces = lldbutil.print_stacktraces(process, string_buffer=True)
self.expect(stacktraces, exe=False,
- substrs = ['(int)argc=3'])
+ substrs=['(int)argc=3'])
diff --git a/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py b/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
index 859edd80ee83..79b988465d7e 100644
--- a/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
+++ b/packages/Python/lldbsuite/test/python_api/module_section/TestModuleAndSection.py
@@ -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(TestBase):
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(TestBase):
INDENT2 = INDENT * 2
for cu in exe_module.compile_unit_iter():
print(cu)
-
diff --git a/packages/Python/lldbsuite/test/python_api/objc_type/TestObjCType.py b/packages/Python/lldbsuite/test/python_api/objc_type/TestObjCType.py
index b81c422863cb..89dfebde1af7 100644
--- a/packages/Python/lldbsuite/test/python_api/objc_type/TestObjCType.py
+++ b/packages/Python/lldbsuite/test/python_api/objc_type/TestObjCType.py
@@ -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.GetName() == "Bar *",
+ "Bar has the right name")
- self.assertTrue(aBarType.GetNumberOfDirectBaseClasses() == 1, "Bar has a superclass")
+ 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")
diff --git a/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py b/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
index d5f407155b29..1009536b3709 100644
--- a/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/process/TestProcessAPI.py
@@ -5,13 +5,14 @@ Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others.
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')
-
- # Now read the memory content. The bytearray should have (byte)1 as the second element.
+ 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.
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)
-
diff --git a/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py b/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py
index 1a194035f4de..5314930ff99e 100644
--- a/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py
+++ b/packages/Python/lldbsuite/test/python_api/process/io/TestProcessIO.py
@@ -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.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.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.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")
diff --git a/packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py b/packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py
index f56fd96e4665..a84d0004c18b 100644
--- a/packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py
+++ b/packages/Python/lldbsuite/test/python_api/rdar-12481949/Test-rdar-12481949.py
@@ -5,12 +5,13 @@ Check that SBValue.GetValueAsSigned() does the right thing for a 32-bit -1.
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(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'])
# 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(TestBase):
# 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").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").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")
diff --git a/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py b/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py
index d8e9515973f7..e853d6567e73 100644
--- a/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py
+++ b/packages/Python/lldbsuite/test/python_api/sbdata/TestSBData.py
@@ -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')
+ 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(
+ 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(
+ 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))
diff --git a/packages/Python/lldbsuite/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py b/packages/Python/lldbsuite/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py
index 49bc148dd579..46a90fe428c0 100644
--- a/packages/Python/lldbsuite/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py
+++ b/packages/Python/lldbsuite/test/python_api/sbtype_typeclass/TestSBTypeTypeClass.py
@@ -1,4 +1,10 @@
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,
+ decorators.expectedFailureAll(
+ oslist=['macosx'], archs=['i386'],
+ bugnumber='rdar://28656677')])
diff --git a/packages/Python/lldbsuite/test/python_api/sbvalue_persist/TestSBValuePersist.py b/packages/Python/lldbsuite/test/python_api/sbvalue_persist/TestSBValuePersist.py
index e726db7c2d08..eab3cbb30ddc 100644
--- a/packages/Python/lldbsuite/test/python_api/sbvalue_persist/TestSBValuePersist.py
+++ b/packages/Python/lldbsuite/test/python_api/sbvalue_persist/TestSBValuePersist.py
@@ -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'])
diff --git a/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py b/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py
index 29e089f6b84d..5893dfb8f7f2 100644
--- a/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/section/TestSectionAPI.py
@@ -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)
diff --git a/packages/Python/lldbsuite/test/python_api/signals/TestSignalsAPI.py b/packages/Python/lldbsuite/test/python_api/signals/TestSignalsAPI.py
index 733b0c9d6764..76b1d603f55f 100644
--- a/packages/Python/lldbsuite/test/python_api/signals/TestSignalsAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/signals/TestSignalsAPI.py
@@ -5,19 +5,20 @@ Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others.
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")
diff --git a/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py b/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py
index 5d0d01d7a2b6..85ecb69a91fc 100644
--- a/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py
+++ b/packages/Python/lldbsuite/test/python_api/symbol-context/TestSymbolContext.py
@@ -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'")
diff --git a/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py b/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py
index 1d8d70114573..429e9c4da34a 100644
--- a/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py
+++ b/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/TestSymbolContextTwoFiles.py
@@ -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,53 @@ class SymbolContextTwoFilesTestCase(TestBase):
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())
+
+ @add_test_categories(['pyapi'])
+ def test_ranges_in_multiple_compile_unit(self):
+ """This test verifies that we correctly handle the case when multiple
+ compile unit contains DW_AT_ranges and DW_AT_ranges_base attributes."""
+ self.build()
+ exe = os.path.join(os.getcwd(), "a.out")
+
+ target = self.dbg.CreateTarget(exe)
+ self.assertTrue(target, VALID_TARGET)
+
+ source1 = "file1.cpp"
+ line1 = line_number(source1, '// Break1')
+ breakpoint1 = target.BreakpointCreateByLocation(source1, line1)
+ self.assertIsNotNone(breakpoint1)
+ self.assertTrue(breakpoint1.IsValid())
+
+ source2 = "file2.cpp"
+ line2 = line_number(source2, '// Break2')
+ breakpoint2 = target.BreakpointCreateByLocation(source2, line2)
+ self.assertIsNotNone(breakpoint2)
+ self.assertTrue(breakpoint2.IsValid())
+
+ process = target.LaunchSimple(None, None, self.get_process_working_directory())
+ self.assertIsNotNone(process, PROCESS_IS_VALID)
+
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint2)
+ self.assertEqual(len(threads), 1)
+ frame = threads[0].GetFrameAtIndex(0)
+ value = frame.FindVariable("x")
+ self.assertTrue(value.IsValid())
+
+ process.Continue()
+
+ threads = lldbutil.get_threads_stopped_at_breakpoint(
+ process, breakpoint1)
+ self.assertEqual(len(threads), 1)
+ frame = threads[0].GetFrameAtIndex(0)
+ value = frame.FindVariable("x")
+ self.assertTrue(value.IsValid())
+
+ process.Continue()
diff --git a/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/decls.h b/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/decls.h
index 0cb685622cd0..7c8045842062 100644
--- a/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/decls.h
+++ b/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/decls.h
@@ -1,11 +1,11 @@
-struct struct1
-{
- static void
- f();
+struct struct1 {
+ ~struct1();
+ static void f();
};
-struct struct2
-{
- static void
- f();
+struct struct2 {
+ ~struct2();
+ static void f();
};
+
+int g();
diff --git a/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file1.cpp b/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file1.cpp
index 16c8ce7d9488..327d0fb7718f 100644
--- a/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file1.cpp
+++ b/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file1.cpp
@@ -1,13 +1,21 @@
#include "decls.h"
-void
-struct1::f()
-{
+int g() {
+ return 1;
}
-int main()
-{
- struct1::f();
- struct2::f();
- return 0;
+struct1::~struct1() {
+ int x = g(); // Break1
+}
+
+void struct1::f() {}
+
+int main() {
+ struct1::f();
+ struct2::f();
+
+ struct1 s1;
+ struct2 s2;
+
+ return 0;
}
diff --git a/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file2.cpp b/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file2.cpp
index 3bd1aaf95a73..109e01572ed2 100644
--- a/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file2.cpp
+++ b/packages/Python/lldbsuite/test/python_api/symbol-context/two-files/file2.cpp
@@ -1,6 +1,7 @@
#include "decls.h"
-void
-struct2::f()
-{
+struct2::~struct2() {
+ int x = g(); // Break2
}
+
+void struct2::f() {}
diff --git a/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py b/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
index 1278742675f3..adbdc524949d 100644
--- a/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/target/TestTargetAPI.py
@@ -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.")
-
- #rdar://problem/9700873
+ 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
# 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)
diff --git a/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py b/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py
index 588aa66cf53e..a1272cbcbce1 100644
--- a/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/thread/TestThreadAPI.py
@@ -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.")
-
- # We'll use the test method name as the exe_name for executable comppiled from main2.cpp.
+ 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.
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()
diff --git a/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py b/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py
index 20e899beee45..5ab742dac7c7 100644
--- a/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py
+++ b/packages/Python/lldbsuite/test/python_api/type/TestTypeList.py
@@ -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)
diff --git a/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py b/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
index 2a53177d28af..632244e8b9e6 100644
--- a/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/value/TestValueAPI.py
@@ -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')
diff --git a/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py b/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py
index 52c91e0b2621..64c7fde22670 100644
--- a/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/value/change_values/TestChangeValueAPI.py
@@ -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()
diff --git a/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py b/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py
index 879efd186d68..d5f53d712e7d 100644
--- a/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py
+++ b/packages/Python/lldbsuite/test/python_api/value/linked_list/TestValueAPILinkedList.py
@@ -6,14 +6,15 @@ supports iteration till the end of list is reached.
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)
diff --git a/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py b/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py
index 8620117386f9..f4789877f34e 100644
--- a/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py
+++ b/packages/Python/lldbsuite/test/python_api/value_var_update/TestValueVarUpdate.py
@@ -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")
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py b/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py
index bedf286e199b..e4f2c5c7a182 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/TestSetWatchpoint.py
@@ -5,14 +5,15 @@ Use lldb Python SBValue API to create a watchpoint for read_write of 'globl' var
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)
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py b/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py
index d7b45a533e39..1bef9968b4ab 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIgnoreCount.py
@@ -5,14 +5,15 @@ Use lldb Python SBWatchpoint API to set the ignore count.
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(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_set_watch_ignore_count(self):
"""Test SBWatchpoint.SetIgnoreCount() API."""
self.build()
@@ -45,18 +51,20 @@ class WatchpointIgnoreCountTestCase(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")
@@ -82,7 +90,9 @@ class WatchpointIgnoreCountTestCase(TestBase):
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)
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py b/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py
index 8bbb93af07e5..33f1be77ad57 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/TestWatchpointIter.py
@@ -5,7 +5,6 @@ Use lldb Python SBTarget API to iterate on the watchpoint(s) for the target.
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(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")
+ # 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(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, False, True, error)
self.assertTrue(value and watchpoint,
"Successfully found the variable and set a watchpoint")
@@ -73,7 +79,8 @@ class WatchpointIteratorTestCase(TestBase):
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(TestBase):
# 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(TestBase):
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(TestBase):
self.assertTrue(watchpoint.GetWatchSize() == 4)
self.assertTrue(watchpoint.GetHitCount() == 1)
print(watchpoint)
-
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py b/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
index b368cc066615..03c94b6d04fa 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py
@@ -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(TestBase):
# 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(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 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(TestBase):
# 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(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)
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py b/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
index d0a2c2fff128..1cbaf5f46f61 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py
@@ -5,7 +5,6 @@ Use lldb Python SBValue.WatchPointee() API to create a watchpoint for write of '
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(TestBase):
# 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(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)
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(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)
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.
diff --git a/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
index 468f3131f337..6078901c6697 100644
--- a/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
+++ b/packages/Python/lldbsuite/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py
@@ -5,14 +5,15 @@ Use lldb Python SBtarget.WatchAddress() API to create a watchpoint for write of
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(TestBase):
# 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(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)
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,36 @@ class TargetWatchAddressAPITestCase(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)
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
+ @expectedFailureAll(oslist=["windows"])
def test_watch_address_with_invalid_watch_size(self):
"""Exercise SBTarget.WatchAddress() API but pass an invalid watch_size."""
self.build()
@@ -110,23 +129,27 @@ class TargetWatchAddressAPITestCase(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)
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])