Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Andrea Gussoni
artifacts-asiaccs20
Commits
2c005a5f
Commit
2c005a5f
authored
Dec 11, 2020
by
Andrea Gussoni
Browse files
Add revng-c decompiled parser driver
parent
9f45c26a
Changes
2
Hide whitespace changes
Inline
Side-by-side
scripting/revng-extraction-scripts/clang-parse-all.sh
0 → 100755
View file @
2c005a5f
#!/bin/bash
if
[
$#
-eq
0
]
;
then
echo
"No arguments supplied"
exit
1
fi
arch
=
$1
basepath
=
$(
pwd
)
workdir
=
$basepath
/workdir-
$arch
revng_sources
=
$workdir
/revng-sources
metrics_dir
=
$workdir
/revng-cyclomatic
if
[
!
-d
$metrics_dir
]
;
then
mkdir
$metrics_dir
;
fi
cd
$revng_sources
tmp_dir
=
$basepath
/scripting/revng-extraction-scripts/tmp/
if
[
!
-d
$tmp_dir
]
;
then
mkdir
$tmp_dir
;
fi
for
binary
in
*
do
echo
"Parsing with clang input:
$source
"
metrics_subdir
=
$metrics_dir
/
$binary
/triple-metrics/
if
[
!
-d
$metrics_subdir
]
;
then
mkdir
-p
$metrics_subdir
;
fi
cd
$binary
for
function_source
in
*
do
echo
"Parsing with clang function:
$function_source
"
cp
$function_source
$tmp_dir
/
cd
$tmp_dir
../revng-normalizer.sh
$function_source
clang-7
-std
=
c11
-Wno-return-type
-S
-emit-llvm
-O0
-femit-all-decls
-Xclang
-disable-O0-optnone
-w
$function_source
.normalized.c
revng opt
-cyclomatic
-cyclomatic-output
=
$metrics_subdir
/
$function_source
.csv
-S
-o
/dev/null
$function_source
.normalized.opt.ll
rm
$function_source
$function_source
.normalized.c
$function_source
.normalized.ll
$function_source
.normalized.opt.ll
cd
$revng_sources
/
$binary
done
;
cd
$revng_sources
done
;
scripting/revng-extraction-scripts/revng-normalizer.sh
0 → 100755
View file @
2c005a5f
#!/bin/bash
# Create the output file
cp
$1
$1
.purged.c
# Remove redefinition of struct `__fsid_t`
sed
-i
-e
's/extern void indirect_handler(...);/extern void indirect_handler(int p, ...);/g;'
$1
.purged.c
sed
-i
-e
's/#include <stdint.h>//g'
$1
.purged.c
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment