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
6b73d17c
"c-utils/git@git.frama-c.com:pub/open-source-case-studies.git" did not exist on "3adb7a1dd33e74e8b5b1efef987b5fad03b7ce2f"
Commit
6b73d17c
authored
7 years ago
by
Kostyantyn Vorobyov
Browse files
Options
Downloads
Patches
Plain Diff
Track offset in global vars (prereq. to temporal analysis)
parent
711a3ed0
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/visit.ml
+15
-8
15 additions, 8 deletions
src/plugins/e-acsl/visit.ml
with
15 additions
and
8 deletions
src/plugins/e-acsl/visit.ml
+
15
−
8
View file @
6b73d17c
...
...
@@ -111,7 +111,8 @@ class e_acsl_visitor prj generate = object (self)
(* Global flag set to [true] if a currently visited node
belongs to a global initializer and set to [false] otherwise *)
val
global_vars
:
init
option
Varinfo
.
Hashtbl
.
t
=
Varinfo
.
Hashtbl
.
create
7
val
global_vars
:
(
offset
*
init
option
)
Varinfo
.
Hashtbl
.
t
=
Varinfo
.
Hashtbl
.
create
7
(* Hashtable mapping global variables (as Cil_type.varinfo) to their
initializers aiming to capture memory allocated by global variable
declarations and initialization. At runtime the memory blocks
...
...
@@ -150,7 +151,7 @@ class e_acsl_visitor prj generate = object (self)
||
try
Varinfo
.
Hashtbl
.
iter
(
fun
old_vi
i
->
match
i
with
None
|
Some
_
->
(
fun
old_vi
(
_
,
i
)
->
match
i
with
None
|
Some
_
->
if
Mmodel_analysis
.
must_model_vi
old_vi
then
raise
Exit
)
global_vars
;
false
...
...
@@ -166,7 +167,7 @@ class e_acsl_visitor prj generate = object (self)
let
env
=
Env
.
push
!
function_env
in
let
stmts
,
env
=
Varinfo
.
Hashtbl
.
fold_sorted
(
fun
old_vi
i
(
stmts
,
env
)
->
(
fun
old_vi
(
_
,
i
)
(
stmts
,
env
)
->
let
new_vi
=
Cil
.
get_varinfo
self
#
behavior
old_vi
in
(* [model] creates an initialization statement
of the form [__e_acsl_full_init(...)] for every global
...
...
@@ -375,15 +376,16 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
(* Make a unique mapping for each global variable omitting initializers.
Initializers (used to capture literal strings) are added to
[global_vars] via the [vinit] visitor method (see comments below). *)
Varinfo
.
Hashtbl
.
replace
global_vars
vi
None
Varinfo
.
Hashtbl
.
replace
global_vars
vi
(
NoOffset
,
None
)
|
_
->
()
);
if
generate
then
Cil
.
DoChildrenPost
(
fun
g
->
List
.
iter
do_it
g
;
g
)
else
Cil
.
DoChildren
(* Add mappings from global variables to their initializers in [global_vars].
Note that the below function captures only [SingleInit]s. All compound
initializers (which contain single ones) are unrapped and thrown away. *)
method
!
vinit
vi
_off
_i
=
initializers containing SingleInits (except for empty compound
initializers) are unrapped and thrown away. *)
method
!
vinit
vi
off
_
=
if
generate
then
if
Mmodel_analysis
.
must_model_vi
vi
then
begin
is_initializer
<-
vi
.
vglob
;
...
...
@@ -393,7 +395,12 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
(* Note the use of [add] instead of [replace]. This is because a
single variable can be associated with multiple initializers
and all of them need to be captured. *)
|
true
->
Varinfo
.
Hashtbl
.
add
global_vars
vi
(
Some
i
)
|
true
->
(
match
i
with
(* Case of an empty CompoundInit, treat it as if there were
* no initializer at all *)
|
CompoundInit
(
_
,
[]
)
->
()
|
_
->
Varinfo
.
Hashtbl
.
add
global_vars
vi
(
off
,
(
Some
i
)))
|
false
->
()
);
is_initializer
<-
false
;
i
)
...
...
@@ -637,7 +644,7 @@ you must call function `%s' and `__e_acsl_memory_clean by yourself.@]"
let
loc
=
Stmt
.
loc
stmt
in
let
delete_stmts
=
Varinfo
.
Hashtbl
.
fold_sorted
(
fun
old_vi
i
acc
->
(
fun
old_vi
(
_
,
i
)
acc
->
if
Mmodel_analysis
.
must_model_vi
old_vi
then
let
new_vi
=
Cil
.
get_varinfo
self
#
behavior
old_vi
in
(* Since there are multiple entries for same variables
...
...
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