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
5b4e1b3c
Commit
5b4e1b3c
authored
2 years ago
by
Valentin Perrelle
Committed by
David Bühler
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
[Dive] Rework callstack abstraction
parent
17e6542f
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/plugins/dive/build.ml
+9
-2
9 additions, 2 deletions
src/plugins/dive/build.ml
src/plugins/dive/callstack.ml
+1
-12
1 addition, 12 deletions
src/plugins/dive/callstack.ml
src/plugins/dive/callstack.mli
+8
-1
8 additions, 1 deletion
src/plugins/dive/callstack.mli
with
18 additions
and
15 deletions
src/plugins/dive/build.ml
+
9
−
2
View file @
5b4e1b3c
...
@@ -231,7 +231,9 @@ let build_node_locality callstack node_kind =
...
@@ -231,7 +231,9 @@ let build_node_locality callstack node_kind =
let
find_compatible_callstacks
stmt
callstack
=
let
find_compatible_callstacks
stmt
callstack
=
let
kf
=
Kernel_function
.
find_englobing_kf
stmt
in
let
kf
=
Kernel_function
.
find_englobing_kf
stmt
in
if
callstack
<>
[]
&&
Kernel_function
.
equal
kf
(
Callstack
.
top_kf
callstack
)
if
callstack
=
[]
(* Globals variables *)
then
[
Callstack
.
init
kf
]
(* Default *)
else
if
Kernel_function
.
equal
kf
(
Callstack
.
top_kf
callstack
)
then
then
(* slight improvement which only work when there is no recursion
(* slight improvement which only work when there is no recursion
and which is only usefull because you currently can't have
and which is only usefull because you currently can't have
...
@@ -242,7 +244,12 @@ let find_compatible_callstacks stmt callstack =
...
@@ -242,7 +244,12 @@ let find_compatible_callstacks stmt callstack =
(* Keep only callstacks which are a compatible with the current one *)
(* Keep only callstacks which are a compatible with the current one *)
let
callstacks
=
Eval
.
to_callstacks
stmt
in
let
callstacks
=
Eval
.
to_callstacks
stmt
in
(* TODO: missing callstacks filtered by memexec *)
(* TODO: missing callstacks filtered by memexec *)
Callstack
.
filter_truncate
callstacks
callstack
let
make_compatible
cs
=
Callstack
.
truncate_to_sub
cs
callstack
|>
Option
.
value
~
default
:
(
Callstack
.
init
kf
)
in
let
result
=
List
.
map
make_compatible
callstacks
in
List
.
sort_uniq
Callstack
.
compare
result
(* Remove duplicates *)
(* --- Graph building --- *)
(* --- Graph building --- *)
...
...
This diff is collapsed.
Click to expand it.
src/plugins/dive/callstack.ml
+
1
−
12
View file @
5b4e1b3c
...
@@ -69,18 +69,7 @@ let truncate_to_sub full_cs sub_cs =
...
@@ -69,18 +69,7 @@ let truncate_to_sub full_cs sub_cs =
|
[]
->
None
|
[]
->
None
|
(
s
::
t
)
as
cs
->
|
(
s
::
t
)
as
cs
->
if
is_prefix
sub_cs
cs
if
is_prefix
sub_cs
cs
then
Some
(
List
.
rev
acc
@
sub_cs
)
then
Some
(
List
.
rev
_append
acc
sub_cs
)
else
aux
(
s
::
acc
)
t
else
aux
(
s
::
acc
)
t
in
in
aux
[]
full_cs
aux
[]
full_cs
let
list_filter_map
f
l
=
let
aux
acc
x
=
match
f
x
with
|
None
->
acc
|
Some
y
->
y
::
acc
in
List
.
rev
(
List
.
fold_left
aux
[]
l
)
let
filter_truncate
l
sub_cs
=
list_filter_map
(
fun
cs
->
truncate_to_sub
cs
sub_cs
)
l
This diff is collapsed.
Click to expand it.
src/plugins/dive/callstack.mli
+
8
−
1
View file @
5b4e1b3c
...
@@ -35,6 +35,13 @@ val pop : t -> (Cil_types.kernel_function * Cil_types.stmt * t) option
...
@@ -35,6 +35,13 @@ val pop : t -> (Cil_types.kernel_function * Cil_types.stmt * t) option
val
pop_downto
:
Cil_types
.
kernel_function
->
t
->
t
val
pop_downto
:
Cil_types
.
kernel_function
->
t
->
t
val
top_kf
:
t
->
Cil_types
.
kernel_function
val
top_kf
:
t
->
Cil_types
.
kernel_function
val
push
:
Cil_types
.
kernel_function
*
Cil_types
.
stmt
->
t
->
t
val
push
:
Cil_types
.
kernel_function
*
Cil_types
.
stmt
->
t
->
t
(* Dive use partial callstack where the first call in the callstack are
abstracted away. Thus, Dive callstack are prefixes of complete callstacks. *)
(* [is_prefix sub full] returns true whenever [sub] is a prefix of [full] *)
val
is_prefix
:
t
->
t
->
bool
val
is_prefix
:
t
->
t
->
bool
(* [truncate_to_sub full sub] removes [full] tail until [sub] becomes a suffix.
Returns None if [sub] is not included in [full] *)
val
truncate_to_sub
:
t
->
t
->
t
option
val
truncate_to_sub
:
t
->
t
->
t
option
val
filter_truncate
:
t
list
->
t
->
t
list
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