···40404141def get_sym(sloc):4242 loc = int(sloc)4343- for symloc, name in kallsyms[::-1]:4444- if loc >= symloc:4545- return (name, loc - symloc)4646- return (None, 0)4343+4444+ # Invariant: kallsyms[i][0] <= loc for all 0 <= i <= start4545+ # kallsyms[i][0] > loc for all end <= i < len(kallsyms)4646+ start, end = -1, len(kallsyms)4747+ while end != start + 1:4848+ pivot = (start + end) // 24949+ if loc < kallsyms[pivot][0]:5050+ end = pivot5151+ else:5252+ start = pivot5353+5454+ # Now (start == -1 or kallsyms[start][0] <= loc)5555+ # and (start == len(kallsyms) - 1 or loc < kallsyms[start + 1][0])5656+ if start >= 0:5757+ symloc, name = kallsyms[start]5858+ return (name, loc - symloc)5959+ else:6060+ return (None, 0)47614862def print_drop_table():4963 print "%25s %25s %25s" % ("LOCATION", "OFFSET", "COUNT")