[dpdk-dev] [PATCH v3 2/2] config: make backtrace optional

Thomas Monjalon thomas at monjalon.net
Fri May 5 15:18:27 CEST 2017


From: Wei Dai <wei.dai at intel.com>

When building DPDK with musl, there is need not to disable
backtrace to remove some references to execinfo.h which is
not supported by musl now.
This also applies to some other libc implementation which
doesn't support backtrace() and backtrace_symbols().

musl is an implementation of the userspace portion
of the standard library functionality described in
the ISO C and POSIX standards, plus common extensions.
Got more details about musl from http://www.musl-libc.org .

Signed-off-by: Wei Dai <wei.dai at intel.com>
Signed-off-by: Thomas Monjalon <thomas at monjalon.net>
---
 config/common_base                      | 1 +
 lib/librte_eal/bsdapp/eal/eal_debug.c   | 4 ++++
 lib/librte_eal/linuxapp/eal/eal_debug.c | 4 ++++
 3 files changed, 9 insertions(+)

diff --git a/config/common_base b/config/common_base
index 93e923507..8907bea36 100644
--- a/config/common_base
+++ b/config/common_base
@@ -96,6 +96,7 @@ CONFIG_RTE_MAX_TAILQ=32
 CONFIG_RTE_LOG_LEVEL=RTE_LOG_INFO
 CONFIG_RTE_LOG_DP_LEVEL=RTE_LOG_INFO
 CONFIG_RTE_LOG_HISTORY=256
+CONFIG_RTE_BACKTRACE=y
 CONFIG_RTE_LIBEAL_USE_HPET=n
 CONFIG_RTE_EAL_ALLOW_INV_SOCKET_ID=n
 CONFIG_RTE_EAL_ALWAYS_PANIC_ON_ERROR=n
diff --git a/lib/librte_eal/bsdapp/eal/eal_debug.c b/lib/librte_eal/bsdapp/eal/eal_debug.c
index 5fbc17c59..e1c755482 100644
--- a/lib/librte_eal/bsdapp/eal/eal_debug.c
+++ b/lib/librte_eal/bsdapp/eal/eal_debug.c
@@ -31,7 +31,9 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef RTE_BACKTRACE
 #include <execinfo.h>
+#endif
 #include <stdarg.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -47,6 +49,7 @@
 /* dump the stack of the calling core */
 void rte_dump_stack(void)
 {
+#ifdef RTE_BACKTRACE
 	void *func[BACKTRACE_SIZE];
 	char **symb = NULL;
 	int size;
@@ -64,6 +67,7 @@ void rte_dump_stack(void)
 	}
 
 	free(symb);
+#endif /* RTE_BACKTRACE */
 }
 
 /* not implemented in this environment */
diff --git a/lib/librte_eal/linuxapp/eal/eal_debug.c b/lib/librte_eal/linuxapp/eal/eal_debug.c
index 5fbc17c59..e1c755482 100644
--- a/lib/librte_eal/linuxapp/eal/eal_debug.c
+++ b/lib/librte_eal/linuxapp/eal/eal_debug.c
@@ -31,7 +31,9 @@
  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+#ifdef RTE_BACKTRACE
 #include <execinfo.h>
+#endif
 #include <stdarg.h>
 #include <signal.h>
 #include <stdlib.h>
@@ -47,6 +49,7 @@
 /* dump the stack of the calling core */
 void rte_dump_stack(void)
 {
+#ifdef RTE_BACKTRACE
 	void *func[BACKTRACE_SIZE];
 	char **symb = NULL;
 	int size;
@@ -64,6 +67,7 @@ void rte_dump_stack(void)
 	}
 
 	free(symb);
+#endif /* RTE_BACKTRACE */
 }
 
 /* not implemented in this environment */
-- 
2.12.2



More information about the dev mailing list