aboutsummaryrefslogtreecommitdiff
path: root/malloc/mtrace.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2007-01-22 21:21:52 +0000
committerUlrich Drepper <drepper@redhat.com>2007-01-22 21:21:52 +0000
commit765bbb24bd0bc5da4e183b1f6f43196da0126ffb (patch)
tree4b2950da43a7d6c3dcf3d2be97431e7e3b102e54 /malloc/mtrace.c
parent6cae39579b699d09b94a315483a9ac804b56fe34 (diff)
downloadglibc-765bbb24bd0bc5da4e183b1f6f43196da0126ffb.zip
glibc-765bbb24bd0bc5da4e183b1f6f43196da0126ffb.tar.gz
glibc-765bbb24bd0bc5da4e183b1f6f43196da0126ffb.tar.bz2
* stdio-common/_itowa.c: Don't compile _itowa for 64-bit
platforms. * stdio-common/_itoa.c: Don't compile in _itoa and _fitoa for 64-bit platforms. * malloc/mtrace.c (tr_where): Use _fitoa_word instead of _fitoa if possible. * posix/wordexp.c (parse_arith): Use _itoa_word instead of _itoa if possible.
Diffstat (limited to 'malloc/mtrace.c')
-rw-r--r--malloc/mtrace.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/malloc/mtrace.c b/malloc/mtrace.c
index 1a9522b..f40f3b2 100644
--- a/malloc/mtrace.c
+++ b/malloc/mtrace.c
@@ -1,5 +1,5 @@
/* More debugging hooks for `malloc'.
- Copyright (C) 1991-1994,1996-2003, 2004 Free Software Foundation, Inc.
+ Copyright (C) 1991-1994,1996-2004, 2007 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written April 2, 1991 by John Gilmore of Cygnus Support.
Based on mcheck.c by Mike Haertel.
@@ -28,6 +28,7 @@
#include <dlfcn.h>
#include <fcntl.h>
+#include <limits.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
@@ -113,15 +114,20 @@ tr_where (caller)
buf = alloca (len + 6 + 2 * sizeof (void *));
buf[0] = '(';
- __stpcpy (_fitoa (caller >= (const __ptr_t) info.dli_saddr
- ? caller - (const __ptr_t) info.dli_saddr
- : (const __ptr_t) info.dli_saddr - caller,
- __stpcpy (__mempcpy (buf + 1, info.dli_sname,
- len),
- caller >= (__ptr_t) info.dli_saddr
- ? "+0x" : "-0x"),
- 16, 0),
- ")");
+
+ char *cp = __stpcpy (__mempcpy (buf + 1, info.dli_sname, len),
+ caller >= (__ptr_t) info.dli_saddr
+ ? "+0x" : "-0x");
+ intptr_t offset = (caller >= (const __ptr_t) info.dli_saddr
+ ? caller - (const __ptr_t) info.dli_saddr
+ : (const __ptr_t) info.dli_saddr - caller);
+# if LLONG_MAX == LONG_MAX
+ cp = _fitoa_word (offset, cp, 16, 0);
+# else
+ cp = _fitoa (offset, cp, 16, 0);
+# endif
+
+ __stpcpy (cp, ")");
}
fprintf (mallstream, "@ %s%s%s[%p] ",