summaryrefslogtreecommitdiff
path: root/m4
diff options
context:
space:
mode:
authorcsilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2009-11-10 16:24:57 +0000
committercsilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2009-11-10 16:24:57 +0000
commit5b80f01df1137337131b4c50ce97faaff9973e90 (patch)
treeb1fe4fad33a359f76e0384d309e747795c373a23 /m4
parent25eed16e1b042a80c9a3e83bbf7ed227d04fb45a (diff)
downloadgperftools-5b80f01df1137337131b4c50ce97faaff9973e90.tar.gz
* Replace usleep() and poll() with nanosleep() (glider)
* Document problems with _recalloc (csilvers) * Detect when x86_64 doesn't turn off frame pointers (csilvers) * Fix sysinfo.cc/etc to work with 64-bit os x (csilvers) * BUGFIX: Use __TEXT instead of __DATA to store tcmalloc fns (csilvers) * Added two numeric pageheap properties to tcmalloc (fikes) * Support for mallocranges stats visualization (sanjay) * Use libunwind for i386, not just x86_64 (ppluzhnikov) * Add ReleaseToSystem(num_bytes) (kash) * Provide corect library filenames under solaris (jeffrey) * BUGFIX: a simple bug in pprof --raw mode (mrabkin) * Prfer sys/ucontext.h to ucontext.h, to fix OS X 10.6 (csilvers) * Improve supprot for inlined functions in pprof (sanjay) * Document inaccuracies in profiling mmap calls (csilvers) * Update wget code to not use keepalive (mrabkin, csilvers) git-svn-id: http://gperftools.googlecode.com/svn/trunk@78 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
Diffstat (limited to 'm4')
-rw-r--r--m4/pc_from_ucontext.m433
1 files changed, 24 insertions, 9 deletions
diff --git a/m4/pc_from_ucontext.m4 b/m4/pc_from_ucontext.m4
index 8c4c5ce..daffddb 100644
--- a/m4/pc_from_ucontext.m4
+++ b/m4/pc_from_ucontext.m4
@@ -6,8 +6,13 @@
# OpenBSD doesn't have ucontext.h, but we can get PC from ucontext_t
# by using signal.h.
+# The first argument of AC_PC_FROM_UCONTEXT will be invoked when we
+# cannot find a way to obtain PC from ucontext.
+
AC_DEFUN([AC_PC_FROM_UCONTEXT],
- [AC_MSG_CHECKING([how to access the program counter from a struct ucontext])
+ [AC_CHECK_HEADERS(ucontext.h)
+ AC_CHECK_HEADERS(sys/ucontext.h) # ucontext on OS X 10.6 (at least)
+ 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)
pc_fields="$pc_fields uc_mcontext.gregs[[REG_RIP]]" # Linux (x86_64)
@@ -28,13 +33,23 @@ AC_DEFUN([AC_PC_FROM_UCONTEXT],
pc_field_found=false
for pc_field in $pc_fields; do
if ! $pc_field_found; then
- AC_TRY_COMPILE([#define _GNU_SOURCE 1
- #include <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)
+ if 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)
+ else
+ AC_TRY_COMPILE([#define _GNU_SOURCE 1
+ #include <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)
+ fi
fi
done
if ! $pc_field_found; then
@@ -52,5 +67,5 @@ AC_DEFUN([AC_PC_FROM_UCONTEXT],
done
fi
if ! $pc_field_found; then
- AC_MSG_WARN(Could not find the PC. Will not output failed addresses...)
+ [$1]
fi])