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
ead7afc1
Commit
ead7afc1
authored
3 years ago
by
Basile Desloges
Browse files
Options
Downloads
Patches
Plain Diff
[eacsl] Add a function to print the content of /proc/self/maps on linux
parent
72e3c1b8
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/observation_model/segment_model/e_acsl_segment_tracking.c
+32
-0
32 additions, 0 deletions
...observation_model/segment_model/e_acsl_segment_tracking.c
with
32 additions
and
0 deletions
src/plugins/e-acsl/share/e-acsl/observation_model/segment_model/e_acsl_segment_tracking.c
+
32
−
0
View file @
ead7afc1
...
@@ -20,8 +20,11 @@
...
@@ -20,8 +20,11 @@
/* */
/* */
/**************************************************************************/
/**************************************************************************/
#include
<inttypes.h>
#include
<stddef.h>
#include
<stddef.h>
#include
<stdint.h>
#include
<stdint.h>
#include
<stdio.h>
#include
<string.h>
#include
"../../instrumentation_model/e_acsl_temporal_timestamp.h"
#include
"../../instrumentation_model/e_acsl_temporal_timestamp.h"
#include
"../../internals/e_acsl_bits.h"
#include
"../../internals/e_acsl_bits.h"
...
@@ -1148,6 +1151,33 @@ void print_memory_partition(struct memory_partition *p) {
...
@@ -1148,6 +1151,33 @@ void print_memory_partition(struct memory_partition *p) {
# endif
# endif
}
}
# if E_ACSL_OS_IS_LINUX
/*! \brief Print the content of the `/proc/self/maps` file that is used to
retrieve the addresses informations of some segments. */
static
void
print_all_segments
()
{
FILE
*
maps
=
fopen
(
"/proc/self/maps"
,
"r"
);
DVASSERT
(
maps
!=
NULL
,
"Unable to open /proc/self/maps: %s
\n
"
,
rtl_strerror
(
errno
));
int
result
;
char
buffer
[
255
];
uintptr_t
start
,
end
;
while
(
fgets
(
buffer
,
sizeof
(
buffer
),
maps
)
!=
NULL
)
{
result
=
sscanf
(
buffer
,
"%"
SCNxPTR
"-%"
SCNxPTR
,
&
start
,
&
end
);
if
(
result
==
2
)
{
char
*
remaining
=
strchr
(
buffer
,
' '
);
DLOG
(
"%a - %a %s"
,
start
,
end
,
remaining
?
remaining
:
buffer
);
}
else
{
DLOG
(
"%s"
,
buffer
);
}
}
result
=
fclose
(
maps
);
DVASSERT
(
result
==
0
,
"Unable to close /proc/self/maps: %s
\n
"
,
rtl_strerror
(
errno
));
}
# endif
void
print_shadow_layout
()
{
void
print_shadow_layout
()
{
RTL_IO_LOCK
();
RTL_IO_LOCK
();
DLOG
(
">>> HEAP ---------------------
\n
"
);
DLOG
(
">>> HEAP ---------------------
\n
"
);
...
@@ -1161,6 +1191,8 @@ void print_shadow_layout() {
...
@@ -1161,6 +1191,8 @@ void print_shadow_layout() {
print_memory_partition
(
&
mem_layout
.
tls
);
print_memory_partition
(
&
mem_layout
.
tls
);
DLOG
(
">>> VDSO ---------------------
\n
"
);
DLOG
(
">>> VDSO ---------------------
\n
"
);
print_memory_partition
(
&
mem_layout
.
vdso
);
print_memory_partition
(
&
mem_layout
.
vdso
);
// DLOG(">>> /proc/self/maps ----------\n");
// print_all_segments();
# elif E_ACSL_OS_IS_WINDOWS
# elif E_ACSL_OS_IS_WINDOWS
DLOG
(
">>> TEXT ---------------------
\n
"
);
DLOG
(
">>> TEXT ---------------------
\n
"
);
print_memory_partition
(
&
mem_layout
.
text
);
print_memory_partition
(
&
mem_layout
.
text
);
...
...
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