Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frama-c
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
frama-c
Commits
79f6cadb
Commit
79f6cadb
authored
9 years ago
by
Kostyantyn Vorobyov
Committed by
Julien Signoles
9 years ago
Browse files
Options
Downloads
Patches
Plain Diff
Added options to the e-acsl wrapper script allowing to specify frama-c
and gcc executables
parent
91d3c522
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/plugins/e-acsl/scripts/e-acsl-gcc.sh
+57
-36
57 additions, 36 deletions
src/plugins/e-acsl/scripts/e-acsl-gcc.sh
with
57 additions
and
36 deletions
src/plugins/e-acsl/scripts/e-acsl-gcc.sh
+
57
−
36
View file @
79f6cadb
...
...
@@ -33,49 +33,37 @@ error () {
fi
}
# Check if an executable can be found by in the PATH
# Check if a
give
n executable
name
can be found by in the PATH
has_tool
()
{
which
"
$@
"
>
/dev/null 2>&1
&&
return
0
||
return
1
}
# Abort if a given executable cannot be found in the $PATH
# Check if a given executable name is indeed an executable or can be found
# in the $PATH. Abort the execution if not.
check_tool
()
{
has_tool
"
$1
"
&&
echo
"
$1
"
\
||
error
"Cannot find '
$1
' executable in the
\$
PATH"
{
has_tool
"
$1
"
||
test
-e
"
$1
"
;
}
||
error
"No executable
$1
found"
;
}
# Getopt options
LONGOPTIONS
=
"help,compile,compile-only,print,debug:,ocode:,oexec:,verbose:,
\
frama-c-only,extra-cpp-args:,frama-c-stdlib,full-mmodel,gmp,quiet,logfile:,
ld-flags:,cpp-flags:,frama-c-extra:,memory-model:,production,no-stdlib,
debug-log:"
SHORTOPTIONS
=
"h,c,C,p,d:,o:,O:,v:,f,E:,L,M,l:,e:,g,q,s:,F:,m:,P,N,D:"
debug-log:
,frama-c:,gcc:
"
SHORTOPTIONS
=
"h,c,C,p,d:,o:,O:,v:,f,E:,L,M,l:,e:,g,q,s:,F:,m:,P,N,D:
I:G:
"
# Prefix for an error message due to wrong arguments
ERROR
=
"ERROR parsing arguments:"
# Architecture-dependent flags. Since by default Frama-C uses 32-bit
# architecture we need to make sure that same architecture is used for
# instrumentation and for compilation.
MACHDEPFLAGS
=
"
`
getconf LONG_BIT
`
"
# Check if getconf gives out the value accepted by Frama-C/GCC
echo
"
$MACHDEPFLAGS
"
|
grep
'16\|32\|64'
2>&1
>
/dev/null
\
||
error
"
$MACHDEPFLAGS
-bit architecture not supported"
# -machdep option sent to frama-c
MACHDEP
=
"-machdep gcc_x86_
$MACHDEPFLAGS
"
# Macro for correct preprocessing of Frama-C generated code
CPPMACHDEP
=
"-D__FC_MACHDEP_X86_
$MACHDEPFLAGS
"
# GCC machine option
GCCMACHDEP
=
"-m
$MACHDEPFLAGS
"
# Variables holding getopt options
OPTION_CFLAGS
=
# Compiler flags
OPTION_CPPFLAGS
=
# Preprocessor flags
OPTION_LDFLAGS
=
# Linker flags
OPTION_FRAMAC
=
"frama-c"
# Frama-C executable name
OPTION_CC
=
"gcc"
# GCC executable name
OPTION_ECHO
=
"set -x"
# Echo executed commands to STDOUT
OPTION_INSTRUMENT
=
1
# Perform E-ACSL instrumentation
OPTION_PRINT
=
# Output instrumented code
OPTION_DEBUG
=
# Set
f
rama-
c
debug flag
OPTION_VERBOSE
=
# Set
f
rama-
c
verbose flag
OPTION_DEBUG
=
# Set
F
rama-
C
debug flag
OPTION_VERBOSE
=
# Set
F
rama-
C
verbose flag
OPTION_COMPILE
=
# Compile instrumented program
OPTION_OCODE
=
"a.out.frama.c"
# Name of the translated file
OPTION_OEXEC
=
"a.out"
# Generated executable name
...
...
@@ -85,7 +73,7 @@ OPTION_FULL_MMODEL= # Instrument as much as possible
OPTION_GMP
=
# Use GMP integers everywhere
OPTION_DEBUG_MACRO
=
"-DE_ACSL_DEBUG"
# Debug macro
OPTION_DEBUG_LOG_MACRO
=
""
# Specification of debug log file
OPTION_FRAMAC_CPP_EXTRA
=
""
# Extra CPP flags for
f
rama-
c
OPTION_FRAMAC_CPP_EXTRA
=
""
# Extra CPP flags for
F
rama-
C
OPTION_EACSL_MMODEL
=
"bittree"
# Memory model used
# The following option controls whether to use gcc builtins
# (e.g., __builtin_strlen) in RTL or fall back to custom implementations
...
...
@@ -98,15 +86,18 @@ Usage: e-acsl-gcc.sh [options] files
Options:
-h show this help page
-c compile instrumented code
-p output the generated code to STDOUT
-O <file> output the generated executable to <file>
-p output the generated code with rich formatting to STDOUT
-o <file> output the generated code to <file> [a.out.frama.c]
-O <file> output the generated executables to <file> [a.out, a.out.e-acsl]
-M maximise memory-related instrumentation
-q suppress any output except for errors and warnings
-s <file> redirect all output to <file>
-P compile executatle without debug features
-I <file> specify Frama-C executable [frama-c]
-G <file> specify GCC executable [gcc]
Notes:
This
manual
page shows only basic options.
This
help
page shows only basic options.
See man (1) e-acsl-gcc.sh for full up-to-date documentation.
\n
"
exit
1
}
...
...
@@ -154,7 +145,7 @@ do
exec
2>
$1
shift
;
;;
# Pass an option to a
f
rama-
c
invocation
# Pass an option to a
F
rama-
C
invocation
--frama-c-extra
|
-F
)
shift
;
FRAMAC_FLAGS
=
"
$FRAMAC_FLAGS
$1
"
...
...
@@ -230,7 +221,7 @@ do
OPTION_INSTRUMENT
=
OPTION_COMPILE
=
"1"
;;
# Run only
f
rama-
c
related instrumentation
# Run only
F
rama-
C
related instrumentation
--frama-c-only
|
-f
)
shift
;
OPTION_EACSL
=
...
...
@@ -263,11 +254,24 @@ do
OPTION_DEBUG_LOG_MACRO
=
"-DE_ACSL_DEBUG_LOG=
$1
"
shift
;
;;
# Supply Frama-C executable name
-I
|
--frama-c
)
shift
;
OPTION_FRAMAC
=
"
$1
"
shift
;
;;
# Supply GCC executable name
-G
|
--gcc
)
shift
;
OPTION_CC
=
"
$1
"
shift
;
;;
# A memory model to link against
-m
|
--memory-model
)
shift
;
echo
$1
|
grep
"
\(
tree
\|
bittree
\|
splay_tree
\|
list
\)
"
error
"no such memory model:
$1
"
$?
OPTION_EACSL_MMODEL
=
"
$1
"
echo
$OPTION_EACSL_MMODEL
|
grep
"
\(
tree
\|
bittree
\|
splay_tree
\|
list
\)
"
error
"no such memory model:
$OPTION_EACSL_MMODEL
"
$?
shift
;
;;
esac
...
...
@@ -279,16 +283,33 @@ if test -z "$1"; then
error
"no input files"
;
fi
# Architecture-dependent flags. Since by default Frama-C uses 32-bit
# architecture we need to make sure that same architecture is used for
# instrumentation and for compilation.
MACHDEPFLAGS
=
"
`
getconf LONG_BIT
`
"
# Check if getconf gives out the value accepted by Frama-C/GCC
echo
"
$MACHDEPFLAGS
"
|
grep
'16\|32\|64'
2>&1
>
/dev/null
\
||
error
"
$MACHDEPFLAGS
-bit architecture not supported"
# -machdep option sent to Frama-C
MACHDEP
=
"-machdep gcc_x86_
$MACHDEPFLAGS
"
# Macro for correct preprocessing of Frama-C generated code
CPPMACHDEP
=
"-D__FC_MACHDEP_X86_
$MACHDEPFLAGS
"
# GCC machine option
GCCMACHDEP
=
"-m
$MACHDEPFLAGS
"
# Check if Frama-C and GCC executable names
check_tool
"
$OPTION_FRAMAC
"
check_tool
"
$OPTION_CC
"
# Frama-C and related flags
FRAMAC
=
"
`
check_tool
'frama-c'
`
"
FRAMAC
=
"
$OPTION_FRAMAC
"
FRAMAC_FLAGS
=
""
FRAMAC_SHARE
=
"
`
$FRAMAC
-print-share-path
`
"
FRAMAC_CPP_EXTRA
=
"
$OPTION_FRAMAC_CPP_EXTRA
-D
$EACSL_MACRO_ID
-I
$FRAMAC_SHARE
/libc
$CPPMACHDEP
"
$CPPMACHDEP
"
EACSL_SHARE
=
"
$FRAMAC_SHARE
/e-acsl"
EACSL_MMODEL
=
"
$OPTION_EACSL_MMODEL
"
...
...
@@ -297,7 +318,7 @@ EACSL_MMODEL="$OPTION_EACSL_MMODEL"
EACSL_MACRO_ID
=
"__E_ACSL__"
# Gcc and related flags
CC
=
"
`
check_tool
'gcc'
`
"
CC
=
"
$OPTION_CC
"
CFLAGS
=
"
$OPTION_CFLAGS
-std=c99
$GCCMACHDEP
-g3 -O2 -pedantic -fno-builtin
-Wall
\
...
...
@@ -343,7 +364,7 @@ if [ -n "$OPTION_INSTRUMENT" ]; then
$OPTION_EACSL
\
-print
\
-ocode
"
$OPTION_OCODE
"
)
;
error
"aborted by
f
rama-
c
"
$?
;
error
"aborted by
F
rama-
C
"
$?
;
# Print translated code
if
[
-n
"
$OPTION_PRINT
"
]
;
then
$CAT
$OPTION_OCODE
...
...
@@ -361,7 +382,7 @@ if test -n "$OPTION_COMPILE" ; then
OPTION_OCODE
=
"
$@
"
fi
# Compile and link E-ACSL-instrumented file
(
$OPTION_ECHO
;
\
(
$OPTION_ECHO
;
$CC
\
$CFLAGS
$CPPFLAGS
\
$EACSL_CFLAGS
$EACSL_CPPFLAGS
\
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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!
Save comment
Cancel
Please
register
or
sign in
to comment