[ovs-dev] [PATCH] utilities: New helper ovs-parse-backtrace.

Ethan Jackson ethan at nicira.com
Wed Oct 17 20:21:45 UTC 2012


Actually, ovs_vswitchd is a silly name for that variable.  I've actually
decided to fold this in instead.

Ethan

---
 utilities/ovs-parse-backtrace.in | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/utilities/ovs-parse-backtrace.in b/utilities/ovs-parse-backtrace.in
index b420314..4f793be 100755
--- a/utilities/ovs-parse-backtrace.in
+++ b/utilities/ovs-parse-backtrace.in
@@ -24,7 +24,7 @@ import sys
 addr2line_cache = {}  # None if addr2line is missing or broken.
 
 
-def addr2line(ovs_vswitchd, addr):
+def addr2line(binary, addr):
     global addr2line_cache
 
     if addr2line_cache is None:
@@ -33,7 +33,7 @@ def addr2line(ovs_vswitchd, addr):
     if addr in addr2line_cache:
         return addr2line_cache[addr]
 
-    cmd = ["addr2line", "-f", "-s", "-e", ovs_vswitchd, addr]
+    cmd = ["addr2line", "-f", "-s", "-e", binary, addr]
     try:
         proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
                                 stderr=subprocess.PIPE)
@@ -63,12 +63,14 @@ result.  Expected usage is for ovs-appctl backtrace to be piped in.""")
         sys.exit(1)
 
     if len(args) == 1:
-        ovs_vswitchd = args[0]
+        binary = args[0]
     else:
-        ovs_vswitchd = "@sbindir@/ovs-vswitchd"
-        debug = "/usr/lib/debug%s.debug" % ovs_vswitchd
+        binary = "@sbindir@/ovs-vswitchd"
+        debug = "/usr/lib/debug%s.debug" % binary
         if os.path.exists(debug):
-            ovs_vswitchd = debug
+            binary = debug
+
+    print "Binary: %s\n" % binary
 
     stdin = sys.stdin.read()
     trace_list = stdin.strip().split("\n\n")
@@ -95,7 +97,7 @@ result.  Expected usage is for ovs-appctl backtrace to be piped in.""")
             match = re.search(r'\[(0x.*)]', line)
             if match:
                 print "%s %s" % (line.ljust(longest),
-                                 addr2line(ovs_vswitchd, match.group(1)))
+                                 addr2line(binary, match.group(1)))
             else:
                 print line
         print
-- 
1.7.12.3




More information about the dev mailing list