summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/examples/customization/bin-utils/binutils.py2
-rwxr-xr-xlldb/examples/python/mach_o.py4
-rwxr-xr-xlldb/utils/git-svn/convert.py4
-rw-r--r--lldb/utils/lui/lldbutil.py16
-rwxr-xr-xlldb/utils/misc/grep-svn-log.py4
-rw-r--r--lldb/utils/sync-source/syncsource.py6
-rwxr-xr-xlldb/utils/test/disasm.py2
-rwxr-xr-xlldb/utils/test/run-until-faulted.py1
8 files changed, 18 insertions, 21 deletions
diff --git a/lldb/examples/customization/bin-utils/binutils.py b/lldb/examples/customization/bin-utils/binutils.py
index 20f5a2e3143..f1aa48fa26d 100644
--- a/lldb/examples/customization/bin-utils/binutils.py
+++ b/lldb/examples/customization/bin-utils/binutils.py
@@ -1,7 +1,5 @@
"Collection of tools for displaying bit representation of numbers."""
-import StringIO
-
from __future__ import print_function
def binary(n, width=None):
diff --git a/lldb/examples/python/mach_o.py b/lldb/examples/python/mach_o.py
index 0f36a8bc330..eb97fe57cfc 100755
--- a/lldb/examples/python/mach_o.py
+++ b/lldb/examples/python/mach_o.py
@@ -8,7 +8,7 @@ import optparse
import re
import struct
import string
-import StringIO
+import io
import sys
import uuid
@@ -1054,7 +1054,7 @@ class Mach:
if options.extract_modules:
# print "Extracting modules from mach file..."
data = file_extract.FileExtract(
- StringIO.StringIO(sect_bytes), self.data.byte_order)
+ io.BytesIO(sect_bytes), self.data.byte_order)
version = data.get_uint32()
num_modules = data.get_uint32()
# print "version = %u, num_modules = %u" %
diff --git a/lldb/utils/git-svn/convert.py b/lldb/utils/git-svn/convert.py
index 7f149ec0978..b6e54ed80b7 100755
--- a/lldb/utils/git-svn/convert.py
+++ b/lldb/utils/git-svn/convert.py
@@ -16,7 +16,7 @@ from __future__ import print_function
import os
import re
import sys
-import StringIO
+import io
def usage(problem_file=None):
@@ -37,7 +37,7 @@ def do_convert(file):
content = f_in.read()
# The new content to be written back to the same file.
- new_content = StringIO.StringIO()
+ new_content = io.StringIO()
# Boolean flag controls whether to start printing lines.
from_header_seen = False
diff --git a/lldb/utils/lui/lldbutil.py b/lldb/utils/lui/lldbutil.py
index 77b8cac8d72..6bfaaecab4b 100644
--- a/lldb/utils/lui/lldbutil.py
+++ b/lldb/utils/lui/lldbutil.py
@@ -17,7 +17,7 @@ from __future__ import print_function
import lldb
import os
import sys
-import StringIO
+import io
# ===================================================
# Utilities for locating/checking executable programs
@@ -52,7 +52,7 @@ def disassemble(target, function_or_symbol):
It returns the disassembly content in a string object.
"""
- buf = StringIO.StringIO()
+ buf = io.StringIO()
insts = function_or_symbol.GetInstructions(target)
for i in insts:
print(i, file=buf)
@@ -776,7 +776,7 @@ def get_stack_frames(thread):
def print_stacktrace(thread, string_buffer=False):
"""Prints a simple stack trace of this thread."""
- output = StringIO.StringIO() if string_buffer else sys.stdout
+ output = io.StringIO() if string_buffer else sys.stdout
target = thread.GetProcess().GetTarget()
depth = thread.GetNumFrames()
@@ -819,7 +819,7 @@ def print_stacktrace(thread, string_buffer=False):
def print_stacktraces(process, string_buffer=False):
"""Prints the stack traces of all the threads."""
- output = StringIO.StringIO() if string_buffer else sys.stdout
+ output = io.StringIO() if string_buffer else sys.stdout
print("Stack traces for " + str(process), file=output)
@@ -879,7 +879,7 @@ def get_args_as_string(frame, showFuncName=True):
def print_registers(frame, string_buffer=False):
"""Prints all the register sets of the frame."""
- output = StringIO.StringIO() if string_buffer else sys.stdout
+ output = io.StringIO() if string_buffer else sys.stdout
print("Register sets for " + str(frame), file=output)
@@ -962,7 +962,7 @@ class BasicFormatter(object):
def format(self, value, buffer=None, indent=0):
if not buffer:
- output = StringIO.StringIO()
+ output = io.StringIO()
else:
output = buffer
# If there is a summary, it suffices.
@@ -992,7 +992,7 @@ class ChildVisitingFormatter(BasicFormatter):
def format(self, value, buffer=None):
if not buffer:
- output = StringIO.StringIO()
+ output = io.StringIO()
else:
output = buffer
@@ -1019,7 +1019,7 @@ class RecursiveDecentFormatter(BasicFormatter):
def format(self, value, buffer=None):
if not buffer:
- output = StringIO.StringIO()
+ output = io.StringIO()
else:
output = buffer
diff --git a/lldb/utils/misc/grep-svn-log.py b/lldb/utils/misc/grep-svn-log.py
index 2a9795e37be..a1490479200 100755
--- a/lldb/utils/misc/grep-svn-log.py
+++ b/lldb/utils/misc/grep-svn-log.py
@@ -13,7 +13,7 @@ from __future__ import print_function
import fileinput
import re
import sys
-import StringIO
+import io
# Separator string for "svn log -v" output.
separator = '-' * 72
@@ -23,7 +23,7 @@ Example:
svn log -v | grep-svn-log.py '^ D.+why_are_you_missing.h'"""
-class Log(StringIO.StringIO):
+class Log(io.StringIO):
"""Simple facade to keep track of the log content."""
def __init__(self):
diff --git a/lldb/utils/sync-source/syncsource.py b/lldb/utils/sync-source/syncsource.py
index 66d7cd95bdf..6cf2612bd7e 100644
--- a/lldb/utils/sync-source/syncsource.py
+++ b/lldb/utils/sync-source/syncsource.py
@@ -11,7 +11,7 @@ and multiple OS types, verifying changes across all.
"""
import argparse
-import cStringIO
+import io
import importlib
import json
import os.path
@@ -89,11 +89,11 @@ def read_rcfile(filename):
# preserving the line count.
regex = re.compile(r"#.*$")
- comment_stripped_file = cStringIO.StringIO()
+ comment_stripped_file = io.StringIO()
with open(filename, "r") as json_file:
for line in json_file:
comment_stripped_file.write(regex.sub("", line))
- return json.load(cStringIO.StringIO(comment_stripped_file.getvalue()))
+ return json.load(io.StringIO(comment_stripped_file.getvalue()))
def find_appropriate_rcfile(options):
diff --git a/lldb/utils/test/disasm.py b/lldb/utils/test/disasm.py
index fc1db1acd73..7d95d893747 100755
--- a/lldb/utils/test/disasm.py
+++ b/lldb/utils/test/disasm.py
@@ -39,7 +39,7 @@ def do_llvm_mc_disassembly(
func,
mc,
mc_options):
- from cStringIO import StringIO
+ from io import StringIO
import pexpect
gdb_prompt = "\r\n\(gdb\) "
diff --git a/lldb/utils/test/run-until-faulted.py b/lldb/utils/test/run-until-faulted.py
index a51dbb88e1c..0ce32771f75 100755
--- a/lldb/utils/test/run-until-faulted.py
+++ b/lldb/utils/test/run-until-faulted.py
@@ -32,7 +32,6 @@ def which(program):
def do_lldb_launch_loop(lldb_command, exe, exe_options):
- from cStringIO import StringIO
import pexpect
import time
OpenPOWER on IntegriCloud