summaryrefslogtreecommitdiffstats
path: root/kernel/arch/ia64/scripts/unwcheck.py
diff options
context:
space:
mode:
authorYunhong Jiang <yunhong.jiang@intel.com>2015-08-04 12:17:53 -0700
committerYunhong Jiang <yunhong.jiang@intel.com>2015-08-04 15:44:42 -0700
commit9ca8dbcc65cfc63d6f5ef3312a33184e1d726e00 (patch)
tree1c9cafbcd35f783a87880a10f85d1a060db1a563 /kernel/arch/ia64/scripts/unwcheck.py
parent98260f3884f4a202f9ca5eabed40b1354c489b29 (diff)
Add the rt linux 4.1.3-rt3 as base
Import the rt linux 4.1.3-rt3 as OPNFV kvm base. It's from git://git.kernel.org/pub/scm/linux/kernel/git/rt/linux-rt-devel.git linux-4.1.y-rt and the base is: commit 0917f823c59692d751951bf5ea699a2d1e2f26a2 Author: Sebastian Andrzej Siewior <bigeasy@linutronix.de> Date: Sat Jul 25 12:13:34 2015 +0200 Prepare v4.1.3-rt3 Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de> We lose all the git history this way and it's not good. We should apply another opnfv project repo in future. Change-Id: I87543d81c9df70d99c5001fbdf646b202c19f423 Signed-off-by: Yunhong Jiang <yunhong.jiang@intel.com>
Diffstat (limited to 'kernel/arch/ia64/scripts/unwcheck.py')
-rw-r--r--kernel/arch/ia64/scripts/unwcheck.py64
1 files changed, 64 insertions, 0 deletions
diff --git a/kernel/arch/ia64/scripts/unwcheck.py b/kernel/arch/ia64/scripts/unwcheck.py
new file mode 100644
index 000000000..2bfd941ff
--- /dev/null
+++ b/kernel/arch/ia64/scripts/unwcheck.py
@@ -0,0 +1,64 @@
+#!/usr/bin/python
+#
+# Usage: unwcheck.py FILE
+#
+# This script checks the unwind info of each function in file FILE
+# and verifies that the sum of the region-lengths matches the total
+# length of the function.
+#
+# Based on a shell/awk script originally written by Harish Patil,
+# which was converted to Perl by Matthew Chapman, which was converted
+# to Python by David Mosberger.
+#
+import os
+import re
+import sys
+
+if len(sys.argv) != 2:
+ print "Usage: %s FILE" % sys.argv[0]
+ sys.exit(2)
+
+readelf = os.getenv("READELF", "readelf")
+
+start_pattern = re.compile("<([^>]*)>: \[0x([0-9a-f]+)-0x([0-9a-f]+)\]")
+rlen_pattern = re.compile(".*rlen=([0-9]+)")
+
+def check_func (func, slots, rlen_sum):
+ if slots != rlen_sum:
+ global num_errors
+ num_errors += 1
+ if not func: func = "[%#x-%#x]" % (start, end)
+ print "ERROR: %s: %lu slots, total region length = %lu" % (func, slots, rlen_sum)
+ return
+
+num_funcs = 0
+num_errors = 0
+func = False
+slots = 0
+rlen_sum = 0
+for line in os.popen("%s -u %s" % (readelf, sys.argv[1])):
+ m = start_pattern.match(line)
+ if m:
+ check_func(func, slots, rlen_sum)
+
+ func = m.group(1)
+ start = long(m.group(2), 16)
+ end = long(m.group(3), 16)
+ slots = 3 * (end - start) / 16
+ rlen_sum = 0L
+ num_funcs += 1
+ else:
+ m = rlen_pattern.match(line)
+ if m:
+ rlen_sum += long(m.group(1))
+check_func(func, slots, rlen_sum)
+
+if num_errors == 0:
+ print "No errors detected in %u functions." % num_funcs
+else:
+ if num_errors > 1:
+ err="errors"
+ else:
+ err="error"
+ print "%u %s detected in %u functions." % (num_errors, err, num_funcs)
+ sys.exit(1)