diff options
author | Zachary Turner <zturner@google.com> | 2015-10-23 17:04:29 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2015-10-23 17:04:29 +0000 |
commit | 35d017f0fc38b53e31f1a44d07c3c142f5d3620b (patch) | |
tree | 9bb8d7e92d30ed6ea5387993d53a07e8f16a155c /lldb/test/python_api | |
parent | d43fe0bd39ab70b739123853ebd0c2991512b9d7 (diff) | |
download | bcm5719-llvm-35d017f0fc38b53e31f1a44d07c3c142f5d3620b.tar.gz bcm5719-llvm-35d017f0fc38b53e31f1a44d07c3c142f5d3620b.zip |
Add from __future__ import print_function everywhere.
Apparently there were tons of instances I missed last time, I
guess I accidentally ran 2to3 non-recursively. This should be
every occurrence of a print statement fixed to use a print function
as well as from __future__ import print_function being added to
every file.
After this patch print statements will stop working everywhere in
the test suite, and the print function should be used instead.
llvm-svn: 251121
Diffstat (limited to 'lldb/test/python_api')
41 files changed, 276 insertions, 191 deletions
diff --git a/lldb/test/python_api/breakpoint/TestBreakpointAPI.py b/lldb/test/python_api/breakpoint/TestBreakpointAPI.py index 9c29e6cd992..245c14267dd 100644 --- a/lldb/test/python_api/breakpoint/TestBreakpointAPI.py +++ b/lldb/test/python_api/breakpoint/TestBreakpointAPI.py @@ -2,6 +2,8 @@ Test SBBreakpoint APIs. """ +from __future__ import print_function + import lldb_shared import os, time @@ -25,7 +27,7 @@ class BreakpointAPITestCase(TestBase): # Now create a breakpoint on main.c by name 'AFunction'. breakpoint = target.BreakpointCreateByName('AFunction', 'a.out') - #print "breakpoint:", breakpoint + #print("breakpoint:", breakpoint) self.assertTrue(breakpoint and breakpoint.GetNumLocations() == 1, VALID_BREAKPOINT) diff --git a/lldb/test/python_api/class_members/TestSBTypeClassMembers.py b/lldb/test/python_api/class_members/TestSBTypeClassMembers.py index 90e79dc1a7a..6ead0af0643 100644 --- a/lldb/test/python_api/class_members/TestSBTypeClassMembers.py +++ b/lldb/test/python_api/class_members/TestSBTypeClassMembers.py @@ -2,6 +2,8 @@ Test SBType APIs to fetch member function types. """ +from __future__ import print_function + import lldb_shared import os, time diff --git a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py index e7b141ebaf5..fb8961dd2f8 100644 --- a/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py +++ b/lldb/test/python_api/default-constructor/TestDefaultConstructorForAPIObjects.py @@ -11,6 +11,8 @@ SBCommadnReturnObject, SBStream, and SBSymbolContextList, are all valid objects after default construction. """ +from __future__ import print_function + import lldb_shared import os, time @@ -27,7 +29,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBAddress(self): obj = lldb.SBAddress() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_address @@ -38,7 +40,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBBlock(self): obj = lldb.SBBlock() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_block @@ -49,7 +51,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBBreakpoint(self): obj = lldb.SBBreakpoint() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_breakpoint @@ -60,7 +62,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBBreakpointLocation(self): obj = lldb.SBBreakpointLocation() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_breakpointlocation @@ -71,7 +73,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBBroadcaster(self): obj = lldb.SBBroadcaster() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_broadcaster @@ -83,7 +85,7 @@ class APIDefaultConstructorTestCase(TestBase): """SBCommandReturnObject object is valid after default construction.""" obj = lldb.SBCommandReturnObject() if self.TraceOn(): - print obj + print(obj) self.assertTrue(obj) @python_api_test @@ -91,7 +93,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBCommunication(self): obj = lldb.SBCommunication() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_communication @@ -102,7 +104,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBCompileUnit(self): obj = lldb.SBCompileUnit() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_compileunit @@ -113,7 +115,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBDebugger(self): obj = lldb.SBDebugger() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_debugger @@ -125,7 +127,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBError(self): obj = lldb.SBError() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_error @@ -138,7 +140,7 @@ class APIDefaultConstructorTestCase(TestBase): # This is just to test that typemap, as defined in lldb.swig, works. obj2 = lldb.SBEvent(0, "abc") if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_event @@ -150,7 +152,7 @@ class APIDefaultConstructorTestCase(TestBase): # This is just to test that FileSpec(None) does not crash. obj2 = lldb.SBFileSpec(None, True) if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_filespec @@ -161,7 +163,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBFrame(self): obj = lldb.SBFrame() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_frame @@ -172,7 +174,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBFunction(self): obj = lldb.SBFunction() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_function @@ -183,7 +185,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBInstruction(self): obj = lldb.SBInstruction() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_instruction @@ -194,7 +196,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBInstructionList(self): obj = lldb.SBInstructionList() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_instructionlist @@ -205,7 +207,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBLineEntry(self): obj = lldb.SBLineEntry() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_lineentry @@ -216,7 +218,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBListener(self): obj = lldb.SBListener() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_listener @@ -227,7 +229,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBModule(self): obj = lldb.SBModule() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_module @@ -238,7 +240,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBProcess(self): obj = lldb.SBProcess() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_process @@ -249,7 +251,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBSection(self): obj = lldb.SBSection() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_section @@ -261,7 +263,7 @@ class APIDefaultConstructorTestCase(TestBase): """SBStream object is valid after default construction.""" obj = lldb.SBStream() if self.TraceOn(): - print obj + print(obj) self.assertTrue(obj) @python_api_test @@ -269,7 +271,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBStringList(self): obj = lldb.SBStringList() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_stringlist @@ -280,7 +282,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBSymbol(self): obj = lldb.SBSymbol() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_symbol @@ -291,7 +293,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBSymbolContext(self): obj = lldb.SBSymbolContext() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_symbolcontext @@ -303,7 +305,7 @@ class APIDefaultConstructorTestCase(TestBase): """SBSymbolContextList object is valid after default construction.""" obj = lldb.SBSymbolContextList() if self.TraceOn(): - print obj + print(obj) self.assertTrue(obj) @python_api_test @@ -311,7 +313,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBTarget(self): obj = lldb.SBTarget() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_target @@ -322,7 +324,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBThread(self): obj = lldb.SBThread() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_thread @@ -334,7 +336,7 @@ class APIDefaultConstructorTestCase(TestBase): try: obj = lldb.SBType() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # If we reach here, the test fails. self.fail("lldb.SBType() should fail, not succeed!") @@ -353,7 +355,7 @@ class APIDefaultConstructorTestCase(TestBase): """SBTypeList object is valid after default construction.""" obj = lldb.SBTypeList() if self.TraceOn(): - print obj + print(obj) self.assertTrue(obj) @python_api_test @@ -361,7 +363,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBValue(self): obj = lldb.SBValue() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_value @@ -372,7 +374,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBValueList(self): obj = lldb.SBValueList() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_valuelist @@ -383,7 +385,7 @@ class APIDefaultConstructorTestCase(TestBase): def test_SBWatchpoint(self): obj = lldb.SBWatchpoint() if self.TraceOn(): - print obj + print(obj) self.assertFalse(obj) # Do fuzz testing on the invalid obj, it should not crash lldb. import sb_watchpoint diff --git a/lldb/test/python_api/disassemble-raw-data/TestDisassembleRawData.py b/lldb/test/python_api/disassemble-raw-data/TestDisassembleRawData.py index e16c6f09437..a6a165777ec 100644 --- a/lldb/test/python_api/disassemble-raw-data/TestDisassembleRawData.py +++ b/lldb/test/python_api/disassemble-raw-data/TestDisassembleRawData.py @@ -2,6 +2,8 @@ Use lldb Python API to disassemble raw machine code bytes """ +from __future__ import print_function + import lldb_shared import os, time @@ -28,9 +30,9 @@ class DisassembleRawDataTestCase(TestBase): inst = insts.GetInstructionAtIndex(0) if self.TraceOn(): - print - print "Raw bytes: ", [hex(x) for x in raw_bytes] - print "Disassembled%s" % str(inst) + print() + print("Raw bytes: ", [hex(x) for x in raw_bytes]) + print("Disassembled%s" % str(inst)) self.assertTrue (inst.GetMnemonic(target) == "movq") self.assertTrue (inst.GetOperands(target) == '%' + "rsp, " + '%' + "rbp") diff --git a/lldb/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py b/lldb/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py index d25dabc6e63..6e326b897b9 100644 --- a/lldb/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py +++ b/lldb/test/python_api/disassemble-raw-data/TestDisassemble_VST1_64.py @@ -2,6 +2,8 @@ Use lldb Python API to disassemble raw machine code bytes """ +from __future__ import print_function + import lldb_shared import os, time @@ -31,9 +33,9 @@ class Disassemble_VST1_64(TestBase): insts = target.GetInstructions(lldb.SBAddress(), raw_bytes) if self.TraceOn(): - print + print() for i in insts: - print "Disassembled%s" % str(i) + print("Disassembled%s" % str(i)) # Remove the following return statement when the radar is fixed. return @@ -48,8 +50,8 @@ class Disassemble_VST1_64(TestBase): inst = insts.GetInstructionAtIndex(0) if self.TraceOn(): - print - print "Raw bytes: ", [hex(x) for x in raw_bytes] - print "Disassembled%s" % str(inst) + print() + print("Raw bytes: ", [hex(x) for x in raw_bytes]) + print("Disassembled%s" % str(inst)) self.assertTrue (inst.GetMnemonic(target) == "vst1.64") diff --git a/lldb/test/python_api/event/TestEvents.py b/lldb/test/python_api/event/TestEvents.py index f2d52570d25..6fcb67f5869 100644 --- a/lldb/test/python_api/event/TestEvents.py +++ b/lldb/test/python_api/event/TestEvents.py @@ -2,6 +2,8 @@ Test lldb Python event APIs. """ +from __future__ import print_function + import lldb_shared import os, time @@ -69,17 +71,17 @@ class EventAPITestCase(TestBase): # After that, the thread exits. while not count > 3: if traceOn: - print "Try wait for event..." + print("Try wait for event...") if listener.WaitForEvent(5, event): if traceOn: 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 + print("Event description:", desc) + print("Event data flavor:", event.GetDataFlavor()) + print("Process state:", lldbutil.state_type_to_str(process.GetState())) + print() else: if traceOn: - print "timeout occurred waiting for event..." + print("timeout occurred waiting for event...") count = count + 1 return @@ -112,7 +114,7 @@ class EventAPITestCase(TestBase): # Now create a breakpoint on main.c by name 'c'. breakpoint = target.BreakpointCreateByName('c', 'a.out') - #print "breakpoint:", breakpoint + #print("breakpoint:", breakpoint) self.assertTrue(breakpoint and breakpoint.GetNumLocations() == 1, VALID_BREAKPOINT) @@ -146,12 +148,12 @@ class EventAPITestCase(TestBase): # Let's only try at most 3 times to retrieve any kind of event. while not count > 3: if listener.WaitForEvent(5, event): - #print "Got a valid event:", event - #print "Event data flavor:", event.GetDataFlavor() - #print "Event type:", lldbutil.state_type_to_str(event.GetType()) + #print("Got a valid event:", event) + #print("Event data flavor:", event.GetDataFlavor()) + #print("Event type:", lldbutil.state_type_to_str(event.GetType())) return count = count + 1 - print "Timeout: listener.WaitForEvent" + print("Timeout: listener.WaitForEvent") return @@ -186,7 +188,7 @@ class EventAPITestCase(TestBase): # Now create a breakpoint on main.c by name 'c'. breakpoint = target.BreakpointCreateByName('c', 'a.out') - #print "breakpoint:", breakpoint + #print("breakpoint:", breakpoint) self.assertTrue(breakpoint and breakpoint.GetNumLocations() == 1, VALID_BREAKPOINT) @@ -225,7 +227,7 @@ class EventAPITestCase(TestBase): import threading class MyListeningThread(threading.Thread): def run(self): - #print "Running MyListeningThread:", self + #print("Running MyListeningThread:", self) # Regular expression pattern for the event description. pattern = re.compile("data = {.*, state = (.*)}$") @@ -235,7 +237,7 @@ class EventAPITestCase(TestBase): while True: if listener.WaitForEvent(5, event): desc = lldbutil.get_description(event) - #print "Event description:", desc + #print("Event description:", desc) match = pattern.search(desc) if not match: break; @@ -256,7 +258,7 @@ class EventAPITestCase(TestBase): break else: break - print "Timeout: listener.WaitForEvent" + print("Timeout: listener.WaitForEvent") count = count + 1 if count > 6: break diff --git a/lldb/test/python_api/findvalue_duplist/TestSBFrameFindValue.py b/lldb/test/python_api/findvalue_duplist/TestSBFrameFindValue.py index c5bdcb89fec..6a3be36a592 100644 --- a/lldb/test/python_api/findvalue_duplist/TestSBFrameFindValue.py +++ b/lldb/test/python_api/findvalue_duplist/TestSBFrameFindValue.py @@ -1,5 +1,7 @@ """Test that SBFrame::FindValue finds things but does not duplicate the entire variables list""" +from __future__ import print_function + import lldb_shared import os, sys, time diff --git a/lldb/test/python_api/formatters/TestFormattersSBAPI.py b/lldb/test/python_api/formatters/TestFormattersSBAPI.py index b6d693ff1fd..7f3075f09c5 100644 --- a/lldb/test/python_api/formatters/TestFormattersSBAPI.py +++ b/lldb/test/python_api/formatters/TestFormattersSBAPI.py @@ -1,5 +1,7 @@ """Test Python APIs for working with formatters""" +from __future__ import print_function + import lldb_shared import os, sys, time @@ -324,19 +326,19 @@ class SBFormattersAPITestCase(TestBase): frame = self.dbg.GetSelectedTarget().GetProcess().GetSelectedThread().GetSelectedFrame() int_vector = frame.FindVariable("int_vector") if self.TraceOn(): - print int_vector + 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() int_vector = frame.FindVariable("int_vector") if self.TraceOn(): - print int_vector + 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() int_vector = frame.FindVariable("int_vector") if self.TraceOn(): - print int_vector + print(int_vector) self.assertTrue(int_vector.GetNumChildren() == 0, 'synthetic vector is still empty') diff --git a/lldb/test/python_api/frame/TestFrames.py b/lldb/test/python_api/frame/TestFrames.py index b13edd09396..d8cccc6fea0 100644 --- a/lldb/test/python_api/frame/TestFrames.py +++ b/lldb/test/python_api/frame/TestFrames.py @@ -3,6 +3,8 @@ Use lldb Python SBFrame API to get the argument values of the call stacks. And other SBFrame API tests. """ +from __future__ import print_function + import lldb_shared import os, time @@ -27,7 +29,7 @@ class FrameAPITestCase(TestBase): # Now create a breakpoint on main.c by name 'c'. breakpoint = target.BreakpointCreateByName('c', 'a.out') - #print "breakpoint:", breakpoint + #print("breakpoint:", breakpoint) self.assertTrue(breakpoint and breakpoint.GetNumLocations() == 1, VALID_BREAKPOINT) @@ -52,7 +54,7 @@ class FrameAPITestCase(TestBase): for i in range(numFrames): frame = thread.GetFrameAtIndex(i) if self.TraceOn(): - print "frame:", frame + print("frame:", frame) name = frame.GetFunction().GetName() if name == 'a': @@ -70,7 +72,7 @@ class FrameAPITestCase(TestBase): argList.append("(%s)%s=%s" % (val.GetTypeName(), val.GetName(), val.GetValue())) - print >> session, "%s(%s)" % (name, ", ".join(argList)) + 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. @@ -84,7 +86,7 @@ class FrameAPITestCase(TestBase): 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 >> session, "---" + print("---", file=session) process.Continue() # At this point, the inferior process should have exited. @@ -97,8 +99,8 @@ class FrameAPITestCase(TestBase): # o a((int)val=1, (char)ch='A') # o a((int)val=3, (char)ch='A') if self.TraceOn(): - print "Full stack traces when stopped on the breakpoint 'c':" - print session.getvalue() + print("Full stack traces when stopped on the breakpoint 'c':") + print(session.getvalue()) self.expect(session.getvalue(), "Argugment values displayed correctly", exe=False, substrs = ["a((int)val=1, (char)ch='A')", @@ -116,7 +118,7 @@ class FrameAPITestCase(TestBase): # Now create a breakpoint on main.c by name 'c'. breakpoint = target.BreakpointCreateByName('c', 'a.out') - #print "breakpoint:", breakpoint + #print("breakpoint:", breakpoint) self.assertTrue(breakpoint and breakpoint.GetNumLocations() == 1, VALID_BREAKPOINT) @@ -131,15 +133,15 @@ class FrameAPITestCase(TestBase): thread = process.GetThreadAtIndex(0) frame = thread.GetFrameAtIndex(0) if self.TraceOn(): - print "frame:", frame + print("frame:", frame) # Boundary condition testings. val1 = frame.FindVariable(None, True) val2 = frame.FindVariable(None, False) val3 = frame.FindValue(None, lldb.eValueTypeVariableGlobal) if self.TraceOn(): - print "val1:", val1 - print "val2:", val2 + print("val1:", val1) + print("val2:", val2) frame.EvaluateExpression(None) @@ -155,7 +157,7 @@ class FrameAPITestCase(TestBase): # Now create a breakpoint on main.c by name 'c'. breakpoint = target.BreakpointCreateByName('c', 'a.out') - #print "breakpoint:", breakpoint + #print("breakpoint:", breakpoint) self.assertTrue(breakpoint and breakpoint.GetNumLocations() == 1, VALID_BREAKPOINT) @@ -172,7 +174,7 @@ class FrameAPITestCase(TestBase): frameEntered = thread.GetFrameAtIndex(0) if self.TraceOn(): - print frameEntered + print(frameEntered) lldbutil.print_stacktrace(thread) self.assertTrue(frameEntered) @@ -182,7 +184,7 @@ class FrameAPITestCase(TestBase): self.assertTrue(thread) frameNow = thread.GetFrameAtIndex(0) if self.TraceOn(): - print frameNow + print(frameNow) lldbutil.print_stacktrace(thread) self.assertTrue(frameNow) @@ -193,7 +195,7 @@ class FrameAPITestCase(TestBase): thread.StepOutOfFrame(frameNow) frameOutOfC = thread.GetFrameAtIndex(0) if self.TraceOn(): - print frameOutOfC + print(frameOutOfC) lldbutil.print_stacktrace(thread) self.assertTrue(frameOutOfC) diff --git a/lldb/test/python_api/frame/inlines/TestInlinedFrame.py b/lldb/test/python_api/frame/inlines/TestInlinedFrame.py index e5e53918190..1fc86064fb7 100644 --- a/lldb/test/python_api/frame/inlines/TestInlinedFrame.py +++ b/lldb/test/python_api/frame/inlines/TestInlinedFrame.py @@ -2,6 +2,8 @@ Testlldb Python SBFrame APIs IsInlined() and GetFunctionName(). """ +from __future__ import print_function + import lldb_shared import os, time @@ -33,7 +35,7 @@ class InlinedFrameAPITestCase(TestBase): # Now create a breakpoint on main.c by the name of 'inner_inline'. breakpoint = target.BreakpointCreateByName('inner_inline', 'a.out') - #print "breakpoint:", breakpoint + #print("breakpoint:", breakpoint) self.assertTrue(breakpoint and breakpoint.GetNumLocations() > 1, VALID_BREAKPOINT) @@ -48,8 +50,8 @@ class InlinedFrameAPITestCase(TestBase): import 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 stack_traces1 + 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. # If it's an inlined call frame, expect to find, in the stack trace, @@ -70,7 +72,7 @@ class InlinedFrameAPITestCase(TestBase): PROCESS_STOPPED) 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 stack_traces2 + 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)]) diff --git a/lldb/test/python_api/function_symbol/TestDisasmAPI.py b/lldb/test/python_api/function_symbol/TestDisasmAPI.py index 4018b52ea73..7f0dce11fdb 100644 --- a/lldb/test/python_api/function_symbol/TestDisasmAPI.py +++ b/lldb/test/python_api/function_symbol/TestDisasmAPI.py @@ -2,6 +2,8 @@ Test retrieval of SBAddress from function/symbol, disassembly, and SBAddress APIs. """ +from __future__ import print_function + import lldb_shared import os, time @@ -33,8 +35,8 @@ class DisasmAPITestCase(TestBase): # Now create the two breakpoints inside function 'a'. breakpoint1 = target.BreakpointCreateByLocation('main.c', self.line1) breakpoint2 = target.BreakpointCreateByLocation('main.c', self.line2) - #print "breakpoint1:", breakpoint1 - #print "breakpoint2:", breakpoint2 + #print("breakpoint1:", breakpoint1) + #print("breakpoint2:", breakpoint2) self.assertTrue(breakpoint1 and breakpoint1.GetNumLocations() == 1, VALID_BREAKPOINT) @@ -55,14 +57,14 @@ class DisasmAPITestCase(TestBase): self.assertTrue(lineEntry.GetLine() == self.line1) address1 = lineEntry.GetStartAddress() - #print "address1:", address1 + #print("address1:", address1) # Now call SBTarget.ResolveSymbolContextForAddress() with address1. context1 = target.ResolveSymbolContextForAddress(address1, lldb.eSymbolContextEverything) self.assertTrue(context1) if self.TraceOn(): - print "context1:", context1 + print("context1:", context1) # Continue the inferior, the breakpoint 2 should be hit. process.Continue() @@ -80,24 +82,24 @@ class DisasmAPITestCase(TestBase): disasm_output = lldbutil.disassemble(target, symbol) if self.TraceOn(): - print "symbol:", symbol - print "disassembly=>\n", disasm_output + print("symbol:", symbol) + print("disassembly=>\n", disasm_output) disasm_output = lldbutil.disassemble(target, function) if self.TraceOn(): - print "function:", function - print "disassembly=>\n", disasm_output + print("function:", function) + print("disassembly=>\n", disasm_output) sa1 = symbol.GetStartAddress() - #print "sa1:", sa1 - #print "sa1.GetFileAddress():", hex(sa1.GetFileAddress()) + #print("sa1:", sa1) + #print("sa1.GetFileAddress():", hex(sa1.GetFileAddress())) #ea1 = symbol.GetEndAddress() - #print "ea1:", ea1 + #print("ea1:", ea1) sa2 = function.GetStartAddress() - #print "sa2:", sa2 - #print "sa2.GetFileAddress():", hex(sa2.GetFileAddress()) + #print("sa2:", sa2) + #print("sa2.GetFileAddress():", hex(sa2.GetFileAddress())) #ea2 = function.GetEndAddress() - #print "ea2:", ea2 + #print("ea2:", ea2) self.assertTrue(sa1 and sa2 and sa1 == sa2, "The two starting addresses should be the same") diff --git a/lldb/test/python_api/function_symbol/TestSymbolAPI.py b/lldb/test/python_api/function_symbol/TestSymbolAPI.py index 1d7a428ddf4..bb0a78a59f4 100644 --- a/lldb/test/python_api/function_symbol/TestSymbolAPI.py +++ b/lldb/test/python_api/function_symbol/TestSymbolAPI.py @@ -2,6 +2,8 @@ Test newly added SBSymbol and SBAddress APIs. """ +from __future__ import print_function + import lldb_shared import os, time @@ -34,8 +36,8 @@ class SymbolAPITestCase(TestBase): # Now create the two breakpoints inside function 'a'. breakpoint1 = target.BreakpointCreateByLocation('main.c', self.line1) breakpoint2 = target.BreakpointCreateByLocation('main.c', self.line2) - #print "breakpoint1:", breakpoint1 - #print "breakpoint2:", breakpoint2 + #print("breakpoint1:", breakpoint1) + #print("breakpoint2:", breakpoint2) self.assertTrue(breakpoint1 and breakpoint1.GetNumLocations() == 1, VALID_BREAKPOINT) @@ -74,5 +76,5 @@ class SymbolAPITestCase(TestBase): # Now verify that both addresses point to the same module. if self.TraceOn(): - print "UUID:", addr_line1.GetModule().GetUUIDString() + print("UUID:", addr_line1.GetModule().GetUUIDString()) self.assertTrue(addr_line1.GetModule().GetUUIDString() == addr_line2.GetModule().GetUUIDString()) diff --git a/lldb/test/python_api/hello_world/TestHelloWorld.py b/lldb/test/python_api/hello_world/TestHelloWorld.py index 1800dd0fb69..5e8343e2407 100644 --- a/lldb/test/python_api/hello_world/TestHelloWorld.py +++ b/lldb/test/python_api/hello_world/TestHelloWorld.py @@ -1,5 +1,7 @@ """Test Python APIs for target (launch and attach), breakpoint, and process.""" +from __future__ import print_function + import lldb_shared import os, sys, time diff --git a/lldb/test/python_api/interpreter/TestCommandInterpreterAPI.py b/lldb/test/python_api/interpreter/TestCommandInterpreterAPI.py index 1f5171d1018..74baf11029d 100644 --- a/lldb/test/python_api/interpreter/TestCommandInterpreterAPI.py +++ b/lldb/test/python_api/interpreter/TestCommandInterpreterAPI.py @@ -1,5 +1,7 @@ """Test the SBCommandInterpreter APIs.""" +from __future__ import print_function + import lldb_shared import os @@ -56,7 +58,7 @@ class CommandInterpreterAPICase(TestBase): res.AppendMessage("Just appended a message.") res.AppendMessage(None) if self.TraceOn(): - print res + print(res) process = ci.GetProcess() self.assertTrue(process) diff --git a/lldb/test/python_api/lldbutil/frame/TestFrameUtils.py b/lldb/test/python_api/lldbutil/frame/TestFrameUtils.py index 28121365b75..90ceed2a29e 100644 --- a/lldb/test/python_api/lldbutil/frame/TestFrameUtils.py +++ b/lldb/test/python_api/lldbutil/frame/TestFrameUtils.py @@ -2,6 +2,8 @@ Test utility functions for the frame object. """ +from __future__ import print_function + import lldb_shared import os @@ -53,5 +55,5 @@ class FrameUtilsTestCase(TestBase): 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 - print "Parent frame: %s" % parent_args + print("Current frame: %s" % frame0_args) + print("Parent frame: %s" % parent_args) diff --git a/lldb/test/python_api/lldbutil/iter/TestLLDBIterator.py b/lldb/test/python_api/lldbutil/iter/TestLLDBIterator.py index c8ee37c1661..c8ab81317f4 100644 --- a/lldb/test/python_api/lldbutil/iter/TestLLDBIterator.py +++ b/lldb/test/python_api/lldbutil/iter/TestLLDBIterator.py @@ -2,6 +2,8 @@ Test the iteration protocol for some lldb container objects. """ +from __future__ import print_function + import lldb_shared import os, time @@ -49,8 +51,8 @@ class LLDBIteratorTestCase(TestBase): self.assertTrue(len(yours) == len(mine)) for i in range(len(yours)): if self.TraceOn(): - print "yours[%d]='%s'" % (i, get_description(yours[i])) - print "mine[%d]='%s'" % (i, get_description(mine[i])) + 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)) @@ -81,8 +83,8 @@ class LLDBIteratorTestCase(TestBase): self.assertTrue(len(yours) == len(mine)) for i in range(len(yours)): if self.TraceOn(): - print "yours[%d]='%s'" % (i, get_description(yours[i])) - print "mine[%d]='%s'" % (i, get_description(mine[i])) + print("yours[%d]='%s'" % (i, get_description(yours[i]))) + print("mine[%d]='%s'" % (i, get_description(mine[i]))) self.assertTrue(yours[i] == mine[i], "ID of yours[{0}] and mine[{0}] matches".format(i)) @@ -115,6 +117,6 @@ class LLDBIteratorTestCase(TestBase): for frame in thread: self.assertTrue(frame.GetThread().GetThreadID() == ID) if self.TraceOn(): - print frame + print(frame) self.assertTrue(stopped_due_to_breakpoint) diff --git a/lldb/test/python_api/lldbutil/iter/TestRegistersIterator.py b/lldb/test/python_api/lldbutil/iter/TestRegistersIterator.py index 0a49bc2fe4a..43b5d9d1074 100644 --- a/lldb/test/python_api/lldbutil/iter/TestRegistersIterator.py +++ b/lldb/test/python_api/lldbutil/iter/TestRegistersIterator.py @@ -2,6 +2,8 @@ Test the iteration protocol for frame registers. """ +from __future__ import print_function + import lldb_shared import os, time @@ -44,35 +46,35 @@ class RegistersIteratorTestCase(TestBase): for frame in thread: # Dump the registers of this frame using lldbutil.get_GPRs() and friends. if self.TraceOn(): - print frame + 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(): - print "%s => %s" % (reg.GetName(), reg.GetValue()) + print("%s => %s" % (reg.GetName(), reg.GetValue())) REGs = lldbutil.get_FPRs(frame) num = len(REGs) if self.TraceOn(): - print "\nNumber of floating point registers: %d" % num + print("\nNumber of floating point 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())) REGs = lldbutil.get_ESRs(frame) 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) diff --git a/lldb/test/python_api/lldbutil/process/TestPrintStackTraces.py b/lldb/test/python_api/lldbutil/process/TestPrintStackTraces.py index 7319ce39b48..859cbdc452c 100644 --- a/lldb/test/python_api/lldbutil/process/TestPrintStackTraces.py +++ b/lldb/test/python_api/lldbutil/process/TestPrintStackTraces.py @@ -2,6 +2,8 @@ Test SBprocess and SBThread APIs with printing of the stack traces using lldbutil. """ +from __future__ import print_function + import lldb_shared import os, time diff --git a/lldb/test/python_api/module_section/TestModuleAndSection.py b/lldb/test/python_api/module_section/TestModuleAndSection.py index d1a69f934d6..c89ff221d62 100644 --- a/lldb/test/python_api/module_section/TestModuleAndSection.py +++ b/lldb/test/python_api/module_section/TestModuleAndSection.py @@ -2,6 +2,8 @@ Test some SBModule and SBSection APIs. """ +from __future__ import print_function + import lldb_shared import os, time @@ -28,31 +30,31 @@ class ModuleAndSectionAPIsTestCase(TestBase): if not self.TraceOn(): self.HideStdout() - print "Number of modules for the target: %d" % target.GetNumModules() + print("Number of modules for the target: %d" % target.GetNumModules()) for module in target.module_iter(): - print module + print(module) # Get the executable module at index 0. exe_module = target.GetModuleAtIndex(0) - print "Exe module: %s" % str(exe_module) - print "Number of sections: %d" % exe_module.GetNumSections() + print("Exe module: %s" % str(exe_module)) + print("Number of sections: %d" % exe_module.GetNumSections()) INDENT = ' ' * 4 INDENT2 = INDENT * 2 for sec in exe_module.section_iter(): - print sec - print INDENT + "Number of subsections: %d" % sec.GetNumSubSections() + print(sec) + 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 + str(sym)) + print(INDENT + "symbol type: %s" % symbol_type_to_str(sym.GetType())) else: for subsec in sec: - print INDENT + str(subsec) + 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 + str(sym)) + print(INDENT2 + "symbol type: %s" % symbol_type_to_str(sym.GetType())) @python_api_test def test_module_and_section_boundary_condition(self): @@ -68,15 +70,15 @@ class ModuleAndSectionAPIsTestCase(TestBase): if not self.TraceOn(): self.HideStdout() - print "Number of modules for the target: %d" % target.GetNumModules() + print("Number of modules for the target: %d" % target.GetNumModules()) for module in target.module_iter(): - print module + print(module) # Get the executable module at index 0. exe_module = target.GetModuleAtIndex(0) - print "Exe module: %s" % str(exe_module) - print "Number of sections: %d" % exe_module.GetNumSections() + print("Exe module: %s" % str(exe_module)) + print("Number of sections: %d" % exe_module.GetNumSections()) # Boundary condition testings. Should not crash lldb! exe_module.FindFirstType(None) @@ -88,7 +90,7 @@ class ModuleAndSectionAPIsTestCase(TestBase): # Get the section at index 1. if exe_module.GetNumSections() > 1: sec1 = exe_module.GetSectionAtIndex(1) - print sec1 + print(sec1) else: sec1 = None @@ -109,16 +111,17 @@ class ModuleAndSectionAPIsTestCase(TestBase): if not self.TraceOn(): self.HideStdout() - print "Number of modules for the target: %d" % target.GetNumModules() + print("Number of modules for the target: %d" % target.GetNumModules()) for module in target.module_iter(): - print module + print(module) # Get the executable module at index 0. exe_module = target.GetModuleAtIndex(0) - print "Exe module: %s" % str(exe_module) - print "Number of compile units: %d" % exe_module.GetNumCompileUnits() + print("Exe module: %s" % str(exe_module)) + print("Number of compile units: %d" % exe_module.GetNumCompileUnits()) INDENT = ' ' * 4 INDENT2 = INDENT * 2 for cu in exe_module.compile_unit_iter(): - print cu + print(cu) + diff --git a/lldb/test/python_api/objc_type/TestObjCType.py b/lldb/test/python_api/objc_type/TestObjCType.py index ed34d43a295..d8564632c46 100644 --- a/lldb/test/python_api/objc_type/TestObjCType.py +++ b/lldb/test/python_api/objc_type/TestObjCType.py @@ -2,6 +2,8 @@ Test SBType for ObjC classes. """ +from __future__ import print_function + import lldb_shared import os, time diff --git a/lldb/test/python_api/process/TestProcessAPI.py b/lldb/test/python_api/process/TestProcessAPI.py index 15a70d12a08..e75b78c62f3 100644 --- a/lldb/test/python_api/process/TestProcessAPI.py +++ b/lldb/test/python_api/process/TestProcessAPI.py @@ -2,6 +2,8 @@ Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others. """ +from __future__ import print_function + import lldb_shared import os, time @@ -50,7 +52,7 @@ class ProcessAPITestCase(TestBase): if not error.Success(): self.fail("SBProcess.ReadMemory() failed") if self.TraceOn(): - print "memory content:", content + print("memory content:", content) self.expect(content, "Result from SBProcess.ReadMemory() matches our expected output: 'x'", exe=False, @@ -63,7 +65,7 @@ class ProcessAPITestCase(TestBase): if not error.Success(): self.fail("SBProcess.ReadCStringFromMemory() failed") if self.TraceOn(): - print "cstring read is:", cstring + print("cstring read is:", cstring) self.expect(cstring, "Result from SBProcess.ReadCStringFromMemory() matches our expected output", exe=False, @@ -80,7 +82,7 @@ class ProcessAPITestCase(TestBase): if not error.Success(): self.fail("SBProcess.ReadCStringFromMemory() failed") if self.TraceOn(): - print "cstring read is:", cstring + print("cstring read is:", cstring) self.expect(cstring, "Result from SBProcess.ReadCStringFromMemory() matches our expected output", exe=False, @@ -97,7 +99,7 @@ class ProcessAPITestCase(TestBase): if not error.Success(): self.fail("SBProcess.ReadCStringFromMemory() failed") if self.TraceOn(): - print "uint32 read is:", my_uint32 + print("uint32 read is:", my_uint32) if my_uint32 != 12345: self.fail("Result from SBProcess.ReadUnsignedFromMemory() does not match our expected output") @@ -148,7 +150,7 @@ class ProcessAPITestCase(TestBase): if not error.Success(): self.fail("SBProcess.ReadMemory() failed") if self.TraceOn(): - print "memory content:", content + print("memory content:", content) self.expect(content, "Result from SBProcess.ReadMemory() matches our expected output: 'a'", exe=False, @@ -242,7 +244,7 @@ class ProcessAPITestCase(TestBase): # Dump the memory content.... if self.TraceOn(): for i in new_bytes: - print "byte:", i + print("byte:", i) @python_api_test def test_remote_launch(self): @@ -257,7 +259,7 @@ class ProcessAPITestCase(TestBase): process = target.LaunchSimple (None, None, self.get_process_working_directory()) if self.TraceOn(): - print "process state:", state_type_to_str(process.GetState()) + print("process state:", state_type_to_str(process.GetState())) self.assertTrue(process.GetState() != lldb.eStateConnected) error = lldb.SBError() @@ -283,4 +285,5 @@ class ProcessAPITestCase(TestBase): error = lldb.SBError(); num = process.GetNumSupportedHardwareWatchpoints(error) if self.TraceOn() and error.Success(): - print "Number of supported hardware watchpoints: %d" % num + print("Number of supported hardware watchpoints: %d" % num) + diff --git a/lldb/test/python_api/process/io/TestProcessIO.py b/lldb/test/python_api/process/io/TestProcessIO.py index 1fce478b4f2..162003f6bcf 100644 --- a/lldb/test/python_api/process/io/TestProcessIO.py +++ b/lldb/test/python_api/process/io/TestProcessIO.py @@ -1,5 +1,7 @@ """Test Python APIs for process IO.""" +from __future__ import print_function + import lldb_shared import os, sys, time @@ -164,7 +166,7 @@ class ProcessIOTestCase(TestBase): self.assertTrue(self.process, PROCESS_IS_VALID) if self.TraceOn(): - print "process launched." + print("process launched.") # Frame #0 should be at our breakpoint. threads = lldbutil.get_threads_stopped_at_breakpoint (self.process, self.breakpoint) @@ -175,7 +177,7 @@ class ProcessIOTestCase(TestBase): self.assertTrue(self.frame, "Frame 0 is valid.") if self.TraceOn(): - print "process stopped at breakpoint, sending STDIN via LLDB API." + print("process stopped at breakpoint, sending STDIN via LLDB API.") # Write data to stdin via the public API if we were asked to if put_stdin: @@ -193,8 +195,8 @@ class ProcessIOTestCase(TestBase): # once "input line=>1" appears in stdout. # See also main.c. if self.TraceOn(): - print "output = '%s'" % output - print "error = '%s'" % error + print("output = '%s'" % output) + print("error = '%s'" % error) for line in self.lines: check_line = 'input line to stdout: %s' % (line) diff --git a/lldb/test/python_api/rdar-12481949/Test-rdar-12481949.py b/lldb/test/python_api/rdar-12481949/Test-rdar-12481949.py index 1880dc25f99..5122a148dc5 100644 --- a/lldb/test/python_api/rdar-12481949/Test-rdar-12481949.py +++ b/lldb/test/python_api/rdar-12481949/Test-rdar-12481949.py @@ -2,6 +2,8 @@ Check that SBValue.GetValueAsSigned() does the right thing for a 32-bit -1. """ +from __future__ import print_function + import lldb_shared import os, time diff --git a/lldb/test/python_api/sbdata/TestSBData.py b/lldb/test/python_api/sbdata/TestSBData.py index beb9fd57c5c..1e8f0e3cb0d 100644 --- a/lldb/test/python_api/sbdata/TestSBData.py +++ b/lldb/test/python_api/sbdata/TestSBData.py @@ -1,5 +1,7 @@ """Test the SBData APIs.""" +from __future__ import print_function + import lldb_shared import os @@ -41,16 +43,16 @@ class SBDataAPICase(TestBase): frame = thread.GetSelectedFrame() if self.TraceOn(): - print frame + print(frame) foobar = frame.FindVariable('foobar') self.assertTrue(foobar.IsValid()) if self.TraceOn(): - print foobar + print(foobar) data = foobar.GetPointeeData(0, 2) if self.TraceOn(): - print data + print(data) offset = 0 error = lldb.SBError() @@ -96,7 +98,7 @@ class SBDataAPICase(TestBase): data = star_foobar.GetData() if self.TraceOn(): - print data + print(data) offset = 0 self.assert_data(data.GetUnsignedInt32, offset, 1) @@ -114,12 +116,12 @@ class SBDataAPICase(TestBase): new_foobar = foobar.CreateValueFromAddress("f00", foobar_addr, star_foobar.GetType()) self.assertTrue(new_foobar.IsValid()) if self.TraceOn(): - print new_foobar + print(new_foobar) data = new_foobar.GetData() if self.TraceOn(): - print data + print(data) self.assertTrue(data.uint32[0] == 8, 'then foo[1].a == 8') self.assertTrue(data.uint32[1] == 7, 'then foo[1].b == 7') @@ -138,7 +140,7 @@ class SBDataAPICase(TestBase): data = new_foobar.GetData() if self.TraceOn(): - print data + print(data) offset = 0 self.assert_data(data.GetUnsignedInt32, offset, 8) @@ -155,10 +157,10 @@ class SBDataAPICase(TestBase): data = barfoo.GetData() if self.TraceOn(): - print barfoo + print(barfoo) if self.TraceOn(): - print data + print(data) offset = 0 self.assert_data(data.GetUnsignedInt32, offset, 1) @@ -178,7 +180,7 @@ class SBDataAPICase(TestBase): new_object = barfoo.CreateValueFromData("new_object",data,barfoo.GetType().GetBasicType(lldb.eBasicTypeInt)) if self.TraceOn(): - print new_object + print(new_object) self.assertTrue(new_object.GetValue() == "1", 'new_object == 1') @@ -192,7 +194,7 @@ class SBDataAPICase(TestBase): data.Append(data2) if self.TraceOn(): - print data + print(data) # this breaks on EBCDIC offset = 0 diff --git a/lldb/test/python_api/sbvalue_persist/TestSBValuePersist.py b/lldb/test/python_api/sbvalue_persist/TestSBValuePersist.py index eca6f41a13c..903eb8b57e2 100644 --- a/lldb/test/python_api/sbvalue_persist/TestSBValuePersist.py +++ b/lldb/test/python_api/sbvalue_persist/TestSBValuePersist.py @@ -1,5 +1,7 @@ """Test SBValue::Persist""" +from __future__ import print_function + import lldb_shared import os, sys, time diff --git a/lldb/test/python_api/section/TestSectionAPI.py b/lldb/test/python_api/section/TestSectionAPI.py index 7a6bc3ac812..8d7aef4945d 100755 --- a/lldb/test/python_api/section/TestSectionAPI.py +++ b/lldb/test/python_api/section/TestSectionAPI.py @@ -2,6 +2,8 @@ Test SBSection APIs. """ +from __future__ import print_function + import lldb_shared from lldbtest import * diff --git a/lldb/test/python_api/signals/TestSignalsAPI.py b/lldb/test/python_api/signals/TestSignalsAPI.py index 7bea793c511..8ddbdf3a946 100644 --- a/lldb/test/python_api/signals/TestSignalsAPI.py +++ b/lldb/test/python_api/signals/TestSignalsAPI.py @@ -2,6 +2,8 @@ Test SBProcess APIs, including ReadMemory(), WriteMemory(), and others. """ +from __future__ import print_function + import lldb_shared import os, time diff --git a/lldb/test/python_api/symbol-context/TestSymbolContext.py b/lldb/test/python_api/symbol-context/TestSymbolContext.py index 5bca394d3b1..01509a9dd4a 100644 --- a/lldb/test/python_api/symbol-context/TestSymbolContext.py +++ b/lldb/test/python_api/symbol-context/TestSymbolContext.py @@ -2,6 +2,8 @@ Test SBSymbolContext APIs. """ +from __future__ import print_function + import lldb_shared import os, time @@ -32,7 +34,7 @@ class SymbolContextAPITestCase(TestBase): # Now create a breakpoint on main.c by name 'c'. breakpoint = target.BreakpointCreateByName('c', 'a.out') - #print "breakpoint:", breakpoint + #print("breakpoint:", breakpoint) self.assertTrue(breakpoint and breakpoint.GetNumLocations() == 1, VALID_BREAKPOINT) @@ -64,14 +66,14 @@ class SymbolContextAPITestCase(TestBase): function = context.GetFunction() self.assertTrue(function) - #print "function:", function + #print("function:", function) block = context.GetBlock() self.assertTrue(block) - #print "block:", block + #print("block:", block) lineEntry = context.GetLineEntry() - #print "line entry:", lineEntry + #print("line entry:", lineEntry) self.expect(lineEntry.GetFileSpec().GetDirectory(), "The line entry should have the correct directory", exe=False, substrs = [self.mydir]) diff --git a/lldb/test/python_api/target/TestTargetAPI.py b/lldb/test/python_api/target/TestTargetAPI.py index e61d82d0e04..eadae1dc045 100644 --- a/lldb/test/python_api/target/TestTargetAPI.py +++ b/lldb/test/python_api/target/TestTargetAPI.py @@ -2,6 +2,8 @@ Test SBTarget APIs. """ +from __future__ import print_function + import lldb_shared import unittest2 @@ -308,8 +310,8 @@ class TargetAPITestCase(TestBase): # Now create the two breakpoints inside function 'a'. breakpoint1 = target.BreakpointCreateByLocation('main.c', self.line1) breakpoint2 = target.BreakpointCreateByLocation('main.c', self.line2) - #print "breakpoint1:", breakpoint1 - #print "breakpoint2:", breakpoint2 + #print("breakpoint1:", breakpoint1) + #print("breakpoint2:", breakpoint2) self.assertTrue(breakpoint1 and breakpoint1.GetNumLocations() == 1, VALID_BREAKPOINT) @@ -344,23 +346,23 @@ class TargetAPITestCase(TestBase): address2 = lineEntry.GetStartAddress() - #print "address1:", address1 - #print "address2:", address2 + #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) self.assertTrue(context1 and context2) - #print "context1:", context1 - #print "context2:", context2 + #print("context1:", context1) + #print("context2:", context2) # Verify that the context point to the same function 'a'. symbol1 = context1.GetSymbol() symbol2 = context2.GetSymbol() self.assertTrue(symbol1 and symbol2) - #print "symbol1:", symbol1 - #print "symbol2:", symbol2 + #print("symbol1:", symbol1) + #print("symbol2:", symbol2) from lldbutil import get_description desc1 = get_description(symbol1) diff --git a/lldb/test/python_api/thread/TestThreadAPI.py b/lldb/test/python_api/thread/TestThreadAPI.py index 2fea893a1eb..4d8e9b4872d 100644 --- a/lldb/test/python_api/thread/TestThreadAPI.py +++ b/lldb/test/python_api/thread/TestThreadAPI.py @@ -2,6 +2,8 @@ Test SBThread APIs. """ +from __future__ import print_function + import lldb_shared import os, time @@ -85,7 +87,7 @@ class ThreadAPITestCase(TestBase): self.runCmd("process status") proc_of_thread = thread.GetProcess() - #print "proc_of_thread:", proc_of_thread + #print("proc_of_thread:", proc_of_thread) self.assertTrue(proc_of_thread.GetProcessID() == process.GetProcessID()) def get_stop_description(self): @@ -224,8 +226,8 @@ class ThreadAPITestCase(TestBase): start_addr = lineEntry.GetStartAddress().GetLoadAddress(target) end_addr = lineEntry.GetEndAddress().GetLoadAddress(target) if self.TraceOn(): - print "start addr:", hex(start_addr) - print "end addr:", hex(end_addr) + print("start addr:", hex(start_addr)) + print("end addr:", hex(end_addr)) # Disable the breakpoint. self.assertTrue(target.DisableAllBreakpoints()) diff --git a/lldb/test/python_api/type/TestTypeList.py b/lldb/test/python_api/type/TestTypeList.py index 4be01a210bf..27683c1dc1b 100644 --- a/lldb/test/python_api/type/TestTypeList.py +++ b/lldb/test/python_api/type/TestTypeList.py @@ -2,6 +2,8 @@ Test SBType and SBTypeList API. """ +from __future__ import print_function + import lldb_shared import os, time @@ -51,7 +53,7 @@ class TypeAndTypeListTestCase(TestBase): # 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() + 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 for type in type_list: self.assertTrue(type) diff --git a/lldb/test/python_api/value/TestValueAPI.py b/lldb/test/python_api/value/TestValueAPI.py index e6d8825c530..26813506cb3 100644 --- a/lldb/test/python_api/value/TestValueAPI.py +++ b/lldb/test/python_api/value/TestValueAPI.py @@ -2,6 +2,8 @@ Test some SBValue APIs. """ +from __future__ import print_function + import lldb_shared import os, time @@ -73,10 +75,10 @@ class ValueAPITestCase(TestBase): cvf = lldbutil.ChildVisitingFormatter(indent_child=2) rdf = lldbutil.RecursiveDecentFormatter(indent_child=2) if self.TraceOn(): - print fmt.format(days_of_week) - print cvf.format(days_of_week) - print cvf.format(weekdays) - print rdf.format(g_table) + print(fmt.format(days_of_week)) + print(cvf.format(days_of_week)) + print(cvf.format(weekdays)) + print(rdf.format(g_table)) # Get variable 'my_int_ptr'. value = frame0.FindVariable('my_int_ptr') diff --git a/lldb/test/python_api/value/change_values/TestChangeValueAPI.py b/lldb/test/python_api/value/change_values/TestChangeValueAPI.py index 0b326b945e1..452cc63e704 100644 --- a/lldb/test/python_api/value/change_values/TestChangeValueAPI.py +++ b/lldb/test/python_api/value/change_values/TestChangeValueAPI.py @@ -2,6 +2,8 @@ Test some SBValue APIs. """ +from __future__ import print_function + import lldb_shared import os, time diff --git a/lldb/test/python_api/value/linked_list/TestValueAPILinkedList.py b/lldb/test/python_api/value/linked_list/TestValueAPILinkedList.py index 8270ed8fffe..4c3a9b0da46 100644 --- a/lldb/test/python_api/value/linked_list/TestValueAPILinkedList.py +++ b/lldb/test/python_api/value/linked_list/TestValueAPILinkedList.py @@ -3,6 +3,8 @@ Test SBValue API linked_list_iter which treats the SBValue as a linked list and supports iteration till the end of list is reached. """ +from __future__ import print_function + import lldb_shared import os, time @@ -63,12 +65,12 @@ class ValueAsLinkedListTestCase(TestBase): # Make sure that 'next' corresponds to an SBValue with pointer type. self.assertTrue(t.TypeIsPointerType()) if self.TraceOn(): - print cvf.format(t) + print(cvf.format(t)) list.append(int(t.GetChildMemberWithName("id").GetValue())) # Sanity checks that the we visited all the items (no more, no less). if self.TraceOn(): - print "visited IDs:", list + print("visited IDs:", list) self.assertTrue(visitedIDs == list) # Let's exercise the linked_list_iter() API again, this time supplying @@ -93,12 +95,12 @@ class ValueAsLinkedListTestCase(TestBase): # Make sure that 'next' corresponds to an SBValue with pointer type. self.assertTrue(t.TypeIsPointerType()) if self.TraceOn(): - print cvf.format(t) + print(cvf.format(t)) list.append(int(t.GetChildMemberWithName("id").GetValue())) # Sanity checks that the we visited all the items (no more, no less). if self.TraceOn(): - print "visited IDs:", list + print("visited IDs:", list) self.assertTrue(visitedIDs == list) # Get variable 'empty_task_head'. @@ -110,7 +112,7 @@ class ValueAsLinkedListTestCase(TestBase): # There is no iterable item from empty_task_head.linked_list_iter(). for t in empty_task_head.linked_list_iter('next', eol): if self.TraceOn(): - print cvf.format(t) + print(cvf.format(t)) list.append(int(t.GetChildMemberWithName("id").GetValue())) self.assertTrue(len(list) == 0) @@ -124,7 +126,7 @@ class ValueAsLinkedListTestCase(TestBase): # There 3 iterable items from task_evil.linked_list_iter(). :-) for t in task_evil.linked_list_iter('next'): if self.TraceOn(): - print cvf.format(t) + print(cvf.format(t)) list.append(int(t.GetChildMemberWithName("id").GetValue())) self.assertTrue(len(list) == 3) diff --git a/lldb/test/python_api/value_var_update/TestValueVarUpdate.py b/lldb/test/python_api/value_var_update/TestValueVarUpdate.py index 9c0123ec2e1..87e0ccd6629 100644 --- a/lldb/test/python_api/value_var_update/TestValueVarUpdate.py +++ b/lldb/test/python_api/value_var_update/TestValueVarUpdate.py @@ -1,5 +1,7 @@ """Test SBValue::GetValueDidChange""" +from __future__ import print_function + import lldb_shared import os, sys, time diff --git a/lldb/test/python_api/watchpoint/TestSetWatchpoint.py b/lldb/test/python_api/watchpoint/TestSetWatchpoint.py index 242b199db7d..5554ff044d6 100644 --- a/lldb/test/python_api/watchpoint/TestSetWatchpoint.py +++ b/lldb/test/python_api/watchpoint/TestSetWatchpoint.py @@ -2,6 +2,8 @@ Use lldb Python SBValue API to create a watchpoint for read_write of 'globl' var. """ +from __future__ import print_function + import lldb_shared import os, time @@ -61,7 +63,7 @@ class SetWatchpointAPITestCase(TestBase): if not self.TraceOn(): self.HideStdout() - print watchpoint + print(watchpoint) # Continue. Expect the program to stop due to the variable being written to. process.Continue() diff --git a/lldb/test/python_api/watchpoint/TestWatchpointIgnoreCount.py b/lldb/test/python_api/watchpoint/TestWatchpointIgnoreCount.py index f8ae2a23966..95dad364de9 100644 --- a/lldb/test/python_api/watchpoint/TestWatchpointIgnoreCount.py +++ b/lldb/test/python_api/watchpoint/TestWatchpointIgnoreCount.py @@ -2,6 +2,8 @@ Use lldb Python SBWatchpoint API to set the ignore count. """ +from __future__ import print_function + import lldb_shared import os, time @@ -68,12 +70,12 @@ class WatchpointIgnoreCountTestCase(TestBase): self.assertTrue(watchpoint.GetIgnoreCount() == 0) watch_id = watchpoint.GetID() self.assertTrue(watch_id != 0) - print watchpoint + print(watchpoint) # Now immediately set the ignore count to 2. When we continue, expect the # inferior to run to its completion without stopping due to watchpoint. watchpoint.SetIgnoreCount(2) - print watchpoint + print(watchpoint) process.Continue() # At this point, the inferior process should have exited. @@ -83,4 +85,4 @@ class WatchpointIgnoreCountTestCase(TestBase): self.assertTrue(watchpoint) self.assertTrue(watchpoint.GetWatchSize() == 4) self.assertTrue(watchpoint.GetHitCount() == 2) - print watchpoint + print(watchpoint) diff --git a/lldb/test/python_api/watchpoint/TestWatchpointIter.py b/lldb/test/python_api/watchpoint/TestWatchpointIter.py index 0ba73c0500b..4ce2c0d79d8 100644 --- a/lldb/test/python_api/watchpoint/TestWatchpointIter.py +++ b/lldb/test/python_api/watchpoint/TestWatchpointIter.py @@ -2,6 +2,8 @@ Use lldb Python SBTarget API to iterate on the watchpoint(s) for the target. """ +from __future__ import print_function + import lldb_shared import os, time @@ -84,11 +86,11 @@ class WatchpointIteratorTestCase(TestBase): # We currently only support hardware watchpoint. Verify that we have a # meaningful hardware index at this point. Exercise the printed repr of # SBWatchpointLocation. - print watchpoint + print(watchpoint) self.assertTrue(watchpoint.GetHardwareIndex() != -1) # SBWatchpoint.GetDescription() takes a description level arg. - print lldbutil.get_description(watchpoint, lldb.eDescriptionLevelFull) + print(lldbutil.get_description(watchpoint, lldb.eDescriptionLevelFull)) # Now disable the 'rw' watchpoint. The program won't stop when it reads # 'global' next. @@ -108,4 +110,5 @@ class WatchpointIteratorTestCase(TestBase): self.assertTrue(watchpoint) self.assertTrue(watchpoint.GetWatchSize() == 4) self.assertTrue(watchpoint.GetHitCount() == 1) - print watchpoint + print(watchpoint) + diff --git a/lldb/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py b/lldb/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py index dd7c79971e8..582e60ebe2c 100644 --- a/lldb/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py +++ b/lldb/test/python_api/watchpoint/condition/TestWatchpointConditionAPI.py @@ -2,6 +2,8 @@ Test watchpoint condition API. """ +from __future__ import print_function + import lldb_shared import os, time @@ -71,7 +73,7 @@ class WatchpointConditionAPITestCase(TestBase): if not self.TraceOn(): self.HideStdout() - print watchpoint + print(watchpoint) # Continue. Expect the program to stop due to the variable being written to. process.Continue() diff --git a/lldb/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py b/lldb/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py index 51a8955b689..3ce2445f442 100644 --- a/lldb/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py +++ b/lldb/test/python_api/watchpoint/watchlocation/TestSetWatchlocation.py @@ -2,6 +2,8 @@ Use lldb Python SBValue.WatchPointee() API to create a watchpoint for write of '*g_char_ptr'. """ +from __future__ import print_function + import lldb_shared import os, time @@ -68,7 +70,7 @@ class SetWatchlocationAPITestCase(TestBase): if not self.TraceOn(): self.HideStdout() - print watchpoint + print(watchpoint) # Continue. Expect the program to stop due to the variable being written to. process.Continue() diff --git a/lldb/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py b/lldb/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py index d6a3ca60c87..884989f46de 100644 --- a/lldb/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py +++ b/lldb/test/python_api/watchpoint/watchlocation/TestTargetWatchAddress.py @@ -2,6 +2,8 @@ Use lldb Python SBtarget.WatchAddress() API to create a watchpoint for write of '*g_char_ptr'. """ +from __future__ import print_function + import lldb_shared import os, time @@ -68,7 +70,7 @@ class TargetWatchAddressAPITestCase(TestBase): if not self.TraceOn(): self.HideStdout() - print watchpoint + print(watchpoint) # Continue. Expect the program to stop due to the variable being written to. process.Continue() |