Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Unified Diff: tools/cygprofile/patch_orderfile.py

Issue 799893003: Fix pylint error in patch_orderfile and symbolize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use super instead of Exception Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | tools/cygprofile/symbolize.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/cygprofile/patch_orderfile.py
diff --git a/tools/cygprofile/patch_orderfile.py b/tools/cygprofile/patch_orderfile.py
index a06955680bc259ab0beefcb6ae3ec82a7c43be07..2c6513f2db35a65b0da02937d3e0642409f8eb2f 100755
--- a/tools/cygprofile/patch_orderfile.py
+++ b/tools/cygprofile/patch_orderfile.py
@@ -38,26 +38,27 @@ while nm_index < len(nmlines):
else:
nm_index = nm_index + 1
-def binary_search (addr, start, end):
+def binary_search (search_addr, start, end):
if start >= end or start == end - 1:
- (nm_addr, size) = uniqueAddrs[start]
- if not (addr >= nm_addr and addr < nm_addr + size):
- sys.stderr.write ("ERROR: did not find function in binary: addr: " +
- hex(addr) + " nm_addr: " + str(nm_addr) + " start: " + str(start) +
- " end: " + str(end) + "\n")
- raise Error("error")
- return (addressMap[nm_addr], size)
+ (nm_addr, sym_size) = uniqueAddrs[start]
+ if not (search_addr >= nm_addr and search_addr < nm_addr + sym_size):
+ error_message = ('ERROR: did not find function in binary: addr: ' +
+ hex(addr) + ' nm_addr: ' + str(nm_addr) + ' start: ' +
+ str(start) + ' end: ' + str(end))
+ sys.stderr.write(error_message + "\n")
+ raise Exception(error_message)
+ return (addressMap[nm_addr], sym_size)
else:
halfway = start + ((end - start) / 2)
- (nm_addr, size) = uniqueAddrs[halfway]
- if (addr >= nm_addr and addr < nm_addr + size):
- return (addressMap[nm_addr], size)
+ nm_addr = uniqueAddrs[halfway][0]
+ if (addr >= nm_addr and addr < nm_addr + sym_size):
+ return (addressMap[nm_addr], sym_size)
elif (addr < nm_addr):
return binary_search (addr, start, halfway)
- elif (addr >= nm_addr + size):
+ elif (addr >= nm_addr + sym_size):
return binary_search (addr, halfway, end)
else:
- raise "ERROR: did not expect this case"
+ raise Exception("ERROR: did not expect this case")
f = open (orderfile)
lines = f.readlines()
@@ -77,13 +78,13 @@ functionAddressMap = {}
for line in nmlines:
try:
functionName = line.split()[3]
- except:
+ except Exception:
functionName = line.split()[2]
functionName = functionName.split('.clone.')[0]
functionAddress = int (line.split()[0].strip(), 16)
try:
functionAddressMap[functionName].append(functionAddress)
- except:
+ except Exception:
functionAddressMap[functionName] = [functionAddress]
functions.append(functionName)
@@ -94,7 +95,7 @@ for function in profiled_list:
try:
addrs = functionAddressMap[function]
symbols_found = symbols_found + 1
- except:
+ except Exception:
addrs = []
# sys.stderr.write ("WARNING: could not find symbol " + function + "\n")
for addr in addrs:
« no previous file with comments | « no previous file | tools/cygprofile/symbolize.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698