summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEugene Syromyatnikov <evgsyr@gmail.com>2020-10-05 16:55:48 +0200
committerEugene Syromyatnikov <evgsyr@gmail.com>2020-10-21 19:29:26 +0200
commitf74f5443e90a5bb21e4eaa00078116ce695c3884 (patch)
tree4cb269fa1a3c601f261079f2c4c8022a3807e163
parent23903f6b707e84c1121ab4d13bc0e0f64d662430 (diff)
downloadstrace-esyr/enable-libdw-mpers.tar.gz
Enable stack tracing with libdw for non-native personality traceesesyr/enable-libdw-mpers
libdw can handle compat processes, so it makes little sense to have stack tracing disabled when it is used. * syscall.c [!defined(USE_LIBUNWIND) && ENABLE_STACKTRACE] (update_personality): Re-initialise unwinder on personality change. * unwind.c [!defined(USE_LIBUNWIND) && (SUPPORTED_PERSONALITIES > 1)] (unwind_tcb_print, unwind_tcb_capture): Do not return early. * tests/Makefile.am (STACKTRACE_XFAIL_TESTS): New variable, initialise it to $(STACKTRACE_TESTS) if ENABLE_STACKTRACE and USE_LIBUNWIND are true, otherwise make it empty. (XFAIL_TESTS_m32, XFAIL_TESTS_mx32): Initialise it to $(STACKTRACE_XFAIL_TESTS) and not $(STACKTRACE_TESTS). * NEWS: Mention the change. Closes: https://github.com/strace/strace/issues/162
-rw-r--r--NEWS2
-rw-r--r--syscall.c7
-rw-r--r--tests/Makefile.am10
-rw-r--r--unwind.c4
4 files changed, 19 insertions, 4 deletions
diff --git a/NEWS b/NEWS
index 70c3e0ae2..3462521b5 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,8 @@ Noteworthy changes in release ?.? (????-??-??)
==============================================
* Improvements
+ * libdw-based stack tracing is now enabled for non-native
+ personalities.
* Bug fixes
diff --git a/syscall.c b/syscall.c
index d228ae4d5..9691de5b5 100644
--- a/syscall.c
+++ b/syscall.c
@@ -281,6 +281,13 @@ update_personality(struct tcb *tcp, unsigned int personality)
"building strace with mpers support enabled.");
need_mpers_warning[personality] = false;
}
+
+#if defined(ENABLE_STACKTRACE) && !defined(USE_LIBUNWIND)
+ if (stack_trace_enabled) {
+ unwind_tcb_fin(tcp);
+ unwind_tcb_init(tcp);
+ }
+#endif
}
#endif
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 17f4b4245..b9a58f552 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -320,8 +320,14 @@ STACKTRACE_TESTS = strace-k.test strace-k-p.test
if USE_DEMANGLE
STACKTRACE_TESTS += strace-k-demangle.test
endif
+if USE_LIBUNWIND
+STACKTRACE_XFAIL_TESTS = $(STACKTRACE_TESTS)
+else
+STACKTRACE_XFAIL_TESTS =
+endif
else
STACKTRACE_TESTS =
+STACKTRACE_XFAIL_TESTS =
endif
DECODER_TESTS = \
@@ -483,8 +489,8 @@ MISC_TESTS = \
TESTS = $(GEN_TESTS) $(DECODER_TESTS) $(MISC_TESTS) $(STACKTRACE_TESTS)
XFAIL_TESTS_ =
-XFAIL_TESTS_m32 = $(STACKTRACE_TESTS)
-XFAIL_TESTS_mx32 = $(STACKTRACE_TESTS)
+XFAIL_TESTS_m32 = $(STACKTRACE_XFAIL_TESTS)
+XFAIL_TESTS_mx32 = $(STACKTRACE_XFAIL_TESTS)
XFAIL_TESTS = $(XFAIL_TESTS_$(MPERS_NAME)) $(XFAIL_TESTS_$(ARCH))
TEST_LOG_COMPILER = env
diff --git a/unwind.c b/unwind.c
index 42e6a7fa4..7e7c12881 100644
--- a/unwind.c
+++ b/unwind.c
@@ -264,7 +264,7 @@ queue_print(struct unwind_queue_t *queue)
void
unwind_tcb_print(struct tcb *tcp)
{
-#if SUPPORTED_PERSONALITIES > 1
+#if defined(USE_LIBUNWIND) && (SUPPORTED_PERSONALITIES > 1)
if (tcp->currpers != DEFAULT_PERSONALITY) {
/* disable stack trace */
return;
@@ -284,7 +284,7 @@ unwind_tcb_print(struct tcb *tcp)
void
unwind_tcb_capture(struct tcb *tcp)
{
-#if SUPPORTED_PERSONALITIES > 1
+#if defined(USE_LIBUNWIND) && (SUPPORTED_PERSONALITIES > 1)
if (tcp->currpers != DEFAULT_PERSONALITY) {
/* disable stack trace */
return;