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
faa0377b
Commit
faa0377b
authored
7 years ago
by
Kostyantyn Vorobyov
Browse files
Options
Downloads
Patches
Plain Diff
Comments
parent
195e1b45
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/share/e-acsl/e_acsl_mmodel_api.h
+29
-7
29 additions, 7 deletions
src/plugins/e-acsl/share/e-acsl/e_acsl_mmodel_api.h
with
29 additions
and
7 deletions
src/plugins/e-acsl/share/e-acsl/e_acsl_mmodel_api.h
+
29
−
7
View file @
faa0377b
...
@@ -32,6 +32,10 @@
...
@@ -32,6 +32,10 @@
#include
<stddef.h>
#include
<stddef.h>
/***********************************************/
/************ Basic API ************************/
/***********************************************/
/*! \brief Drop-in replacement for \p malloc with memory tracking enabled.
/*! \brief Drop-in replacement for \p malloc with memory tracking enabled.
*
*
* For further information, see \p malloc(3). */
* For further information, see \p malloc(3). */
...
@@ -129,22 +133,41 @@ int __e_acsl_freeable(void * ptr)
...
@@ -129,22 +133,41 @@ int __e_acsl_freeable(void * ptr)
/*! \brief Implementation of the \b \\valid predicate of E-ACSL.
/*! \brief Implementation of the \b \\valid predicate of E-ACSL.
*
*
* Return a non-zero value if the first \p size bytes starting at an address
* \\valid evaluates an expression of the form `p+i`, where `p` is a pointer
* given by \p ptr are readable and writable and 0 otherwise. */
* and `i` is an integer offset and returns `true` of both `p` and `p+i` belong
* to the same allocated memory block.
*
* @param ptr - memory address under question
* @param size - the byte-length (starting from `ptr`) of the memory area which
* needs to be valid
* @param base - if `ptr` can be represented by the expression `p+i` then
* `base` refers to `p`
* @param addrof_base - if `ptr` can be represented by the expression `p+i`
* then `addrof_base` refers to `&p`. For the cases when the address of `p`
* cannot be taked (e.g., address of s static array or a constant value
* casted to a pointer) then `addrof_base` is zero.
*
* @returns
* `true` if regions `[ptr, ptr + size]` and `[base, base + size]` are
* writable and lie within the same memory block and `false` otherwise.
* If `weak validity` is used (see macro `E_ACSL_WEAK_VALIDITY`)
* then only region `[ptr, ptr + size]` should lie within the same block
* and be writable.
*/
/*@ ensures \result == 0 || \result == 1;
/*@ ensures \result == 0 || \result == 1;
@ ensures \result == 1 ==> \valid(((char *)ptr)+(0..size-1));
@ ensures \result == 1 ==> \valid(((char *)ptr)+(0..size-1));
@ assigns \result \from *(((char*)ptr)+(0..size-1)); */
@ assigns \result \from *(((char*)ptr)+(0..size-1)); */
int
__e_acsl_valid
(
void
*
ptr
,
size_t
size
,
void
*
ptr_
base
,
void
*
addr
_
of_base
)
int
__e_acsl_valid
(
void
*
ptr
,
size_t
size
,
void
*
base
,
void
*
addrof_base
)
__attribute__
((
FC_BUILTIN
));
__attribute__
((
FC_BUILTIN
));
/*! \brief Implementation of the \b \\valid_read predicate of E-ACSL.
/*! \brief Implementation of the \b \\valid_read predicate of E-ACSL.
*
*
*
Return a non-zero value if the first \p size bytes starting at an address
*
Same as ::__e_acsl_valid except the checked memory locations are only
*
given by \p ptr are readable and 0 otherwise.
*/
*
required to be allocated.
*/
/*@ ensures \result == 0 || \result == 1;
/*@ ensures \result == 0 || \result == 1;
@ ensures \result == 1 ==> \valid_read(((char *)ptr)+(0..size-1));
@ ensures \result == 1 ==> \valid_read(((char *)ptr)+(0..size-1));
@ assigns \result \from *(((char*)ptr)+(0..size-1)); */
@ assigns \result \from *(((char*)ptr)+(0..size-1)); */
int
__e_acsl_valid_read
(
void
*
ptr
,
size_t
size
,
void
*
ptr_base
,
void
*
addr
_
of_base
)
int
__e_acsl_valid_read
(
void
*
ptr
,
size_t
size
,
void
*
ptr_base
,
void
*
addrof_base
)
__attribute__
((
FC_BUILTIN
));
__attribute__
((
FC_BUILTIN
));
/*! \brief Implementation of the \b \\base_addr predicate of E-ACSL.
/*! \brief Implementation of the \b \\base_addr predicate of E-ACSL.
...
@@ -195,7 +218,6 @@ void __e_acsl_memory_clean(void)
...
@@ -195,7 +218,6 @@ void __e_acsl_memory_clean(void)
__attribute__
((
FC_BUILTIN
));
__attribute__
((
FC_BUILTIN
));
/*! \brief Initialize memory tracking state.
/*! \brief Initialize memory tracking state.
*
* Called before any other statement in \p main */
* Called before any other statement in \p main */
/*@ assigns \nothing; */
/*@ assigns \nothing; */
void
__e_acsl_memory_init
(
int
*
argc_ref
,
char
***
argv
,
size_t
ptr_size
)
void
__e_acsl_memory_init
(
int
*
argc_ref
,
char
***
argv
,
size_t
ptr_size
)
...
...
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