mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-01 08:42:13 +00:00
Bug 1464869 - Fix flake8/pep8 issue by hand in memory/ r=njn
MozReview-Commit-ID: 8bkhAB4g6rv --HG-- extra : rebase_source : 623f4ed95d601b47878c910859f3b91e87897011
This commit is contained in:
parent
21f28e8329
commit
3e84d308c3
@ -94,7 +94,8 @@ parser.add_argument('-f', '--max-frames', type=range_1_24, default=8,
|
||||
help='maximum number of frames to consider in each trace')
|
||||
|
||||
parser.add_argument('-c', '--chain-reports', action='store_true',
|
||||
help='if only one block is found to hold onto the object, report the next one, too')
|
||||
help='if only one block is found to hold onto the object, report '
|
||||
'the next one, too')
|
||||
|
||||
|
||||
####
|
||||
@ -122,7 +123,7 @@ def print_trace_segment(args, stacks, block):
|
||||
|
||||
for l in traceTable[block.alloc_stack]:
|
||||
# The 5: is to remove the bogus leading "#00: " from the stack frame.
|
||||
print ' ', frameTable[l][5:args.max_stack_frame_length]
|
||||
print(' ', frameTable[l][5:args.max_stack_frame_length])
|
||||
|
||||
|
||||
def show_referrers(args, blocks, stacks, block):
|
||||
@ -171,7 +172,7 @@ def show_referrers(args, blocks, stacks, block):
|
||||
break
|
||||
|
||||
if not anyFound:
|
||||
print 'No referrers found.'
|
||||
print('No referrers found.')
|
||||
|
||||
|
||||
def show_block_info(args, blocks, stacks, block):
|
||||
@ -225,8 +226,6 @@ def loadGraph(options):
|
||||
if j['version'] != outputVersion:
|
||||
raise Exception("'version' property isn't '{:d}'".format(outputVersion))
|
||||
|
||||
invocation = j['invocation']
|
||||
|
||||
block_list = j['blockList']
|
||||
blocks = {}
|
||||
|
||||
@ -248,9 +247,9 @@ def analyzeLogs():
|
||||
|
||||
block = int(options.block, 16)
|
||||
|
||||
if not block in blocks:
|
||||
print 'Object', block, 'not found in traces.'
|
||||
print 'It could still be the target of some nodes.'
|
||||
if block not in blocks:
|
||||
print('Object', block, 'not found in traces.')
|
||||
print('It could still be the target of some nodes.')
|
||||
return
|
||||
|
||||
if options.info:
|
||||
|
@ -28,13 +28,17 @@ outputVersion = 5
|
||||
# we hit a non-matching frame, any subsequent frames won't be removed even if
|
||||
# they do match.)
|
||||
allocatorFns = [
|
||||
# Matches malloc, replace_malloc, moz_xmalloc, vpx_malloc, js_malloc, pod_malloc, malloc_zone_*, g_malloc.
|
||||
# Matches malloc, replace_malloc, moz_xmalloc, vpx_malloc, js_malloc,
|
||||
# pod_malloc, malloc_zone_*, g_malloc.
|
||||
'malloc',
|
||||
# Matches calloc, replace_calloc, moz_xcalloc, vpx_calloc, js_calloc, pod_calloc, malloc_zone_calloc, pod_callocCanGC.
|
||||
# Matches calloc, replace_calloc, moz_xcalloc, vpx_calloc, js_calloc,
|
||||
# pod_calloc, malloc_zone_calloc, pod_callocCanGC.
|
||||
'calloc',
|
||||
# Matches realloc, replace_realloc, moz_xrealloc, vpx_realloc, js_realloc, pod_realloc, pod_reallocCanGC.
|
||||
# Matches realloc, replace_realloc, moz_xrealloc, vpx_realloc, js_realloc,
|
||||
# pod_realloc, pod_reallocCanGC.
|
||||
'realloc',
|
||||
# Matches memalign, posix_memalign, replace_memalign, replace_posix_memalign, moz_xmemalign, vpx_memalign, malloc_zone_memalign.
|
||||
# Matches memalign, posix_memalign, replace_memalign, replace_posix_memalign,
|
||||
# moz_xmemalign, vpx_memalign, malloc_zone_memalign.
|
||||
'memalign',
|
||||
'operator new(',
|
||||
'operator new[](',
|
||||
@ -181,10 +185,12 @@ variable is used to find breakpad symbols for stack fixing.
|
||||
help='do not fix stacks')
|
||||
|
||||
p.add_argument('--clamp-contents', action='store_true',
|
||||
help='for a scan mode log, clamp addresses to the start of live blocks, or zero if not in one')
|
||||
help='for a scan mode log, clamp addresses to the start of live blocks, '
|
||||
'or zero if not in one')
|
||||
|
||||
p.add_argument('--print-clamp-stats', action='store_true',
|
||||
help='print information about the results of pointer clamping; mostly useful for debugging clamping')
|
||||
help='print information about the results of pointer clamping; mostly '
|
||||
'useful for debugging clamping')
|
||||
|
||||
p.add_argument('--filter-stacks-for-testing', action='store_true',
|
||||
help='filter stack traces; only useful for testing purposes')
|
||||
@ -290,7 +296,7 @@ def getDigestFromFile(args, inputFile):
|
||||
if mode == 'scan':
|
||||
mode = 'live'
|
||||
|
||||
if not mode in ['live', 'dark-matter', 'cumulative']:
|
||||
if mode not in ['live', 'dark-matter', 'cumulative']:
|
||||
raise Exception("bad 'mode' property: '{:s}'".format(mode))
|
||||
|
||||
# Remove allocation functions at the start of traces.
|
||||
@ -426,7 +432,7 @@ def getDigestFromFile(args, inputFile):
|
||||
record.reqSize += num * reqSize
|
||||
record.slopSize += num * slopSize
|
||||
record.usableSize += num * usableSize
|
||||
if record.allocatedAtDesc == None:
|
||||
if record.allocatedAtDesc is None:
|
||||
record.allocatedAtDesc = \
|
||||
buildTraceDescription(traceTable, frameTable,
|
||||
allocatedAtTraceKey)
|
||||
@ -621,7 +627,7 @@ def printDigest(args, digest):
|
||||
|
||||
def printInvocation(n, dmdEnvVar, mode):
|
||||
out('Invocation{:} {{'.format(n))
|
||||
if dmdEnvVar == None:
|
||||
if dmdEnvVar is None:
|
||||
out(' $DMD is undefined')
|
||||
else:
|
||||
out(' $DMD = \'' + dmdEnvVar + '\'')
|
||||
@ -778,10 +784,12 @@ class ClampStats:
|
||||
def log(self):
|
||||
sys.stderr.write('Results:\n')
|
||||
sys.stderr.write(
|
||||
' Number of pointers already pointing to start of blocks: ' + str(self.startBlockPtr) + '\n')
|
||||
' Number of pointers already pointing to start of blocks: ' +
|
||||
str(self.startBlockPtr) + '\n')
|
||||
sys.stderr.write(' Number of pointers clamped to start of blocks: ' +
|
||||
str(self.midBlockPtr) + '\n')
|
||||
sys.stderr.write(' Number of non-null pointers not pointing into blocks clamped to null: ' +
|
||||
sys.stderr.write(' Number of non-null pointers not pointing into blocks '
|
||||
'clamped to null: ' +
|
||||
str(self.nonNullNonBlockPtr) + '\n')
|
||||
sys.stderr.write(' Number of null pointers: ' + str(self.nullPtr) + '\n')
|
||||
|
||||
@ -844,7 +852,7 @@ def clampBlockList(args, inputFileName, isZipped, opener):
|
||||
|
||||
for block in blockList:
|
||||
# Small blocks don't have any contents.
|
||||
if not 'contents' in block:
|
||||
if 'contents' not in block:
|
||||
continue
|
||||
|
||||
cont = block['contents']
|
||||
|
@ -25,7 +25,8 @@ This is only for testing. Input files can be gzipped.
|
||||
p = argparse.ArgumentParser(description=description)
|
||||
|
||||
p.add_argument('--clamp-contents', action='store_true',
|
||||
help='expect that the contents of the JSON input file have had their addresses clamped')
|
||||
help='expect that the contents of the JSON input file have had '
|
||||
'their addresses clamped')
|
||||
|
||||
p.add_argument('input_file',
|
||||
help='a file produced by DMD')
|
||||
|
@ -82,7 +82,7 @@ def split_log_line(line):
|
||||
else:
|
||||
tid = pid
|
||||
return pid, tid, func, args, result
|
||||
except:
|
||||
except Exception:
|
||||
raise Ignored('Malformed input')
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user