aboutsummaryrefslogtreecommitdiffstats
path: root/src/vlib
diff options
context:
space:
mode:
Diffstat (limited to 'src/vlib')
-rw-r--r--src/vlib/CMakeLists.txt15
-rw-r--r--src/vlib/node_funcs.h24
-rw-r--r--src/vlib/unix/main.c20
3 files changed, 56 insertions, 3 deletions
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/node_funcs.h b/src/vlib/node_funcs.h
index 91fedaa4c9c..ef8cf78e838 100644
--- a/src/vlib/node_funcs.h
+++ b/src/vlib/node_funcs.h
@@ -261,6 +261,13 @@ vlib_node_set_interrupt_pending (vlib_main_t *vm, u32 node_index)
clib_interrupt_set (interrupts, n->runtime_index);
}
+always_inline int
+vlib_node_is_scheduled (vlib_main_t *vm, u32 node_index)
+{
+ vlib_node_runtime_t *rt = vlib_node_get_runtime (vm, node_index);
+ return rt->stop_timer_handle_plus_1 ? 1 : 0;
+}
+
always_inline void
vlib_node_schedule (vlib_main_t *vm, u32 node_index, f64 dt)
{
@@ -273,6 +280,9 @@ vlib_node_schedule (vlib_main_t *vm, u32 node_index, f64 dt)
.index = node_index,
};
+ ASSERT (vm == vlib_get_main ());
+ ASSERT (vlib_node_is_scheduled (vm, node_index) == 0);
+
dt = flt_round_nearest (dt * VLIB_TW_TICKS_PER_SECOND);
ticks = clib_max ((u64) dt, 1);
@@ -280,6 +290,20 @@ vlib_node_schedule (vlib_main_t *vm, u32 node_index, f64 dt)
1 + TW (tw_timer_start) (tw, e.as_u32, 0 /* timer_id */, ticks);
}
+always_inline void
+vlib_node_unschedule (vlib_main_t *vm, u32 node_index)
+{
+ vlib_node_runtime_t *rt = vlib_node_get_runtime (vm, node_index);
+ TWT (tw_timer_wheel) *tw = (TWT (tw_timer_wheel) *) vm->timing_wheel;
+
+ ASSERT (vm == vlib_get_main ());
+ ASSERT (vlib_node_is_scheduled (vm, node_index) == 1);
+
+ TW (tw_timer_stop) (tw, rt->stop_timer_handle_plus_1);
+
+ rt->stop_timer_handle_plus_1 = 0;
+}
+
always_inline vlib_process_t *
vlib_get_process_from_node (vlib_main_t * vm, vlib_node_t * node)
{
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);
}