您的位置:首页 > 编程语言

获取指定代码片段中各类汇编指令个数 getInsnNumbers.sh

2014-07-18 17:59 246 查看
tmpfile=$1
echo $tmpfile
#grep "\[\ 0x[0-9a-f]*\ 0x[0-9a-f]*\ [0-9]\ \]" $tmpfile | grep "\"[a-z][0-9a-z,. ]*\"" -c
# cat $tmpfile | awk -F: '{OFS=":"; $1=""; print $0}' | awk '{$1=""; print $0}' > $tmpfile.tmp1
cat $tmpfile | awk -F: '{OFS=":"; $1=""; print $0}' | awk '{$1=""; $2=""; print $0}' > $tmpfile.tmp1

echo "" > $tmpfile.tmp2
OLDIFS=$IFS;IFS=';';for i in `cat $tmpfile.tmp1`;do echo $i >> $tmpfile.tmp2;done;IFS=$OLDIFS

# delete '{', '}' and blank space
cat $tmpfile.tmp2 | sed 's/{//g' | sed 's/}//g' | tr -s " " | sed '/^$/d' > $tmpfile.tmp3

# get insns without @agx, @sau elt.
cat $tmpfile.tmp3 | awk '{print $1}' | awk -F@ '{print $1}' > $tmpfile.tmp4

# sort the insns
cat $tmpfile.tmp4 | sort -k1 -g | uniq -c | grep "[a-z]" > $tmpfile.tmp5


说明:

1) 汇编指令使用{}打bundle, bundle内指令使用;分隔
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: