diff --git a/configure.in b/configure.ac similarity index 81% rename from configure.in rename to configure.ac index 2caceffe..afd63c15 100644 --- a/configure.in +++ b/configure.ac @@ -70,44 +70,44 @@ PT_STEP, PT_SYSCALL], [], [], dnl Checks for library functions. AC_CHECK_FUNCS(dl_iterate_phdr dl_phdr_removals_counter dlmodinfo getunwind \ ttrace mincore) -is_gcc_m64() { - if test `echo $CFLAGS | grep "\-m64" -c` -eq 1 ; then echo ppc64; - else - if test `echo $CC | grep "\-m64" -c` -eq 1 ; then echo ppc64; else echo ppc32; fi; - fi; -} - -is_gcc_altivec() { - if test `echo $CFLAGS | grep "\-maltivec" -c` -eq 1 ; then echo has_altivec; - else - if test `echo $CC | grep "\-maltivec" -c` -eq 1 ; then echo has_altivec; else echo no_altivec; fi; - fi; -} AC_MSG_CHECKING([if building with AltiVec]) -use_altivec=`is_gcc_altivec` -AM_CONDITIONAL(USE_ALTIVEC, test x$use_altivec = xhas_altivec) -if test x$use_altivec = xhas_altivec; then - AC_MSG_RESULT([yes]) -else - AC_MSG_RESULT([no]) -fi +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#ifndef __ALTIVEC__ +# error choke +#endif +]])], [use_altivec=yes],[use_altivec=no]) +AM_CONDITIONAL(USE_ALTIVEC, [test x$use_altivec = xyes]) +AC_MSG_RESULT([$use_altivec]) -get_arch() { - case "$1" in - arm*) echo arm;; - i?86) echo x86;; - hppa*) echo hppa;; - mips*) echo mips;; - powerpc*) is_gcc_m64;; - amd64) echo x86_64;; - *) echo $1;; - esac -} +AC_COMPILE_IFELSE([AC_LANG_SOURCE([[ +#ifndef __powerpc64__ +# error choke +#endif +]])], [ppc_bits=64], [ppc_bits=32]) -build_arch=`get_arch $build_cpu` -host_arch=`get_arch $host_cpu` -target_arch=`get_arch $target_cpu` +AC_DEFUN([SET_ARCH],[ + AS_CASE([$1], + [arm*],[$2=arm], + [i?86],[$2=x86], + [hppa*],[$2=hppa], + [mips*],[$2=mips], + [powerpc*],[$2=ppc$ppc_bits], + [amd64],[$2=x86_64], + [$2=$1]) +]) dnl SET_ARCH + +SET_ARCH([$build_cpu],[build_arch]) +SET_ARCH([$host_cpu],[host_arch]) +SET_ARCH([$target_cpu],[target_arch]) + +AC_ARG_ENABLE(coredump, + AS_HELP_STRING([--enable-coredump],[building libunwind-coredump library]),, + [AS_CASE([$host_arch], [x86*], [enable_coredump=yes], [enable_coredump=no])] +) + +AC_MSG_CHECKING([if we should build libunwind-coredump]) +AC_MSG_RESULT([$enable_coredump]) AC_MSG_CHECKING([for build architecture]) AC_MSG_RESULT([$build_arch]) @@ -118,6 +118,7 @@ AC_MSG_RESULT([$target_arch]) AC_MSG_CHECKING([for target operating system]) 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_ARM, test x$target_arch = xarm) AM_CONDITIONAL(ARCH_IA64, test x$target_arch = xia64) @@ -168,8 +169,7 @@ AC_MSG_RESULT([$remote_only]) AC_MSG_CHECKING([whether to enable debug support]) AC_ARG_ENABLE(debug, -[ --enable-debug turn on debug support (slows down execution)], -[enable_debug=$enableval], [enable_debug=no]) +AS_HELP_STRING([--enable-debug],[turn on debug support (slows down execution)])) if test x$enable_debug = xyes; then CPPFLAGS="${CPPFLAGS} -DDEBUG" else @@ -179,8 +179,7 @@ AC_MSG_RESULT([$enable_debug]) AC_MSG_CHECKING([whether to enable C++ exception support]) AC_ARG_ENABLE(cxx_exceptions, -[ --enable-cxx-exceptions use libunwind to handle C++ exceptions], -[enable_cxx_exceptions=$enableval], +AS_HELP_STRING([--enable-cxx-exceptions],[use libunwind to handle C++ exceptions]),, [ # C++ exception handling doesn't work too well on x86 case $target_arch in @@ -196,8 +195,7 @@ AC_MSG_RESULT([$enable_cxx_exceptions]) AC_MSG_CHECKING([whether to load .debug_frame sections]) AC_ARG_ENABLE(debug_frame, -[ --enable-debug-frame Load the ".debug_frame" section if available], -[enable_debug_frame=$enableval], [ +AS_HELP_STRING([--enable-debug-frame],[Load the ".debug_frame" section if available]),, [ case "${target_arch}" in (arm) enable_debug_frame=yes;; (*) enable_debug_frame=no;; @@ -209,8 +207,8 @@ AC_MSG_RESULT([$enable_debug_frame]) AC_MSG_CHECKING([whether to block signals during mutex ops]) AC_ARG_ENABLE(block_signals, -[ --enable-block-signals Block signals before performing mutex operations], -[enable_block_signals=$enableval], [enable_block_signals=yes]) +AS_HELP_STRING([--enable-block-signals],[Block signals before performing mutex operations]),, +[enable_block_signals=yes]) if test x$enable_block_signals = xyes; then AC_DEFINE([CONFIG_BLOCK_SIGNALS], [], [Block signals before mutex operations]) fi @@ -218,8 +216,8 @@ AC_MSG_RESULT([$enable_block_signals]) AC_MSG_CHECKING([whether to validate memory addresses before use]) AC_ARG_ENABLE(conservative_checks, -[ --enable-conservative-checks Validate all memory addresses before use], -[enable_conservative_checks=$enableval], [enable_conservative_checks=yes]) +AS_HELP_STRING([--enable-conservative-checks],[Validate all memory addresses before use]),, +[enable_conservative_checks=yes]) if test x$enable_conservative_checks = xyes; then AC_DEFINE(CONSERVATIVE_CHECKS, 1, [Define to 1 if you want every memory access validated]) @@ -228,8 +226,7 @@ AC_MSG_RESULT([$enable_conservative_checks]) AC_MSG_CHECKING([whether to enable msabi support]) AC_ARG_ENABLE(msabi_support, -[ --enable-msabi-support Enables support for Microsoft ABI extensions ], -[enable_msabi_support=$enableval], [enable_msabi_support=no]) +AS_HELP_STRING([--enable-msabi-support],[Enables support for Microsoft ABI extensions])) if test x$enable_msabi_support = xyes; then AC_DEFINE([CONFIG_MSABI_SUPPORT], [], [Support for Microsoft ABI extensions]) fi @@ -237,8 +234,7 @@ AC_MSG_RESULT([$enable_msabi_support]) 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=$enableval], [enable_minidebuginfo=auto]) +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], @@ -321,4 +317,7 @@ AC_SUBST(DLLIB) AC_CONFIG_FILES(Makefile src/Makefile tests/Makefile tests/check-namespace.sh doc/Makefile doc/common.tex include/libunwind-common.h include/libunwind.h include/tdep/libunwind_i.h) +AC_CONFIG_FILES(src/unwind/libunwind.pc src/coredump/libunwind-coredump.pc + src/ptrace/libunwind-ptrace.pc src/setjmp/libunwind-setjmp.pc + src/libunwind-generic.pc:src/libunwind-generic.pc.in) AC_OUTPUT diff --git a/doc/libunwind-setjmp.man b/doc/libunwind-setjmp.man index e8b9de82..1faa38e4 100644 --- a/doc/libunwind-setjmp.man +++ b/doc/libunwind-setjmp.man @@ -36,7 +36,7 @@ _longjmp(jmp_buf env, int val); .br int -setjmp(sigjmp_buf env, +sigsetjmp(sigjmp_buf env, int savemask); .br void diff --git a/doc/libunwind-setjmp.tex b/doc/libunwind-setjmp.tex index b31ee9e5..17ce0731 100644 --- a/doc/libunwind-setjmp.tex +++ b/doc/libunwind-setjmp.tex @@ -17,7 +17,7 @@ \Type{void} \Func{longjmp}(\Type{jmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\ \Type{int} \Func{\_setjmp}(\Type{jmp\_buf}~\Var{env});\\ \Type{void} \Func{\_longjmp}(\Type{jmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\ -\Type{int} \Func{setjmp}(\Type{sigjmp\_buf}~\Var{env}, \Type{int}~\Var{savemask});\\ +\Type{int} \Func{sigsetjmp}(\Type{sigjmp\_buf}~\Var{env}, \Type{int}~\Var{savemask});\\ \Type{void} \Func{siglongjmp}(\Type{sigjmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\ \section{Description} diff --git a/src/Makefile.am b/src/Makefile.am index f5414d06..a7528a1c 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,12 +9,27 @@ COMMON_SO_LDFLAGS = -XCClinker -nostartfiles lib_LIBRARIES = lib_LTLIBRARIES = if !REMOTE_ONLY -lib_LTLIBRARIES += libunwind.la libunwind-coredump.la libunwind-ptrace.la +lib_LTLIBRARIES += libunwind.la libunwind-ptrace.la +if BUILD_COREDUMP +lib_LTLIBRARIES += libunwind-coredump.la +endif endif noinst_HEADERS = noinst_LTLIBRARIES = +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libunwind-generic.pc + +if !REMOTE_ONLY +pkgconfig_DATA += unwind/libunwind.pc ptrace/libunwind-ptrace.pc \ + setjmp/libunwind-setjmp.pc +endif + +if BUILD_COREDUMP +pkgconfig_DATA += coredump/libunwind-coredump.pc +endif + ### libunwind-ptrace: libunwind_ptrace_la_SOURCES = \ ptrace/_UPT_elf.c \ diff --git a/src/coredump/libunwind-coredump.pc.in b/src/coredump/libunwind-coredump.pc.in new file mode 100644 index 00000000..9205c41c --- /dev/null +++ b/src/coredump/libunwind-coredump.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libunwind-coredump +Description: libunwind coredump library +Version: @VERSION@ +Requires: libunwind-@arch@ libunwind +Libs: -L${libdir} -lunwind-coredump diff --git a/src/libunwind-generic.pc.in b/src/libunwind-generic.pc.in new file mode 100644 index 00000000..89e9814f --- /dev/null +++ b/src/libunwind-generic.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libunwind-generic +Description: libunwind generic library +Version: @VERSION@ +Requires: libunwind +Libs: -L${libdir} -lunwind-generic diff --git a/src/ppc32/ucontext_i.h b/src/ppc32/ucontext_i.h index 52c3dc7e..0fd60d91 100644 --- a/src/ppc32/ucontext_i.h +++ b/src/ppc32/ucontext_i.h @@ -43,8 +43,7 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ /* These are dummy structures used only for obtaining the offsets of the various structure members. */ -static ucontext_t dmy_ctxt; -static vrregset_t dmy_vrregset; +static ucontext_t dmy_ctxt UNUSED; #define UC_MCONTEXT_GREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[0] - (void *)&dmy_ctxt) #define UC_MCONTEXT_GREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[1] - (void *)&dmy_ctxt) diff --git a/src/ppc64/Ginit.c b/src/ppc64/Ginit.c index 97c9d78c..53c40280 100644 --- a/src/ppc64/Ginit.c +++ b/src/ppc64/Ginit.c @@ -141,9 +141,9 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, unw_word_t *addr; ucontext_t *uc = arg; - if ((unsigned int) (reg - UNW_PPC64_F0) < 32) + if (UNW_PPC64_F0 <= reg && reg <= UNW_PPC64_F31) goto badreg; - if ((unsigned int) (reg - UNW_PPC64_V0) < 32) + if (UNW_PPC64_V0 <= reg && reg <= UNW_PPC64_V31) goto badreg; addr = uc_addr (uc, reg); diff --git a/src/ppc64/regname.c b/src/ppc64/regname.c index 7d648347..3e3a1419 100644 --- a/src/ppc64/regname.c +++ b/src/ppc64/regname.c @@ -149,6 +149,9 @@ static const char *regname[] = [UNW_PPC64_SPE_ACC]="SPE_ACC", [UNW_PPC64_SPEFSCR]="SPEFSCR", + [UNW_PPC64_FRAME_POINTER]="FRAME_POINTER", + [UNW_PPC64_NIP]="NIP", + }; PROTECTED const char * diff --git a/src/ptrace/_UPT_access_mem.c b/src/ptrace/_UPT_access_mem.c index b0c2ef04..918a8f9e 100644 --- a/src/ptrace/_UPT_access_mem.c +++ b/src/ptrace/_UPT_access_mem.c @@ -32,6 +32,9 @@ _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, void *arg) { struct UPT_info *ui = arg; + if (!ui) + return -UNW_EINVAL; + pid_t pid = ui->pid; errno = 0; @@ -65,6 +68,8 @@ _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, void *arg) { struct UPT_info *ui = arg; + if (!ui) + return -UNW_EINVAL; pid_t pid = ui->pid; struct ptrace_io_desc iod; diff --git a/src/ptrace/_UPT_access_reg.c b/src/ptrace/_UPT_access_reg.c index 00ba0cc7..ed259d82 100644 --- a/src/ptrace/_UPT_access_reg.c +++ b/src/ptrace/_UPT_access_reg.c @@ -43,6 +43,8 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, pid_t pid = ui->pid; #if UNW_DEBUG + Debug(16, "using pokeuser: reg: %s [%u], val: %lx, write: %d\n", unw_regname(reg), (unsigned) reg, (long) val, write); + if (write) Debug (16, "%s <- %lx\n", unw_regname (reg), (long) *val); #endif @@ -221,10 +223,13 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, } break; } -#endif +#endif /* End of IA64 */ if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0])) { +#if UNW_DEBUG + Debug(2, "register out of range: >= %zu / %zu\n", sizeof(_UPT_reg_offset), sizeof(_UPT_reg_offset[0])); +#endif errno = EINVAL; goto badreg; } @@ -235,10 +240,19 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, errno = 0; if (write) ptrace (PTRACE_POKEUSER, pid, _UPT_reg_offset[reg], *val); - else + else { +#if UNW_DEBUG + Debug(16, "ptrace PEEKUSER pid: %lu , reg: %lu , offs: %lu\n", (unsigned long)pid, (unsigned long)reg, + (unsigned long)_UPT_reg_offset[reg]); +#endif *val = ptrace (PTRACE_PEEKUSER, pid, _UPT_reg_offset[reg], 0); - if (errno) + } + if (errno) { +#if UNW_DEBUG + Debug(2, "ptrace failure\n"); +#endif goto badreg; + } #endif #ifdef UNW_TARGET_IA64 @@ -246,12 +260,12 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, #endif #if UNW_DEBUG if (!write) - Debug (16, "%s -> %lx\n", unw_regname (reg), (long) *val); + Debug (16, "%s[%u] -> %lx\n", unw_regname (reg), (unsigned) reg, (long) *val); #endif return 0; badreg: - Debug (1, "bad register number %u (error: %s)\n", reg, strerror (errno)); + Debug (1, "bad register %s [%u] (error: %s)\n", unw_regname(reg), reg, strerror (errno)); return -UNW_EBADREG; } #elif HAVE_DECL_PT_GETREGS @@ -265,8 +279,10 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, char *r; #if UNW_DEBUG + Debug(16, "using getregs: reg: %s [%u], val: %lx, write: %u\n", unw_regname(reg), (unsigned) reg, (long) val, write); + if (write) - Debug (16, "%s <- %lx\n", unw_regname (reg), (long) *val); + Debug (16, "%s [%u] <- %lx\n", unw_regname (reg), (unsigned) reg, (long) *val); #endif if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0])) { @@ -285,7 +301,7 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, return 0; badreg: - Debug (1, "bad register number %u (error: %s)\n", reg, strerror (errno)); + Debug (1, "bad register %s [%u] (error: %s)\n", unw_regname(reg), reg, strerror (errno)); return -UNW_EBADREG; } #else diff --git a/src/ptrace/_UPT_reg_offset.c b/src/ptrace/_UPT_reg_offset.c index d6e12741..82a09002 100644 --- a/src/ptrace/_UPT_reg_offset.c +++ b/src/ptrace/_UPT_reg_offset.c @@ -335,8 +335,153 @@ int _UPT_reg_offset[UNW_REG_LAST + 1] = #else #error Port me #endif -#elif defined(UNW_TARGET_PPC32) -#elif defined(UNW_TARGET_PPC64) +#elif defined(UNW_TARGET_PPC32) || defined(UNW_TARGET_PPC64) + +#define UNW_REG_SLOT_SIZE sizeof(unsigned long) +#define UNW_PPC_R(v) ((v) * UNW_REG_SLOT_SIZE) +#define UNW_PPC_PT(p) UNW_PPC_R(PT_##p) + +#define UNW_FP_OFF(b, i) \ + [UNW_PPC##b##_F##i] = UNW_PPC_R(PT_FPR0 + i * 8/UNW_REG_SLOT_SIZE) + +#define UNW_R_OFF(b, i) \ + [UNW_PPC##b##_R##i] = UNW_PPC_R(PT_R##i) + +#define UNW_PPC_REGS(b) \ + UNW_R_OFF(b, 0), \ + UNW_R_OFF(b, 1), \ + UNW_R_OFF(b, 2), \ + UNW_R_OFF(b, 3), \ + UNW_R_OFF(b, 4), \ + UNW_R_OFF(b, 5), \ + UNW_R_OFF(b, 6), \ + UNW_R_OFF(b, 7), \ + UNW_R_OFF(b, 8), \ + UNW_R_OFF(b, 9), \ + UNW_R_OFF(b, 10), \ + UNW_R_OFF(b, 11), \ + UNW_R_OFF(b, 12), \ + UNW_R_OFF(b, 13), \ + UNW_R_OFF(b, 14), \ + UNW_R_OFF(b, 15), \ + UNW_R_OFF(b, 16), \ + UNW_R_OFF(b, 17), \ + UNW_R_OFF(b, 18), \ + UNW_R_OFF(b, 19), \ + UNW_R_OFF(b, 20), \ + UNW_R_OFF(b, 21), \ + UNW_R_OFF(b, 22), \ + UNW_R_OFF(b, 23), \ + UNW_R_OFF(b, 24), \ + UNW_R_OFF(b, 25), \ + UNW_R_OFF(b, 26), \ + UNW_R_OFF(b, 27), \ + UNW_R_OFF(b, 28), \ + UNW_R_OFF(b, 29), \ + UNW_R_OFF(b, 30), \ + UNW_R_OFF(b, 31), \ + \ + [UNW_PPC##b##_CTR] = UNW_PPC_PT(CTR), \ + [UNW_PPC##b##_XER] = UNW_PPC_PT(XER), \ + [UNW_PPC##b##_LR] = UNW_PPC_PT(LNK), \ + \ + UNW_FP_OFF(b, 0), \ + UNW_FP_OFF(b, 1), \ + UNW_FP_OFF(b, 2), \ + UNW_FP_OFF(b, 3), \ + UNW_FP_OFF(b, 4), \ + UNW_FP_OFF(b, 5), \ + UNW_FP_OFF(b, 6), \ + UNW_FP_OFF(b, 7), \ + UNW_FP_OFF(b, 8), \ + UNW_FP_OFF(b, 9), \ + UNW_FP_OFF(b, 10), \ + UNW_FP_OFF(b, 11), \ + UNW_FP_OFF(b, 12), \ + UNW_FP_OFF(b, 13), \ + UNW_FP_OFF(b, 14), \ + UNW_FP_OFF(b, 15), \ + UNW_FP_OFF(b, 16), \ + UNW_FP_OFF(b, 17), \ + UNW_FP_OFF(b, 18), \ + UNW_FP_OFF(b, 19), \ + UNW_FP_OFF(b, 20), \ + UNW_FP_OFF(b, 21), \ + UNW_FP_OFF(b, 22), \ + UNW_FP_OFF(b, 23), \ + UNW_FP_OFF(b, 24), \ + UNW_FP_OFF(b, 25), \ + UNW_FP_OFF(b, 26), \ + UNW_FP_OFF(b, 27), \ + UNW_FP_OFF(b, 28), \ + UNW_FP_OFF(b, 29), \ + UNW_FP_OFF(b, 30), \ + UNW_FP_OFF(b, 31) + +#define UNW_PPC32_REGS \ + [UNW_PPC##b##_FPSCR] = UNW_PPC_PT(FPSCR), \ + [UNW_PPC##b##_CCR] = UNW_PPC_PT(CCR) + +#define UNW_VR_OFF(i) \ + [UNW_PPC64_V##i] = UNW_PPC_R(PT_VR0 + i * 2) + +#define UNW_PPC64_REGS \ + [UNW_PPC64_NIP] = UNW_PPC_PT(NIP), \ + [UNW_PPC64_FRAME_POINTER] = -1, \ + [UNW_PPC64_ARG_POINTER] = -1, \ + [UNW_PPC64_CR0] = -1, \ + [UNW_PPC64_CR1] = -1, \ + [UNW_PPC64_CR2] = -1, \ + [UNW_PPC64_CR3] = -1, \ + [UNW_PPC64_CR4] = -1, \ + [UNW_PPC64_CR5] = -1, \ + [UNW_PPC64_CR6] = -1, \ + [UNW_PPC64_CR7] = -1, \ + [UNW_PPC64_VRSAVE] = UNW_PPC_PT(VRSAVE), \ + [UNW_PPC64_VSCR] = UNW_PPC_PT(VSCR), \ + [UNW_PPC64_SPE_ACC] = -1, \ + [UNW_PPC64_SPEFSCR] = -1, \ + UNW_VR_OFF(0), \ + UNW_VR_OFF(1), \ + UNW_VR_OFF(2), \ + UNW_VR_OFF(3), \ + UNW_VR_OFF(4), \ + UNW_VR_OFF(5), \ + UNW_VR_OFF(6), \ + UNW_VR_OFF(7), \ + UNW_VR_OFF(8), \ + UNW_VR_OFF(9), \ + UNW_VR_OFF(10), \ + UNW_VR_OFF(11), \ + UNW_VR_OFF(12), \ + UNW_VR_OFF(13), \ + UNW_VR_OFF(14), \ + UNW_VR_OFF(15), \ + UNW_VR_OFF(16), \ + UNW_VR_OFF(17), \ + UNW_VR_OFF(18), \ + UNW_VR_OFF(19), \ + UNW_VR_OFF(20), \ + UNW_VR_OFF(21), \ + UNW_VR_OFF(22), \ + UNW_VR_OFF(23), \ + UNW_VR_OFF(24), \ + UNW_VR_OFF(25), \ + UNW_VR_OFF(26), \ + UNW_VR_OFF(27), \ + UNW_VR_OFF(28), \ + UNW_VR_OFF(29), \ + UNW_VR_OFF(30), \ + UNW_VR_OFF(31) + +#if defined(UNW_TARGET_PPC32) + UNW_PPC_REGS(32), + UNW_PPC32_REGS, +#else + UNW_PPC_REGS(64), + UNW_PPC64_REGS, +#endif + #elif defined(UNW_TARGET_ARM) [UNW_ARM_R0] = 0x00, [UNW_ARM_R1] = 0x04, diff --git a/src/ptrace/libunwind-ptrace.pc.in b/src/ptrace/libunwind-ptrace.pc.in new file mode 100644 index 00000000..15ce82bc --- /dev/null +++ b/src/ptrace/libunwind-ptrace.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libunwind-ptrace +Description: libunwind ptrace library +Version: @VERSION@ +Requires: libunwind-@arch@ libunwind +Libs: -L${libdir} -lunwind-ptrace diff --git a/src/setjmp/libunwind-setjmp.pc.in b/src/setjmp/libunwind-setjmp.pc.in new file mode 100644 index 00000000..aa34b7b0 --- /dev/null +++ b/src/setjmp/libunwind-setjmp.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libunwind-setjmp +Description: libunwind setjmp library +Version: @VERSION@ +Requires: libunwind +Libs: -L${libdir} -lunwind-setjmp diff --git a/src/unwind/libunwind.pc.in b/src/unwind/libunwind.pc.in new file mode 100644 index 00000000..c2799ea5 --- /dev/null +++ b/src/unwind/libunwind.pc.in @@ -0,0 +1,9 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +Name: libunwind +Description: libunwind base library +Version: @VERSION@ +Libs: -L${libdir} -lunwind diff --git a/src/x86_64/Gglobal.c b/src/x86_64/Gglobal.c index 8eba27aa..b9b001aa 100644 --- a/src/x86_64/Gglobal.c +++ b/src/x86_64/Gglobal.c @@ -25,6 +25,7 @@ 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 "config.h" #include "unwind_i.h" #include "dwarf_i.h" diff --git a/src/x86_64/Lglobal.c b/src/x86_64/Lglobal.c index 6d7b489e..8c43a67c 100644 --- a/src/x86_64/Lglobal.c +++ b/src/x86_64/Lglobal.c @@ -1,4 +1,5 @@ #define UNW_LOCAL_ONLY +#include "config.h" #include #if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) #include "Gglobal.c" diff --git a/tests/Makefile.am b/tests/Makefile.am index c96d8a58..74d2ed25 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -29,14 +29,13 @@ if ARCH_IA64 Gia64-test-rbs Lia64-test-rbs \ Gia64-test-readonly Lia64-test-readonly \ ia64-test-setjmp ia64-test-sig -else +else #!ARCH_IA64 if ARCH_PPC64 if USE_ALTIVEC - noinst_PROGRAMS_arch_altivec = ppc64-test-altivec ppc64-test-wchar + noinst_PROGRAMS_arch = ppc64-test-altivec endif #USE_ALTIVEC - noinst_PROGRAMS_arch = $(noinst_PROGRAMS_arch_altivec) ppc64-test-wchar endif #ARCH_PPC64 -endif #ARCH_IA64 +endif #!ARCH_IA64 check_SCRIPTS_cdep = run-ptrace-mapper run-ptrace-misc check_PROGRAMS_cdep = Gtest-bt Ltest-bt Gtest-exc Ltest-exc \ Gtest-init Ltest-init \ @@ -60,13 +59,15 @@ if SUPPORT_CXX_EXCEPTIONS endif if OS_LINUX +if BUILD_COREDUMP check_SCRIPTS_cdep += run-coredump-unwind noinst_PROGRAMS_cdep += test-coredump-unwind if HAVE_LZMA check_SCRIPTS_cdep += run-coredump-unwind-mdi -endif -endif +endif # HAVE_LZMA +endif # BUILD_COREDUMP +endif # OS_LINUX perf: perf-startup Gperf-simple Lperf-simple Lperf-trace @echo "########## Basic performance of generic libunwind:" @@ -104,7 +105,6 @@ Gia64_test_nat_SOURCES = Gia64-test-nat.c ia64-test-nat-asm.S ia64_test_dyn1_SOURCES = ia64-test-dyn1.c ia64-dyn-asm.S flush-cache.S \ flush-cache.h ppc64_test_altivec_SOURCES = ppc64-test-altivec.c ppc64-test-altivec-utils.c -ppc64_test_wchar_SOURCES = ppc64-test-wchar.c Gtest_init_SOURCES = Gtest-init.cxx Ltest_init_SOURCES = Ltest-init.cxx Ltest_cxx_exceptions_SOURCES = Ltest-cxx-exceptions.cxx @@ -177,7 +177,9 @@ Lperf_trace_LDADD = $(LIBUNWIND_local) test_setjmp_LDADD = $(LIBUNWIND_setjmp) ia64_test_setjmp_LDADD = $(LIBUNWIND_setjmp) +if BUILD_COREDUMP test_coredump_unwind_LDADD = $(LIBUNWIND_coredump) $(LIBUNWIND) +endif Gia64_test_nat_LDADD = $(LIBUNWIND) $(LIBUNWIND_local) Gia64_test_stack_LDADD = $(LIBUNWIND) $(LIBUNWIND_local) diff --git a/tests/ppc64-test-wchar.c b/tests/ppc64-test-wchar.c deleted file mode 100644 index 01d637ce..00000000 --- a/tests/ppc64-test-wchar.c +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include -main () -{ - wchar_t *wstring = - L"Now is the time for all good men to come to the aid of their country"; - int i; - int ret; - - printf("wcslen(wstring) = %d\n", wcslen(wstring)); - for (i = 0; i < wcslen (wstring); i++) - { - ret = printf ("%lc", wstring[i]); - if (ret != 1) { - printf("printf returned: %d\n", ret); - perror("Linux says"); - } - } - printf("\n"); -}