1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

PowerPC: fix backtrace to handle signal trampolines

This patch fixes backtrace for PPC32 and PPC64 to correctly handle
signal trampolines. The 'debug/tst-backtrace6.c' also check for
SA_SIGINFO handling, where is triggers another vDSO symbols for PPC32.
This commit is contained in:
Adhemerval Zanella
2013-08-20 15:01:59 -05:00
parent c980f2f4fe
commit d400dcac5e
8 changed files with 172 additions and 6 deletions

View File

@ -130,16 +130,18 @@ CFLAGS-tst-backtrace2.c += -funwind-tables
CFLAGS-tst-backtrace3.c += -funwind-tables
CFLAGS-tst-backtrace4.c += -funwind-tables
CFLAGS-tst-backtrace5.c += -funwind-tables
CFLAGS-tst-backtrace6.c += -funwind-tables
LDFLAGS-tst-backtrace2 = -rdynamic
LDFLAGS-tst-backtrace3 = -rdynamic
LDFLAGS-tst-backtrace4 = -rdynamic
LDFLAGS-tst-backtrace5 = -rdynamic
LDFLAGS-tst-backtrace6 = -rdynamic
tests = backtrace-tst tst-longjmp_chk tst-chk1 tst-chk2 tst-chk3 \
tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6 \
tst-longjmp_chk2 tst-backtrace2 tst-backtrace3 tst-backtrace4 \
tst-backtrace5
tst-backtrace5 tst-backtrace6
tests-ifunc := $(stpcpy_chk strcpy_chk:%=test-%-ifunc)
tests += $(tests-ifunc)

View File

@ -28,6 +28,10 @@
#include "tst-backtrace.h"
#ifndef SIGACTION_FLAGS
# define SIGACTION_FLAGS 0
#endif
static int do_test (void);
#define TEST_FUNCTION do_test ()
#include "../test-skeleton.c"
@ -91,7 +95,7 @@ handle_signal (int signum)
}
NO_INLINE int
fn (int c)
fn (int c, int flags)
{
pid_t parent_pid, child_pid;
int pipefd[2];
@ -100,12 +104,13 @@ fn (int c)
if (c > 0)
{
fn (c - 1);
fn (c - 1, flags);
return x;
}
memset (&act, 0, sizeof (act));
act.sa_handler = handle_signal;
act.sa_flags = flags;
sigemptyset (&act.sa_mask);
sigaction (SIGUSR1, &act, NULL);
parent_pid = getpid ();
@ -131,6 +136,6 @@ fn (int c)
NO_INLINE static int
do_test (void)
{
fn (2);
fn (2, SIGACTION_FLAGS);
return ret;
}

21
debug/tst-backtrace6.c Normal file
View File

@ -0,0 +1,21 @@
/* Test backtrace and backtrace_symbols for signal frames, where a
system call was interrupted by a signal.
Copyright (C) 2013 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
The GNU C Library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
#define SIGACTION_FLAGS SA_SIGINFO
#include <debug/tst-backtrace5.c>