+2017-05-30 Mark Wielaard <mark@klomp.org>
+
+ * ppc64_unwind.c: New file.
+ * ppc64_init.c (pcc64_init): Hook unwind.
+ * Makefile.am (ppc64_SRCS): Add ppc64_unwind.c
+
2017-04-06 Mark Wielaard <mark@klomp.org>
* i386_unwind.c: New file.
ppc64_SRCS = ppc64_init.c ppc64_symbol.c ppc64_retval.c \
ppc64_corenote.c ppc_regs.c ppc_auxv.c ppc_attrs.c ppc_syscall.c \
- ppc_cfi.c ppc_initreg.c ppc64_resolve_sym.c
+ ppc_cfi.c ppc_initreg.c ppc64_unwind.c ppc64_resolve_sym.c
libebl_ppc64_pic_a_SOURCES = $(ppc64_SRCS)
am_libebl_ppc64_pic_a_OBJECTS = $(ppc64_SRCS:.c=.os)
eh->frame_nregs = (114 - 1) + 32;
HOOK (eh, set_initial_registers_tid);
HOOK (eh, dwarf_to_regno);
+ HOOK (eh, unwind);
HOOK (eh, resolve_sym_value);
/* Find the function descriptor .opd table for resolve_sym_value. */
--- /dev/null
+/* Get previous frame state for an existing frame state.
+ Copyright (C) 2017 Red Hat, Inc.
+ This file is part of elfutils.
+
+ This file is free software; you can redistribute it and/or modify
+ it under the terms of either
+
+ * the GNU Lesser General Public License as published by the Free
+ Software Foundation; either version 3 of the License, or (at
+ your option) any later version
+
+ or
+
+ * the GNU General Public License as published by the Free
+ Software Foundation; either version 2 of the License, or (at
+ your option) any later version
+
+ or both in parallel, as here.
+
+ elfutils 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
+ General Public License for more details.
+
+ You should have received copies of the GNU General Public License and
+ the GNU Lesser General Public License along with this program. If
+ not, see <http://www.gnu.org/licenses/>. */
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#define BACKEND ppc64_
+
+#define LR_REG 65 /* Not 108, see ppc_dwarf_to_regno. */
+#define SP_REG 1
+
+#define LR_OFFSET 16
+
+#include "libebl_CPU.h"
+
+/* Simplistic fallback frame unwinder. SP points to the backchain (contains
+ address of previous stack pointer). At SP offset 16 is the LR save area
+ (contains the value of the previous LR). */
+
+bool
+EBLHOOK(unwind) (Ebl *ebl __attribute__ ((unused)),
+ Dwarf_Addr pc __attribute__ ((unused)),
+ ebl_tid_registers_t *setfunc, ebl_tid_registers_get_t *getfunc,
+ ebl_pid_memory_read_t *readfunc, void *arg,
+ bool *signal_framep __attribute__ ((unused)))
+{
+ Dwarf_Word sp, newSp, lr, newLr;
+
+ /* Stack pointer points to the backchain which contains the previous sp. */
+ if (! getfunc (SP_REG, 1, &sp, arg))
+ sp = 0;
+
+ /* Link register contains previous program counter. */
+ if (! getfunc (LR_REG, 1, &lr, arg)
+ || lr == 0
+ || ! setfunc (-1, 1, &lr, arg))
+ return false;
+
+ if (! readfunc(sp, &newSp, arg))
+ newSp = 0;
+
+ if (! readfunc(newSp + LR_OFFSET, &newLr, arg))
+ newLr = 0;
+
+ setfunc(SP_REG, 1, &newSp, arg);
+ setfunc(LR_REG, 1, &newLr, arg);
+
+ /* Sanity check the stack grows down. */
+ return newSp > sp;
+}
+2017-05-30 Mark Wielaard <mark@klomp.org>
+
+ * run-backtrace-fp-core-ppc64le.sh: New test.
+ * backtrace.ppc64le.fp.core.bz2: New test file.
+ * backtrace.ppc64le.fp.exec.bz2: New testfile.
+ * backtrace-subr.sh (check_backtracegen): Accept '(null)'.
+ * Makefile.am (TESTS): Add run-backtrace-fp-core-ppc64le.sh.
+ (EXTRA_DIST): Add run-backtrace-fp-core-ppc64le.sh,
+ backtrace.ppc64le.fp.core.bz2 and backtrace.ppc64le.fp.exec.bz2.
+
2017-02-13 Ulf Hermann <ulf.hermann@qt.io>
Mark Wielaard <mark@klomp.org>
run-backtrace-native-core-biarch.sh run-backtrace-core-x86_64.sh \
run-backtrace-fp-core-x86_64.sh \
run-backtrace-fp-core-aarch64.sh \
+ run-backtrace-fp-core-ppc64le.sh \
run-backtrace-core-x32.sh \
run-backtrace-core-i386.sh run-backtrace-fp-core-i386.sh \
run-backtrace-core-ppc.sh \
backtrace-subr.sh backtrace.i386.core.bz2 backtrace.i386.exec.bz2 \
run-backtrace-fp-core-i386.sh \
backtrace.i386.fp.core.bz2 backtrace.i386.fp.exec.bz2 \
+ run-backtrace-fp-core-ppc64le.sh \
+ backtrace.ppc64le.fp.core.bz2 backtrace.ppc64le.fp.exec.bz2 \
backtrace.x86_64.core.bz2 backtrace.x86_64.exec.bz2 \
backtrace.x86_64.fp.core.bz2 backtrace.x86_64.fp.exec.bz2 \
backtrace.ppc.core.bz2 backtrace.ppc.exec.bz2 \
# Ignore it here as it is a bug of OS, not a bug of elfutils.
check_err()
{
- if [ $(egrep -v <$1 'dwfl_thread_getframes: (No DWARF information found|no matching address range|address out of range|Invalid register)$' \
+ if [ $(egrep -v <$1 'dwfl_thread_getframes: (No DWARF information found|no matching address range|address out of range|Invalid register|\(null\))$' \
| wc -c) \
-eq 0 ]
then
--- /dev/null
+#! /bin/bash
+# Copyright (C) 2017 Red Hat, Inc.
+# This file is part of elfutils.
+#
+# This file is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# elfutils 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 General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+. $srcdir/backtrace-subr.sh
+
+# The binary is generated by compiling backtrace-child without unwind
+# information, but with -fno-omit-frame-pointer.
+#
+# gcc -static -O2 -fno-omit-frame-pointer -fno-asynchronous-unwind-tables \
+# -D_GNU_SOURCE -pthread -o tests/backtrace.ppc64le.fp.exec -I. -Ilib \
+# tests/backtrace-child.c
+#
+# The core is generated by calling tests/backtrace.ppc64le.fp.exec --gencore
+
+check_core ppc64le.fp