diff options
author | Elliott Hughes <enh@google.com> | 2013-01-25 17:13:45 -0800 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2013-01-25 17:13:45 -0800 |
commit | 239e7a0756fddf3698bf72cab10d7f382421090b (patch) | |
tree | 6ec3636787883bf1b20bd490cc011110b625d3fe /libc/bionic/pthread_debug.cpp | |
parent | 6a94cb748bf63278c3271b0ab610061b0dc6f04a (diff) | |
download | android_bionic-239e7a0756fddf3698bf72cab10d7f382421090b.tar.gz android_bionic-239e7a0756fddf3698bf72cab10d7f382421090b.tar.bz2 android_bionic-239e7a0756fddf3698bf72cab10d7f382421090b.zip |
More debug malloc fixes.
Include the leaky executable's name in the log output. Fix the "sh" test.
Use uintptr_t instead of intptr_t.
Also fix debug formatting of NULL with %s.
Bug: 7291287
Change-Id: I015bf341cd48d43a247173612e6ccb1bf1243d53
Diffstat (limited to 'libc/bionic/pthread_debug.cpp')
-rw-r--r-- | libc/bionic/pthread_debug.cpp | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libc/bionic/pthread_debug.cpp b/libc/bionic/pthread_debug.cpp index 7d98d109b..ac81837e2 100644 --- a/libc/bionic/pthread_debug.cpp +++ b/libc/bionic/pthread_debug.cpp @@ -180,8 +180,8 @@ static void* debug_realloc(void *ptr, size_t size, size_t old_size) { struct MutexInfo; typedef struct CallStack { - intptr_t depth; - intptr_t* addrs; + uintptr_t depth; + uintptr_t* addrs; } CallStack; typedef struct MutexInfo* MutexInfoListEntry; @@ -222,7 +222,7 @@ typedef struct MutexInfo { CallStackList stacks; // call stack when this lock was acquired last int stackDepth; - intptr_t stackTrace[STACK_TRACE_DEPTH]; + uintptr_t stackTrace[STACK_TRACE_DEPTH]; } MutexInfo; static void growingListInit(GrowingList* list) { @@ -285,10 +285,10 @@ static int pthread_mutex_unlock_unchecked(pthread_mutex_t *mutex) { /****************************************************************************/ -static void dup_backtrace(CallStack* stack, size_t count, intptr_t const* addrs) { +static void dup_backtrace(CallStack* stack, size_t count, uintptr_t const* addrs) { stack->depth = count; - stack->addrs = DbgAllocLocked<intptr_t>(count); - memcpy(stack->addrs, addrs, count * sizeof(intptr_t)); + stack->addrs = DbgAllocLocked<uintptr_t>(count); + memcpy(stack->addrs, addrs, count * sizeof(uintptr_t)); } /****************************************************************************/ @@ -343,7 +343,7 @@ static void unlinkParentFromChild(MutexInfo* parent, MutexInfo* child) { /****************************************************************************/ static void callstackListAdd(CallStackList* pList, - int count, intptr_t const* addrs) { + int count, uintptr_t const* addrs) { growingListAdd(pList, sizeof(CallStackListEntry)); dup_backtrace(&pList->stack[pList->count - 1], count, addrs); } @@ -365,7 +365,7 @@ static int traverseTree(MutexInfo* obj, MutexInfo const* objParent) */ if (obj->historyMark) { int stackDepth; - intptr_t addrs[STACK_TRACE_DEPTH]; + uintptr_t addrs[STACK_TRACE_DEPTH]; /* Turn off prediction temporarily in this thread while logging */ sPthreadDebugDisabledThread = gettid(); |