3 # Script that prints information about generated code in TSan runtime.
8 if [[ "$#" != 1 ]]; then
9 echo "Usage: $0 /path/to/binary/built/with/tsan"
14 grep __tsan_
$1.
: -A 10000 ${OBJDUMP_CONTENTS} | \
15 awk "/[^:]$/ {print;} />:/ {c++; if (c == 2) {exit}}"
30 OUTPUT_DIR
=$
(mktemp
-t -d analyze_libtsan_out.XXXXXXXX
)
31 OBJDUMP_CONTENTS
=${OUTPUT_DIR}/libtsan_objdump
32 NM_CONTENTS
=${OUTPUT_DIR}/libtsan_nm
34 objdump
-d $BIN > ${OBJDUMP_CONTENTS}
35 nm
-S $BIN |
grep "__tsan_" > ${NM_CONTENTS}
38 file=${OUTPUT_DIR}/asm_
$f.s
41 size
=$
(grep __tsan_
$f$
${NM_CONTENTS} |
awk --non-decimal-data '{print ("0x"$2)+0}')
42 rsp
=$
(grep '(%rsp)' $file |
wc -l)
43 push
=$
(grep 'push' $file |
wc -l)
44 pop
=$
(grep 'pop' $file |
wc -l)
45 call
=$
(grep 'call' $file |
wc -l)
46 load
=$
(egrep 'mov .*\,.*\(.*\)|cmp .*\,.*\(.*\)' $file |
wc -l)
47 store
=$
(egrep 'mov .*\(.*\),' $file |
wc -l)
48 mov
=$
(grep 'mov' $file |
wc -l)
49 lea
=$
(grep 'lea' $file |
wc -l)
50 sh
=$
(grep 'shr\|shl' $file |
wc -l)
51 cmp=$
(grep 'cmp\|test' $file |
wc -l)
52 printf "%10s tot %3d; size %4d; rsp %d; push %d; pop %d; call %d; load %2d; store %2d; sh %3d; mov %3d; lea %3d; cmp %3d\n" \
53 $f $tot $size $rsp $push $pop $call $load $store $sh $mov $lea $cmp;