Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
basepath=$(pwd)
arch=$1
workdir=$basepath/workdir-$arch
timing_dir=$workdir/timings
revng_lifted_dir=$workdir/revng-isolated
revng_source_dir=$workdir/revng-sources
revng_decompilation_dir=$workdir/revng-decompilation-info
metrics_dir=$workdir/revng-metrics
if [ ! -d $metrics_dir ]; then
mkdir $metrics_dir;
fi
# Blank the outcome file
echo > $revng_decompilation_dir/outcome.txt
if [ ! -d $timing_dir ]; then
mkdir -p $timing_dir;
fi
if [ ! -d $revng_source_dir ]; then
mkdir -p $revng_source_dir;
fi
if [ ! -d $revng_decompilation_dir ]; then
mkdir -p $revng_decompilation_dir;
fi
cd $arch
for filename in *
do
echo "Decompiling input: $filename"
metrics_subdir1=$metrics_dir/$filename/duplication/
if [ ! -d $metrics_subdir1 ]; then
mkdir -p $metrics_subdir1;
fi
metrics_subdir2=$metrics_dir/$filename/short-circuit/
if [ ! -d $metrics_subdir2 ]; then
mkdir -p $metrics_subdir2;
fi
(/usr/bin/time --format="%S,%U,%e,%M" -o "$timing_dir/$filename.revng.decompilation.time" revng opt -decompilation --decompiled-dir=$revng_source_dir/$filename --restructure-metrics-output-dir=$metrics_subdir1/ --short-circuit-metrics-output-dir=$metrics_subdir2/ -o /dev/null $revng_lifted_dir/$filename.ll.isolated.purged.sroa|& tee $revng_decompilation_dir/$filename-raw-log.txt)
ret_value=$?
if [ $ret_value -eq 0 ]; then
echo "OK"
echo "$filename OK" >> $revng_decompilation_dir/outcome.txt
else
echo "ERROR"
echo "$filename ERROR" >> $revng_decompilation_dir/outcome.txt
fi
done;