Blame SOURCES/0001-Convert-symbolication.py-to-python3-using-2to3.patch

056a81
From 660490d17fa1c649a7ad86da4a197c91090ce97a Mon Sep 17 00:00:00 2001
056a81
From: Tom Stellard <tstellar@redhat.com>
056a81
Date: Wed, 3 Oct 2018 15:44:30 -0700
056a81
Subject: [PATCH] Convert symbolication.py to python3 using 2to3
056a81
056a81
---
056a81
 examples/python/symbolication.py | 70 ++++++++++++++++++++--------------------
056a81
 1 file changed, 35 insertions(+), 35 deletions(-)
056a81
056a81
diff --git a/examples/python/symbolication.py b/examples/python/symbolication.py
056a81
index b655ad0..313d724 100755
056a81
--- a/examples/python/symbolication.py
056a81
+++ b/examples/python/symbolication.py
056a81
@@ -27,7 +27,7 @@
056a81
 #----------------------------------------------------------------------
056a81
 
056a81
 import lldb
056a81
-import commands
056a81
+import subprocess
056a81
 import optparse
056a81
 import os
056a81
 import plistlib
056a81
@@ -203,13 +203,13 @@ class Section:
056a81
                 if op == '+':
056a81
                     self.end_addr += self.start_addr
056a81
                 return True
056a81
-        print 'error: invalid section info string "%s"' % s
056a81
-        print 'Valid section info formats are:'
056a81
-        print 'Format                Example                    Description'
056a81
-        print '--------------------- -----------------------------------------------'
056a81
-        print '<name>=<base>        __TEXT=0x123000             Section from base address only'
056a81
-        print '<name>=<base>-<end>  __TEXT=0x123000-0x124000    Section from base address and end address'
056a81
-        print '<name>=<base>+<size> __TEXT=0x123000+0x1000      Section from base address and size'
056a81
+        print('error: invalid section info string "%s"' % s)
056a81
+        print('Valid section info formats are:')
056a81
+        print('Format                Example                    Description')
056a81
+        print('--------------------- -----------------------------------------------')
056a81
+        print('<name>=<base>        __TEXT=0x123000             Section from base address only')
056a81
+        print('<name>=<base>-<end>  __TEXT=0x123000-0x124000    Section from base address and end address')
056a81
+        print('<name>=<base>+<size> __TEXT=0x123000+0x1000      Section from base address and size')
056a81
         return False
056a81
 
056a81
     def __str__(self):
056a81
@@ -261,21 +261,21 @@ class Image:
056a81
         return obj
056a81
 
056a81
     def dump(self, prefix):
056a81
-        print "%s%s" % (prefix, self)
056a81
+        print("%s%s" % (prefix, self))
056a81
 
056a81
     def debug_dump(self):
056a81
-        print 'path = "%s"' % (self.path)
056a81
-        print 'resolved_path = "%s"' % (self.resolved_path)
056a81
-        print 'resolved = %i' % (self.resolved)
056a81
-        print 'unavailable = %i' % (self.unavailable)
056a81
-        print 'uuid = %s' % (self.uuid)
056a81
-        print 'section_infos = %s' % (self.section_infos)
056a81
-        print 'identifier = "%s"' % (self.identifier)
056a81
-        print 'version = %s' % (self.version)
056a81
-        print 'arch = %s' % (self.arch)
056a81
-        print 'module = %s' % (self.module)
056a81
-        print 'symfile = "%s"' % (self.symfile)
056a81
-        print 'slide = %i (0x%x)' % (self.slide, self.slide)
056a81
+        print('path = "%s"' % (self.path))
056a81
+        print('resolved_path = "%s"' % (self.resolved_path))
056a81
+        print('resolved = %i' % (self.resolved))
056a81
+        print('unavailable = %i' % (self.unavailable))
056a81
+        print('uuid = %s' % (self.uuid))
056a81
+        print('section_infos = %s' % (self.section_infos))
056a81
+        print('identifier = "%s"' % (self.identifier))
056a81
+        print('version = %s' % (self.version))
056a81
+        print('arch = %s' % (self.arch))
056a81
+        print('module = %s' % (self.module))
056a81
+        print('symfile = "%s"' % (self.symfile))
056a81
+        print('slide = %i (0x%x)' % (self.slide, self.slide))
056a81
 
056a81
     def __str__(self):
056a81
         s = ''
056a81
@@ -428,12 +428,12 @@ class Image:
056a81
                 if self.has_section_load_info():
056a81
                     err = self.load_module(target)
056a81
                     if err:
056a81
-                        print 'ERROR: ', err
056a81
+                        print('ERROR: ', err)
056a81
                 return target
056a81
             else:
056a81
-                print 'error: unable to create a valid target for (%s) "%s"' % (self.arch, self.path)
056a81
+                print('error: unable to create a valid target for (%s) "%s"' % (self.arch, self.path))
056a81
         else:
056a81
-            print 'error: unable to locate main executable (%s) "%s"' % (self.arch, self.path)
056a81
+            print('error: unable to locate main executable (%s) "%s"' % (self.arch, self.path))
056a81
         return None
056a81
 
056a81
 
056a81
@@ -554,7 +554,7 @@ class Symbolicator:
056a81
                     if symbolicated_addresses:
056a81
                         return symbolicated_addresses
056a81
         else:
056a81
-            print 'error: no target in Symbolicator'
056a81
+            print('error: no target in Symbolicator')
056a81
         return None
056a81
 
056a81
 
056a81
@@ -602,22 +602,22 @@ def disassemble_instructions(
056a81
             end_idx = inst_idx
056a81
         for i in range(start_idx, end_idx + 1):
056a81
             if i == pc_index:
056a81
-                print ' -> ', lines[i]
056a81
+                print(' -> ', lines[i])
056a81
             else:
056a81
-                print '    ', lines[i]
056a81
+                print('    ', lines[i])
056a81
 
056a81
 
056a81
 def print_module_section_data(section):
056a81
-    print section
056a81
+    print(section)
056a81
     section_data = section.GetSectionData()
056a81
     if section_data:
056a81
         ostream = lldb.SBStream()
056a81
         section_data.GetDescription(ostream, section.GetFileAddress())
056a81
-        print ostream.GetData()
056a81
+        print(ostream.GetData())
056a81
 
056a81
 
056a81
 def print_module_section(section, depth):
056a81
-    print section
056a81
+    print(section)
056a81
     if depth > 0:
056a81
         num_sub_sections = section.GetNumSubSections()
056a81
         for sect_idx in range(num_sub_sections):
056a81
@@ -632,7 +632,7 @@ def print_module_sections(module, depth):
056a81
 
056a81
 def print_module_symbols(module):
056a81
     for sym in module:
056a81
-        print sym
056a81
+        print(sym)
056a81
 
056a81
 
056a81
 def Symbolicate(command_args):
056a81
@@ -709,17 +709,17 @@ def Symbolicate(command_args):
056a81
 
056a81
     target = symbolicator.create_target()
056a81
     if options.verbose:
056a81
-        print symbolicator
056a81
+        print(symbolicator)
056a81
     if target:
056a81
         for addr_str in args:
056a81
             addr = int(addr_str, 0)
056a81
             symbolicated_addrs = symbolicator.symbolicate(
056a81
                 addr, options.verbose)
056a81
             for symbolicated_addr in symbolicated_addrs:
056a81
-                print symbolicated_addr
056a81
-            print
056a81
+                print(symbolicated_addr)
056a81
+            print()
056a81
     else:
056a81
-        print 'error: no target for %s' % (symbolicator)
056a81
+        print('error: no target for %s' % (symbolicator))
056a81
 
056a81
 if __name__ == '__main__':
056a81
     # Create a new debugger instance
056a81
-- 
056a81
1.8.3.1
056a81