Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
libbacktrace
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
libbacktrace
Commits
1b8128cf
Commit
1b8128cf
authored
Apr 17, 2018
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* backtrace.c: Revert last change. Don't call mmap
directly. Updates #13
parent
012b950b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
33 deletions
+11
-33
backtrace.c
backtrace.c
+11
-33
No files found.
backtrace.c
View file @
1b8128cf
...
@@ -32,26 +32,12 @@ POSSIBILITY OF SUCH DAMAGE. */
...
@@ -32,26 +32,12 @@ POSSIBILITY OF SUCH DAMAGE. */
#include "config.h"
#include "config.h"
#include <unistd.h>
#include <sys/types.h>
#include <sys/types.h>
#if !BACKTRACE_USES_MALLOC
#include <sys/mman.h>
#endif
#include "unwind.h"
#include "unwind.h"
#include "backtrace.h"
#include "backtrace.h"
#include "backtrace-supported.h"
#include "internal.h"
#include "internal.h"
#ifndef MAP_ANONYMOUS
#define MAP_ANONYMOUS MAP_ANON
#endif
#ifndef MAP_FAILED
#define MAP_FAILED ((void *)-1)
#endif
/* The main backtrace_full routine. */
/* The main backtrace_full routine. */
/* Data passed through _Unwind_Backtrace. */
/* Data passed through _Unwind_Backtrace. */
...
@@ -118,6 +104,7 @@ backtrace_full (struct backtrace_state *state, int skip,
...
@@ -118,6 +104,7 @@ backtrace_full (struct backtrace_state *state, int skip,
backtrace_error_callback
error_callback
,
void
*
data
)
backtrace_error_callback
error_callback
,
void
*
data
)
{
{
struct
backtrace_data
bdata
;
struct
backtrace_data
bdata
;
void
*
p
;
bdata
.
skip
=
skip
+
1
;
bdata
.
skip
=
skip
+
1
;
bdata
.
state
=
state
;
bdata
.
state
=
state
;
...
@@ -126,25 +113,16 @@ backtrace_full (struct backtrace_state *state, int skip,
...
@@ -126,25 +113,16 @@ backtrace_full (struct backtrace_state *state, int skip,
bdata
.
data
=
data
;
bdata
.
data
=
data
;
bdata
.
ret
=
0
;
bdata
.
ret
=
0
;
#if !BACKTRACE_USES_MALLOC
/* If we can't allocate any memory at all, don't try to produce
{
file/line information. */
size_t
pagesize
;
p
=
backtrace_alloc
(
state
,
4096
,
NULL
,
NULL
);
void
*
page
;
if
(
p
==
NULL
)
bdata
.
can_alloc
=
0
;
/* If we can't allocate any memory at all, don't try to produce
else
file/line information. */
{
pagesize
=
getpagesize
();
backtrace_free
(
state
,
p
,
4096
,
NULL
,
NULL
);
page
=
mmap
(
NULL
,
pagesize
,
PROT_READ
|
PROT_WRITE
,
bdata
.
can_alloc
=
1
;
MAP_PRIVATE
|
MAP_ANONYMOUS
,
-
1
,
0
);
}
if
(
page
==
MAP_FAILED
)
bdata
.
can_alloc
=
0
;
else
{
munmap
(
page
,
pagesize
);
bdata
.
can_alloc
=
1
;
}
}
#endif
_Unwind_Backtrace
(
unwind
,
&
bdata
);
_Unwind_Backtrace
(
unwind
,
&
bdata
);
return
bdata
.
ret
;
return
bdata
.
ret
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment