Skip to content

Commit

Permalink
perf: net_dropmonitor: Fix symbol-relative addresses
Browse files Browse the repository at this point in the history
The comparison between traced and symbol addresses is backwards: if
the traced address doesn't exactly match a symbol (which we don't
expect it to), we'll show the next symbol and the offset to it,
whereas we should show the previous symbol and the offset from it.

Cc: [email protected]
Signed-off-by: Ben Hutchings <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
bwhacks authored and davem330 committed May 22, 2013
1 parent 140c3c6 commit 5a1e99d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions tools/perf/scripts/python/net_dropmonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ def get_kallsyms_table():

def get_sym(sloc):
loc = int(sloc)
for i in kallsyms:
if (i['loc'] >= loc):
return (i['name'], i['loc']-loc)
for i in kallsyms[::-1]:
if loc >= i['loc']:
return (i['name'], loc - i['loc'])
return (None, 0)

def print_drop_table():
Expand Down

0 comments on commit 5a1e99d

Please sign in to comment.