diff options
author | Ulrich Drepper <drepper@redhat.com> | 2003-12-17 23:52:56 +0000 |
---|---|---|
committer | Ulrich Drepper <drepper@redhat.com> | 2003-12-17 23:52:56 +0000 |
commit | e796f92f68585f61412f569e4b4f49b5e21d80df (patch) | |
tree | b3cb5d9bf8e91e54d6d443330b2bad65ac867580 /malloc/mtrace.c | |
parent | 0278652840d0b09297986baee97ab46c136f304c (diff) | |
download | glibc-e796f92f68585f61412f569e4b4f49b5e21d80df.tar.gz glibc-e796f92f68585f61412f569e4b4f49b5e21d80df.tar.xz glibc-e796f92f68585f61412f569e4b4f49b5e21d80df.zip |
Update.
2003-12-17 Jakub Jelinek <jakub@redhat.com> * malloc/mtrace.c (tr_old_memalign_hook): New variable. (tr_memalignhook): New function. (mtrace): Register tr_memalignhook. (muntrace): Deregister tr_memalignhook. * malloc/malloc.c (__posix_memalign): If __memalign_hook != NULL, call it directly instead of memalign_internal. 2003-12-17 Ulrich Drepper <drepper@redhat.com> * misc/mntent_r.c: Change encoding to match recently change decoder. Patch by Alexander Achenbach <xela@slit.de>. 2003-12-16 Steven Munroe <sjmunroe@us.ibm.com> * sysdeps/unix/sysv/linux/powerpc/sys/ucontext.h: Correct definition of vrregset_t. 2003-12-16 Steven Munroe <sjmunroe@us.ibm.com> * sysdeps/unix/sysv/linux/powerpc/sys/procfs.h [!__PPC64_ELF_H]: Extent conditional to include typedef elf_vrreg_t. 2002-12-17 Paolo Bonzini <bonzini@gnu.org> * posix/regexec.c (re_search_internal): Limit search to the beginning of the buffer if the initial states are empty for contexts that do not include CONTEXT_BEGBUF or, if !preg->newline_anchor, that do not include any one of CONTEXT_BEGBUF and CONTEXT_NEWLINE.
Diffstat (limited to 'malloc/mtrace.c')
-rw-r--r-- | malloc/mtrace.c | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/malloc/mtrace.c b/malloc/mtrace.c index 6cdd5f3324..c4239ddfba 100644 --- a/malloc/mtrace.c +++ b/malloc/mtrace.c @@ -71,6 +71,9 @@ static __ptr_t (*tr_old_malloc_hook) __P ((__malloc_size_t size, static __ptr_t (*tr_old_realloc_hook) __P ((__ptr_t ptr, __malloc_size_t size, const __ptr_t)); +static __ptr_t (*tr_old_memalign_hook) __P ((__malloc_size_t __alignment, + __malloc_size_t __size, + __const __ptr_t)); /* This function is called when the block being alloc'd, realloc'd, or freed has an address matching the variable "mallwatch". In a debugger, @@ -233,6 +236,39 @@ tr_reallochook (ptr, size, caller) return hdr; } +static __ptr_t tr_memalignhook __P ((__malloc_size_t, __malloc_size_t, + const __ptr_t)); +static __ptr_t +tr_memalignhook (alignment, size, caller) + __malloc_size_t alignment, size; + const __ptr_t caller; +{ + __ptr_t hdr; + + __libc_lock_lock (lock); + + __memalign_hook = tr_old_memalign_hook; + __malloc_hook = tr_old_malloc_hook; + if (tr_old_memalign_hook != NULL) + hdr = (__ptr_t) (*tr_old_memalign_hook) (alignment, size, caller); + else + hdr = (__ptr_t) memalign (alignment, size); + __memalign_hook = tr_memalignhook; + __malloc_hook = tr_mallochook; + + tr_where (caller); + /* We could be printing a NULL here; that's OK. */ + fprintf (mallstream, "+ %p %#lx\n", hdr, (unsigned long int) size); + + __libc_lock_unlock (lock); + + if (hdr == mallwatch) + tr_break (); + + return hdr; +} + + #ifdef _LIBC @@ -300,6 +336,8 @@ mtrace () __malloc_hook = tr_mallochook; tr_old_realloc_hook = __realloc_hook; __realloc_hook = tr_reallochook; + tr_old_memalign_hook = __memalign_hook; + __memalign_hook = tr_memalignhook; #ifdef _LIBC if (!added_atexit_handler) { @@ -327,4 +365,5 @@ muntrace () __free_hook = tr_old_free_hook; __malloc_hook = tr_old_malloc_hook; __realloc_hook = tr_old_realloc_hook; + __memalign_hook = tr_old_memalign_hook; } |