Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
f88d129b
Commit
f88d129b
authored
May 06, 2016
by
Doron Somech
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1966 from bluca/backtrace_assert
Problem: no backtrace is printed on assert
parents
c1dc9d02
bb5037e8
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
75 additions
and
5 deletions
+75
-5
Makefile.am
Makefile.am
+5
-4
configure.ac
configure.ac
+10
-1
err.cpp
src/err.cpp
+59
-0
err.hpp
src/err.hpp
+1
-0
No files found.
Makefile.am
View file @
f88d129b
...
...
@@ -277,10 +277,11 @@ endif
endif
endif
src_libzmq_la_CPPFLAGS
=
$(CODE_COVERAGE_CPPFLAGS)
src_libzmq_la_CFLAGS
=
$(CODE_COVERAGE_CFLAGS)
src_libzmq_la_CXXFLAGS
=
@LIBZMQ_EXTRA_CXXFLAGS@
$(CODE_COVERAGE_CXXFLAGS)
src_libzmq_la_LIBADD
=
$(CODE_COVERAGE_LDFLAGS)
src_libzmq_la_CPPFLAGS
=
$(CODE_COVERAGE_CPPFLAGS)
$(LIBUNWIND_CFLAGS)
src_libzmq_la_CFLAGS
=
$(CODE_COVERAGE_CFLAGS)
$(LIBUNWIND_CFLAGS)
src_libzmq_la_CXXFLAGS
=
@LIBZMQ_EXTRA_CXXFLAGS@
$(CODE_COVERAGE_CXXFLAGS)
\
$(LIBUNWIND_CFLAGS)
src_libzmq_la_LIBADD
=
$(CODE_COVERAGE_LDFLAGS)
$(LIBUNWIND_LIBS)
if
USE_LIBSODIUM
src_libzmq_la_CPPFLAGS
+=
${
sodium_CFLAGS
}
...
...
configure.ac
View file @
f88d129b
...
...
@@ -626,12 +626,21 @@ if test "x$enable_drafts" = "xyes"; then
AC_MSG_NOTICE([Building stable and legacy API + draft API])
AC_DEFINE(ZMQ_BUILD_DRAFT_API, 1, [Provide draft classes and methods])
AC_SUBST(pkg_config_defines, "-DZMQ_BUILD_DRAFT_API=1")
# CPPFLAGS="-DZMQ_BUILD_DRAFT_API=1 $CPPFLAGS"
else
AC_MSG_NOTICE([Building stable and legacy API (no draft API)])
AC_SUBST(pkg_config_defines, "")
fi
PKG_CHECK_MODULES(LIBUNWIND, [libunwind],
[
AC_DEFINE(HAVE_LIBUNWIND, 1, [The libunwind library is to be used])
AC_SUBST([LIBUNWIND_CFLAGS])
AC_SUBST([LIBUNWIND_LIBS])
],
[
AC_MSG_WARN([Cannot find libunwind])
])
# Subst LIBZMQ_EXTRA_CFLAGS & CXXFLAGS & LDFLAGS
AC_SUBST(LIBZMQ_EXTRA_CFLAGS)
AC_SUBST(LIBZMQ_EXTRA_CXXFLAGS)
...
...
src/err.cpp
View file @
f88d129b
...
...
@@ -81,6 +81,7 @@ void zmq::zmq_abort(const char *errmsg_)
RaiseException
(
0x40000015
,
EXCEPTION_NONCONTINUABLE
,
1
,
extra_info
);
#else
(
void
)
errmsg_
;
print_backtrace
();
abort
();
#endif
}
...
...
@@ -384,3 +385,61 @@ int zmq::wsa_error_to_errno (int errcode)
}
#endif
#ifdef HAVE_LIBUNWIND
#define UNW_LOCAL_ONLY
#include <libunwind.h>
#include <dlfcn.h>
#include <cxxabi.h>
void
zmq
::
print_backtrace
(
void
)
{
Dl_info
dl_info
;
unw_cursor_t
cursor
;
unw_context_t
ctx
;
unsigned
frame_n
=
0
;
unw_getcontext
(
&
ctx
);
unw_init_local
(
&
cursor
,
&
ctx
);
while
(
unw_step
(
&
cursor
)
>
0
)
{
unw_word_t
offset
;
unw_proc_info_t
p_info
;
const
char
*
file_name
;
char
*
demangled_name
;
char
func_name
[
256
]
=
""
;
void
*
addr
;
int
rc
;
if
(
unw_get_proc_info
(
&
cursor
,
&
p_info
))
break
;
addr
=
(
void
*
)(
p_info
.
start_ip
+
offset
);
if
(
dladdr
(
addr
,
&
dl_info
)
&&
dl_info
.
dli_fname
)
file_name
=
dl_info
.
dli_fname
;
else
file_name
=
"?"
;
rc
=
unw_get_proc_name
(
&
cursor
,
func_name
,
256
,
&
offset
);
if
(
rc
==
-
UNW_ENOINFO
)
strcpy
(
func_name
,
"?"
);
demangled_name
=
abi
::
__cxa_demangle
(
func_name
,
NULL
,
NULL
,
&
rc
);
printf
(
"#%u %p in %s (%s+0x%lx)
\n
"
,
frame_n
++
,
addr
,
file_name
,
rc
?
func_name
:
demangled_name
,
(
unsigned
long
)
offset
);
free
(
demangled_name
);
}
fflush
(
stdout
);
}
#else
void
zmq
::
print_backtrace
(
void
)
{
}
#endif
src/err.hpp
View file @
f88d129b
...
...
@@ -62,6 +62,7 @@ namespace zmq
{
const
char
*
errno_to_string
(
int
errno_
);
void
zmq_abort
(
const
char
*
errmsg_
);
void
print_backtrace
(
void
);
}
#ifdef ZMQ_HAVE_WINDOWS
...
...
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