perf: net_dropmonitor: Fix symbol-relative addresses
authorBen Hutchings <ben@decadent.org.uk>
Mon, 20 May 2013 14:45:26 +0000 (14:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 22 May 2013 22:10:10 +0000 (15:10 -0700)
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: stable@vger.kernel.org
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/perf/scripts/python/net_dropmonitor.py

index adbfbf030576038d1a90d194ee22ebeaa6c8afcb..4c1160560917b1d2ddf36c2ca614f0c011519d36 100755 (executable)
@@ -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():