summaryrefslogtreecommitdiff
path: root/src/heap-checker.cc
diff options
context:
space:
mode:
authorcsilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2010-08-05 20:36:47 +0000
committercsilvers <csilvers@6b5cf1ce-ec42-a296-1ba9-69fdba395a50>2010-08-05 20:36:47 +0000
commit682ff7da1205398376ee725b4ce3219c107b3f8a (patch)
tree5140c04e49c3be7a04985ce4f67b04cfbc66034c /src/heap-checker.cc
parent488eee994d571da216ef105d4144282c801f0eee (diff)
downloadgperftools-682ff7da1205398376ee725b4ce3219c107b3f8a.tar.gz
Thu Aug 5 12:48:03 PDT 2010
* google-perftools: version 1.6 release * Add tc_malloc_usable_size for compatibility with glibc (csilvers) * Override malloc_usable_size with tc_malloc_usable_size (csilvers) * Default to no automatic heap sampling in tcmalloc (csilvers) * Add -DTCMALLOC_LARGE_PAGES, a possibly faster tcmalloc (rus) * Make some functions extern "C" to avoid false ODR warnings (jyasskin) * pprof: Add SVG-based output (rsc) * pprof: Extend pprof --tools to allow per-tool configs (csilvers) * pprof: Improve support of 64-bit and big-endian profiles (csilvers) * pprof: Add interactive callgrind suport (weidenri...) * pprof: Improve address->function mapping a bit (dpeng) * Better detection of when we're running under valgrind (csilvers) * Better CPU-speed detection under valgrind (saito) * Use, and recommend, -fno-builtin-malloc when compiling (csilvers) * Avoid false-sharing of memory between caches (bmaurer) * BUGFIX: Fix heap sampling to use correct alloc size (bmauer) * BUGFIX: Avoid gcc 4.0.x bug by making hook-clearing atomic (csilvers) * BUGFIX: Avoid gcc 4.5.x optimization bug (csilvers) * BUGFIX: Work around deps-determining bug in libtool 1.5.26 (csilvers) * BUGFIX: Fixed test to use HAVE_PTHREAD, not HAVE_PTHREADS (csilvers) * BUGFIX: Fix tls callback behavior on windows when using wpo (wtc) * BUGFIX: properly align allocation sizes on Windows (antonm) * BUGFIX: Fix prototypes for tcmalloc/debugalloc wrt throw() (csilvers) * DOC: Updated heap-checker doc to match reality better (fischman) * DOC: Document ProfilerFlush, ProfilerStartWithOptions (csilvers) * DOC: Update docs for heap-profiler functions (csilvers) * DOC: Clean up documentation around tcmalloc.slack_bytes (fikes) * DOC: Renamed README.windows to README_windows.txt (csilvers) * DOC: Update the NEWS file to be non-empty (csilvers) * PORTING: Fix windows addr2line and nm with proper rc code (csilvers) * PORTING: Add CycleClock and atomicops support for arm 5 (sanek) * PORTING: Improve PC finding on cygwin and redhat 7 (csilvers) * PORTING: speed up function-patching under windows (csilvers) git-svn-id: http://gperftools.googlecode.com/svn/trunk@97 6b5cf1ce-ec42-a296-1ba9-69fdba395a50
Diffstat (limited to 'src/heap-checker.cc')
-rw-r--r--src/heap-checker.cc25
1 files changed, 13 insertions, 12 deletions
diff --git a/src/heap-checker.cc b/src/heap-checker.cc
index 2b0b854..c4f6da8 100644
--- a/src/heap-checker.cc
+++ b/src/heap-checker.cc
@@ -965,7 +965,8 @@ static enum {
// specially via self_thread_stack, not here:
if (thread_pids[i] == self_thread_pid) continue;
RAW_VLOG(11, "Handling thread with pid %d", thread_pids[i]);
-#if defined(HAVE_LINUX_PTRACE_H) && defined(HAVE_SYS_SYSCALL_H) && defined(DUMPER)
+#if (defined(__i386__) || defined(__x86_64)) && \
+ defined(HAVE_LINUX_PTRACE_H) && defined(HAVE_SYS_SYSCALL_H) && defined(DUMPER)
i386_regs thread_regs;
#define sys_ptrace(r, p, a, d) syscall(SYS_ptrace, (r), (p), (a), (d))
// We use sys_ptrace to avoid thread locking
@@ -2091,12 +2092,11 @@ void HeapLeakChecker::CancelGlobalCheck() {
// HeapLeakChecker global constructor/destructor ordering components
//----------------------------------------------------------------------
-static bool in_initial_malloc_hook = false;
-
#ifdef HAVE___ATTRIBUTE__ // we need __attribute__((weak)) for this to work
#define INSTALLED_INITIAL_MALLOC_HOOKS
void HeapLeakChecker_BeforeConstructors(); // below
+static bool in_initial_malloc_hook = false;
// Helper for InitialMallocHook_* below
static inline void InitHeapLeakCheckerFromMallocHook() {
@@ -2115,20 +2115,20 @@ static inline void InitHeapLeakCheckerFromMallocHook() {
// These will owerwrite the weak definitions in malloc_hook.cc:
// Important to have this to catch the first allocation call from the binary:
-extern void InitialMallocHook_New(const void* ptr, size_t size) {
+extern "C" void InitialMallocHook_New(const void* ptr, size_t size) {
InitHeapLeakCheckerFromMallocHook();
// record this first allocation as well (if we need to):
MallocHook::InvokeNewHook(ptr, size);
}
// Important to have this to catch the first mmap call (say from tcmalloc):
-extern void InitialMallocHook_MMap(const void* result,
- const void* start,
- size_t size,
- int protection,
- int flags,
- int fd,
- off_t offset) {
+extern "C" void InitialMallocHook_MMap(const void* result,
+ const void* start,
+ size_t size,
+ int protection,
+ int flags,
+ int fd,
+ off_t offset) {
InitHeapLeakCheckerFromMallocHook();
// record this first mmap as well (if we need to):
MallocHook::InvokeMmapHook(
@@ -2136,7 +2136,8 @@ extern void InitialMallocHook_MMap(const void* result,
}
// Important to have this to catch the first sbrk call (say from tcmalloc):
-extern void InitialMallocHook_Sbrk(const void* result, ptrdiff_t increment) {
+extern "C" void InitialMallocHook_Sbrk(const void* result,
+ ptrdiff_t increment) {
InitHeapLeakCheckerFromMallocHook();
// record this first sbrk as well (if we need to):
MallocHook::InvokeSbrkHook(result, increment);