Skip to content
This repository was archived by the owner on May 21, 2019. It is now read-only.

Commit 77732b8

Browse files
committed
asan_symbolize.py: [Py3] Get rid of "print" statement. Use print() or write() instead.
Differential Revision: https://reviews.llvm.org/D27404 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@294450 91177308-0d34-0410-b5e6-96231b3b80d8
1 parent ebc7c29 commit 77732b8

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

lib/asan/scripts/asan_symbolize.py

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def open_llvm_symbolizer(self):
8989
for hint in self.dsym_hints:
9090
cmd.append('--dsym-hint=%s' % hint)
9191
if DEBUG:
92-
print ' '.join(cmd)
92+
print(' '.join(cmd))
9393
try:
9494
result = subprocess.Popen(cmd, stdin=subprocess.PIPE,
9595
stdout=subprocess.PIPE,
@@ -107,8 +107,8 @@ def symbolize(self, addr, binary, offset):
107107
try:
108108
symbolizer_input = '"%s" %s' % (binary, offset)
109109
if DEBUG:
110-
print symbolizer_input
111-
print >> self.pipe.stdin, symbolizer_input
110+
print(symbolizer_input)
111+
self.pipe.stdin.write("%s\n" % symbolizer_input)
112112
while True:
113113
function_name = self.pipe.stdout.readline().rstrip()
114114
if not function_name:
@@ -153,7 +153,7 @@ def open_addr2line(self):
153153
cmd += ['--demangle']
154154
cmd += ['-e', self.binary]
155155
if DEBUG:
156-
print ' '.join(cmd)
156+
print(' '.join(cmd))
157157
return subprocess.Popen(cmd,
158158
stdin=subprocess.PIPE, stdout=subprocess.PIPE,
159159
bufsize=0,
@@ -165,8 +165,8 @@ def symbolize(self, addr, binary, offset):
165165
return None
166166
lines = []
167167
try:
168-
print >> self.pipe.stdin, offset
169-
print >> self.pipe.stdin, self.output_terminator
168+
self.pipe.stdin.write("%s\n" % offset)
169+
self.pipe.stdin.write("%s\n" % self.output_terminator)
170170
is_first_frame = True
171171
while True:
172172
function_name = self.pipe.stdout.readline().rstrip()
@@ -223,7 +223,7 @@ def __init__(self, addr, binary, arch):
223223

224224
def open_atos(self):
225225
if DEBUG:
226-
print 'atos -o %s -arch %s' % (self.binary, self.arch)
226+
print('atos -o %s -arch %s' % (self.binary, self.arch))
227227
cmdline = ['atos', '-o', self.binary, '-arch', self.arch]
228228
self.atos = UnbufferedLineConverter(cmdline, close_stderr=True)
229229

@@ -238,7 +238,7 @@ def symbolize(self, addr, binary, offset):
238238
# foo(type1, type2) (in object.name) (filename.cc:80)
239239
match = re.match('^(.*) \(in (.*)\) \((.*:\d*)\)$', atos_line)
240240
if DEBUG:
241-
print 'atos_line: ', atos_line
241+
print('atos_line: ', atos_line)
242242
if match:
243243
function_name = match.group(1)
244244
function_name = re.sub('\(.*?\)', '', function_name)
@@ -352,7 +352,7 @@ def symbolize(self, addr, binary, offset):
352352
function_name, file_name, line_no = res
353353
result = ['%s in %s %s:%d' % (
354354
addr, function_name, file_name, line_no)]
355-
print result
355+
print(result)
356356
return result
357357
else:
358358
return None
@@ -438,7 +438,7 @@ def process_logfile(self):
438438
self.frame_no = 0
439439
for line in logfile:
440440
processed = self.process_line(line)
441-
print '\n'.join(processed)
441+
print('\n'.join(processed))
442442

443443
def process_line_echo(self, line):
444444
return [line.rstrip()]
@@ -452,7 +452,7 @@ def process_line_posix(self, line):
452452
if not match:
453453
return [self.current_line]
454454
if DEBUG:
455-
print line
455+
print(line)
456456
_, frameno_str, addr, binary, offset = match.groups()
457457
arch = ""
458458
# Arch can be embedded in the filename, e.g.: "libabc.dylib:x86_64h"

0 commit comments

Comments
 (0)