aboutsummaryrefslogtreecommitdiff
path: root/check_ops.sh
diff options
context:
space:
mode:
authorpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2007-01-07 19:38:08 +0000
committerpbrook <pbrook@c046a42c-6fe2-441c-8c8c-71466251a162>2007-01-07 19:38:08 +0000
commit2f67a0d55aea184ec31f81df87ba4aa07c378fdb (patch)
tree0b3daae74f0e39e09bc3f01207a2ce4a2fd07ca0 /check_ops.sh
parent21664424ede70eebaaddae1168261e73fa46bc33 (diff)
Script to check for missing FORCE_RET.
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@2308 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'check_ops.sh')
-rwxr-xr-xcheck_ops.sh47
1 files changed, 47 insertions, 0 deletions
diff --git a/check_ops.sh b/check_ops.sh
new file mode 100755
index 0000000000..b1f2f8500c
--- /dev/null
+++ b/check_ops.sh
@@ -0,0 +1,47 @@
+#! /bin/sh
+# Script to check for duplicate function prologues in op.o
+# Typically this indicates missing FORCE_RET();
+# This script does not detect other errors that may be present.
+
+# Usage: check_ops.sh [-m machine] [op.o]
+# machine and op.o are guessed if not specified.
+
+if [ "x$1" = "x-m" ]; then
+ machine=$2
+ shift 2
+else
+ machine=`uname -m`
+fi
+if [ -z "$1" ]; then
+ for f in `find . -name op.o`; do
+ /bin/sh "$0" -m $machine $f
+ done
+ exit 0
+fi
+
+case $machine in
+ i?86)
+ ret='\tret'
+ ;;
+ x86_64)
+ ret='\tretq'
+ ;;
+ arm)
+ ret='\tldm.*pc'
+ ;;
+ ppc* | powerpc*)
+ ret='\tblr'
+ ;;
+ mips*)
+ ret='\tjr.*ra'
+ ;;
+ *)
+ echo "Unknown machine `uname -m`"
+ ;;
+esac
+echo $1
+# op_exit_tb causes false positives on some hosts.
+${CROSS}objdump -dr $1 | \
+ sed -e '/>:$\|'"$ret"'/!d' -e 's/.*<\(.*\)>:/~\1:/' -e 's/.*'"$ret"'.*/!/' | \
+ sed -e ':1;N;s/\n//;t1' | sed -e 's/~/\n/g' | grep -v '^op_exit_tb' | \
+ grep '^op_.*!!'