mirror of
https://github.com/tobast/libunwind-eh_elf.git
synced 2024-11-25 16:47:38 +01:00
Merge ../libunwind.test1
This commit is contained in:
commit
ef4d2e6361
19 changed files with 306 additions and 91 deletions
|
@ -70,44 +70,44 @@ PT_STEP, PT_SYSCALL], [], [],
|
||||||
dnl Checks for library functions.
|
dnl Checks for library functions.
|
||||||
AC_CHECK_FUNCS(dl_iterate_phdr dl_phdr_removals_counter dlmodinfo getunwind \
|
AC_CHECK_FUNCS(dl_iterate_phdr dl_phdr_removals_counter dlmodinfo getunwind \
|
||||||
ttrace mincore)
|
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])
|
AC_MSG_CHECKING([if building with AltiVec])
|
||||||
use_altivec=`is_gcc_altivec`
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||||
AM_CONDITIONAL(USE_ALTIVEC, test x$use_altivec = xhas_altivec)
|
#ifndef __ALTIVEC__
|
||||||
if test x$use_altivec = xhas_altivec; then
|
# error choke
|
||||||
AC_MSG_RESULT([yes])
|
#endif
|
||||||
else
|
]])], [use_altivec=yes],[use_altivec=no])
|
||||||
AC_MSG_RESULT([no])
|
AM_CONDITIONAL(USE_ALTIVEC, [test x$use_altivec = xyes])
|
||||||
fi
|
AC_MSG_RESULT([$use_altivec])
|
||||||
|
|
||||||
get_arch() {
|
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[
|
||||||
case "$1" in
|
#ifndef __powerpc64__
|
||||||
arm*) echo arm;;
|
# error choke
|
||||||
i?86) echo x86;;
|
#endif
|
||||||
hppa*) echo hppa;;
|
]])], [ppc_bits=64], [ppc_bits=32])
|
||||||
mips*) echo mips;;
|
|
||||||
powerpc*) is_gcc_m64;;
|
|
||||||
amd64) echo x86_64;;
|
|
||||||
*) echo $1;;
|
|
||||||
esac
|
|
||||||
}
|
|
||||||
|
|
||||||
build_arch=`get_arch $build_cpu`
|
AC_DEFUN([SET_ARCH],[
|
||||||
host_arch=`get_arch $host_cpu`
|
AS_CASE([$1],
|
||||||
target_arch=`get_arch $target_cpu`
|
[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_CHECKING([for build architecture])
|
||||||
AC_MSG_RESULT([$build_arch])
|
AC_MSG_RESULT([$build_arch])
|
||||||
|
@ -118,6 +118,7 @@ AC_MSG_RESULT([$target_arch])
|
||||||
AC_MSG_CHECKING([for target operating system])
|
AC_MSG_CHECKING([for target operating system])
|
||||||
AC_MSG_RESULT([$target_os])
|
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(REMOTE_ONLY, test x$target_arch != x$host_arch)
|
||||||
AM_CONDITIONAL(ARCH_ARM, test x$target_arch = xarm)
|
AM_CONDITIONAL(ARCH_ARM, test x$target_arch = xarm)
|
||||||
AM_CONDITIONAL(ARCH_IA64, test x$target_arch = xia64)
|
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_MSG_CHECKING([whether to enable debug support])
|
||||||
AC_ARG_ENABLE(debug,
|
AC_ARG_ENABLE(debug,
|
||||||
[ --enable-debug turn on debug support (slows down execution)],
|
AS_HELP_STRING([--enable-debug],[turn on debug support (slows down execution)]))
|
||||||
[enable_debug=$enableval], [enable_debug=no])
|
|
||||||
if test x$enable_debug = xyes; then
|
if test x$enable_debug = xyes; then
|
||||||
CPPFLAGS="${CPPFLAGS} -DDEBUG"
|
CPPFLAGS="${CPPFLAGS} -DDEBUG"
|
||||||
else
|
else
|
||||||
|
@ -179,8 +179,7 @@ AC_MSG_RESULT([$enable_debug])
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to enable C++ exception support])
|
AC_MSG_CHECKING([whether to enable C++ exception support])
|
||||||
AC_ARG_ENABLE(cxx_exceptions,
|
AC_ARG_ENABLE(cxx_exceptions,
|
||||||
[ --enable-cxx-exceptions use libunwind to handle C++ exceptions],
|
AS_HELP_STRING([--enable-cxx-exceptions],[use libunwind to handle C++ exceptions]),,
|
||||||
[enable_cxx_exceptions=$enableval],
|
|
||||||
[
|
[
|
||||||
# C++ exception handling doesn't work too well on x86
|
# C++ exception handling doesn't work too well on x86
|
||||||
case $target_arch in
|
case $target_arch in
|
||||||
|
@ -196,8 +195,7 @@ AC_MSG_RESULT([$enable_cxx_exceptions])
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to load .debug_frame sections])
|
AC_MSG_CHECKING([whether to load .debug_frame sections])
|
||||||
AC_ARG_ENABLE(debug_frame,
|
AC_ARG_ENABLE(debug_frame,
|
||||||
[ --enable-debug-frame Load the ".debug_frame" section if available],
|
AS_HELP_STRING([--enable-debug-frame],[Load the ".debug_frame" section if available]),, [
|
||||||
[enable_debug_frame=$enableval], [
|
|
||||||
case "${target_arch}" in
|
case "${target_arch}" in
|
||||||
(arm) enable_debug_frame=yes;;
|
(arm) enable_debug_frame=yes;;
|
||||||
(*) enable_debug_frame=no;;
|
(*) 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_MSG_CHECKING([whether to block signals during mutex ops])
|
||||||
AC_ARG_ENABLE(block_signals,
|
AC_ARG_ENABLE(block_signals,
|
||||||
[ --enable-block-signals Block signals before performing mutex operations],
|
AS_HELP_STRING([--enable-block-signals],[Block signals before performing mutex operations]),,
|
||||||
[enable_block_signals=$enableval], [enable_block_signals=yes])
|
[enable_block_signals=yes])
|
||||||
if test x$enable_block_signals = xyes; then
|
if test x$enable_block_signals = xyes; then
|
||||||
AC_DEFINE([CONFIG_BLOCK_SIGNALS], [], [Block signals before mutex operations])
|
AC_DEFINE([CONFIG_BLOCK_SIGNALS], [], [Block signals before mutex operations])
|
||||||
fi
|
fi
|
||||||
|
@ -218,8 +216,8 @@ AC_MSG_RESULT([$enable_block_signals])
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to validate memory addresses before use])
|
AC_MSG_CHECKING([whether to validate memory addresses before use])
|
||||||
AC_ARG_ENABLE(conservative_checks,
|
AC_ARG_ENABLE(conservative_checks,
|
||||||
[ --enable-conservative-checks Validate all memory addresses before use],
|
AS_HELP_STRING([--enable-conservative-checks],[Validate all memory addresses before use]),,
|
||||||
[enable_conservative_checks=$enableval], [enable_conservative_checks=yes])
|
[enable_conservative_checks=yes])
|
||||||
if test x$enable_conservative_checks = xyes; then
|
if test x$enable_conservative_checks = xyes; then
|
||||||
AC_DEFINE(CONSERVATIVE_CHECKS, 1,
|
AC_DEFINE(CONSERVATIVE_CHECKS, 1,
|
||||||
[Define to 1 if you want every memory access validated])
|
[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_MSG_CHECKING([whether to enable msabi support])
|
||||||
AC_ARG_ENABLE(msabi_support,
|
AC_ARG_ENABLE(msabi_support,
|
||||||
[ --enable-msabi-support Enables support for Microsoft ABI extensions ],
|
AS_HELP_STRING([--enable-msabi-support],[Enables support for Microsoft ABI extensions]))
|
||||||
[enable_msabi_support=$enableval], [enable_msabi_support=no])
|
|
||||||
if test x$enable_msabi_support = xyes; then
|
if test x$enable_msabi_support = xyes; then
|
||||||
AC_DEFINE([CONFIG_MSABI_SUPPORT], [], [Support for Microsoft ABI extensions])
|
AC_DEFINE([CONFIG_MSABI_SUPPORT], [], [Support for Microsoft ABI extensions])
|
||||||
fi
|
fi
|
||||||
|
@ -237,8 +234,7 @@ AC_MSG_RESULT([$enable_msabi_support])
|
||||||
|
|
||||||
AC_MSG_CHECKING([whether to support LZMA-compressed symbol tables])
|
AC_MSG_CHECKING([whether to support LZMA-compressed symbol tables])
|
||||||
AC_ARG_ENABLE(minidebuginfo,
|
AC_ARG_ENABLE(minidebuginfo,
|
||||||
AS_HELP_STRING([--enable-minidebuginfo], [Enables support for LZMA-compressed symbol tables]),
|
AS_HELP_STRING([--enable-minidebuginfo], [Enables support for LZMA-compressed symbol tables]),, [enable_minidebuginfo=auto])
|
||||||
[enable_minidebuginfo=$enableval], [enable_minidebuginfo=auto])
|
|
||||||
AC_MSG_RESULT([$enable_minidebuginfo])
|
AC_MSG_RESULT([$enable_minidebuginfo])
|
||||||
if test x$enable_minidebuginfo != xno; then
|
if test x$enable_minidebuginfo != xno; then
|
||||||
AC_CHECK_LIB([lzma], [lzma_mf_is_supported],
|
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
|
AC_CONFIG_FILES(Makefile src/Makefile tests/Makefile tests/check-namespace.sh
|
||||||
doc/Makefile doc/common.tex include/libunwind-common.h
|
doc/Makefile doc/common.tex include/libunwind-common.h
|
||||||
include/libunwind.h include/tdep/libunwind_i.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
|
AC_OUTPUT
|
|
@ -36,7 +36,7 @@ _longjmp(jmp_buf env,
|
||||||
int val);
|
int val);
|
||||||
.br
|
.br
|
||||||
int
|
int
|
||||||
setjmp(sigjmp_buf env,
|
sigsetjmp(sigjmp_buf env,
|
||||||
int savemask);
|
int savemask);
|
||||||
.br
|
.br
|
||||||
void
|
void
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
\Type{void} \Func{longjmp}(\Type{jmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\
|
\Type{void} \Func{longjmp}(\Type{jmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\
|
||||||
\Type{int} \Func{\_setjmp}(\Type{jmp\_buf}~\Var{env});\\
|
\Type{int} \Func{\_setjmp}(\Type{jmp\_buf}~\Var{env});\\
|
||||||
\Type{void} \Func{\_longjmp}(\Type{jmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\
|
\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});\\
|
\Type{void} \Func{siglongjmp}(\Type{sigjmp\_buf}~\Var{env}, \Type{int}~\Var{val});\\
|
||||||
|
|
||||||
\section{Description}
|
\section{Description}
|
||||||
|
|
|
@ -9,12 +9,27 @@ COMMON_SO_LDFLAGS = -XCClinker -nostartfiles
|
||||||
lib_LIBRARIES =
|
lib_LIBRARIES =
|
||||||
lib_LTLIBRARIES =
|
lib_LTLIBRARIES =
|
||||||
if !REMOTE_ONLY
|
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
|
endif
|
||||||
|
|
||||||
noinst_HEADERS =
|
noinst_HEADERS =
|
||||||
noinst_LTLIBRARIES =
|
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:
|
||||||
libunwind_ptrace_la_SOURCES = \
|
libunwind_ptrace_la_SOURCES = \
|
||||||
ptrace/_UPT_elf.c \
|
ptrace/_UPT_elf.c \
|
||||||
|
|
10
src/coredump/libunwind-coredump.pc.in
Normal file
10
src/coredump/libunwind-coredump.pc.in
Normal file
|
@ -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
|
10
src/libunwind-generic.pc.in
Normal file
10
src/libunwind-generic.pc.in
Normal file
|
@ -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
|
|
@ -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
|
/* These are dummy structures used only for obtaining the offsets of the
|
||||||
various structure members. */
|
various structure members. */
|
||||||
static ucontext_t dmy_ctxt;
|
static ucontext_t dmy_ctxt UNUSED;
|
||||||
static vrregset_t dmy_vrregset;
|
|
||||||
|
|
||||||
#define UC_MCONTEXT_GREGS_R0 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[0] - (void *)&dmy_ctxt)
|
#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)
|
#define UC_MCONTEXT_GREGS_R1 ((void *)&dmy_ctxt.uc_mcontext.uc_regs->gregs[1] - (void *)&dmy_ctxt)
|
||||||
|
|
|
@ -141,9 +141,9 @@ access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val,
|
||||||
unw_word_t *addr;
|
unw_word_t *addr;
|
||||||
ucontext_t *uc = arg;
|
ucontext_t *uc = arg;
|
||||||
|
|
||||||
if ((unsigned int) (reg - UNW_PPC64_F0) < 32)
|
if (UNW_PPC64_F0 <= reg && reg <= UNW_PPC64_F31)
|
||||||
goto badreg;
|
goto badreg;
|
||||||
if ((unsigned int) (reg - UNW_PPC64_V0) < 32)
|
if (UNW_PPC64_V0 <= reg && reg <= UNW_PPC64_V31)
|
||||||
goto badreg;
|
goto badreg;
|
||||||
|
|
||||||
addr = uc_addr (uc, reg);
|
addr = uc_addr (uc, reg);
|
||||||
|
|
|
@ -149,6 +149,9 @@ static const char *regname[] =
|
||||||
[UNW_PPC64_SPE_ACC]="SPE_ACC",
|
[UNW_PPC64_SPE_ACC]="SPE_ACC",
|
||||||
[UNW_PPC64_SPEFSCR]="SPEFSCR",
|
[UNW_PPC64_SPEFSCR]="SPEFSCR",
|
||||||
|
|
||||||
|
[UNW_PPC64_FRAME_POINTER]="FRAME_POINTER",
|
||||||
|
[UNW_PPC64_NIP]="NIP",
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
PROTECTED const char *
|
PROTECTED const char *
|
||||||
|
|
|
@ -32,6 +32,9 @@ _UPT_access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val,
|
||||||
int write, void *arg)
|
int write, void *arg)
|
||||||
{
|
{
|
||||||
struct UPT_info *ui = arg;
|
struct UPT_info *ui = arg;
|
||||||
|
if (!ui)
|
||||||
|
return -UNW_EINVAL;
|
||||||
|
|
||||||
pid_t pid = ui->pid;
|
pid_t pid = ui->pid;
|
||||||
|
|
||||||
errno = 0;
|
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)
|
int write, void *arg)
|
||||||
{
|
{
|
||||||
struct UPT_info *ui = arg;
|
struct UPT_info *ui = arg;
|
||||||
|
if (!ui)
|
||||||
|
return -UNW_EINVAL;
|
||||||
pid_t pid = ui->pid;
|
pid_t pid = ui->pid;
|
||||||
struct ptrace_io_desc iod;
|
struct ptrace_io_desc iod;
|
||||||
|
|
||||||
|
|
|
@ -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;
|
pid_t pid = ui->pid;
|
||||||
|
|
||||||
#if UNW_DEBUG
|
#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)
|
if (write)
|
||||||
Debug (16, "%s <- %lx\n", unw_regname (reg), (long) *val);
|
Debug (16, "%s <- %lx\n", unw_regname (reg), (long) *val);
|
||||||
#endif
|
#endif
|
||||||
|
@ -221,10 +223,13 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif /* End of IA64 */
|
||||||
|
|
||||||
if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0]))
|
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;
|
errno = EINVAL;
|
||||||
goto badreg;
|
goto badreg;
|
||||||
}
|
}
|
||||||
|
@ -235,10 +240,19 @@ _UPT_access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val,
|
||||||
errno = 0;
|
errno = 0;
|
||||||
if (write)
|
if (write)
|
||||||
ptrace (PTRACE_POKEUSER, pid, _UPT_reg_offset[reg], *val);
|
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);
|
*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;
|
goto badreg;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef UNW_TARGET_IA64
|
#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
|
#endif
|
||||||
#if UNW_DEBUG
|
#if UNW_DEBUG
|
||||||
if (!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
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
badreg:
|
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;
|
return -UNW_EBADREG;
|
||||||
}
|
}
|
||||||
#elif HAVE_DECL_PT_GETREGS
|
#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;
|
char *r;
|
||||||
|
|
||||||
#if UNW_DEBUG
|
#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)
|
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
|
#endif
|
||||||
if ((unsigned) reg >= sizeof (_UPT_reg_offset) / sizeof (_UPT_reg_offset[0]))
|
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;
|
return 0;
|
||||||
|
|
||||||
badreg:
|
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;
|
return -UNW_EBADREG;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -335,8 +335,153 @@ int _UPT_reg_offset[UNW_REG_LAST + 1] =
|
||||||
#else
|
#else
|
||||||
#error Port me
|
#error Port me
|
||||||
#endif
|
#endif
|
||||||
#elif defined(UNW_TARGET_PPC32)
|
#elif defined(UNW_TARGET_PPC32) || defined(UNW_TARGET_PPC64)
|
||||||
#elif 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)
|
#elif defined(UNW_TARGET_ARM)
|
||||||
[UNW_ARM_R0] = 0x00,
|
[UNW_ARM_R0] = 0x00,
|
||||||
[UNW_ARM_R1] = 0x04,
|
[UNW_ARM_R1] = 0x04,
|
||||||
|
|
10
src/ptrace/libunwind-ptrace.pc.in
Normal file
10
src/ptrace/libunwind-ptrace.pc.in
Normal file
|
@ -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
|
10
src/setjmp/libunwind-setjmp.pc.in
Normal file
10
src/setjmp/libunwind-setjmp.pc.in
Normal file
|
@ -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
|
9
src/unwind/libunwind.pc.in
Normal file
9
src/unwind/libunwind.pc.in
Normal file
|
@ -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
|
|
@ -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
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||||
|
|
||||||
|
#include "config.h"
|
||||||
#include "unwind_i.h"
|
#include "unwind_i.h"
|
||||||
#include "dwarf_i.h"
|
#include "dwarf_i.h"
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
#define UNW_LOCAL_ONLY
|
#define UNW_LOCAL_ONLY
|
||||||
|
#include "config.h"
|
||||||
#include <libunwind.h>
|
#include <libunwind.h>
|
||||||
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY)
|
||||||
#include "Gglobal.c"
|
#include "Gglobal.c"
|
||||||
|
|
|
@ -29,14 +29,13 @@ if ARCH_IA64
|
||||||
Gia64-test-rbs Lia64-test-rbs \
|
Gia64-test-rbs Lia64-test-rbs \
|
||||||
Gia64-test-readonly Lia64-test-readonly \
|
Gia64-test-readonly Lia64-test-readonly \
|
||||||
ia64-test-setjmp ia64-test-sig
|
ia64-test-setjmp ia64-test-sig
|
||||||
else
|
else #!ARCH_IA64
|
||||||
if ARCH_PPC64
|
if ARCH_PPC64
|
||||||
if USE_ALTIVEC
|
if USE_ALTIVEC
|
||||||
noinst_PROGRAMS_arch_altivec = ppc64-test-altivec ppc64-test-wchar
|
noinst_PROGRAMS_arch = ppc64-test-altivec
|
||||||
endif #USE_ALTIVEC
|
endif #USE_ALTIVEC
|
||||||
noinst_PROGRAMS_arch = $(noinst_PROGRAMS_arch_altivec) ppc64-test-wchar
|
|
||||||
endif #ARCH_PPC64
|
endif #ARCH_PPC64
|
||||||
endif #ARCH_IA64
|
endif #!ARCH_IA64
|
||||||
check_SCRIPTS_cdep = run-ptrace-mapper run-ptrace-misc
|
check_SCRIPTS_cdep = run-ptrace-mapper run-ptrace-misc
|
||||||
check_PROGRAMS_cdep = Gtest-bt Ltest-bt Gtest-exc Ltest-exc \
|
check_PROGRAMS_cdep = Gtest-bt Ltest-bt Gtest-exc Ltest-exc \
|
||||||
Gtest-init Ltest-init \
|
Gtest-init Ltest-init \
|
||||||
|
@ -60,13 +59,15 @@ if SUPPORT_CXX_EXCEPTIONS
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if OS_LINUX
|
if OS_LINUX
|
||||||
|
if BUILD_COREDUMP
|
||||||
check_SCRIPTS_cdep += run-coredump-unwind
|
check_SCRIPTS_cdep += run-coredump-unwind
|
||||||
noinst_PROGRAMS_cdep += test-coredump-unwind
|
noinst_PROGRAMS_cdep += test-coredump-unwind
|
||||||
|
|
||||||
if HAVE_LZMA
|
if HAVE_LZMA
|
||||||
check_SCRIPTS_cdep += run-coredump-unwind-mdi
|
check_SCRIPTS_cdep += run-coredump-unwind-mdi
|
||||||
endif
|
endif # HAVE_LZMA
|
||||||
endif
|
endif # BUILD_COREDUMP
|
||||||
|
endif # OS_LINUX
|
||||||
|
|
||||||
perf: perf-startup Gperf-simple Lperf-simple Lperf-trace
|
perf: perf-startup Gperf-simple Lperf-simple Lperf-trace
|
||||||
@echo "########## Basic performance of generic libunwind:"
|
@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 \
|
ia64_test_dyn1_SOURCES = ia64-test-dyn1.c ia64-dyn-asm.S flush-cache.S \
|
||||||
flush-cache.h
|
flush-cache.h
|
||||||
ppc64_test_altivec_SOURCES = ppc64-test-altivec.c ppc64-test-altivec-utils.c
|
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
|
Gtest_init_SOURCES = Gtest-init.cxx
|
||||||
Ltest_init_SOURCES = Ltest-init.cxx
|
Ltest_init_SOURCES = Ltest-init.cxx
|
||||||
Ltest_cxx_exceptions_SOURCES = Ltest-cxx-exceptions.cxx
|
Ltest_cxx_exceptions_SOURCES = Ltest-cxx-exceptions.cxx
|
||||||
|
@ -177,7 +177,9 @@ Lperf_trace_LDADD = $(LIBUNWIND_local)
|
||||||
test_setjmp_LDADD = $(LIBUNWIND_setjmp)
|
test_setjmp_LDADD = $(LIBUNWIND_setjmp)
|
||||||
ia64_test_setjmp_LDADD = $(LIBUNWIND_setjmp)
|
ia64_test_setjmp_LDADD = $(LIBUNWIND_setjmp)
|
||||||
|
|
||||||
|
if BUILD_COREDUMP
|
||||||
test_coredump_unwind_LDADD = $(LIBUNWIND_coredump) $(LIBUNWIND)
|
test_coredump_unwind_LDADD = $(LIBUNWIND_coredump) $(LIBUNWIND)
|
||||||
|
endif
|
||||||
|
|
||||||
Gia64_test_nat_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
|
Gia64_test_nat_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
|
||||||
Gia64_test_stack_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
|
Gia64_test_stack_LDADD = $(LIBUNWIND) $(LIBUNWIND_local)
|
||||||
|
|
|
@ -1,20 +0,0 @@
|
||||||
#include <wchar.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
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");
|
|
||||||
}
|
|
Loading…
Reference in a new issue