Fix bug 550388: avoid regexp perf issues in the stack fixer. r=dbaron
This commit is contained in:
@@ -132,7 +132,8 @@ def cxxfilt(sym):
|
||||
cxxfilt_proc.stdin.write(sym[1:] + "\n")
|
||||
return cxxfilt_proc.stdout.readline().rstrip("\n")
|
||||
|
||||
line_re = re.compile("^([ \|0-9-]*)(.*) ?\[([^ ]*) \+(0x[0-9A-F]{1,8})\](.*)$")
|
||||
line_re = re.compile("^(.*) ?\[([^ ]*) \+(0x[0-9A-F]{1,8})\](.*)$")
|
||||
balance_tree_re = re.compile("^([ \|0-9-]*)")
|
||||
atos_sym_re = re.compile("^(\S+) \(in ([^)]+)\) \((.+)\)$")
|
||||
|
||||
def fixSymbols(line):
|
||||
@@ -140,7 +141,7 @@ def fixSymbols(line):
|
||||
if result is not None:
|
||||
# before allows preservation of balance trees
|
||||
# after allows preservation of counts
|
||||
(before, badsymbol, file, address, after) = result.groups()
|
||||
(before, file, address, after) = result.groups()
|
||||
address = int(address, 16)
|
||||
|
||||
if os.path.exists(file) and os.path.isfile(file):
|
||||
@@ -158,6 +159,9 @@ def fixSymbols(line):
|
||||
symbol = cxxfilt(symbol)
|
||||
info = "%s (%s, in %s)" % (symbol, fileline, library)
|
||||
|
||||
# throw away the bad symbol, but keep balance tree structure
|
||||
before = balance_tree_re.match(before).groups()[0]
|
||||
|
||||
return before + info + after + "\n"
|
||||
else:
|
||||
sys.stderr.write("Warning: File \"" + file + "\" does not exist.\n")
|
||||
|
||||
Reference in New Issue
Block a user