debian/0000775000000000000000000000000012267711620007174 5ustar debian/libunwind.ver0000664000000000000000000000011112234301555011672 0ustar HIDDEN { local: __*; _rest*; _save*; }; libunwind8 { *; }; debian/libunwind-setjmp0.install0000664000000000000000000000004012234301555014125 0ustar usr/lib/*/libunwind-setjmp.so.* debian/rules0000775000000000000000000000257212236666731010272 0ustar #!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 export DEB_BUILD_MAINT_OPTIONS = hardening=-all,+format %: dh $@ --parallel --with autoreconf binary binary-arch: debian/libunwind-setjmp0.preinst debian/libunwind-setjmp0.postrm debian/libunwind-setjmp0.%: debian/libunwind-setjmp0.%.in $(if $(DEB_HOST_MULTIARCH),:,$(error DEB_HOST_MULTIARCH is not defined)) sed 's/@DEB_HOST_MULTIARCH@/$(DEB_HOST_MULTIARCH)/g' $< > $@ override_dh_auto_configure: dh_auto_configure -- --with-pic --enable-cxx-exceptions --enable-minidebuginfo override_dh_install: dh_install for d in libunwind8 libunwind8-dev ; do \ find "debian/$$d/usr/lib" -name "libunwind*-setjmp*" -delete ; \ done override_dh_installchangelogs: dh_installchangelogs ChangeLog override_dh_auto_test: ifeq (,$(findstring nocheck, $(DEB_BUILD_OPTIONS))) # Test suite is only useful on amd64 architecture; # other ARCH's have quite a few know test faulures. ifeq (amd64, $(DEB_BUILD_ARCH)) $(MAKE) check endif # amd64 endif # nocheck override_dh_strip: dh_strip -plibunwind8 --dbg-package=libunwind8-dbg dh_strip -plibunwind-setjmp0 --dbg-package=libunwind-setjmp0-dbg get-orig-source: uscan --verbose --force-download --rename --repack --destdir=.. .PHONY: override_dh_auto_configure override_dh_install override_dh_installchangelogs override_dh_strip get-orig-source debian/watch0000664000000000000000000000015412234301555010221 0ustar version=3 http://download.savannah.nongnu.org/releases/libunwind/libunwind-([0-9].[0-9]+\.?[0-9]*)\.tar\.gz debian/libunwind8-dev.manpages0000664000000000000000000000217112234301555013545 0ustar debian/tmp/usr/share/man/man3/libunwind-*.* debian/tmp/usr/share/man/man3/libunwind.* debian/tmp/usr/share/man/man3/unw_destroy_addr_space.* debian/tmp/usr/share/man/man3/unw_flush_cache.* debian/tmp/usr/share/man/man3/unw_get_accessors.* debian/tmp/usr/share/man/man3/unw_get_fpreg.* debian/tmp/usr/share/man/man3/unw_get_proc_info.* debian/tmp/usr/share/man/man3/unw_get_proc_info_by_ip.* debian/tmp/usr/share/man/man3/unw_get_proc_name.* debian/tmp/usr/share/man/man3/unw_get_reg.* debian/tmp/usr/share/man/man3/unw_getcontext.* debian/tmp/usr/share/man/man3/unw_init_local.* debian/tmp/usr/share/man/man3/unw_init_remote.* debian/tmp/usr/share/man/man3/unw_is_fpreg.* debian/tmp/usr/share/man/man3/unw_is_signal_frame.* debian/tmp/usr/share/man/man3/unw_regname.* debian/tmp/usr/share/man/man3/unw_resume.* debian/tmp/usr/share/man/man3/unw_set_fpreg.* debian/tmp/usr/share/man/man3/unw_set_reg.* debian/tmp/usr/share/man/man3/unw_step.* debian/tmp/usr/share/man/man3/_U_dyn_cancel.* debian/tmp/usr/share/man/man3/_U_dyn_register.* debian/tmp/usr/share/man/man3/unw_create_addr_space.* debian/tmp/usr/share/man/man3/unw_set_caching_policy.* debian/copyright0000664000000000000000000000703412234301555011127 0ustar Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ Upstream-Name: libunwind Upstream-Contact: David Mosberger Source: http://www.nongnu.org/libunwind Files: * Copyright: 2001-2005 Hewlett-Packard Co. 2007 David Mosberger-Tang License: Expat Files: src/arm/* Copyright: 2008 CodeSourcery License: Expat Files: src/mi/strerror.c Copyright: 2004 BEA Systems License: Expat Files: src/mips/* Copyright: 2008 CodeSourcery License: Expat Files: src/os-freebsd.c src/x86/*-freebsd.* Copyright: 2010 Konstantin Belousov License: Expat Files: src/ppc*/* Copyright: 2006-2007 IBM License: Expat Files: src/ptrace/_UPT_access_* Copyright: 2003-2005 Hewlett-Packard Co 2010 Konstantin Belousov License: Expat Files: src/unwind/GetIPInfo.c Copyright: 2009 Red Hat License: Expat Files: src/x86/getcontext-linux.S Copyright: 2009 Google, Inc License: Expat Files: src/x86_64/Gstash_frame.c src/x86_64/Gtrace.c Copyright: 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY License: Expat Files: src/x86_64/*context.S Copyright: 2008 Google, Inc 2010 Konstantin Belousov License: Expat Files: tests/Gtest-nocalloc.c tests/Gtest-nomalloc.c Copyright: 2009, 2011 Google, Inc License: Expat Files: tests/Gtest-trace.c Copyright: 2010, 2011 by FERMI NATIONAL ACCELERATOR LABORATORY License: Expat Files: tests/Ltest-cxx-exceptions.cxx Copyright: 2010 stefan.demharter@gmx.net 2010 arun.sharma@google.com License: Expat Files: debian/* Copyright: Copyright 2003 Matthieu Delahaye Copyright 2012 Daigo Moriwaki License: GPL-2+ This program 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 2 of the License, or (at your option) any later version. . This program 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 package; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA . On Debian systems, the full text of the GNU General Public License version 2 can be found in the file `/usr/share/common-licenses/GPL-2'. License: Expat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: . The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. . THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. debian/libunwind8.dirs0000664000000000000000000000001412234301555012131 0ustar lib usr/lib debian/README.source0000664000000000000000000000150612216571720011354 0ustar Building libunwind/amd64 on Ubuntu ---------------------------------- The libunwind test suite is executed during the amd64 build; the run-coredump-unwind test intentionally creates a core dump during execution; on systems where apport is installed, the default core_pattern will try to push the core dump to apport. If you are building in a (s)chroot using sbuild or pbuilder, this will fail, the core dump will not be written to disk and the test fails. To work around this, set the core pattern to: sudo sysctl kernel.core_pattern=core This will allow run-coredump-unwind test to correctly create the core file it relies on to complete testing. You can set it back to the apport default: sudo sysctl kernel.core_pattern="|/usr/share/apport/apport %p %s %c" Note that this is not an issue on the official Launchpad buildds. debian/libunwind8-dev.dirs0000664000000000000000000000004712234301555012713 0ustar usr/include usr/lib usr/share/man/man3 debian/libunwind-setjmp0-dev.manpages0000664000000000000000000000004612234301555015034 0ustar usr/share/man/man3/libunwind-setjmp.* debian/source/0000775000000000000000000000000012267711507010500 5ustar debian/source/format0000664000000000000000000000001412234301555011676 0ustar 3.0 (quilt) debian/source/options0000664000000000000000000000015112267711507012113 0ustar extend-diff-ignore = "(^|/)(config\.sub|config\.guess|Makefile|Makefile\.am|configure\.ac|.*\.c|.*\.h)$" debian/libunwind-setjmp0.dirs0000664000000000000000000000001012234301555013415 0ustar usr/lib debian/libunwind-setjmp0.preinst.in0000664000000000000000000000065212233232577014567 0ustar #!/bin/sh set -e if [ install = "$1" ]; then dpkg-divert --package libunwind-setjmp0 --add --rename --divert /usr/lib/@DEB_HOST_MULTIARCH@/libunwind-setjmp.so.0.0.0.old /usr/lib/@DEB_HOST_MULTIARCH@/libunwind-setjmp.so.0.0.0 dpkg-divert --package libunwind-setjmp0 --add --rename --divert /usr/lib/@DEB_HOST_MULTIARCH@/libunwind-setjmp.so.0.old /usr/lib/@DEB_HOST_MULTIARCH@/libunwind-setjmp.so.0 fi #DEBHELPER# debian/libunwind-setjmp0.postrm.in0000664000000000000000000000065712233232577014434 0ustar #!/bin/sh set -e if [ remove = "$1" ]; then dpkg-divert --package libunwind-setjmp0 --remove --rename --divert /usr/lib/@DEB_HOST_MULTIARCH@/libunwind-setjmp.so.0.0.0.old /usr/lib/@DEB_HOST_MULTIARCH@/libunwind-setjmp.so.0.0.0 dpkg-divert --package libunwind-setjmp0 --remove --rename --divert /usr/lib/@DEB_HOST_MULTIARCH@/libunwind-setjmp.so.0.old /usr/lib/@DEB_HOST_MULTIARCH@/libunwind-setjmp.so.0 fi #DEBHELPER# debian/libunwind-setjmp0-dev.install0000664000000000000000000000014312234301555014705 0ustar usr/lib/*/libunwind-setjmp.so usr/lib/*/libunwind-setjmp.a usr/lib/*/pkgconfig/libunwind-setjmp.pc debian/dirs0000664000000000000000000000004712234301555010055 0ustar usr/lib usr/share/man/man3 usr/include debian/libunwind-setjmp0-dev.dirs0000664000000000000000000000003312234301555014176 0ustar usr/lib usr/share/man/man3 debian/patches/0000775000000000000000000000000012267711523010625 5ustar debian/patches/01-rpath.patch0000664000000000000000000000107512234301555013177 0ustar From: Daigo Moriwaki Subject: rpath should not be used. See http://wiki.debian.org/RpathIssue --- a/configure.ac +++ b/configure.ac @@ -21,6 +21,16 @@ LT_INIT AM_PROG_AS AM_PROG_CC_C_O +case ${host} in + *-pc-linux-gnu) + AC_MSG_RESULT([Fixing libtool for -rpath problems.]) + sed < libtool > libtool-2 \ + 's/^hardcode_libdir_flag_spec.*$'/'hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "/' + mv libtool-2 libtool + chmod 755 libtool + ;; +esac + dnl Checks for libraries. AC_CHECK_LIB(uca, __uc_get_grs) OLD_LIBS=${LIBS} debian/patches/20130803-crasher_test_only_for_coredump.patch0000664000000000000000000000160012234301555021026 0ustar Index: pkg-libunwind/tests/Makefile.am =================================================================== --- pkg-libunwind.orig/tests/Makefile.am 2013-08-04 16:25:11.271314176 +0900 +++ pkg-libunwind/tests/Makefile.am 2013-08-04 16:30:32.666240614 +0900 @@ -47,7 +47,7 @@ test-async-sig test-flush-cache test-init-remote \ test-mem test-setjmp test-ptrace Ltest-varargs \ Ltest-nomalloc Ltest-nocalloc Lrs-race - noinst_PROGRAMS_cdep = forker crasher mapper test-ptrace-misc \ + noinst_PROGRAMS_cdep = forker mapper test-ptrace-misc \ Gperf-simple Lperf-simple noinst_PROGRAMS_cdep += Gperf-trace Lperf-trace @@ -59,7 +59,7 @@ if OS_LINUX if BUILD_COREDUMP check_SCRIPTS_cdep += run-coredump-unwind - noinst_PROGRAMS_cdep += test-coredump-unwind + noinst_PROGRAMS_cdep += crasher test-coredump-unwind if HAVE_LZMA check_SCRIPTS_cdep += run-coredump-unwind-mdi debian/patches/AArch64-port.diff0000664000000000000000000025141712216571720013600 0ustar From 7852e18a504f8224cb3f8fa0127b885a7d5e3844 Mon Sep 17 00:00:00 2001 From: Yvan Roux Date: Fri, 3 May 2013 15:51:14 +0200 Subject: [PATCH] AArch64 port. --- Makefile.am | 6 + README | 1 + configure.ac | 6 +- include/libunwind-aarch64.h | 187 +++++++++++++++++++++ include/libunwind.h.in | 4 +- include/tdep-aarch64/dwarf-config.h | 52 ++++++ include/tdep-aarch64/jmpbuf.h | 33 ++++ include/tdep-aarch64/libunwind_i.h | 294 ++++++++++++++++++++++++++++++++++ include/tdep/dwarf-config.h | 4 +- include/tdep/jmpbuf.h | 2 + include/tdep/libunwind_i.h.in | 4 +- src/Makefile.am | 39 ++++- src/aarch64/Gcreate_addr_space.c | 60 +++++++ src/aarch64/Gget_proc_info.c | 39 +++++ src/aarch64/Gget_save_loc.c | 100 ++++++++++++ src/aarch64/Gglobal.c | 57 +++++++ src/aarch64/Ginit.c | 187 +++++++++++++++++++++ src/aarch64/Ginit_local.c | 55 +++++++ src/aarch64/Ginit_remote.c | 45 ++++++ src/aarch64/Gis_signal_frame.c | 64 ++++++++ src/aarch64/Gregs.c | 113 +++++++++++++ src/aarch64/Gresume.c | 177 ++++++++++++++++++++ src/aarch64/Gstep.c | 129 +++++++++++++++ src/aarch64/Lcreate_addr_space.c | 5 + src/aarch64/Lget_proc_info.c | 5 + src/aarch64/Lget_save_loc.c | 5 + src/aarch64/Lglobal.c | 5 + src/aarch64/Linit.c | 5 + src/aarch64/Linit_local.c | 5 + src/aarch64/Linit_remote.c | 5 + src/aarch64/Lis_signal_frame.c | 5 + src/aarch64/Lregs.c | 5 + src/aarch64/Lresume.c | 5 + src/aarch64/Lstep.c | 5 + src/aarch64/gen-offsets.c | 68 ++++++++ src/aarch64/init.h | 127 +++++++++++++++ src/aarch64/is_fpreg.c | 32 ++++ src/aarch64/offsets.h | 49 ++++++ src/aarch64/regname.c | 106 ++++++++++++ src/aarch64/siglongjmp.S | 12 ++ src/aarch64/unwind_i.h | 43 +++++ src/coredump/_UCD_access_reg_linux.c | 5 +- src/ptrace/_UPT_reg_offset.c | 36 +++++ 43 files changed, 2184 insertions(+), 7 deletions(-) create mode 100644 include/libunwind-aarch64.h create mode 100644 include/tdep-aarch64/dwarf-config.h create mode 100644 include/tdep-aarch64/jmpbuf.h create mode 100644 include/tdep-aarch64/libunwind_i.h create mode 100644 src/aarch64/Gcreate_addr_space.c create mode 100644 src/aarch64/Gget_proc_info.c create mode 100644 src/aarch64/Gget_save_loc.c create mode 100644 src/aarch64/Gglobal.c create mode 100644 src/aarch64/Ginit.c create mode 100644 src/aarch64/Ginit_local.c create mode 100644 src/aarch64/Ginit_remote.c create mode 100644 src/aarch64/Gis_signal_frame.c create mode 100644 src/aarch64/Gregs.c create mode 100644 src/aarch64/Gresume.c create mode 100644 src/aarch64/Gstep.c create mode 100644 src/aarch64/Lcreate_addr_space.c create mode 100644 src/aarch64/Lget_proc_info.c create mode 100644 src/aarch64/Lget_save_loc.c create mode 100644 src/aarch64/Lglobal.c create mode 100644 src/aarch64/Linit.c create mode 100644 src/aarch64/Linit_local.c create mode 100644 src/aarch64/Linit_remote.c create mode 100644 src/aarch64/Lis_signal_frame.c create mode 100644 src/aarch64/Lregs.c create mode 100644 src/aarch64/Lresume.c create mode 100644 src/aarch64/Lstep.c create mode 100644 src/aarch64/gen-offsets.c create mode 100644 src/aarch64/init.h create mode 100644 src/aarch64/is_fpreg.c create mode 100644 src/aarch64/offsets.h create mode 100644 src/aarch64/regname.c create mode 100644 src/aarch64/siglongjmp.S create mode 100644 src/aarch64/unwind_i.h --- a/Makefile.am +++ b/Makefile.am @@ -2,6 +2,9 @@ include_HEADERS = include/libunwind-dyna include/libunwind-ptrace.h \ include/libunwind-coredump.h +if ARCH_AARCH64 +include_HEADERS += include/libunwind-aarch64.h +endif if ARCH_ARM include_HEADERS += include/libunwind-arm.h endif @@ -41,6 +44,9 @@ SUBDIRS = src tests doc noinst_HEADERS = include/dwarf.h include/dwarf_i.h include/dwarf-eh.h \ include/compiler.h include/libunwind_i.h include/mempool.h \ include/remote.h \ + include/tdep-aarch64/dwarf-config.h \ + include/tdep-aarch64/jmpbuf.h \ + include/tdep-aarch64/libunwind_i.h \ include/tdep-arm/dwarf-config.h include/tdep-arm/ex_tables.h \ include/tdep-arm/jmpbuf.h include/tdep-arm/libunwind_i.h \ include/tdep-ia64/jmpbuf.h include/tdep-ia64/rse.h \ --- a/README +++ b/README @@ -9,6 +9,7 @@ several architecture/operating-system co Linux/IA-64: Fully tested and supported. Linux/PARISC: Works well, but C library missing unwind-info. HP-UX/IA-64: Mostly works but known to have some serious limitations. + Linux/AArch64: Newly added. Linux/PPC64: Newly added. Linux/SuperH: Newly added. FreeBSD/i386: Newly added. --- a/configure.ac +++ b/configure.ac @@ -114,7 +114,7 @@ SET_ARCH([$target_cpu],[target_arch]) AC_ARG_ENABLE(coredump, AS_HELP_STRING([--enable-coredump],[building libunwind-coredump library]),, - [AS_CASE([$host_arch], [arm*|mips*|sh*|x86*], [enable_coredump=yes], [enable_coredump=no])] + [AS_CASE([$host_arch], [aarch64*|arm*|mips*|sh*|x86*], [enable_coredump=yes], [enable_coredump=no])] ) AC_MSG_CHECKING([if we should build libunwind-coredump]) @@ -131,6 +131,7 @@ AC_MSG_RESULT([$target_os]) AM_CONDITIONAL(BUILD_COREDUMP, test x$enable_coredump = xyes) AM_CONDITIONAL(REMOTE_ONLY, test x$target_arch != x$host_arch) +AM_CONDITIONAL(ARCH_AARCH64, test x$target_arch = xaarch64) AM_CONDITIONAL(ARCH_ARM, test x$target_arch = xarm) AM_CONDITIONAL(ARCH_IA64, test x$target_arch = xia64) AM_CONDITIONAL(ARCH_HPPA, test x$target_arch = xhppa) @@ -147,7 +148,7 @@ AM_CONDITIONAL(OS_FREEBSD, expr x$target AC_MSG_CHECKING([for ELF helper width]) case "${target_arch}" in (arm|hppa|ppc32|x86|sh) use_elf32=yes; AC_MSG_RESULT([32]);; -(ia64|ppc64|x86_64) use_elf64=yes; AC_MSG_RESULT([64]);; +(aarch64|ia64|ppc64|x86_64) use_elf64=yes; AC_MSG_RESULT([64]);; (mips) use_elfxx=yes; AC_MSG_RESULT([xx]);; *) AC_MSG_ERROR([Unknown ELF target: ${target_arch}]) esac @@ -196,6 +197,7 @@ AS_HELP_STRING([--enable-cxx-exceptions] # C++ exception handling doesn't work too well on x86 case $target_arch in x86*) enable_cxx_exceptions=no;; + aarch64*) enable_cxx_exceptions=no;; arm*) enable_cxx_exceptions=no;; mips*) enable_cxx_exceptions=no;; *) enable_cxx_exceptions=yes;; --- /dev/null +++ b/include/libunwind-aarch64.h @@ -0,0 +1,187 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2004 Hewlett-Packard Co + Contributed by David Mosberger-Tang + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include +#include +#include + +#define UNW_TARGET aarch64 +#define UNW_TARGET_AARCH64 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ + +#define UNW_TDEP_CURSOR_LEN 4096 + +typedef uint64_t unw_word_t; +typedef int64_t unw_sword_t; + +typedef long double unw_tdep_fpreg_t; + +typedef struct + { + /* no aarch64-specific auxiliary proc-info */ + } +unw_tdep_proc_info_t; + +typedef enum + { + /* 64-bit general registers. */ + UNW_AARCH64_X0, + UNW_AARCH64_X1, + UNW_AARCH64_X2, + UNW_AARCH64_X3, + UNW_AARCH64_X4, + UNW_AARCH64_X5, + UNW_AARCH64_X6, + UNW_AARCH64_X7, + UNW_AARCH64_X8, + + /* Temporary registers. */ + UNW_AARCH64_X9, + UNW_AARCH64_X10, + UNW_AARCH64_X11, + UNW_AARCH64_X12, + UNW_AARCH64_X13, + UNW_AARCH64_X14, + UNW_AARCH64_X15, + + /* Intra-procedure-call temporary registers. */ + UNW_AARCH64_X16, + UNW_AARCH64_X17, + + /* Callee-saved registers. */ + UNW_AARCH64_X18, + UNW_AARCH64_X19, + UNW_AARCH64_X20, + UNW_AARCH64_X21, + UNW_AARCH64_X22, + UNW_AARCH64_X23, + UNW_AARCH64_X24, + UNW_AARCH64_X25, + UNW_AARCH64_X26, + UNW_AARCH64_X27, + UNW_AARCH64_X28, + + /* 64-bit frame pointer. */ + UNW_AARCH64_X29, + + /* 64-bit link register. */ + UNW_AARCH64_X30, + + /* 64-bit stack pointer. */ + UNW_AARCH64_SP = 31, + UNW_AARCH64_PC, + UNW_AARCH64_PSTATE, + + /* 128-bit FP/Advanced SIMD registers. */ + UNW_AARCH64_V0 = 64, + UNW_AARCH64_V1, + UNW_AARCH64_V2, + UNW_AARCH64_V3, + UNW_AARCH64_V4, + UNW_AARCH64_V5, + UNW_AARCH64_V6, + UNW_AARCH64_V7, + UNW_AARCH64_V8, + UNW_AARCH64_V9, + UNW_AARCH64_V10, + UNW_AARCH64_V11, + UNW_AARCH64_V12, + UNW_AARCH64_V13, + UNW_AARCH64_V14, + UNW_AARCH64_V15, + UNW_AARCH64_V16, + UNW_AARCH64_V17, + UNW_AARCH64_V18, + UNW_AARCH64_V19, + UNW_AARCH64_V20, + UNW_AARCH64_V21, + UNW_AARCH64_V22, + UNW_AARCH64_V23, + UNW_AARCH64_V24, + UNW_AARCH64_V25, + UNW_AARCH64_V26, + UNW_AARCH64_V27, + UNW_AARCH64_V28, + UNW_AARCH64_V29, + UNW_AARCH64_V30, + UNW_AARCH64_V31, + + UNW_AARCH64_FPSR, + UNW_AARCH64_FPCR, + + /* For AArch64, the CFA is the value of SP (x31) at the call site of the + previous frame. */ + UNW_AARCH64_CFA = UNW_AARCH64_SP, + + UNW_TDEP_LAST_REG = UNW_AARCH64_FPCR, + + UNW_TDEP_IP = UNW_AARCH64_X30, + UNW_TDEP_SP = UNW_AARCH64_SP, + UNW_TDEP_EH = UNW_AARCH64_X0, + + } +aarch64_regnum_t; + +/* Use R0 through R3 to pass exception handling information. */ +#define UNW_TDEP_NUM_EH_REGS 4 + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + } +unw_tdep_save_loc_t; + + +/* On AArch64, we can directly use ucontext_t as the unwind context. */ +typedef ucontext_t unw_tdep_context_t; + +#include "libunwind-common.h" +#include "libunwind-dynamic.h" + +#define unw_tdep_getcontext(uc) (getcontext (uc), 0) +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) + +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ --- a/include/libunwind.h.in +++ b/include/libunwind.h.in @@ -3,7 +3,9 @@ #ifndef UNW_REMOTE_ONLY -#if defined __arm__ +#if defined __aarch64__ +#include "libunwind-aarch64.h" +#elif defined __arm__ # include "libunwind-arm.h" #elif defined __hppa__ # include "libunwind-hppa.h" --- /dev/null +++ b/include/tdep-aarch64/dwarf-config.h @@ -0,0 +1,52 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2012 Tommi Rantala + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef dwarf_config_h +#define dwarf_config_h + +/* This matches the value udes by GCC (see + gcc/config/aarch64/aarch64.h:DWARF_FRAME_REGISTERS. */ +#define DWARF_NUM_PRESERVED_REGS 97 + +/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ +#define dwarf_is_big_endian(addr_space) 0 + +#define dwarf_to_unw_regnum(reg) (((reg) <= UNW_AARCH64_V31) ? (reg) : 0) + +/* Convert a pointer to a dwarf_cursor structure to a pointer to + unw_cursor_t. */ +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) + +typedef struct dwarf_loc + { + unw_word_t val; +#ifndef UNW_LOCAL_ONLY + unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */ +#endif + } +dwarf_loc_t; + +#endif /* dwarf_config_h */ --- /dev/null +++ b/include/tdep-aarch64/jmpbuf.h @@ -0,0 +1,33 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +/* Use glibc's jump-buffer indices; NPTL peeks at SP: */ + +/* FIXME for AArch64 */ + +#define JB_SP 13 +#define JB_RP 14 +#define JB_MASK_SAVED 15 +#define JB_MASK 16 --- /dev/null +++ b/include/tdep-aarch64/libunwind_i.h @@ -0,0 +1,294 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2001-2005 Hewlett-Packard Co + Contributed by David Mosberger-Tang + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef AARCH64_LIBUNWIND_I_H +#define AARCH64_LIBUNWIND_I_H + +/* Target-dependent definitions that are internal to libunwind but need + to be shared with target-independent code. */ + +#include +#include + +#include "elf64.h" +#include "mempool.h" +#include "dwarf.h" + +typedef struct + { + /* no aarch64-specific fast trace */ + } +unw_tdep_frame_t; + +#ifdef UNW_LOCAL_ONLY + +typedef unw_word_t aarch64_loc_t; + +#else /* !UNW_LOCAL_ONLY */ + +typedef struct aarch64_loc + { + unw_word_t w0, w1; + } +aarch64_loc_t; + +#endif /* !UNW_LOCAL_ONLY */ + +struct unw_addr_space + { + struct unw_accessors acc; + int big_endian; + unw_caching_policy_t caching_policy; +#ifdef HAVE_ATOMIC_OPS_H + AO_t cache_generation; +#else + uint32_t cache_generation; +#endif + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + struct dwarf_rs_cache global_cache; + struct unw_debug_frame_list *debug_frames; + }; + +struct cursor + { + struct dwarf_cursor dwarf; /* must be first */ + enum + { + AARCH64_SCF_NONE, + AARCH64_SCF_LINUX_RT_SIGFRAME, + } + sigcontext_format; + unw_word_t sigcontext_addr; + unw_word_t sigcontext_sp; + unw_word_t sigcontext_pc; + }; + +#define DWARF_GET_LOC(l) ((l).val) + +#ifdef UNW_LOCAL_ONLY +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) + +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *val = *(unw_fpreg_t *) DWARF_GET_LOC (loc); + return 0; +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *(unw_fpreg_t *) DWARF_GET_LOC (loc) = val; + return 0; +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *val = *(unw_word_t *) DWARF_GET_LOC (loc); + return 0; +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *(unw_word_t *) DWARF_GET_LOC (loc) = val; + return 0; +} + +#else /* !UNW_LOCAL_ONLY */ +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) + +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + char *valp = (char *) &val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + val, 0, c->as_arg); + + addr = DWARF_GET_LOC (loc); + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, + 0, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0, + c->as_arg); +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + char *valp = (char *) &val; + unw_word_t addr; + int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + &val, 1, c->as_arg); + + addr = DWARF_GET_LOC (loc); + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, + 1, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, + 1, c->as_arg); +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); +} + +#endif /* !UNW_LOCAL_ONLY */ + + + +#define tdep_getcontext_trace unw_getcontext +#define tdep_init_done UNW_OBJ(init_done) +#define tdep_init UNW_OBJ(init) +/* Platforms that support UNW_INFO_FORMAT_TABLE need to define + tdep_search_unwind_table. */ +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c,rs) do {} while(0) +#define tdep_reuse_frame(c,rs) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) + +#ifdef UNW_LOCAL_ONLY +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) +#else +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +#endif + +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) +#define tdep_big_endian(as) ((as)->big_endian) + +extern int tdep_init_done; + +extern void tdep_init (void); +extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); +extern void *tdep_uc_addr (unw_tdep_context_t *uc, int reg); +extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); +extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, + unw_word_t *valp, int write); +extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, + unw_fpreg_t *valp, int write); + +#endif /* AARCH64_LIBUNWIND_I_H */ --- a/include/tdep/dwarf-config.h +++ b/include/tdep/dwarf-config.h @@ -1,7 +1,9 @@ /* Provide a real file - not a symlink - as it would cause multiarch conflicts when multiple different arch releases are installed simultaneously. */ -#if defined __arm__ +#if defined __aarch64__ +# include "tdep-aarch64/dwarf-config.h" +#elif defined __arm__ # include "tdep-arm/dwarf-config.h" #elif defined __hppa__ # include "tdep-hppa/dwarf-config.h" --- a/include/tdep/jmpbuf.h +++ b/include/tdep/jmpbuf.h @@ -3,6 +3,8 @@ #ifndef UNW_REMOTE_ONLY +#if defined __aarch64__ +# include "tdep-aarch64/jmpbuf.h" #if defined __arm__ # include "tdep-arm/jmpbuf.h" #elif defined __hppa__ --- a/include/tdep/libunwind_i.h.in +++ b/include/tdep/libunwind_i.h.in @@ -3,7 +3,9 @@ #ifndef UNW_REMOTE_ONLY -#if defined __arm__ +#if defined __aarch64__ +# include "tdep-aarch64/libunwind_i.h" +#elif defined __arm__ # include "tdep-arm/libunwind_i.h" #elif defined __hppa__ # include "tdep-hppa/libunwind_i.h" --- a/src/Makefile.am +++ b/src/Makefile.am @@ -170,6 +170,28 @@ libunwind_elfxx_la_SOURCES = elfxx.c noinst_LTLIBRARIES += $(LIBUNWIND_ELF) libunwind_la_LIBADD += $(LIBUNWIND_ELF) +# The list of files that go into libunwind and libunwind-aarch64: +noinst_HEADERS += aarch64/init.h aarch64/offsets.h aarch64/unwind_i.h +libunwind_la_SOURCES_aarch64_common = $(libunwind_la_SOURCES_common) \ + aarch64/is_fpreg.c aarch64/regname.c + +# The list of files that go into libunwind: +libunwind_la_SOURCES_aarch64 = $(libunwind_la_SOURCES_aarch64_common) \ + $(libunwind_la_SOURCES_local) \ + aarch64/Lcreate_addr_space.c aarch64/Lget_proc_info.c \ + aarch64/Lget_save_loc.c aarch64/Lglobal.c aarch64/Linit.c \ + aarch64/Linit_local.c aarch64/Linit_remote.c \ + aarch64/Lis_signal_frame.c aarch64/Lregs.c aarch64/Lresume.c \ + aarch64/Lstep.c + +libunwind_aarch64_la_SOURCES_aarch64 = $(libunwind_la_SOURCES_aarch64_common) \ + $(libunwind_la_SOURCES_generic) \ + aarch64/Gcreate_addr_space.c aarch64/Gget_proc_info.c \ + aarch64/Gget_save_loc.c aarch64/Gglobal.c aarch64/Ginit.c \ + aarch64/Ginit_local.c aarch64/Ginit_remote.c \ + aarch64/Gis_signal_frame.c aarch64/Gregs.c aarch64/Gresume.c \ + aarch64/Gstep.c + # The list of files that go into libunwind and libunwind-arm: noinst_HEADERS += arm/init.h arm/offsets.h arm/unwind_i.h libunwind_la_SOURCES_arm_common = $(libunwind_la_SOURCES_common) \ @@ -418,6 +440,18 @@ if OS_FREEBSD libunwind_coredump_la_SOURCES += coredump/_UCD_access_reg_freebsd.c endif +if ARCH_AARCH64 + lib_LTLIBRARIES += libunwind-aarch64.la + libunwind_la_SOURCES = $(libunwind_la_SOURCES_aarch64) + libunwind_aarch64_la_SOURCES = $(libunwind_aarch64_la_SOURCES_aarch64) + libunwind_aarch64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) + libunwind_aarch64_la_LIBADD = libunwind-dwarf-generic.la + libunwind_aarch64_la_LIBADD += libunwind-elf64.la +if !REMOTE_ONLY + libunwind_aarch64_la_LIBADD += libunwind.la -lc +endif + libunwind_setjmp_la_SOURCES += aarch64/siglongjmp.S +else if ARCH_ARM lib_LTLIBRARIES += libunwind-arm.la libunwind_la_SOURCES = $(libunwind_la_SOURCES_arm) @@ -545,6 +579,7 @@ endif # ARCH_MIPS endif # ARCH_HPPA endif # ARCH_IA64 endif # ARCH_ARM +endif # ARCH_AARCH64 # libunwind-setjmp depends on libunwind-$(arch). Therefore must be added # at the end. @@ -567,7 +602,8 @@ AM_CPPFLAGS = -I$(top_srcdir)/include -I AM_CCASFLAGS = $(AM_CPPFLAGS) noinst_HEADERS += unwind/unwind-internal.h -EXTRA_DIST = $(libunwind_la_SOURCES_arm) \ +EXTRA_DIST = $(libunwind_la_SOURCES_aarch64) \ + $(libunwind_la_SOURCES_arm) \ $(libunwind_la_SOURCES_hppa) \ $(libunwind_la_SOURCES_ia64) \ $(libunwind_la_SOURCES_mips) \ @@ -579,6 +615,7 @@ EXTRA_DIST = $(libunwind_la_SOURCES_arm) $(libunwind_la_SOURCES_common) \ $(libunwind_la_SOURCES_local) \ $(libunwind_la_SOURCES_generic) \ + $(libunwind_aarch64_la_SOURCES_aarch64) \ $(libunwind_arm_la_SOURCES_arm) \ $(libunwind_hppa_la_SOURCES_hppa) \ $(libunwind_ia64_la_SOURCES_ia64) \ --- /dev/null +++ b/src/aarch64/Gcreate_addr_space.c @@ -0,0 +1,60 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2012 Tommi Rantala + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include + +#include "unwind_i.h" + +PROTECTED unw_addr_space_t +unw_create_addr_space (unw_accessors_t *a, int byte_order) +{ +#ifdef UNW_LOCAL_ONLY + return NULL; +#else + unw_addr_space_t as; + + /* AArch64 supports little-endian and big-endian. */ + if (byte_order != 0 && byte_order != __LITTLE_ENDIAN + && byte_order != __BIG_ENDIAN) + return NULL; + + as = malloc (sizeof (*as)); + if (!as) + return NULL; + + memset (as, 0, sizeof (*as)); + + as->acc = *a; + + /* Default to little-endian for AArch64. */ + if (byte_order == 0 || byte_order == __LITTLE_ENDIAN) + as->big_endian = 0; + else + as->big_endian = 1; + + return as; +#endif +} --- /dev/null +++ b/src/aarch64/Gget_proc_info.c @@ -0,0 +1,39 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + ret = dwarf_make_proc_info (&c->dwarf); + if (ret < 0) + return ret; + + *pi = c->dwarf.pi; + return 0; +} --- /dev/null +++ b/src/aarch64/Gget_save_loc.c @@ -0,0 +1,100 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2012 Tommi Rantala + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +PROTECTED int +unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) +{ + struct cursor *c = (struct cursor *) cursor; + dwarf_loc_t loc; + + switch (reg) + { + case UNW_AARCH64_X0: + case UNW_AARCH64_X1: + case UNW_AARCH64_X2: + case UNW_AARCH64_X3: + case UNW_AARCH64_X4: + case UNW_AARCH64_X5: + case UNW_AARCH64_X6: + case UNW_AARCH64_X7: + case UNW_AARCH64_X8: + case UNW_AARCH64_X9: + case UNW_AARCH64_X10: + case UNW_AARCH64_X11: + case UNW_AARCH64_X12: + case UNW_AARCH64_X13: + case UNW_AARCH64_X14: + case UNW_AARCH64_X15: + case UNW_AARCH64_X16: + case UNW_AARCH64_X17: + case UNW_AARCH64_X18: + case UNW_AARCH64_X19: + case UNW_AARCH64_X20: + case UNW_AARCH64_X21: + case UNW_AARCH64_X22: + case UNW_AARCH64_X23: + case UNW_AARCH64_X24: + case UNW_AARCH64_X25: + case UNW_AARCH64_X26: + case UNW_AARCH64_X27: + case UNW_AARCH64_X28: + case UNW_AARCH64_X29: + case UNW_AARCH64_X30: + case UNW_AARCH64_SP: + case UNW_AARCH64_PC: + case UNW_AARCH64_PSTATE: + loc = c->dwarf.loc[reg]; + break; + + default: + loc = DWARF_NULL_LOC; /* default to "not saved" */ + break; + } + + memset (sloc, 0, sizeof (*sloc)); + + if (DWARF_IS_NULL_LOC (loc)) + { + sloc->type = UNW_SLT_NONE; + return 0; + } + +#if !defined(UNW_LOCAL_ONLY) + if (DWARF_IS_REG_LOC (loc)) + { + sloc->type = UNW_SLT_REG; + sloc->u.regnum = DWARF_GET_LOC (loc); + } + else +#endif + { + sloc->type = UNW_SLT_MEMORY; + sloc->u.addr = DWARF_GET_LOC (loc); + } + return 0; +} --- /dev/null +++ b/src/aarch64/Gglobal.c @@ -0,0 +1,57 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2012 Tommi Rantala + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "dwarf_i.h" + +HIDDEN define_lock (aarch64_lock); +HIDDEN int tdep_init_done; + +HIDDEN void +tdep_init (void) +{ + intrmask_t saved_mask; + + sigfillset (&unwi_full_mask); + + lock_acquire (&aarch64_lock, saved_mask); + { + if (tdep_init_done) + /* another thread else beat us to it... */ + goto out; + + mi_init (); + + dwarf_init (); + +#ifndef UNW_REMOTE_ONLY + aarch64_local_addr_space_init (); +#endif + tdep_init_done = 1; /* signal that we're initialized... */ + } + out: + lock_release (&aarch64_lock, saved_mask); +} --- /dev/null +++ b/src/aarch64/Ginit.c @@ -0,0 +1,187 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2012 Tommi Rantala + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include +#include + +#include "unwind_i.h" + +#ifdef UNW_REMOTE_ONLY + +/* unw_local_addr_space is a NULL pointer in this case. */ +PROTECTED unw_addr_space_t unw_local_addr_space; + +#else /* !UNW_REMOTE_ONLY */ + +static struct unw_addr_space local_addr_space; + +PROTECTED unw_addr_space_t unw_local_addr_space = &local_addr_space; + +static inline void * +uc_addr (ucontext_t *uc, int reg) +{ + if (reg >= UNW_AARCH64_X0 && reg <= UNW_AARCH64_V31) + return &uc->uc_mcontext.regs[reg]; + else + return NULL; +} + +# ifdef UNW_LOCAL_ONLY + +HIDDEN void * +tdep_uc_addr (ucontext_t *uc, int reg) +{ + return uc_addr (uc, reg); +} + +# endif /* UNW_LOCAL_ONLY */ + +HIDDEN unw_dyn_info_list_t _U_dyn_info_list; + +/* XXX fix me: there is currently no way to locate the dyn-info list + by a remote unwinder. On ia64, this is done via a special + unwind-table entry. Perhaps something similar can be done with + DWARF2 unwind info. */ + +static void +put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) +{ + /* it's a no-op */ +} + +static int +get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, + void *arg) +{ + *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list; + return 0; +} + +static int +access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, + void *arg) +{ + if (write) + { + Debug (16, "mem[%x] <- %x\n", addr, *val); + *(unw_word_t *) addr = *val; + } + else + { + *val = *(unw_word_t *) addr; + Debug (16, "mem[%x] -> %x\n", addr, *val); + } + return 0; +} + +static int +access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, + void *arg) +{ + unw_word_t *addr; + ucontext_t *uc = arg; + + if (unw_is_fpreg (reg)) + goto badreg; + + if (!(addr = uc_addr (uc, reg))) + goto badreg; + + if (write) + { + *(unw_word_t *) addr = *val; + Debug (12, "%s <- %x\n", unw_regname (reg), *val); + } + else + { + *val = *(unw_word_t *) addr; + Debug (12, "%s -> %x\n", unw_regname (reg), *val); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} + +static int +access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + ucontext_t *uc = arg; + unw_fpreg_t *addr; + + if (!unw_is_fpreg (reg)) + goto badreg; + + if (!(addr = uc_addr (uc, reg))) + goto badreg; + + if (write) + { + Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + *(unw_fpreg_t *) addr = *val; + } + else + { + *val = *(unw_fpreg_t *) addr; + Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + /* attempt to access a non-preserved register */ + return -UNW_EBADREG; +} + +static int +get_static_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) +{ + return _Uelf64_get_proc_name (as, getpid (), ip, buf, buf_len, offp); +} + +HIDDEN void +aarch64_local_addr_space_init (void) +{ + memset (&local_addr_space, 0, sizeof (local_addr_space)); + local_addr_space.caching_policy = UNW_CACHE_GLOBAL; + local_addr_space.acc.find_proc_info = dwarf_find_proc_info; + local_addr_space.acc.put_unwind_info = put_unwind_info; + local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr; + local_addr_space.acc.access_mem = access_mem; + local_addr_space.acc.access_reg = access_reg; + local_addr_space.acc.access_fpreg = access_fpreg; + local_addr_space.acc.resume = aarch64_local_resume; + local_addr_space.acc.get_proc_name = get_static_proc_name; + unw_flush_cache (&local_addr_space, 0, 0); +} + +#endif /* !UNW_REMOTE_ONLY */ --- /dev/null +++ b/src/aarch64/Ginit_local.c @@ -0,0 +1,55 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2011-2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "init.h" + +#ifdef UNW_REMOTE_ONLY + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, unw_context_t *uc) +{ + return -UNW_EINVAL; +} + +#else /* !UNW_REMOTE_ONLY */ + +PROTECTED int +unw_init_local (unw_cursor_t *cursor, unw_context_t *uc) +{ + struct cursor *c = (struct cursor *) cursor; + + if (!tdep_init_done) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = unw_local_addr_space; + c->dwarf.as_arg = uc; + + return common_init (c, 1); +} + +#endif /* !UNW_REMOTE_ONLY */ --- /dev/null +++ b/src/aarch64/Ginit_remote.c @@ -0,0 +1,45 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "init.h" +#include "unwind_i.h" + +PROTECTED int +unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) +{ +#ifdef UNW_LOCAL_ONLY + return -UNW_EINVAL; +#else /* !UNW_LOCAL_ONLY */ + struct cursor *c = (struct cursor *) cursor; + + if (!tdep_init_done) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = as; + c->dwarf.as_arg = as_arg; + return common_init (c, 0); +#endif /* !UNW_LOCAL_ONLY */ +} --- /dev/null +++ b/src/aarch64/Gis_signal_frame.c @@ -0,0 +1,64 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2012 Tommi Rantala + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +/* The restorer stub will always have the form: + + d2801168 movz x8, #0x8b + d4000001 svc #0x0 +*/ + +PROTECTED int +unw_is_signal_frame (unw_cursor_t *cursor) +{ +#ifdef __linux__ + struct cursor *c = (struct cursor *) cursor; + unw_word_t w0, ip; + unw_addr_space_t as; + unw_accessors_t *a; + void *arg; + int ret; + + as = c->dwarf.as; + a = unw_get_accessors (as); + arg = c->dwarf.as_arg; + + ip = c->dwarf.ip; + + ret = (*a->access_mem) (as, ip, &w0, 0, arg); + if (ret < 0) + return ret; + + /* FIXME: distinguish 32bit insn vs 64bit registers. */ + if (w0 != 0xd4000001d2801168) + return 0; + + return 1; + +#else + return -UNW_ENOINFO; +#endif +} --- /dev/null +++ b/src/aarch64/Gregs.c @@ -0,0 +1,113 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2012 Tommi Rantala + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +HIDDEN int +tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, + int write) +{ + dwarf_loc_t loc = DWARF_NULL_LOC; + unsigned int mask; + + switch (reg) + { + case UNW_AARCH64_X0: + case UNW_AARCH64_X1: + case UNW_AARCH64_X2: + case UNW_AARCH64_X3: + mask = 1 << reg; + if (write) + { + c->dwarf.eh_args[reg] = *valp; + c->dwarf.eh_valid_mask |= mask; + return 0; + } + else if ((c->dwarf.eh_valid_mask & mask) != 0) + { + *valp = c->dwarf.eh_args[reg]; + return 0; + } + else + loc = c->dwarf.loc[reg]; + break; + + case UNW_AARCH64_X4: + case UNW_AARCH64_X5: + case UNW_AARCH64_X6: + case UNW_AARCH64_X7: + case UNW_AARCH64_X8: + case UNW_AARCH64_X9: + case UNW_AARCH64_X10: + case UNW_AARCH64_X11: + case UNW_AARCH64_X12: + case UNW_AARCH64_X13: + case UNW_AARCH64_X14: + case UNW_AARCH64_X15: + case UNW_AARCH64_X16: + case UNW_AARCH64_X17: + case UNW_AARCH64_X18: + case UNW_AARCH64_X19: + case UNW_AARCH64_X20: + case UNW_AARCH64_X21: + case UNW_AARCH64_X22: + case UNW_AARCH64_X23: + case UNW_AARCH64_X24: + case UNW_AARCH64_X25: + case UNW_AARCH64_X26: + case UNW_AARCH64_X27: + case UNW_AARCH64_X28: + case UNW_AARCH64_X29: + case UNW_AARCH64_X30: + case UNW_AARCH64_PC: + case UNW_AARCH64_PSTATE: + loc = c->dwarf.loc[reg]; + break; + + case UNW_AARCH64_SP: + if (write) + return -UNW_EREADONLYREG; + *valp = c->dwarf.cfa; + return 0; + + default: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; + } + + if (write) + return dwarf_put (&c->dwarf, loc, *valp); + else + return dwarf_get (&c->dwarf, loc, valp); +} + +HIDDEN int +tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, + int write) +{ + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} --- /dev/null +++ b/src/aarch64/Gresume.c @@ -0,0 +1,177 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2011-2013 Linaro Limited + Copyright (C) 2012 Tommi Rantala + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "offsets.h" + +#ifndef UNW_REMOTE_ONLY + +HIDDEN inline int +aarch64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) +{ +#ifdef __linux__ + struct cursor *c = (struct cursor *) cursor; + unw_tdep_context_t *uc = c->dwarf.as_arg; + + if (c->sigcontext_format == AARCH64_SCF_NONE) + { + /* Since there are no signals involved here we restore the non scratch + registers only. */ + unsigned long regs[11]; + regs[0] = uc->uc_mcontext.regs[19]; + regs[1] = uc->uc_mcontext.regs[20]; + regs[2] = uc->uc_mcontext.regs[21]; + regs[3] = uc->uc_mcontext.regs[22]; + regs[4] = uc->uc_mcontext.regs[23]; + regs[5] = uc->uc_mcontext.regs[24]; + regs[6] = uc->uc_mcontext.regs[25]; + regs[7] = uc->uc_mcontext.regs[26]; + regs[8] = uc->uc_mcontext.regs[27]; + regs[9] = uc->uc_mcontext.regs[28]; + regs[10] = uc->uc_mcontext.regs[30]; /* LR */ + unsigned long sp = uc->uc_mcontext.sp; + + struct regs_overlay { + char x[sizeof(regs)]; + }; + + asm volatile ( + "ldp x19, x20, [%0]\n" + "ldp x21, x22, [%0,16]\n" + "ldp x23, x24, [%0,32]\n" + "ldp x25, x26, [%0,48]\n" + "ldp x27, x28, [%0,64]\n" + "ldr x30, [%0,80]\n" + "mov sp, %1\n" + "ret \n" + : + : "r" (regs), + "r" (sp), + "m" (*(struct regs_overlay *)regs) + ); + } + else + { + struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; + + if (c->dwarf.eh_valid_mask & 0x1) sc->regs[0] = c->dwarf.eh_args[0]; + if (c->dwarf.eh_valid_mask & 0x2) sc->regs[1] = c->dwarf.eh_args[1]; + if (c->dwarf.eh_valid_mask & 0x4) sc->regs[2] = c->dwarf.eh_args[2]; + if (c->dwarf.eh_valid_mask & 0x8) sc->regs[3] = c->dwarf.eh_args[3]; + + sc->regs[4] = uc->uc_mcontext.regs[4]; + sc->regs[5] = uc->uc_mcontext.regs[5]; + sc->regs[6] = uc->uc_mcontext.regs[6]; + sc->regs[7] = uc->uc_mcontext.regs[7]; + sc->regs[8] = uc->uc_mcontext.regs[8]; + sc->regs[9] = uc->uc_mcontext.regs[9]; + sc->regs[10] = uc->uc_mcontext.regs[10]; + sc->regs[11] = uc->uc_mcontext.regs[11]; + sc->regs[12] = uc->uc_mcontext.regs[12]; + sc->regs[13] = uc->uc_mcontext.regs[13]; + sc->regs[14] = uc->uc_mcontext.regs[14]; + sc->regs[15] = uc->uc_mcontext.regs[15]; + sc->regs[16] = uc->uc_mcontext.regs[16]; + sc->regs[17] = uc->uc_mcontext.regs[17]; + sc->regs[18] = uc->uc_mcontext.regs[18]; + sc->regs[19] = uc->uc_mcontext.regs[19]; + sc->regs[20] = uc->uc_mcontext.regs[20]; + sc->regs[21] = uc->uc_mcontext.regs[21]; + sc->regs[22] = uc->uc_mcontext.regs[22]; + sc->regs[23] = uc->uc_mcontext.regs[23]; + sc->regs[24] = uc->uc_mcontext.regs[24]; + sc->regs[25] = uc->uc_mcontext.regs[25]; + sc->regs[26] = uc->uc_mcontext.regs[26]; + sc->regs[27] = uc->uc_mcontext.regs[27]; + sc->regs[28] = uc->uc_mcontext.regs[28]; + sc->regs[29] = uc->uc_mcontext.regs[29]; + sc->regs[30] = uc->uc_mcontext.regs[30]; + sc->sp = uc->uc_mcontext.sp; + sc->pc = uc->uc_mcontext.pc; + sc->pstate = uc->uc_mcontext.pstate; + + asm volatile ( + "mov sp, %0\n" + "ret %1\n" + : : "r" (c->sigcontext_sp), "r" (c->sigcontext_pc) + ); + } + __builtin_unreachable(); +#else + printf ("%s: implement me\n", __FUNCTION__); +#endif + return -UNW_EINVAL; +} + +#endif /* !UNW_REMOTE_ONLY */ + +static inline void +establish_machine_state (struct cursor *c) +{ + unw_addr_space_t as = c->dwarf.as; + void *arg = c->dwarf.as_arg; + unw_fpreg_t fpval; + unw_word_t val; + int reg; + + Debug (8, "copying out cursor state\n"); + + for (reg = 0; reg <= UNW_AARCH64_PSTATE; ++reg) + { + Debug (16, "copying %s %d\n", unw_regname (reg), reg); + if (unw_is_fpreg (reg)) + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + as->acc.access_fpreg (as, reg, &fpval, 1, arg); + } + else + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + as->acc.access_reg (as, reg, &val, 1, arg); + } + } +} + +PROTECTED int +unw_resume (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + + Debug (1, "(cursor=%p)\n", c); + + if (!c->dwarf.ip) + { + /* This can happen easily when the frame-chain gets truncated + due to bad or missing unwind-info. */ + Debug (1, "refusing to resume execution at address 0\n"); + return -UNW_EINVAL; + } + + establish_machine_state (c); + + return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, + c->dwarf.as_arg); +} --- /dev/null +++ b/src/aarch64/Gstep.c @@ -0,0 +1,129 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2011-2013 Linaro Limited + Copyright (C) 2012 Tommi Rantala + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" +#include "offsets.h" + +PROTECTED int +unw_handle_signal_frame (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + unw_word_t sc_addr, sp, sp_addr = c->dwarf.cfa; + struct dwarf_loc sp_loc = DWARF_LOC (sp_addr, 0); + + if ((ret = dwarf_get (&c->dwarf, sp_loc, &sp)) < 0) + return -UNW_EUNSPEC; + + ret = unw_is_signal_frame (cursor); + Debug(1, "unw_is_signal_frame()=%d\n", ret); + + /* Save the SP and PC to be able to return execution at this point + later in time (unw_resume). */ + c->sigcontext_sp = c->dwarf.cfa; + c->sigcontext_pc = c->dwarf.ip; + + if (ret) + { + c->sigcontext_format = AARCH64_SCF_LINUX_RT_SIGFRAME; + sc_addr = sp_addr + sizeof (siginfo_t) + LINUX_UC_MCONTEXT_OFF; + } + else + return -UNW_EUNSPEC; + + c->sigcontext_addr = sc_addr; + + /* Update the dwarf cursor. + Set the location of the registers to the corresponding addresses of the + uc_mcontext / sigcontext structure contents. */ + c->dwarf.loc[UNW_AARCH64_X0] = DWARF_LOC (sc_addr + LINUX_SC_X0_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X1] = DWARF_LOC (sc_addr + LINUX_SC_X1_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X2] = DWARF_LOC (sc_addr + LINUX_SC_X2_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X3] = DWARF_LOC (sc_addr + LINUX_SC_X3_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X4] = DWARF_LOC (sc_addr + LINUX_SC_X4_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X5] = DWARF_LOC (sc_addr + LINUX_SC_X5_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X6] = DWARF_LOC (sc_addr + LINUX_SC_X6_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X7] = DWARF_LOC (sc_addr + LINUX_SC_X7_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X8] = DWARF_LOC (sc_addr + LINUX_SC_X8_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X9] = DWARF_LOC (sc_addr + LINUX_SC_X9_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X10] = DWARF_LOC (sc_addr + LINUX_SC_X10_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X11] = DWARF_LOC (sc_addr + LINUX_SC_X11_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X12] = DWARF_LOC (sc_addr + LINUX_SC_X12_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X13] = DWARF_LOC (sc_addr + LINUX_SC_X13_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X14] = DWARF_LOC (sc_addr + LINUX_SC_X14_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X15] = DWARF_LOC (sc_addr + LINUX_SC_X15_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X16] = DWARF_LOC (sc_addr + LINUX_SC_X16_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X17] = DWARF_LOC (sc_addr + LINUX_SC_X17_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X18] = DWARF_LOC (sc_addr + LINUX_SC_X18_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X19] = DWARF_LOC (sc_addr + LINUX_SC_X19_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X20] = DWARF_LOC (sc_addr + LINUX_SC_X20_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X21] = DWARF_LOC (sc_addr + LINUX_SC_X21_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X22] = DWARF_LOC (sc_addr + LINUX_SC_X22_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X23] = DWARF_LOC (sc_addr + LINUX_SC_X23_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X24] = DWARF_LOC (sc_addr + LINUX_SC_X24_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X25] = DWARF_LOC (sc_addr + LINUX_SC_X25_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X26] = DWARF_LOC (sc_addr + LINUX_SC_X26_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X27] = DWARF_LOC (sc_addr + LINUX_SC_X27_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X28] = DWARF_LOC (sc_addr + LINUX_SC_X28_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X29] = DWARF_LOC (sc_addr + LINUX_SC_X29_OFF, 0); + c->dwarf.loc[UNW_AARCH64_X30] = DWARF_LOC (sc_addr + LINUX_SC_X30_OFF, 0); + c->dwarf.loc[UNW_AARCH64_SP] = DWARF_LOC (sc_addr + LINUX_SC_SP_OFF, 0); + c->dwarf.loc[UNW_AARCH64_PC] = DWARF_LOC (sc_addr + LINUX_SC_PC_OFF, 0); + c->dwarf.loc[UNW_AARCH64_PSTATE] = DWARF_LOC (sc_addr + LINUX_SC_PSTATE_OFF, 0); + + /* Set SP/CFA and PC/IP. */ + dwarf_get (&c->dwarf, c->dwarf.loc[UNW_AARCH64_SP], &c->dwarf.cfa); + dwarf_get (&c->dwarf, c->dwarf.loc[UNW_AARCH64_PC], &c->dwarf.ip); + + c->dwarf.pi_valid = 0; + + return 1; +} + +PROTECTED int +unw_step (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + Debug (1, "(cursor=%p, ip=0x%016lx, cfa=0x%016lx))\n", + c, c->dwarf.ip, c->dwarf.cfa); + + /* Check if this is a signal frame. */ + if (unw_is_signal_frame (cursor)) + return unw_handle_signal_frame (cursor); + + ret = dwarf_step (&c->dwarf); + Debug(1, "dwarf_step()=%d\n", ret); + + if (unlikely (ret == -UNW_ESTOPUNWIND)) + return ret; + + if (unlikely (ret < 0)) + return 0; + + return (c->dwarf.ip == 0) ? 0 : 1; +} --- /dev/null +++ b/src/aarch64/Lcreate_addr_space.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gcreate_addr_space.c" +#endif --- /dev/null +++ b/src/aarch64/Lget_proc_info.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_proc_info.c" +#endif --- /dev/null +++ b/src/aarch64/Lget_save_loc.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_save_loc.c" +#endif --- /dev/null +++ b/src/aarch64/Lglobal.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gglobal.c" +#endif --- /dev/null +++ b/src/aarch64/Linit.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit.c" +#endif --- /dev/null +++ b/src/aarch64/Linit_local.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_local.c" +#endif --- /dev/null +++ b/src/aarch64/Linit_remote.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_remote.c" +#endif --- /dev/null +++ b/src/aarch64/Lis_signal_frame.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gis_signal_frame.c" +#endif --- /dev/null +++ b/src/aarch64/Lregs.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gregs.c" +#endif --- /dev/null +++ b/src/aarch64/Lresume.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gresume.c" +#endif --- /dev/null +++ b/src/aarch64/Lstep.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gstep.c" +#endif --- /dev/null +++ b/src/aarch64/gen-offsets.c @@ -0,0 +1,68 @@ +#include +#include +#include +#include + +#define UC(N,X) \ + printf ("#define LINUX_UC_" N "_OFF\t0x%X\n", offsetof (ucontext_t, X)) + +#define SC(N,X) \ + printf ("#define LINUX_SC_" N "_OFF\t0x%X\n", offsetof (struct sigcontext, X)) + +int +main (void) +{ + printf ( +"/* Linux-specific definitions: */\n\n" + +"/* Define various structure offsets to simplify cross-compilation. */\n\n" + +"/* Offsets for AArch64 Linux \"ucontext_t\": */\n\n"); + + UC ("FLAGS", uc_flags); + UC ("LINK", uc_link); + UC ("STACK", uc_stack); + UC ("MCONTEXT", uc_mcontext); + UC ("SIGMASK", uc_sigmask); + + printf ("\n/* Offsets for AArch64 Linux \"struct sigcontext\": */\n\n"); + + SC ("R0", regs[0]); + SC ("R1", regs[1]); + SC ("R2", regs[2]); + SC ("R3", regs[3]); + SC ("R4", regs[4]); + SC ("R5", regs[5]); + SC ("R6", regs[6]); + SC ("R7", regs[7]); + SC ("R8", regs[8]); + SC ("R9", regs[9]); + SC ("R10", regs[10]); + SC ("R11", regs[11]); + SC ("R12", regs[12]); + SC ("R13", regs[13]); + SC ("R14", regs[14]); + SC ("R15", regs[15]); + SC ("R16", regs[16]); + SC ("R17", regs[17]); + SC ("R18", regs[18]); + SC ("R19", regs[19]); + SC ("R20", regs[20]); + SC ("R21", regs[21]); + SC ("R22", regs[22]); + SC ("R23", regs[23]); + SC ("R24", regs[24]); + SC ("R25", regs[25]); + SC ("R26", regs[26]); + SC ("R27", regs[27]); + SC ("R28", regs[28]); + SC ("R29", regs[29]); + SC ("R30", regs[30]); + SC ("R31", regs[31]); + + SC ("PC", pc); + SC ("SP", sp); + SC ("Fault", fault_address); + SC ("state", pstate); + return 0; +} --- /dev/null +++ b/src/aarch64/init.h @@ -0,0 +1,127 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2012 Tommi Rantala + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static inline int +common_init (struct cursor *c, unsigned use_prev_instr) +{ + int ret, i; + + c->dwarf.loc[UNW_AARCH64_X0] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X0); + c->dwarf.loc[UNW_AARCH64_X1] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X1); + c->dwarf.loc[UNW_AARCH64_X2] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X2); + c->dwarf.loc[UNW_AARCH64_X3] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X3); + c->dwarf.loc[UNW_AARCH64_X4] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X4); + c->dwarf.loc[UNW_AARCH64_X5] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X5); + c->dwarf.loc[UNW_AARCH64_X6] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X6); + c->dwarf.loc[UNW_AARCH64_X7] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X7); + c->dwarf.loc[UNW_AARCH64_X8] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X8); + c->dwarf.loc[UNW_AARCH64_X9] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X9); + c->dwarf.loc[UNW_AARCH64_X10] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X10); + c->dwarf.loc[UNW_AARCH64_X11] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X11); + c->dwarf.loc[UNW_AARCH64_X12] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X12); + c->dwarf.loc[UNW_AARCH64_X13] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X13); + c->dwarf.loc[UNW_AARCH64_X14] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X14); + c->dwarf.loc[UNW_AARCH64_X15] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X15); + c->dwarf.loc[UNW_AARCH64_X16] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X16); + c->dwarf.loc[UNW_AARCH64_X17] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X17); + c->dwarf.loc[UNW_AARCH64_X18] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X18); + c->dwarf.loc[UNW_AARCH64_X19] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X19); + c->dwarf.loc[UNW_AARCH64_X20] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X20); + c->dwarf.loc[UNW_AARCH64_X21] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X21); + c->dwarf.loc[UNW_AARCH64_X22] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X22); + c->dwarf.loc[UNW_AARCH64_X23] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X23); + c->dwarf.loc[UNW_AARCH64_X24] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X24); + c->dwarf.loc[UNW_AARCH64_X25] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X25); + c->dwarf.loc[UNW_AARCH64_X26] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X26); + c->dwarf.loc[UNW_AARCH64_X27] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X27); + c->dwarf.loc[UNW_AARCH64_X28] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X28); + c->dwarf.loc[UNW_AARCH64_X29] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X29); + c->dwarf.loc[UNW_AARCH64_X30] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_X30); + c->dwarf.loc[UNW_AARCH64_SP] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_SP); + c->dwarf.loc[UNW_AARCH64_PC] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_PC); + c->dwarf.loc[UNW_AARCH64_PSTATE] = DWARF_REG_LOC (&c->dwarf, + UNW_AARCH64_PSTATE); + c->dwarf.loc[UNW_AARCH64_V0] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V0); + c->dwarf.loc[UNW_AARCH64_V1] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V1); + c->dwarf.loc[UNW_AARCH64_V2] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V2); + c->dwarf.loc[UNW_AARCH64_V3] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V3); + c->dwarf.loc[UNW_AARCH64_V4] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V4); + c->dwarf.loc[UNW_AARCH64_V5] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V5); + c->dwarf.loc[UNW_AARCH64_V6] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V6); + c->dwarf.loc[UNW_AARCH64_V7] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V7); + c->dwarf.loc[UNW_AARCH64_V8] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V8); + c->dwarf.loc[UNW_AARCH64_V9] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V9); + c->dwarf.loc[UNW_AARCH64_V10] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V10); + c->dwarf.loc[UNW_AARCH64_V11] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V11); + c->dwarf.loc[UNW_AARCH64_V12] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V12); + c->dwarf.loc[UNW_AARCH64_V13] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V13); + c->dwarf.loc[UNW_AARCH64_V14] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V14); + c->dwarf.loc[UNW_AARCH64_V15] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V15); + c->dwarf.loc[UNW_AARCH64_V16] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V16); + c->dwarf.loc[UNW_AARCH64_V17] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V17); + c->dwarf.loc[UNW_AARCH64_V18] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V18); + c->dwarf.loc[UNW_AARCH64_V19] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V19); + c->dwarf.loc[UNW_AARCH64_V20] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V20); + c->dwarf.loc[UNW_AARCH64_V21] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V21); + c->dwarf.loc[UNW_AARCH64_V22] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V22); + c->dwarf.loc[UNW_AARCH64_V23] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V23); + c->dwarf.loc[UNW_AARCH64_V24] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V24); + c->dwarf.loc[UNW_AARCH64_V25] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V25); + c->dwarf.loc[UNW_AARCH64_V26] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V26); + c->dwarf.loc[UNW_AARCH64_V27] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V27); + c->dwarf.loc[UNW_AARCH64_V28] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V28); + c->dwarf.loc[UNW_AARCH64_V29] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V29); + c->dwarf.loc[UNW_AARCH64_V30] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V30); + c->dwarf.loc[UNW_AARCH64_V31] = DWARF_REG_LOC (&c->dwarf, UNW_AARCH64_V31); + + for (i = UNW_AARCH64_PSTATE + 1; i < UNW_AARCH64_V0; ++i) + c->dwarf.loc[i] = DWARF_NULL_LOC; + + ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_AARCH64_PC], &c->dwarf.ip); + if (ret < 0) + return ret; + + ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_AARCH64_SP], &c->dwarf.cfa); + if (ret < 0) + return ret; + + c->sigcontext_format = AARCH64_SCF_NONE; + c->sigcontext_addr = 0; + c->sigcontext_sp = 0; + c->sigcontext_pc = 0; + + c->dwarf.args_size = 0; + c->dwarf.ret_addr_column = 0; + c->dwarf.stash_frames = 0; + c->dwarf.use_prev_instr = use_prev_instr; + c->dwarf.pi_valid = 0; + c->dwarf.pi_is_dynamic = 0; + c->dwarf.hint = 0; + c->dwarf.prev_rs = 0; + + return 0; +} --- /dev/null +++ b/src/aarch64/is_fpreg.c @@ -0,0 +1,32 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "libunwind_i.h" + +PROTECTED int +unw_is_fpreg (int regnum) +{ + return (regnum >= UNW_AARCH64_V0 && regnum <= UNW_AARCH64_V31); +} --- /dev/null +++ b/src/aarch64/offsets.h @@ -0,0 +1,49 @@ +/* Linux-specific definitions: */ + +/* Define various structure offsets to simplify cross-compilation. */ + +/* Offsets for AArch64 Linux "ucontext_t": */ + +#define LINUX_UC_FLAGS_OFF 0x0 +#define LINUX_UC_LINK_OFF 0x8 +#define LINUX_UC_STACK_OFF 0x10 +#define LINUX_UC_SIGMASK_OFF 0x28 +#define LINUX_UC_MCONTEXT_OFF 0xb0 + +/* Offsets for AArch64 Linux "struct sigcontext": */ + +#define LINUX_SC_FAULTADDRESS_OFF 0x00 +#define LINUX_SC_X0_OFF 0x008 +#define LINUX_SC_X1_OFF 0x010 +#define LINUX_SC_X2_OFF 0x018 +#define LINUX_SC_X3_OFF 0x020 +#define LINUX_SC_X4_OFF 0x028 +#define LINUX_SC_X5_OFF 0x030 +#define LINUX_SC_X6_OFF 0x038 +#define LINUX_SC_X7_OFF 0x040 +#define LINUX_SC_X8_OFF 0x048 +#define LINUX_SC_X9_OFF 0x050 +#define LINUX_SC_X10_OFF 0x058 +#define LINUX_SC_X11_OFF 0x060 +#define LINUX_SC_X12_OFF 0x068 +#define LINUX_SC_X13_OFF 0x070 +#define LINUX_SC_X14_OFF 0x078 +#define LINUX_SC_X15_OFF 0x080 +#define LINUX_SC_X16_OFF 0x088 +#define LINUX_SC_X17_OFF 0x090 +#define LINUX_SC_X18_OFF 0x098 +#define LINUX_SC_X19_OFF 0x0a0 +#define LINUX_SC_X20_OFF 0x0a8 +#define LINUX_SC_X21_OFF 0x0b0 +#define LINUX_SC_X22_OFF 0x0b8 +#define LINUX_SC_X23_OFF 0x0c0 +#define LINUX_SC_X24_OFF 0x0c8 +#define LINUX_SC_X25_OFF 0x0d0 +#define LINUX_SC_X26_OFF 0x0d8 +#define LINUX_SC_X27_OFF 0x0e0 +#define LINUX_SC_X28_OFF 0x0e8 +#define LINUX_SC_X29_OFF 0x0f0 +#define LINUX_SC_X30_OFF 0x0f8 +#define LINUX_SC_SP_OFF 0x100 +#define LINUX_SC_PC_OFF 0x108 +#define LINUX_SC_PSTATE_OFF 0x110 --- /dev/null +++ b/src/aarch64/regname.c @@ -0,0 +1,106 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2012 Tommi Rantala + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include "unwind_i.h" + +static const char *const regname[] = + { + [UNW_AARCH64_X0] = "x0", + [UNW_AARCH64_X1] = "x1", + [UNW_AARCH64_X2] = "x2", + [UNW_AARCH64_X3] = "x3", + [UNW_AARCH64_X4] = "x4", + [UNW_AARCH64_X5] = "x5", + [UNW_AARCH64_X6] = "x6", + [UNW_AARCH64_X7] = "x7", + [UNW_AARCH64_X8] = "x8", + [UNW_AARCH64_X9] = "x9", + [UNW_AARCH64_X10] = "x10", + [UNW_AARCH64_X11] = "x11", + [UNW_AARCH64_X12] = "x12", + [UNW_AARCH64_X13] = "x13", + [UNW_AARCH64_X14] = "x14", + [UNW_AARCH64_X15] = "x15", + [UNW_AARCH64_X16] = "ip0", + [UNW_AARCH64_X17] = "ip1", + [UNW_AARCH64_X18] = "x18", + [UNW_AARCH64_X19] = "x19", + [UNW_AARCH64_X20] = "x20", + [UNW_AARCH64_X21] = "x21", + [UNW_AARCH64_X22] = "x22", + [UNW_AARCH64_X23] = "x23", + [UNW_AARCH64_X24] = "x24", + [UNW_AARCH64_X25] = "x25", + [UNW_AARCH64_X26] = "x26", + [UNW_AARCH64_X27] = "x27", + [UNW_AARCH64_X28] = "x28", + [UNW_AARCH64_X29] = "fp", + [UNW_AARCH64_X30] = "lr", + [UNW_AARCH64_SP] = "sp", + [UNW_AARCH64_PC] = "pc", + [UNW_AARCH64_V0] = "v0", + [UNW_AARCH64_V1] = "v1", + [UNW_AARCH64_V2] = "v2", + [UNW_AARCH64_V3] = "v3", + [UNW_AARCH64_V4] = "v4", + [UNW_AARCH64_V5] = "v5", + [UNW_AARCH64_V6] = "v6", + [UNW_AARCH64_V7] = "v7", + [UNW_AARCH64_V8] = "v8", + [UNW_AARCH64_V9] = "v9", + [UNW_AARCH64_V10] = "v10", + [UNW_AARCH64_V11] = "v11", + [UNW_AARCH64_V12] = "v12", + [UNW_AARCH64_V13] = "v13", + [UNW_AARCH64_V14] = "v14", + [UNW_AARCH64_V15] = "v15", + [UNW_AARCH64_V16] = "v16", + [UNW_AARCH64_V17] = "v17", + [UNW_AARCH64_V18] = "v18", + [UNW_AARCH64_V19] = "v19", + [UNW_AARCH64_V20] = "v20", + [UNW_AARCH64_V21] = "v21", + [UNW_AARCH64_V22] = "v22", + [UNW_AARCH64_V23] = "v23", + [UNW_AARCH64_V24] = "v24", + [UNW_AARCH64_V25] = "v25", + [UNW_AARCH64_V26] = "v26", + [UNW_AARCH64_V27] = "v27", + [UNW_AARCH64_V28] = "v28", + [UNW_AARCH64_V29] = "v29", + [UNW_AARCH64_V30] = "v30", + [UNW_AARCH64_V31] = "v31", + [UNW_AARCH64_FPSR] = "fpsr", + [UNW_AARCH64_FPCR] = "fpcr", + }; + +PROTECTED const char * +unw_regname (unw_regnum_t reg) +{ + if (reg < (unw_regnum_t) ARRAY_SIZE (regname) && regname[reg] != NULL) + return regname[reg]; + else + return "???"; +} --- /dev/null +++ b/src/aarch64/siglongjmp.S @@ -0,0 +1,12 @@ + /* Dummy implementation for now. */ + + .global _UI_siglongjmp_cont + .global _UI_longjmp_cont + +_UI_siglongjmp_cont: +_UI_longjmp_cont: + ret +#ifdef __linux__ + /* We do not need executable stack. */ + .section .note.GNU-stack,"",%progbits +#endif --- /dev/null +++ b/src/aarch64/unwind_i.h @@ -0,0 +1,43 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2013 Linaro Limited + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#ifndef unwind_i_h +#define unwind_i_h + +#include + +#include + +#include "libunwind_i.h" + +#define aarch64_lock UNW_OBJ(lock) +#define aarch64_local_resume UNW_OBJ(local_resume) +#define aarch64_local_addr_space_init UNW_OBJ(local_addr_space_init) + +extern void aarch64_local_addr_space_init (void); +extern int aarch64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, + void *arg); + +#endif /* unwind_i_h */ --- a/src/coredump/_UCD_access_reg_linux.c +++ b/src/coredump/_UCD_access_reg_linux.c @@ -39,7 +39,10 @@ _UCD_access_reg (unw_addr_space_t as, return -UNW_EINVAL; } -#if defined(UNW_TARGET_ARM) +#if defined(UNW_TARGET_AARCH64) + if (regnum < 0 || regnum >= UNW_AARCH64_FPCR) + goto badreg; +#elif defined(UNW_TARGET_ARM) if (regnum < 0 || regnum >= 16) goto badreg; #elif defined(UNW_TARGET_SH) --- a/src/ptrace/_UPT_reg_offset.c +++ b/src/ptrace/_UPT_reg_offset.c @@ -1,6 +1,7 @@ /* libunwind - a platform-independent unwind library Copyright (C) 2003-2004 Hewlett-Packard Co Contributed by David Mosberger-Tang + Copyright (C) 2013 Linaro Limited This file is part of libunwind. @@ -501,6 +502,41 @@ const int _UPT_reg_offset[UNW_REG_LAST + [UNW_ARM_R15] = 0x3c, #elif defined(UNW_TARGET_MIPS) #elif defined(UNW_TARGET_SH) +#elif defined(UNW_TARGET_AARCH64) + [UNW_AARCH64_X0] = 0x00, + [UNW_AARCH64_X1] = 0x08, + [UNW_AARCH64_X2] = 0x10, + [UNW_AARCH64_X3] = 0x18, + [UNW_AARCH64_X4] = 0x20, + [UNW_AARCH64_X5] = 0x28, + [UNW_AARCH64_X6] = 0x30, + [UNW_AARCH64_X7] = 0x38, + [UNW_AARCH64_X8] = 0x40, + [UNW_AARCH64_X9] = 0x48, + [UNW_AARCH64_X10] = 0x50, + [UNW_AARCH64_X11] = 0x58, + [UNW_AARCH64_X12] = 0x60, + [UNW_AARCH64_X13] = 0x68, + [UNW_AARCH64_X14] = 0x70, + [UNW_AARCH64_X15] = 0x78, + [UNW_AARCH64_X16] = 0x80, + [UNW_AARCH64_X17] = 0x88, + [UNW_AARCH64_X18] = 0x90, + [UNW_AARCH64_X19] = 0x98, + [UNW_AARCH64_X20] = 0xa0, + [UNW_AARCH64_X21] = 0xa8, + [UNW_AARCH64_X22] = 0xb0, + [UNW_AARCH64_X23] = 0xb8, + [UNW_AARCH64_X24] = 0xc0, + [UNW_AARCH64_X25] = 0xc8, + [UNW_AARCH64_X26] = 0xd0, + [UNW_AARCH64_X27] = 0xd8, + [UNW_AARCH64_X28] = 0xe0, + [UNW_AARCH64_X29] = 0xe8, + [UNW_AARCH64_X30] = 0xf0, + [UNW_AARCH64_SP] = 0xf8, + [UNW_AARCH64_PC] = 0x100, + [UNW_AARCH64_PSTATE] = 0x108 #else # error Fix me. #endif debian/patches/ppc64el.diff0000664000000000000000000003714012267711523012741 0ustar Index: b/configure.ac =================================================================== --- a/configure.ac +++ b/configure.ac @@ -165,12 +165,6 @@ AM_CONDITIONAL(USE_DWARF, [test x$use_dwarf = xyes]) AC_MSG_RESULT([$use_dwarf]) -if test x$target_arch = xppc64; then - libdir='${exec_prefix}/lib64' - AC_MSG_NOTICE([PowerPC64 detected, lib will be installed ${libdir}]); - AC_SUBST([libdir]) -fi - AC_MSG_CHECKING([whether to restrict build to remote support]) if test x$target_arch != x$host_arch; then CPPFLAGS="${CPPFLAGS} -DUNW_REMOTE_ONLY" Index: b/src/Makefile.am =================================================================== --- a/src/Makefile.am +++ b/src/Makefile.am @@ -331,12 +331,12 @@ x86_64/Gstash_frame.c x86_64/Gstep.c x86_64/Gtrace.c # The list of local files that go to Power 64 and 32: -libunwind_la_SOURCES_ppc = ppc/Lcreate_addr_space.c \ +libunwind_la_SOURCES_ppc = \ ppc/Lget_proc_info.c ppc/Lget_save_loc.c ppc/Linit_local.c \ ppc/Linit_remote.c ppc/Lis_signal_frame.c # The list of generic files that go to Power 64 and 32: -libunwind_ppc_la_SOURCES_ppc_generic = ppc/Gcreate_addr_space.c \ +libunwind_ppc_la_SOURCES_ppc_generic = \ ppc/Gget_proc_info.c ppc/Gget_save_loc.c ppc/Ginit_local.c \ ppc/Ginit_remote.c ppc/Gis_signal_frame.c @@ -349,6 +349,7 @@ libunwind_la_SOURCES_ppc32 = $(libunwind_la_SOURCES_ppc32_common) \ $(libunwind_la_SOURCES_local) \ $(libunwind_la_SOURCES_ppc) \ + ppc32/Lcreate_addr_space.c \ ppc32/Lglobal.c ppc32/Linit.c \ ppc32/Lregs.c ppc32/Lresume.c ppc32/Lstep.c @@ -356,6 +357,7 @@ libunwind_ppc32_la_SOURCES_ppc32 = $(libunwind_la_SOURCES_ppc32_common) \ $(libunwind_la_SOURCES_generic) \ $(libunwind_ppc_la_SOURCES_ppc_generic) \ + ppc32/Gcreate_addr_space.c \ ppc32/Gglobal.c ppc32/Ginit.c \ ppc32/Gregs.c ppc32/Gresume.c ppc32/Gstep.c @@ -368,6 +370,7 @@ libunwind_la_SOURCES_ppc64 = $(libunwind_la_SOURCES_ppc64_common) \ $(libunwind_la_SOURCES_local) \ $(libunwind_la_SOURCES_ppc) \ + ppc64/Lcreate_addr_space.c \ ppc64/Lglobal.c ppc64/Linit.c \ ppc64/Lregs.c ppc64/Lresume.c ppc64/Lstep.c @@ -375,6 +378,7 @@ libunwind_ppc64_la_SOURCES_ppc64 = $(libunwind_la_SOURCES_ppc64_common) \ $(libunwind_la_SOURCES_generic) \ $(libunwind_ppc_la_SOURCES_ppc_generic) \ + ppc64/Gcreate_addr_space.c \ ppc64/Gglobal.c ppc64/Ginit.c \ ppc64/Gregs.c ppc64/Gresume.c ppc64/Gstep.c @@ -557,6 +561,7 @@ libunwind_ppc64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) libunwind_ppc64_la_LIBADD = libunwind-dwarf-generic.la libunwind_ppc64_la_LIBADD += libunwind-elf64.la + libunwind_ppc64_la_LIBADD += $(LIBLZMA) if !REMOTE_ONLY libunwind_ppc64_la_LIBADD += libunwind.la -lc endif Index: b/tests/Makefile.am =================================================================== --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -193,3 +193,5 @@ Lia64_test_readonly_LDADD = $(LIBUNWIND_local) ia64_test_dyn1_LDADD = $(LIBUNWIND) ia64_test_sig_LDADD = $(LIBUNWIND) +ppc64_test_altivec_LDADD = $(LIBUNWIND) + Index: b/include/libunwind-ppc64.h =================================================================== --- a/include/libunwind-ppc64.h +++ b/include/libunwind-ppc64.h @@ -222,6 +222,13 @@ } ppc64_regnum_t; +typedef enum + { + UNW_PPC64_ABI_ELFv1, + UNW_PPC64_ABI_ELFv2 + } +ppc64_abi_t; + /* * According to David Edelsohn, GNU gcc uses R3, R4, R5, and maybe R6 for * passing parameters to exception handlers. Index: b/include/tdep-ppc64/dwarf-config.h =================================================================== --- a/include/tdep-ppc64/dwarf-config.h +++ b/include/tdep-ppc64/dwarf-config.h @@ -38,7 +38,7 @@ #define DWARF_REGNUM_MAP_LENGTH 115 /* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ -#define dwarf_is_big_endian(addr_space) 1 +#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian) /* Convert a pointer to a dwarf_cursor structure to a pointer to unw_cursor_t. */ Index: b/include/tdep-ppc64/libunwind_i.h =================================================================== --- a/include/tdep-ppc64/libunwind_i.h +++ b/include/tdep-ppc64/libunwind_i.h @@ -51,6 +51,8 @@ struct unw_addr_space { struct unw_accessors acc; + int big_endian; + ppc64_abi_t abi; unw_caching_policy_t caching_policy; #ifdef HAVE_ATOMIC_OPS_H AO_t cache_generation; @@ -289,7 +291,7 @@ #define tdep_get_as(c) ((c)->dwarf.as) #define tdep_get_as_arg(c) ((c)->dwarf.as_arg) #define tdep_get_ip(c) ((c)->dwarf.ip) -#define tdep_big_endian(as) 1 +#define tdep_big_endian(as) ((as)->big_endian) extern int tdep_init_done; Index: b/src/dwarf/Gexpr.c =================================================================== --- a/src/dwarf/Gexpr.c +++ b/src/dwarf/Gexpr.c @@ -212,12 +212,13 @@ }) # define push(x) \ do { \ + unw_word_t _x = (x); \ if (tos >= MAX_EXPR_STACK_SIZE) \ { \ Debug (1, "Stack overflow\n"); \ return -UNW_EINVAL; \ } \ - stack[tos++] = (x); \ + stack[tos++] = _x; \ } while (0) # define pick(n) \ ({ \ Index: b/src/elfxx.c =================================================================== --- a/src/elfxx.c +++ b/src/elfxx.c @@ -128,10 +128,11 @@ if (ELF_W (ST_TYPE) (sym->st_info) == STT_FUNC && sym->st_shndx != SHN_UNDEF) { - if (tdep_get_func_addr (as, sym->st_value, &val) < 0) - continue; + val = sym->st_value; if (sym->st_shndx != SHN_ABS) val += load_offset; + if (tdep_get_func_addr (as, val, &val) < 0) + continue; Debug (16, "0x%016lx info=0x%02x %s\n", (long) val, sym->st_info, strtab + sym->st_name); Index: b/src/ppc/Gcreate_addr_space.c =================================================================== --- a/src/ppc/Gcreate_addr_space.c +++ /dev/null @@ -1,56 +0,0 @@ -/* libunwind - a platform-independent unwind library - Copyright (C) 2006-2007 IBM - Contributed by - Corey Ashford - Jose Flavio Aguilar Paulino - -This file is part of libunwind. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE -LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION -OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION -WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ - -#include - -#include - -PROTECTED unw_addr_space_t -unw_create_addr_space (unw_accessors_t *a, int byte_order) -{ -#ifdef UNW_LOCAL_ONLY - return NULL; -#else - unw_addr_space_t as; - - /* - * Linux ppc64 supports only big-endian. - */ - if (byte_order != 0 && byte_order != __BIG_ENDIAN) - return NULL; - - as = malloc (sizeof (*as)); - if (!as) - return NULL; - - memset (as, 0, sizeof (*as)); - - as->acc = *a; - - return as; -#endif -} Index: b/src/ppc/Gis_signal_frame.c =================================================================== --- a/src/ppc/Gis_signal_frame.c +++ b/src/ppc/Gis_signal_frame.c @@ -31,7 +31,7 @@ unw_is_signal_frame (unw_cursor_t * cursor) { struct cursor *c = (struct cursor *) cursor; - unw_word_t w0, w1, ip; + unw_word_t w0, w1, i0, i1, i2, ip; unw_addr_space_t as; unw_accessors_t *a; void *arg; @@ -60,7 +60,19 @@ if ((ret = (*a->access_mem) (as, ip, &w0, 0, arg)) < 0 || (ret = (*a->access_mem) (as, ip + 8, &w1, 0, arg)) < 0) return 0; - w1 >>= 32; - return (w0 == 0x38210080380000ac && w1 == 0x44000002); + if (tdep_big_endian (as)) + { + i0 = w0 >> 32; + i1 = w0 & 0xffffffffUL; + i2 = w1 >> 32; + } + else + { + i0 = w0 & 0xffffffffUL; + i1 = w0 >> 32; + i2 = w1 & 0xffffffffUL; + } + + return (i0 == 0x38210080 && i1 == 0x380000ac && i2 == 0x44000002); } Index: b/src/ppc/Lcreate_addr_space.c =================================================================== --- a/src/ppc/Lcreate_addr_space.c +++ /dev/null @@ -1,5 +0,0 @@ -#define UNW_LOCAL_ONLY -#include -#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) -#include "Gcreate_addr_space.c" -#endif Index: b/src/ppc32/Gcreate_addr_space.c =================================================================== --- /dev/null +++ b/src/ppc32/Gcreate_addr_space.c @@ -0,0 +1,56 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include + +PROTECTED unw_addr_space_t +unw_create_addr_space (unw_accessors_t *a, int byte_order) +{ +#ifdef UNW_LOCAL_ONLY + return NULL; +#else + unw_addr_space_t as; + + /* + * We support only big-endian on Linux ppc32. + */ + if (byte_order != 0 && byte_order != __BIG_ENDIAN) + return NULL; + + as = malloc (sizeof (*as)); + if (!as) + return NULL; + + memset (as, 0, sizeof (*as)); + + as->acc = *a; + + return as; +#endif +} Index: b/src/ppc32/Lcreate_addr_space.c =================================================================== --- /dev/null +++ b/src/ppc32/Lcreate_addr_space.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gcreate_addr_space.c" +#endif Index: b/src/ppc64/Gcreate_addr_space.c =================================================================== --- /dev/null +++ b/src/ppc64/Gcreate_addr_space.c @@ -0,0 +1,71 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2006-2007 IBM + Contributed by + Corey Ashford + Jose Flavio Aguilar Paulino + +This file is part of libunwind. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ + +#include + +#include + +PROTECTED unw_addr_space_t +unw_create_addr_space (unw_accessors_t *a, int byte_order) +{ +#ifdef UNW_LOCAL_ONLY + return NULL; +#else + unw_addr_space_t as; + + /* + * We support both big- and little-endian on Linux ppc64. + */ + if (byte_order != 0 + && byte_order != __LITTLE_ENDIAN + && byte_order != __BIG_ENDIAN) + return NULL; + + as = malloc (sizeof (*as)); + if (!as) + return NULL; + + memset (as, 0, sizeof (*as)); + + as->acc = *a; + + if (byte_order == 0) + /* use host default: */ + as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN); + else + as->big_endian = (byte_order == __BIG_ENDIAN); + + /* FIXME! There is no way to specify the ABI. + Default to ELFv1 on big-endian and ELFv2 on little-endian. */ + if (as->big_endian) + as->abi = UNW_PPC64_ABI_ELFv1; + else + as->abi = UNW_PPC64_ABI_ELFv2; + + return as; +#endif +} Index: b/src/ppc64/Ginit.c =================================================================== --- a/src/ppc64/Ginit.c +++ b/src/ppc64/Ginit.c @@ -210,6 +210,12 @@ ppc64_local_addr_space_init (void) { memset (&local_addr_space, 0, sizeof (local_addr_space)); + local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN); +#if _CALL_ELF == 2 + local_addr_space.abi = UNW_PPC64_ABI_ELFv2; +#else + local_addr_space.abi = UNW_PPC64_ABI_ELFv1; +#endif local_addr_space.caching_policy = UNW_CACHE_GLOBAL; local_addr_space.acc.find_proc_info = dwarf_find_proc_info; local_addr_space.acc.put_unwind_info = put_unwind_info; Index: b/src/ppc64/Lcreate_addr_space.c =================================================================== --- /dev/null +++ b/src/ppc64/Lcreate_addr_space.c @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gcreate_addr_space.c" +#endif Index: b/src/ppc64/get_func_addr.c =================================================================== --- a/src/ppc64/get_func_addr.c +++ b/src/ppc64/get_func_addr.c @@ -31,15 +31,21 @@ tdep_get_func_addr (unw_addr_space_t as, unw_word_t addr, unw_word_t *entry_point) { - unw_accessors_t *a; - int ret; + if (as->abi == UNW_PPC64_ABI_ELFv1) + { + unw_accessors_t *a; + int ret; + + a = unw_get_accessors (as); + /* Entry-point is stored in the 1st word of the function descriptor. + In case that changes in the future, we'd have to update the line + below and read the word at addr + offset: */ + ret = (*a->access_mem) (as, addr, entry_point, 0, NULL); + if (ret < 0) + return ret; + } + else + *entry_point = addr; - a = unw_get_accessors (as); - /* Entry-point is stored in the 1st word of the function descriptor. - In case that changes in the future, we'd have to update the line - below and read the word at addr + offset: */ - ret = (*a->access_mem) (as, addr, entry_point, 0, NULL); - if (ret < 0) - return ret; return 0; } debian/patches/20123007_workaround_test-ptrace.patch0000664000000000000000000000115612216571720017332 0ustar Index: libunwind/tests/test-ptrace.c =================================================================== --- libunwind.orig/tests/test-ptrace.c 2012-07-30 10:05:35.271168000 +0100 +++ libunwind/tests/test-ptrace.c 2012-07-30 11:39:37.309158623 +0100 @@ -182,6 +182,11 @@ /* automated test case */ argv = args; + + /* Unless the args array is 'walked' the child + process is unable to access it and dies with a segfault */ + fprintf(stderr, "Automated test (%s,%s,%s,%s)\n", + args[0],args[1],args[2],args[3]); } else if (argc > 1) while (argv[optind][0] == '-') debian/patches/20130803-known_test_failure_to_XFAIL_TESTS.patch0000664000000000000000000000047312234301555021053 0ustar --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -87,6 +87,10 @@ check_SCRIPTS = $(check_SCRIPTS_common) TESTS = $(check_PROGRAMS) $(check_SCRIPTS) +if !ARCH_IA64 +XFAIL_TESTS = Gtest-dyn1 Ltest-dyn1 +endif + noinst_PROGRAMS = $(noinst_PROGRAMS_common) $(noinst_PROGRAMS_cdep) \ $(noinst_PROGRAMS_arch) debian/patches/fix-lzma-linking.patch0000664000000000000000000000631112216604222015016 0ustar liblzuma used in decoding MiniDebuginfo is not listed in libunwind.pc. Changes in version 2 of patch: * Don't check HAVE_LZMA. It is redundant. * Make liblzma as private libraries in use. Both are suggested by Mike Frysinger . Signed-off-by: Masatake YAMATO --- configure.ac | 4 +++- src/Makefile.am | 4 +--- src/unwind/libunwind.pc.in | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) --- a/configure.ac +++ b/configure.ac @@ -246,19 +246,21 @@ if test x$enable_msabi_support = xyes; t fi AC_MSG_RESULT([$enable_msabi_support]) +LIBLZMA= AC_MSG_CHECKING([whether to support LZMA-compressed symbol tables]) AC_ARG_ENABLE(minidebuginfo, AS_HELP_STRING([--enable-minidebuginfo], [Enables support for LZMA-compressed symbol tables]),, [enable_minidebuginfo=auto]) AC_MSG_RESULT([$enable_minidebuginfo]) if test x$enable_minidebuginfo != xno; then AC_CHECK_LIB([lzma], [lzma_mf_is_supported], - [AC_SUBST([LIBLZMA], [-lzma]) + [LIBLZMA=-llzma AC_DEFINE([HAVE_LZMA], [1], [Define if you have liblzma]) enable_minidebuginfo=yes], [if test x$enable_minidebuginfo = xyes; then AC_MSG_FAILURE([liblzma not found]) fi]) fi +AC_SUBST([LIBLZMA]) AM_CONDITIONAL(HAVE_LZMA, test x$enable_minidebuginfo = xyes) LIBUNWIND___THREAD --- a/src/Makefile.am +++ b/src/Makefile.am @@ -58,6 +58,7 @@ libunwind_coredump_la_SOURCES = \ coredump/_UPT_resume.c libunwind_coredump_la_LDFLAGS = $(COMMON_SO_LDFLAGS) \ -version-info $(COREDUMP_SO_VERSION) +libunwind_coredump_la_LIBADD = $(LIBLZMA) noinst_HEADERS += coredump/_UCD_internal.h ### libunwind-setjmp: @@ -447,6 +448,7 @@ if ARCH_AARCH64 libunwind_aarch64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) libunwind_aarch64_la_LIBADD = libunwind-dwarf-generic.la libunwind_aarch64_la_LIBADD += libunwind-elf64.la + libunwind_aarch64_la_LIBADD += $(LIBLZMA) if !REMOTE_ONLY libunwind_aarch64_la_LIBADD += libunwind.la -lc endif @@ -459,6 +461,7 @@ if ARCH_ARM libunwind_arm_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) libunwind_arm_la_LIBADD = libunwind-dwarf-generic.la libunwind_arm_la_LIBADD += libunwind-elf32.la + libunwind_arm_la_LIBADD += $(LIBLZMA) if !REMOTE_ONLY libunwind_arm_la_LIBADD += libunwind.la -lc endif @@ -541,6 +544,7 @@ if ARCH_PPC32 libunwind_ppc32_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) libunwind_ppc32_la_LIBADD = libunwind-dwarf-generic.la libunwind_ppc32_la_LIBADD += libunwind-elf32.la + libunwind_ppc32_la_LIBADD += $(LIBLZMA) if !REMOTE_ONLY libunwind_ppc32_la_LIBADD += libunwind.la -lc endif @@ -594,9 +598,7 @@ endif libunwind_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -XCClinker -nostdlib \ $(LDFLAGS_STATIC_LIBCXA) -version-info $(SOVERSION) libunwind_la_LIBADD += -lc $(LIBCRTS) -if HAVE_LZMA - libunwind_la_LIBADD += -llzma -endif +libunwind_la_LIBADD += $(LIBLZMA) AM_CPPFLAGS = -I$(top_srcdir)/include -I$(top_srcdir)/include/tdep-$(arch) -I. AM_CCASFLAGS = $(AM_CPPFLAGS) --- a/src/unwind/libunwind.pc.in +++ b/src/unwind/libunwind.pc.in @@ -7,3 +7,4 @@ Name: libunwind Description: libunwind base library Version: @VERSION@ Libs: -L${libdir} -lunwind +Libs.private: @LIBLZMA@ debian/patches/series0000664000000000000000000000031212265145661012040 0ustar 01-rpath.patch 20123007_workaround_test-ptrace.patch 20130803-known_test_failure_to_XFAIL_TESTS.patch 20130803-crasher_test_only_for_coredump.patch AArch64-port.diff fix-lzma-linking.patch ppc64el.diff debian/compat0000664000000000000000000000000212234301555010366 0ustar 9 debian/docs0000664000000000000000000000001412234301555010036 0ustar NEWS README debian/clean0000664000000000000000000000010112233232577010173 0ustar debian/libunwind-setjmp0.preinst debian/libunwind-setjmp0.postrm debian/libunwind8.install0000664000000000000000000000006412234301555012643 0ustar usr/lib/*/libunwind.so.* usr/lib/*/libunwind-*.so.* debian/changelog0000664000000000000000000003610412267711567011064 0ustar libunwind (1.1-2.2ubuntu3) trusty; urgency=medium * ppc64el fixes. -- Matthias Klose Wed, 22 Jan 2014 10:45:59 +0100 libunwind (1.1-2.2ubuntu2) trusty; urgency=medium * Build for ppc64el. -- Matthias Klose Tue, 14 Jan 2014 06:27:16 +0100 libunwind (1.1-2.2ubuntu1) trusty; urgency=low * Merge from Debian unstable. Remaining changes: - Enable test suite for amd64 architecture: + d/rules: Execute test suite when building for amd64 only. + d/patches/20123007_workaround_test-ptrace.patch: Walk default test arguments to ensure child process has visibility. - d/p/AArch64-port.diff: Add Aarch64 port. - d/patches/fix-lzma-linking.patch: Fixup pkg-config configuration and lzma linking. -- James Page Thu, 07 Nov 2013 18:54:54 +0800 libunwind (1.1-2.2) unstable; urgency=low * Non-maintainer upload * Disable kfreebsd architectures for *all* binary packages -- Ben Hutchings Sun, 27 Oct 2013 17:02:22 +0000 libunwind (1.1-2.1) unstable; urgency=low * Non-maintainer upload * Remove dependence of libunwind-setjmp0 maintainer scripts on dpkg-dev by substituting architecture at build time (Closes: #709125) * Disable the test suite without depending on $DEB_BUILD_OPTIONS (Closes: #727840) * Disable kfreebsd architectures again, as they are not yet supported -- Ben Hutchings Sun, 27 Oct 2013 16:25:44 +0000 libunwind (1.1-2ubuntu3) saucy; urgency=low * d/patches/fix-lzma-linking.patch: Include lzma when linking arm, arm64 and ppc32 libunwind, fixing FTBFS. -- James Page Thu, 19 Sep 2013 15:21:35 +0100 libunwind (1.1-2ubuntu2) saucy; urgency=low * d/patches/20130803-known_test_failure_to_XFAIL_TESTS.patch: Drop run-coredump-unwind and run-coredump-unwind-mdi from XFAIL_TESTS. * d/patches/fix-lzma-linking.patch: Fixup pkg-config configuration and lzma linking. -- James Page Thu, 19 Sep 2013 14:53:22 +0100 libunwind (1.1-2ubuntu1) saucy; urgency=low * Merge from Debian unstable. Remaining changes: - Enable test suite for amd64 architecture: + d/rules: Execute test suite when building for amd64 only. + d/patches/20123007_workaround_test-ptrace.patch: Walk default test arguments to ensure child process has visibility. - Add Aarch64 port. * Dropped changes: - d/patches/20123007_disable_known_test_failures.patch: Equivalent patch included in Debian. * d/patches/20130803-known_test_failure_to_XFAIL_TESTS.patch: Added run-coredump-unwind and run-coredump-unwind-mdi to XFAIL_TESTS. -- James Page Wed, 21 Aug 2013 15:05:57 +0100 libunwind (1.1-2) unstable; urgency=low * debian/control: - libunwind-setjmp0 depepnds on dpkg-dev. (Closes: #709125) - Removed DM-Upload-Allowed. - Bumped up Standards-Version to 3.9.4. * debian/rules: - --enable-minidebuginfo for configuration. (Closes: #717737) * Install pkg-config *.pc files. (Closes: #711854) * debian/patches/20130803-known_test_failure_to_XFAIL_TESTS.patch: Back ported from the upstream (ae3dd9417a3d178cf51ce744d85b695dbf025b44). * debian/patches/20130803-crasher_test_only_for_coredump.patch: Back ported from the upstream (61fad17d29ed661d15a80ed931c7822e5e7ea411). -- Daigo Moriwaki Sat, 27 Jul 2013 17:05:27 +0900 libunwind (1.1-1ubuntu2) saucy; urgency=low * Add Aarch64 port. -- Matthias Klose Wed, 24 Jul 2013 11:58:37 +0200 libunwind (1.1-1ubuntu1) saucy; urgency=low * Merge from Debian unstable. Remaining changes: - Enable test suite for amd64 architecture: + d/rules: Execute test suite when building for amd64 only. + d/patches/20123007_disable_known_test_failures.patch: Disable *-dyn1 tests as they use unsupported features on amd64. + d/patches/20123007_workaround_test-ptrace.patch: Walk default test arguments to ensure child process has visibility. * Dropped changes: - d/patches/20122307_fix_setjmp.patch: Included in new upstream release. - d/patches/20123007_workaround_ltest-nocalloc.patch: Failing test no longer in codebase. * d/README.source: Added notes about building libunwind in chroots on Ubuntu systems with apport installed. -- James Page Wed, 22 May 2013 09:01:39 +0100 libunwind (1.1-1) unstable; urgency=low * New upstream release. (Closes: #704621) * debian/patches/01-rpath.patch: Followed the file name change by the upstream. * Removed patches: debian/patches/{20120422_tests_Makefile_am.patch, 20120704_fix_arm_ftbfs.patch, -20120707_ia64_FTBFS.patch} which have been applied by the upstream. * debian/control: Support more architectures: kfreebsd-amd64 kfreebsd-i386 mips. (Closes: #693303) -- Daigo Moriwaki Fri, 17 May 2013 22:44:41 +0900 libunwind (1.0.1-5) unstable; urgency=low * Restored libunwind-setjmp0.postrm libunwind-setjmp0.preinst. (Closes: #688977) -- Daigo Moriwaki Fri, 17 May 2013 22:11:57 +0900 libunwind (1.0.1-4ubuntu2) raring; urgency=low * Re-enable test-async-sig test (LP: #1078666): - d/patches/20121411_disable_test-async-sig.patch: Dropped; turns out using eatmydata with schroots for sbuild is not always a good idea. -- James Page Thu, 06 Dec 2012 18:05:05 +0000 libunwind (1.0.1-4ubuntu1) raring; urgency=low * Merge from Debian unstable. Remaining changes: - Enable test suite for amd64 architecture: + d/rules: Execute test suite when building for amd64 only. + d/patches/20122307_fix_setjmp.patch: Cherry picked fix from upstream VCS to fixup setjmp test failure. + d/patches/20123007_disable_known_test_failures.patch: Disable *-dyn1 tests as they use unsupported features on amd64. + d/patches/20123007_workaround_ltest-nocalloc.patch: Make dummy call to do_backtrace to ensure that malloc is not called post thread init. + d/patches/20123007_workaround_test-ptrace.patch: Walk default test arguments to ensure child process has visibility. * Dropped changes: - d/rules: Added -U_FORTIFY_SOURCE to CFLAGS and pass directly to configure to ensure package build flags are used. * d/patches/20121411_disable_test-async-sig.patch: Disable failing test on raring; tracked under http://pad.lv/1078666. -- James Page Wed, 14 Nov 2012 11:27:13 +0000 libunwind (1.0.1-4) unstable; urgency=low * Converted the build style to dh. * debian/control: - Provides debug packages, libunwind8-dbg and libunwind-setjmp0-dbg. (Closes: #687325) - Pre-Depends: multiarch-support * Removed libunwind-setjmp0.postrm libunwind-setjmp0.preinst: libunwind7 and libunwind8 can not be reconciled. * Added debian/source/options to ignore changes on auto-generated files such as config.{sub,guess}. -- Daigo Moriwaki Sun, 16 Sep 2012 17:16:56 +0900 libunwind (1.0.1-3) unstable; urgency=low * debian/rules: - Compile with the PIC format even for static libraries. (Closes: #682196) - Configure with --enable-cxx-exceptions (Closes: #682194) -- Daigo Moriwaki Sun, 16 Sep 2012 14:34:23 +0900 libunwind (1.0.1-2ubuntu2) quantal; urgency=low * Enable test suite for amd64 architecture: - d/rules: Execute test suite when building for amd64 only. - d/patches/20122307_fix_setjmp.patch: Cherry picked fix from upstream VCS to fixup setjmp test failure. - d/patches/20123007_disable_known_test_failures.patch: Disable *-dyn1 tests as they use unsupported features on amd64. - d/patches/20123007_workaround_ltest-nocalloc.patch: Make dummy call to do_backtrace to ensure that malloc is not called post thread init. - d/patches/20123007_workaround_test-ptrace.patch: Walk default test arguments to ensure child process has visibility. -- James Page Mon, 30 Jul 2012 14:43:28 +0100 libunwind (1.0.1-2ubuntu1) quantal; urgency=low * Fix FTBFS: - d/rules: Added -U_FORTIFY_SOURCE to CFLAGS and pass directly to configure to ensure package build flags are used. -- James Page Mon, 09 Jul 2012 09:14:13 +0100 libunwind (1.0.1-2) unstable; urgency=low [ Luca Falavigna ] * 20120707_ia64_FTBFS.patch: - Cherry pick patch from upstream to fix FTBFS on ia64 (Closes: #680623). [ Daigo Moriwaki ] * debian/control: Removes libunwind8's Conflicts and Replaces with libunwind7. (Closes: #670957) * Imports Ubuntu's patch, supporting the armhf architecture. Thanks to James Page . (Closes: 680308) - 20120704_fix_arm_ftbfs.patch - debian/control: + Supports armhf. + libatomic-ops-dev is no longer required for Build-Depends. -- Daigo Moriwaki Sun, 08 Jul 2012 13:13:11 +0900 libunwind (1.0.1-1) unstable; urgency=low [ Jari Aalto ] * Non-maintainer upload. * Remove deprecated dpatch and upgrade to packaging format "3.0 quilt". * Update to Standards-Version to 3.9.3, debhelper to 9, add autotools-dev. * Add build-arch and build-indep targets, use dh_prep and correct config.* file treatment in rules file. * Update URL in watch and copyright file. * Delete source.lintian-overrides; no longer needed. * Fix binary-control-field-duplicates-source (Lintian). * Fix diff-contains-substvars (Lintian) * Fix no-homepage-field (Lintian). * Fix description-synopsis-starts-with-article (Lintian). [ Daigo Moriwaki ] * Applied a patch from Jari Aalto. (Closes: #669713) * debian/control: + Added new fields: Vcs-Git, Vcs-Browser and DM-Upload-Allowed. + Added myself to Maintainer, after no response from the previous maintainers since May 2009. * NMU version 0.99-0.3 has been applied. (Closes: #631622) * New upstream release. (Closes: #558928, #669710) * debian/control: - Bumped up the version in the package names to match the library's version, libunwind8. - Support the armel architecture as well. * debian/patches/20120422_tests_Makefile_am.patch: added to run make check. * debian/copyright: Updated with copyright-format-1.0. -- Daigo Moriwaki Sat, 28 Apr 2012 15:48:35 +0900 libunwind (0.99-0.3) unstable; urgency=low * Non-maintainer upload. * Don't ship .la files (Closes: #622440). * Build for powerpc (Closes: #556909). -- Luk Claes Sat, 25 Jun 2011 16:05:02 +0200 libunwind (0.99-0.2) unstable; urgency=low * Non-maintainer upload. * debian/control: Fix "libunwind7 is not required on all archs but ia64" The priority was erroneously set high. (Closes: #543346) * i386 libraries are now provided. (Closes: #275639) * debian/rules: use dpatch. * debian/patches/090828-rpath.dpatch: fixed the rpath issue. -- Daigo Moriwaki Thu, 27 Aug 2009 23:58:37 +0900 libunwind (0.99-0.1) unstable; urgency=low [ Monty Taylor ] * Non-maintainer upload. (Closes: #530885) * New upstream release (Closes: #487316) [ Daigo Moriwaki ] * debian/libunwind*.install: - libraries install into /usr/lib. - regular packages contain shared libraries while -dev packages contain static libraries. * debian/control: libunwind7's section is now libs. -- Daigo Moriwaki Sun, 23 Aug 2009 10:37:50 +0900 libunwind (0.98.5-8) unstable; urgency=low * Set priority to package libunwind7 to required as libstdc++5 of priority required depend on libunwind7. Close: bug#317375, bug#317374 * Do not force g++ version to 3.4 -- Matthieu Delahaye Fri, 15 Jul 2005 16:05:22 -0500 libunwind (0.98.5-7) unstable; urgency=low * Upload to unstable. -- Matthias Klose Tue, 7 Jun 2005 12:33:57 +0000 libunwind (0.98.5-6) experimental; urgency=low * Fix libunwind7 shlibs version string. -- Matthias Klose Wed, 4 May 2005 07:22:10 +0200 libunwind (0.98.5-5) experimental; urgency=low * Tighten libunwind7 shlibs version to 0.98.5-4 (the first version, which includes libunwind.so.7. -- Matthias Klose Wed, 4 May 2005 04:49:44 +0000 libunwind (0.98.5-4) experimental; urgency=low * Install the unwind library in the libunwind7 package, not libgcc1. -- Matthias Klose Tue, 3 May 2005 14:50:20 +0000 libunwind (0.98.5-1) unstable; urgency=low * New upstream release - bug correction only: - Fix an off-by-1 bug in the handling of the dynamic ALIAS directive. - Fix a bug in libunwind-ptrace which could cause crash due to extraneous munmap() calls. - Fix a typo in the man-page of unw_create_addr_space() -- Matthieu Delahaye Fri, 22 Apr 2005 11:12:14 -0500 libunwind (0.98.4-1) unstable; urgency=low * New upstream release -- Matthieu Delahaye Thu, 24 Feb 2005 16:12:19 -0600 libunwind (0.98.3-3) unstable; urgency=high * Tighten dependency on libgcc1. -- Matthias Klose Thu, 16 Dec 2004 15:36:15 -0800 libunwind (0.98.3-2) unstable; urgency=low * Depend on libgcc1, for the sarge release, libunwind.so.7 is built by the gcc-3.4 source package. -- Matthias Klose Fri, 26 Nov 2004 00:48:43 +0100 libunwind (0.98.3-1) unstable; urgency=low * New upstream release -- Matthieu Delahaye Tue, 16 Nov 2004 16:38:54 -0600 libunwind (0.98.2-2) unstable; urgency=low * Remove libatomic-ops depedency -- Matthieu Delahaye Tue, 16 Nov 2004 09:20:00 -0500 libunwind (0.98.2-1) unstable; urgency=low * New upstream release -- Matthieu Delahaye Thu, 4 Nov 2004 19:08:59 -0600 libunwind (0.98.1-1) unstable; urgency=low * New upstream release * Major soversion changed in upstream source: new packages libunwind7(-dev) and libunwind-setjmp0(-dev) -- Matthieu Delahaye Fri, 22 Oct 2004 15:03:30 -0500 libunwind (0.98-1) unstable; urgency=low * New upstream release -- Matthieu Delahaye Thu, 9 Sep 2004 18:28:49 -0500 libunwind (0.97-2) unstable; urgency=low * Build libunwind against libatomic-ops -- Matthieu Delahaye Fri, 28 May 2004 14:21:39 +0200 libunwind (0.97-1) unstable; urgency=low * New upstream release -- Matthieu Delahaye Fri, 7 May 2004 14:25:39 +0200 libunwind (0.96-2) unstable; urgency=low * Removed --disable-__thread from configure options * Forced Deps to libc6.1 and libc6.1-dev (>=2.3.2-ds1-8) for NTPL support -- Matthieu Delahaye Fri, 06 Feb 2004 10:29:30 +0100 libunwind (0.96-1) unstable; urgency=low * Initial Release with inputs from Al Stone . * Added Al Stone to Uploaders. * Closes: bug#184751 (Initial ITP) * Closes: bug#215185 (ITP merged with #184751) * Upgraded to latest rev of Debian policy -- Matthieu Delahaye Thu, 11 Dec 2003 10:13:55 +0100 debian/control0000664000000000000000000001066212265145711010604 0ustar Source: libunwind Priority: optional Section: libs Maintainer: Ubuntu Developers XSBC-Original-Maintainer: Daigo Moriwaki Uploaders: Matthieu Delahaye , Al Stone Build-Depends: debhelper (>= 9), autotools-dev, dh-autoreconf, liblzma-dev Standards-Version: 3.9.4 Homepage: http://www.nongnu.org/libunwind Vcs-Git: git://git.debian.org/git/collab-maint/libunwind.git Vcs-Browser: http://git.debian.org/?p=collab-maint/libunwind.git Package: libunwind8-dev Section: libdevel Architecture: ia64 i386 amd64 ppc64 ppc64el powerpc armel armhf arm64 mips Depends: ${misc:Depends}, libunwind8 (= ${binary:Version}) Conflicts: libunwind1-dev, libunwind7-dev Replaces: libunwind7-dev Description: library to determine the call-chain of a program - development The primary goal of this project is to define a portable and efficient C programming interface (API) to determine the call-chain of a program. The API additionally provides the means to manipulate the preserved (callee-saved) state of each call-frame and to resume execution at any point in the call-chain (non-local goto). The API supports both local (same-process) and remote (across-process) operation. As such, the API is useful in a number of applications. . This package includes the development support files. Package: libunwind8 Architecture: ia64 i386 amd64 ppc64 ppc64el powerpc armel armhf arm64 mips Pre-Depends: multiarch-support Depends: ${misc:Depends}, ${shlibs:Depends} Conflicts: libunwind1-dev Replaces: libgcc1 (<< 1:4.0.0-2) Description: library to determine the call-chain of a program - runtime The primary goal of this project is to define a portable and efficient C programming interface (API) to determine the call-chain of a program. The API additionally provides the means to manipulate the preserved (callee-saved) state of each call-frame and to resume execution at any point in the call-chain (non-local goto). The API supports both local (same-process) and remote (across-process) operation. As such, the API is useful in a number of applications. . This package includes the shared libraries Package: libunwind8-dbg Section: debug Priority: extra Architecture: ia64 i386 amd64 ppc64 ppc64el powerpc armel armhf arm64 mips Depends: ${misc:Depends}, ${shlibs:Depends}, libunwind8 (= ${binary:Version}) Description: library to determine the call-chain of a program - runtime Contains debugging symbols for libunwind8. . This package is provided primarily to provide a backtrace with names in a debugger, this makes it somewhat easier to interpret core dumps. Most people will not need this package. Package: libunwind-setjmp0-dev Section: libdevel Architecture: ia64 i386 amd64 ppc64 ppc64el powerpc armel armhf arm64 mips Depends: ${misc:Depends}, libunwind8-dev (= ${binary:Version}), libunwind-setjmp0 (= ${binary:Version}) Description: libunwind-based non local goto - development The unwind-setjmp library offers a libunwind-based implementation of non-local gotos. This implementation is intended to be a drop-in replacement for the normal, system-provided routines of the same name. The main advantage of using the unwind-setjmp library is that setting up a non-local goto via one of the setjmp() routines is very fast. . This package includes the development support files Package: libunwind-setjmp0 Architecture: ia64 i386 amd64 ppc64 ppc64el powerpc armel armhf arm64 mips Pre-Depends: multiarch-support Depends: ${misc:Depends}, ${shlibs:Depends} Description: libunwind-based non local goto - runtime The unwind-setjmp library offers a libunwind-based implementation of non-local gotos. This implementation is intended to be a drop-in replacement for the normal, system-provided routines of the same name. The main advantage of using the unwind-setjmp library is that setting up a non-local goto via one of the setjmp() routines is very fast. . This package includes the shared library Package: libunwind-setjmp0-dbg Section: debug Priority: extra Architecture: ia64 i386 amd64 ppc64 ppc64el powerpc armel armhf arm64 mips Depends: ${misc:Depends}, ${shlibs:Depends}, libunwind-setjmp0 (= ${binary:Version}) Description: libunwind-based non local goto - runtime Contains debugging symbols for libunwind8. . This package is provided primarily to provide a backtrace with names in a debugger, this makes it somewhat easier to interpret core dumps. Most people will not need this package. debian/libunwind8-dev.install0000664000000000000000000000020512234301555013414 0ustar usr/include/* usr/lib/*/libunwind-*.a usr/lib/*/libunwind-*.so usr/lib/*/libunwind.a usr/lib/*/libunwind.so usr/lib/*/pkgconfig/*.pc