summaryrefslogtreecommitdiffstats
path: root/libc/bionic/malloc_debug_common.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Implement malloc_usable_size for debug impls.Christopher Ferris2013-06-071-63/+46
| | | | | | | | | | | | | | | | | | | | | | | | | | - Implemented chk_memalign. - Fixed a few bugs in leak_memalign. - Implemented {leak,fill,check,qemu}_malloc_usable_size. - Make malloc_usable_size update at run time. - Add malloc_test.cpp as a small set of tests for the malloc debug routines. - Fix the qemu routines since it's been broken since it moved to C++. - Add support for the %u format to the out_vformat in libc_logging.cpp. This is used by the emulator code. Tested using the bionic-unit-tests with setprop libc.debug.malloc set to 1, 5, and 10. I tested as much as possible on the emulator, but tracing doesn't appear to be working properly. Bug: 6143477 Merge change from internal master. (cherry-picked from commit 3d594c258045783fc9e1956ce7a4d91e302f011e) Change-Id: I4ae00fffba82315a8c283f35893fd554460722fb
* Fix declaration of malloc_usable_size()David 'Digit' Turner2013-05-231-1/+1
| | | | | | | | | | The function should take a 'const void*' parameter, instead of 'void*'. Note that the implementation in upstream-dlmalloc/malloc.c already does this. For context, see http://b.android.com/55725 Change-Id: Iefd55cdb8996699189e0545f9195972490306227
* Use hidden visibility for internal-use-only functionsKito Cheng2013-04-121-2/+2
| | | | | | - malloc_debug_init and malloc_debug_fini Change-Id: I4261ff428a50d8f0371415cda71bcc0a9487ce67
* Clean up internal libc logging.Elliott Hughes2013-03-151-1/+1
| | | | | | | | | | | We only need one logging API, and I prefer the one that does no allocation and is thus safe to use in any context. Also use O_CLOEXEC when opening the /dev/log files. Move everything logging-related into one header file. Change-Id: Ic1e3ea8e9b910dc29df351bff6c0aa4db26fbb58
* __progname should be const char*, not char*.Elliott Hughes2013-02-071-1/+1
| | | | Change-Id: I8e846872c30a712fbc05c8da59ffa1cec1be31a4
* Don't claim there were no leaks if we weren't even checking.Elliott Hughes2013-02-011-27/+29
| | | | | Bug: 8107016 Change-Id: I9059f1f8374ebcdf00dfc6ac74d3709f501292c9
* More debug malloc fixes.Elliott Hughes2013-01-251-4/+6
| | | | | | | | | | 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
* Disable leak checking for mksh; it's way too leaky.Elliott Hughes2013-01-221-0/+5
| | | | | | | | When each shell leaks ~240 allocations, you can't see the leaks from the program you ran with "adb shell". Bug: 7291287 Change-Id: Ib8780db72ba0114ebdb24768537da74bbb61f354
* Fix the duplication in the debugging code.Elliott Hughes2013-01-181-5/+13
| | | | | | | | | | | | | | | | | | | We had two copies of the backtrace code, and two copies of the libcorkscrew /proc/pid/maps code. This patch gets us down to one. We also had hacks so we could log in the malloc debugging code. This patch pulls the non-allocating "printf" code out of the dynamic linker so everyone can share. This patch also makes the leak diagnostics easier to read, and makes it possible to paste them directly into the 'stack' tool (by using relative PCs). This patch also fixes the stdio standard stream leak that was causing a leak warning every time tf_daemon ran. Bug: 7291287 Change-Id: I66e4083ac2c5606c8d2737cb45c8ac8a32c7cfe8
* Fix debug malloc.Elliott Hughes2013-01-031-10/+8
| | | | | | | ...which has been broken since the linker data structures went read-only. Bug: 7941716 Change-Id: If28f6bac0fcb13e371e4d85b064544f561c8d692
* Fix dlerror(3).Elliott Hughes2012-10-111-2/+5
| | | | | | | | | | Add unit tests for dlerror(3) in various situations. I think We're at least as good as glibc now. Also factor out the ScopedPthreadMutexLock and use it here too. Bug: http://code.google.com/p/android/issues/detail?id=38398 Change-Id: I040938b4366ab836e3df46d1d8055b92f4ea6ed8
* Fix two comment typos.Elliott Hughes2012-10-091-1/+1
| | | | Change-Id: Icb2d6f7fa97ef5a4409a7606875e416cfab0a4b3
* Clean up warnings in the malloc_debug_* files.Elliott Hughes2012-08-291-0/+527
Also clean up cpplint.py-detected lint. Change-Id: Ia18e89c4c6878764f8d7ed34b8247e7a8d8fe88b