diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | src/vlib/CMakeLists.txt | 15 | ||||
-rw-r--r-- | src/vlib/unix/main.c | 20 |
3 files changed, 33 insertions, 3 deletions
@@ -106,6 +106,7 @@ DEB_DEPENDS += iperf ethtool # for 'make test TEST=vm_vpp_interfaces' DEB_DEPENDS += libpcap-dev DEB_DEPENDS += tshark DEB_DEPENDS += jq # for extracting test summary from .json report (hs-test) +DEB_DEPENDS += libiberty-dev DEB_DEPENDS += nasm libnuma-dev # for make-ext-deps LIBFFI=libffi6 # works on all but 20.04 and debian-testing diff --git a/src/vlib/CMakeLists.txt b/src/vlib/CMakeLists.txt index 3c354b764dd..1f1a1396d0d 100644 --- a/src/vlib/CMakeLists.txt +++ b/src/vlib/CMakeLists.txt @@ -71,6 +71,19 @@ set(PLATFORM_SOURCES ) endif() +set(VLIB_LIBS vppinfra svm ${CMAKE_DL_LIBS} ${EPOLL_LIB}) + +vpp_find_path(LIBIBERTY_INCLUDE_DIR libiberty/demangle.h) +vpp_find_library(LIBIBERTY_LIB NAMES iberty libiberty) + +if (LIBIBERTY_INCLUDE_DIR AND LIBUNWIND_LIB) + message(STATUS "libiberty found at ${LIBIBERTY_LIB}") + list(APPEND VLIB_LIBS ${LIBIBERTY_LIB}) + add_definitions(-DHAVE_LIBIBERTY) +else() + message(WARNING "libiberty not found - stack trace demangle disabled") +endif() + add_vpp_library(vlib SOURCES buffer.c @@ -159,7 +172,7 @@ add_vpp_library(vlib API_FILES pci/pci_types.api - LINK_LIBRARIES vppinfra svm ${CMAKE_DL_LIBS} ${EPOLL_LIB} + LINK_LIBRARIES ${VLIB_LIBS} DEPENDS api_headers ) diff --git a/src/vlib/unix/main.c b/src/vlib/unix/main.c index 11d0cb1160c..49aa5d3a8ab 100644 --- a/src/vlib/unix/main.c +++ b/src/vlib/unix/main.c @@ -54,6 +54,10 @@ #include <sys/resource.h> #include <unistd.h> +#ifdef HAVE_LIBIBERTY +#include <libiberty/demangle.h> +#endif + /** Default CLI pager limit is not configured in startup.conf */ #define UNIX_CLI_DEFAULT_PAGER_LIMIT 100000 @@ -226,8 +230,20 @@ unix_signal_handler (int signum, siginfo_t * si, ucontext_t * uc) { if (color) syslog_msg = format (syslog_msg, ANSI_FG_YELLOW); - syslog_msg = - format (syslog_msg, " %s + 0x%x", sf->name, sf->offset); +#if HAVE_LIBIBERTY + if (strncmp (sf->name, "_Z", 2) == 0) + { + char *demangled = cplus_demangle (sf->name, DMGL_AUTO); + syslog_msg = format (syslog_msg, " %s", + demangled ? demangled : sf->name); + if (demangled) + free (demangled); + } + else +#endif + syslog_msg = format (syslog_msg, " %s", sf->name); + + syslog_msg = format (syslog_msg, " + 0x%x", sf->offset); if (color) syslog_msg = format (syslog_msg, ANSI_FG_DEFAULT); } |