aboutsummaryrefslogtreecommitdiff
path: root/libc/malloc_debug/PointerData.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Update for LocalUnwinder object removal.Christopher Ferris2022-03-031-3/+4
| | | | | | | | | | | | | | Modify libfdtrack to use the normal Unwinder object. In addition, update the libfdtrack so that it doesn't record frames in libfdtrack.so rather than skipping frames it thinks will be in the library. Modify the malloc debug code to use the normal Unwinder object. Bug: 120606663 Test: All unit tests pass. Change-Id: I3c9612dd10e62389e6219e68045ee87f7b2625f5
* Update API of MapInfo from libunwindstackDavid Srbecky2021-05-131-2/+2
| | | | | | | Use accessors to for all the fields. Test: build Change-Id: I6ae458002e059ef2f9d73931cc68f2f698f85d7e
* Move bionic_macros.h from private to platform.Josh Gao2020-01-021-1/+1
| | | | | Test: treehugger Change-Id: Ie473914f4c8924c7240b3ac22093a9daf42fc948
* Fix allocations escaping malloc debug.Christopher Ferris2019-11-061-16/+16
| | | | | | | | | | | | | | | | | | | | | | When using a FILE object for some malloc debug functions, calling fprintf will trigger an allocation to be put in the object. The problem is that these allocations were not allocated by the malloc debug wrapper and they get freed during the fclose as if they are malloc debug allocation. In most cases, the code will detect the bad pointer and leak the memory, but it might also cause a crash. The fix is to avoid using fprintf so that no allocations are made in the object that survive and need to be freed in the fclose call. Change the MallocXmlElem.h to use a file decsriptor not a FILE object. Add new unit and system tests to detect this case. Bug: 143742907 Test: Ran unit and system tests. Test: Ran bionic unit tests. Change-Id: I524392de822a29483aa5be8f14c680e70033eba2
* Move to the libc++ demangler.Christopher Ferris2019-07-181-2/+12
| | | | | | | | | | | Bug: 136138882 Test: Ran malloc debug tests. Test: Ran an app with backtrace_full and verified demangling working in Test: log file. Test: Enabled leak checking and verified that the logs include properly Test: demangled. Change-Id: Ic4fd9f1522451e867048ac1bea59d8c5ed0d3577
* Disable info messages by default for malloc debug.Christopher Ferris2019-04-021-4/+8
| | | | | | | | | | | | Add a new option verbose for malloc debug that is not enabled by default. This disables all of the info log messages. It turns out these log messages can add a measurable amount of time and can change the boot up. Bug: 129239269 Test: Adjusted unit tests pass. Test: Verified no messages unless verbose option used. Change-Id: I805cb7c8ecb44de88119574e59d784877cacc383
* Malloc debug: fix mutex deadlock issueIris Chang2019-03-081-1/+1
| | | | | | | | | | | | When we enable free_track option, one thread is in AddFreed->RemoveBacktrace flow (hold free_pointer_mutex_ first and try to lock frame_mutex_), and other thread do fork and enter PrepareFork flow (hold frame_mutex_ first and try to lock free_pointer_mutex_), this situation may result in mutex deadlock issue. Bug: 127733115 Test: build pass and stress test pass Change-Id: Ie5fcc4ef6c169372ad73d81978cfb2a726b6c03e
* Refactor the malloc_info code.Christopher Ferris2019-03-071-0/+11
| | | | | | | | | | | | | | malloc_info needs to be per native allocator, but the code treated it like a global function that doesn't depend on the native memory allocator. Update malloc debug to dump the actual pointers that it has been tracking. Test: bionic-unit-tests pass. Test: malloc debug tests pass. Test: malloc hook tests pass. Change-Id: I3b0d4d748489dd84c16d16933479dc8b8d79013e Merged-In: I3b0d4d748489dd84c16d16933479dc8b8d79013e (cherry picked from commit a3656a98b10d2a4a6194a5d9705ad9c2cc5877b0)
* malloc debug: fix LogFreeError error logIris Chang2019-02-141-3/+4
| | | | | | | | | | | | | When free_track option is enabled and malloc debug detects error in VerifyFreedPointer flow, if freed pointer's usable_size is more than g_debug->config().fill_on_free_bytes(), the error log is not correct. The max. bytes printed to error message should be the max bytes to cmp, not usable size. Bug: 124420174 Test: build pass and test pass Change-Id: I41f35ab3330e49e0a6ad276d405bf4f6c3f0ea92
* Bionic malloc debug: add a new option "abort_on_error"Iris Chang2019-01-221-1/+7
| | | | | | | | | | | This new option causes an abort after malloc debug detects an error. This allows vendors to get process coredumps to analyze memory for corruption. Bug: 123009873 Test: New test cases added for unit tests and config tests. Change-Id: I6b480af7f747d6a82f61e8bf3df204a5f7ba017f
* Add support for using the new unwinder.Christopher Ferris2018-05-241-30/+81
| | | | | | | | | | | | | | | | This adds a new option backtrace_full, when it is set, then it will use libunwindstack. Modify the dump to file data to dump the extra information from libunwindstack. Along with the new dump file format, change the version to v1.1. Updated document for new format of file data. Add unit tests for the new functionality. Bug: 74361929 Test: Ran unit tests. Change-Id: I40fff795f5346bba7b9d7fde2e04f269ff4eb7f1
* Fix nullptr dereference during sort.Christopher Ferris2018-05-011-2/+4
| | | | | | | | | Add new unit test that will crash without this fix. Bug: 78900050 Test: Ran unit tests. Change-Id: I73e1b89e965a7b399822c3a6f25cbc70d2d355e2
* Refactor malloc debug.Christopher Ferris2018-04-021-0/+553
Changes - Refactor the code so that only guards require creating a special header for every pointer allocated. - Store only a single copy of every backtrace. This saves memory so that turning on the backtrace option doesn't result in 10X memory usage. - Added new option track_allocs that only verifies pointers are valid for free/malloc_usable_size/realloc. - Remove suffix from test names. - Add the TRACK_ALLOCS options to all guard options. - Add new option verify_pointers that is a lightweight way to verify pointers that are passed to allocation routines. - Do auto-formatting of the code. - Updated documentation for all of these changes. Bug: 74361929 Test: Ran unit tests. Test: Ran libmemunreachable unit tests. Test: Ran an app with backtrace enabled. Change-Id: I3246c48ae4f9811f64622d90d0a9b4d9d818702c