Merge branch 'dev-trace' into dev-slice-trace

This commit is contained in:
Daan 2021-12-10 17:31:37 -08:00
commit 66c88eec06
5 changed files with 30 additions and 22 deletions

View file

@ -152,7 +152,7 @@ void* _mi_heap_realloc_zero(mi_heap_t* heap, void* p, size_t newsize, bool
mi_block_t* _mi_page_ptr_unalign(const mi_segment_t* segment, const mi_page_t* page, const void* p);
bool _mi_free_delayed_block(mi_block_t* block);
void _mi_block_zero_init(const mi_page_t* page, void* p, size_t size);
void _mi_error_trace_with_predecessor(const mi_page_t* page, const mi_block_t* block, const char* msg);
void _mi_show_block_trace_with_predecessor(const mi_page_t* page, const mi_block_t* block, const char* msg);
#if MI_DEBUG>1
bool _mi_page_is_valid(mi_page_t* page);
@ -681,7 +681,7 @@ static inline mi_block_t* mi_block_next(const mi_page_t* page, const mi_block_t*
// check for free list corruption: is `next` at least in the same page?
// TODO: check if `next` is `page->block_size` aligned?
if (mi_unlikely(next!=NULL && !mi_is_in_same_page(block, next))) {
_mi_error_trace_with_predecessor(page, block, "free block");
_mi_show_block_trace_with_predecessor(page, block, "free block");
_mi_error_message(EFAULT, "corrupted free list entry of size %zu at %p: value 0x%zx\n", mi_page_block_size(page), block, (uintptr_t)next);
next = NULL;
}

View file

@ -61,7 +61,7 @@ terms of the MIT license. A copy of the license can be found in the file
#endif
#if !defined(MI_DEBUG_TRACE) // store stack trace at each allocation
#define MI_DEBUG_TRACE MI_DEBUG
#define MI_DEBUG_TRACE (0)
#endif
#if !defined(MI_DEBUG_TRACE_LEN)
@ -70,7 +70,7 @@ terms of the MIT license. A copy of the license can be found in the file
#if !defined(MI_PADDING_EXTRA) // use extra padding bytes? (so a stack trace can be preserved or next block corruption prevented)
#if MI_DEBUG_TRACE > 0
#define MI_PADDING_EXTRA (128)
#define MI_PADDING_EXTRA (64)
#else
#define MI_PADDING_EXTRA (0)
#endif