Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
30740602
Commit
30740602
authored
Aug 11, 2021
by
Kirill Smelkov
1
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
X switch to libbacktrace
parent
d0789a99
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
25 additions
and
2 deletions
+25
-2
Makefile
Makefile
+2
-1
lib/utils.c
lib/utils.c
+22
-1
setup.py
setup.py
+1
-0
No files found.
Makefile
View file @
30740602
...
@@ -70,6 +70,8 @@ CFLAGS := -g -Wall -D_GNU_SOURCE -std=gnu99 -fplan9-extensions \
...
@@ -70,6 +70,8 @@ CFLAGS := -g -Wall -D_GNU_SOURCE -std=gnu99 -fplan9-extensions \
-Wno-declaration-after-statement
\
-Wno-declaration-after-statement
\
-Wno-error
=
declaration-after-statement
\
-Wno-error
=
declaration-after-statement
\
LDLIBS
:=
-lbacktrace
# XXX hack ugly
# XXX hack ugly
LOADLIBES
=
lib/bug.c lib/utils.c 3rdparty/ccan/ccan/tap/tap.c
LOADLIBES
=
lib/bug.c lib/utils.c 3rdparty/ccan/ccan/tap/tap.c
TESTS
:=
$(
patsubst
%.c,%,
$(
wildcard
bigfile/tests/test_
*
.c
))
TESTS
:=
$(
patsubst
%.c,%,
$(
wildcard
bigfile/tests/test_
*
.c
))
...
@@ -197,7 +199,6 @@ tfault := bigfile/tests/tfault
...
@@ -197,7 +199,6 @@ tfault := bigfile/tests/tfault
FAULTS
:=
$(
shell
grep
'{"fault.*"'
$(tfault)
.c |
sed
's/"/ /g'
|awk
'{print $$2
}
'
)
FAULTS
:=
$(
shell
grep
'{"fault.*"'
$(tfault)
.c |
sed
's/"/ /g'
|awk
'{print $$2
}
'
)
test.fault
:
$(FAULTS:%=%.tfault)
test.fault
:
$(FAULTS:%=%.tfault)
$(tfault).t
:
CFLAGS += -rdynamic
#
so that backtrace_symbols works
%.tfault
:
$(tfault).t
%.tfault
:
$(tfault).t
t/tfault-run
$<
$*
$(
shell
grep
'{"$*"'
$(tfault)
.c |
awk
'{print $$NF
}
'
)
t/tfault-run
$<
$*
$(
shell
grep
'{"$*"'
$(tfault)
.c |
awk
'{print $$NF
}
'
)
...
...
lib/utils.c
View file @
30740602
...
@@ -28,7 +28,8 @@
...
@@ -28,7 +28,8 @@
#include <unistd.h>
#include <unistd.h>
#include <string.h>
#include <string.h>
#include <signal.h>
#include <signal.h>
#include <execinfo.h>
//#include <execinfo.h>
#include <backtrace.h>
/* ilog2 that must be exact */
/* ilog2 that must be exact */
...
@@ -176,12 +177,32 @@ void xwrite(int fd, const void *buf, size_t count)
...
@@ -176,12 +177,32 @@ void xwrite(int fd, const void *buf, size_t count)
}
}
}
}
static
struct
backtrace_state
*
__backtrace_state
;
__attribute__
((
constructor
))
static
void
traceback_init
(
void
)
{
__backtrace_state
=
backtrace_create_state
(
/*filename*/
NULL
,
/*threaded*/
1
,
/*error callback*/
NULL
,
/*data*/
NULL
);
}
/* dump traceback to fd */
/* dump traceback to fd */
void
dump_traceback
(
int
fd
)
void
dump_traceback
(
int
fd
)
{
{
#if 0
void *pcv[256];
void *pcv[256];
int n;
int n;
/* XXX better use https://github.com/ianlancetaylor/libbacktrace
* because backtrace_symbols often does not provide symbolic information */
n = backtrace(pcv, 256);
n = backtrace(pcv, 256);
backtrace_symbols_fd(pcv, n, fd);
backtrace_symbols_fd(pcv, n, fd);
#else
backtrace_print
(
__backtrace_state
,
0
,
stderr
);
// XXX use fd instead
#endif
}
}
setup.py
View file @
30740602
...
@@ -307,6 +307,7 @@ setup(
...
@@ -307,6 +307,7 @@ setup(
'lib/utils.c'
],
'lib/utils.c'
],
depends
=
libvirtmem_h
,
depends
=
libvirtmem_h
,
define_macros
=
[(
'_GNU_SOURCE'
,
None
),
(
'BUILDING_LIBVIRTMEM'
,
None
)],
define_macros
=
[(
'_GNU_SOURCE'
,
None
),
(
'BUILDING_LIBVIRTMEM'
,
None
)],
libraries
=
[
'backtrace'
],
language
=
'c'
),
language
=
'c'
),
DSO
(
'wendelin.wcfs.client.libwcfs'
,
DSO
(
'wendelin.wcfs.client.libwcfs'
,
...
...
Kirill Smelkov
@kirr
mentioned in commit
ddd01cfb
·
Aug 11, 2021
mentioned in commit
ddd01cfb
mentioned in commit ddd01cfb0a943a975948ef23059d9488e17174f2
Toggle commit list
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