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
315fe00d
Commit
315fe00d
authored
8 years ago
by
Julien Signoles
Browse files
Options
Downloads
Plain Diff
Merge branch 'kostyantyn/bugfix/backtrace' into 'master'
Fix for backtrace See merge request !127
parents
75d22798
72694e0d
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_trace.h
+35
-4
35 additions, 4 deletions
src/plugins/e-acsl/share/e-acsl/e_acsl_trace.h
with
35 additions
and
4 deletions
src/plugins/e-acsl/share/e-acsl/e_acsl_trace.h
+
35
−
4
View file @
315fe00d
...
@@ -30,16 +30,47 @@
...
@@ -30,16 +30,47 @@
#include
"e_acsl_shexec.h"
#include
"e_acsl_shexec.h"
# ifdef __GLIBC__
extern
void
*
__libc_stack_end
;
# include <execinfo.h>
# endif
struct
frame_layout
{
void
*
next
;
void
*
return_address
;
};
/* The following implementation of malloc-free backtrace [native_backtrace]
is mostly taken from Glibc-2.22 (see file debug/backtrace.c) */
static
int
native_backtrace
(
void
**
array
,
int
size
)
{
struct
frame_layout
*
current
;
void
*
top_frame
,
*
top_stack
;
int
cnt
=
0
;
top_frame
=
__builtin_frame_address
(
0
);
/* Some notion of current stack. Need not be exactly the top of the stack,
just something somewhere in the current frame. */
top_stack
=
({
char
__csf
;
&
__csf
;
});
/* We skip the call to this function, it makes no sense to record it. */
current
=
((
struct
frame_layout
*
)
top_frame
);
while
(
cnt
<
size
)
{
/* Assume that the stack grows downwards */
if
((
void
*
)
current
<
top_stack
||
!
((
void
*
)
current
<
__libc_stack_end
))
/* This means the address is out of range. Note that for the
toplevel we see a frame pointer with value NULL which clearly is
out of range. */
break
;
array
[
cnt
++
]
=
current
->
return_address
;
current
=
((
struct
frame_layout
*
)
(
current
->
next
));
}
return
cnt
;
}
static
void
trace
()
{
static
void
trace
()
{
# ifdef __GLIBC__
# ifdef __GLIBC__
# ifdef __linux__
# ifdef __linux__
int
size
=
24
;
int
size
=
24
;
void
**
bb
=
native_malloc
(
sizeof
(
void
*
)
*
size
);
void
**
bb
=
native_malloc
(
sizeof
(
void
*
)
*
size
);
backtrace
(
bb
,
size
);
native_
backtrace
(
bb
,
size
);
char
executable
[
PATH_MAX
];
char
executable
[
PATH_MAX
];
sprintf
(
executable
,
"/proc/%d/exe"
,
getpid
());
sprintf
(
executable
,
"/proc/%d/exe"
,
getpid
());
...
...
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