diff options
author | Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com> | 2019-02-08 10:33:09 -0200 |
---|---|---|
committer | Aliaksey Kandratsenka <alkondratenko@gmail.com> | 2019-02-10 11:16:56 -0800 |
commit | fc00474ddc21fff618fc3f009b46590e241e425e (patch) | |
tree | f65d2ff9ae7f46e48fb43d08ee6b586fe171d63b /m4 | |
parent | 5574c87e39ee592c909cb48245c1d91e90ddaf4d (diff) | |
download | gperftools-fc00474ddc21fff618fc3f009b46590e241e425e.tar.gz |
Include asm/ptrace.h when accessing ucontext_t
In some architectures (e.g. powerpc, powerpc64 and powerpc64le), the
macro that specifies the position of the program counter is defined in
header asm/ptrace.h.
When glibc bug 21457 got fixed in version 2.27, header sys/ucontext.h
stopped including signal.h, which indirectly removed asm/ptrace.h too.
Signed-off-by: Tulio Magno Quites Machado Filho <tuliom@linux.ibm.com>
Diffstat (limited to 'm4')
-rw-r--r-- | m4/pc_from_ucontext.m4 | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/m4/pc_from_ucontext.m4 b/m4/pc_from_ucontext.m4 index c9224bc..7114bd0 100644 --- a/m4/pc_from_ucontext.m4 +++ b/m4/pc_from_ucontext.m4 @@ -20,6 +20,7 @@ AC_DEFUN([AC_PC_FROM_UCONTEXT], AC_CHECK_HEADERS(sys/ucontext.h) # ucontext on OS X 10.6 (at least) fi AC_CHECK_HEADERS(cygwin/signal.h) # ucontext on cywgin + AC_CHECK_HEADERS(asm/ptrace.h) # get ptrace macros, e.g. PT_NIP AC_MSG_CHECKING([how to access the program counter from a struct ucontext]) pc_fields=" uc_mcontext.gregs[[REG_PC]]" # Solaris x86 (32 + 64 bit) pc_fields="$pc_fields uc_mcontext.gregs[[REG_EIP]]" # Linux (i386) @@ -53,14 +54,23 @@ AC_DEFUN([AC_PC_FROM_UCONTEXT], How to access the PC from a struct ucontext) AC_MSG_RESULT([$pc_field]) pc_field_found=true) - elif test "x$ac_cv_header_sys_ucontext_h" = xyes; then + elif test "x$ac_cv_header_asm_ptrace_h" = xyes -a "x$ac_cv_header_sys_ucontext_h" = xyes; then AC_TRY_COMPILE([#define _GNU_SOURCE 1 + #include <asm/ptrace.h> #include <sys/ucontext.h>], [ucontext_t u; return u.$pc_field == 0;], AC_DEFINE_UNQUOTED(PC_FROM_UCONTEXT, $pc_field, How to access the PC from a struct ucontext) AC_MSG_RESULT([$pc_field]) pc_field_found=true) + elif test "x$ac_cv_header_sys_ucontext_h" = xyes; then + AC_TRY_COMPILE([#define _GNU_SOURCE 1 + #include <sys/ucontext.h>], + [ucontext_t u; return u.$pc_field == 0;], + AC_DEFINE_UNQUOTED(PC_FROM_UCONTEXT, $pc_field, + How to access the PC from a struct ucontext) + AC_MSG_RESULT([$pc_field]) + pc_field_found=true) elif test "x$ac_cv_header_ucontext_h" = xyes; then AC_TRY_COMPILE([#define _GNU_SOURCE 1 #include <ucontext.h>], |