summaryrefslogtreecommitdiffstats
path: root/libbacktrace/backtrace_test.cpp
diff options
context:
space:
mode:
authorChristopher Ferris <cferris@google.com>2014-04-29 09:35:30 -0700
committerChristopher Ferris <cferris@google.com>2014-04-30 16:32:47 -0700
commitaa63d9f980f95718fc28ca7e222c1e8d7ca9e778 (patch)
tree98901cf725457fc80c71c6a4bede3fda4e172cb0 /libbacktrace/backtrace_test.cpp
parentf3661cc2f124bb7ca38285f156c624dda974b4c5 (diff)
downloadsystem_core-aa63d9f980f95718fc28ca7e222c1e8d7ca9e778.zip
system_core-aa63d9f980f95718fc28ca7e222c1e8d7ca9e778.tar.gz
system_core-aa63d9f980f95718fc28ca7e222c1e8d7ca9e778.tar.bz2
Use real time signal for threads instead of SIGURG.
This guarantees that any application is not also using this signal for some other purpose. Change-Id: I7c9bbb0ec8bb4e13322ecda951bcd43c6bf6ee1a
Diffstat (limited to 'libbacktrace/backtrace_test.cpp')
-rw-r--r--libbacktrace/backtrace_test.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/libbacktrace/backtrace_test.cpp b/libbacktrace/backtrace_test.cpp
index a5e141b..9744922 100644
--- a/libbacktrace/backtrace_test.cpp
+++ b/libbacktrace/backtrace_test.cpp
@@ -33,6 +33,9 @@
#include <backtrace/BacktraceMap.h>
#include <UniquePtr.h>
+// For the THREAD_SIGNAL definition.
+#include "BacktraceThread.h"
+
#include <cutils/atomic.h>
#include <gtest/gtest.h>
@@ -460,9 +463,15 @@ TEST(libbacktrace, thread_level_trace) {
// Wait up to 2 seconds for the tid to be set.
ASSERT_TRUE(WaitForNonZero(&thread_data.state, 2));
+ // Make sure that the thread signal used is not visible when compiled for
+ // the target.
+#if !defined(__GLIBC__)
+ ASSERT_LT(THREAD_SIGNAL, SIGRTMIN);
+#endif
+
// Save the current signal action and make sure it is restored afterwards.
struct sigaction cur_action;
- ASSERT_TRUE(sigaction(SIGURG, NULL, &cur_action) == 0);
+ ASSERT_TRUE(sigaction(THREAD_SIGNAL, NULL, &cur_action) == 0);
UniquePtr<Backtrace> backtrace(Backtrace::Create(getpid(), thread_data.tid));
ASSERT_TRUE(backtrace.get() != NULL);
@@ -475,7 +484,7 @@ TEST(libbacktrace, thread_level_trace) {
// Verify that the old action was restored.
struct sigaction new_action;
- ASSERT_TRUE(sigaction(SIGURG, NULL, &new_action) == 0);
+ ASSERT_TRUE(sigaction(THREAD_SIGNAL, NULL, &new_action) == 0);
EXPECT_EQ(cur_action.sa_sigaction, new_action.sa_sigaction);
EXPECT_EQ(cur_action.sa_flags, new_action.sa_flags);
}