restore sigprocmask in setjmp/longjmp test.

Bug: 18571921
Change-Id: Ib8ca7a36abd3ccc729c20c0e32d45b1b33069f65
This commit is contained in:
Yabin Cui
2014-12-02 09:57:45 -08:00
parent 8374a54813
commit e323e99ffb
2 changed files with 18 additions and 6 deletions

View File

@@ -73,6 +73,7 @@ TEST(stack_unwinding, easy) {
ASSERT_EQ(count + 1, deeper_count);
}
static volatile bool signal_handler_run = false;
static int killer_count = 0;
static int handler_count = 0;
static int handler_one_deeper_count = 0;
@@ -83,6 +84,7 @@ static void noinline UnwindSignalHandler(int) {
handler_one_deeper_count = unwind_one_frame_deeper();
ASSERT_EQ(handler_count + 1, handler_one_deeper_count);
signal_handler_run = true;
}
TEST(stack_unwinding, unwind_through_signal_frame) {
@@ -90,8 +92,9 @@ TEST(stack_unwinding, unwind_through_signal_frame) {
ScopedSignalHandler ssh(SIGUSR1, UnwindSignalHandler);
_Unwind_Backtrace(FrameCounter, &killer_count);
signal_handler_run = false;
ASSERT_EQ(0, kill(getpid(), SIGUSR1));
while (!signal_handler_run) {}
}
// On LP32, the SA_SIGINFO flag gets you __restore_rt instead of __restore.
@@ -100,6 +103,7 @@ TEST(stack_unwinding, unwind_through_signal_frame_SA_SIGINFO) {
ScopedSignalHandler ssh(SIGUSR1, UnwindSignalHandler, SA_SIGINFO);
_Unwind_Backtrace(FrameCounter, &killer_count);
signal_handler_run = false;
ASSERT_EQ(0, kill(getpid(), SIGUSR1));
while (!signal_handler_run) {}
}