diff options
| author | Serge Guelton <sguelton@redhat.com> | 2019-03-25 15:23:34 +0000 |
|---|---|---|
| committer | Serge Guelton <sguelton@redhat.com> | 2019-03-25 15:23:34 +0000 |
| commit | 3a22c3cc2b06bd871cabddac3a541cdf03399b77 (patch) | |
| tree | 28d3f77dd241bf8ad0664f9937dfdf6be2176495 /lldb/utils | |
| parent | 6ee3804613b72ef2e14ca99b047611bddb4814ad (diff) | |
| download | bcm5719-llvm-3a22c3cc2b06bd871cabddac3a541cdf03399b77.tar.gz bcm5719-llvm-3a22c3cc2b06bd871cabddac3a541cdf03399b77.zip | |
Python 2/3 compat: StringIO
Differential Revision: https://reviews.llvm.org/D59582
llvm-svn: 356910
Diffstat (limited to 'lldb/utils')
| -rwxr-xr-x | lldb/utils/git-svn/convert.py | 4 | ||||
| -rw-r--r-- | lldb/utils/lui/lldbutil.py | 16 | ||||
| -rwxr-xr-x | lldb/utils/misc/grep-svn-log.py | 4 | ||||
| -rw-r--r-- | lldb/utils/sync-source/syncsource.py | 6 | ||||
| -rwxr-xr-x | lldb/utils/test/disasm.py | 2 | ||||
| -rwxr-xr-x | lldb/utils/test/run-until-faulted.py | 1 |
6 files changed, 16 insertions, 17 deletions
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 |

