allocator delete checks

This commit is contained in:
Eduardo Bart 2011-07-13 01:25:43 -03:00
parent fbaa89d342
commit 6c05ee0e82
1 changed files with 5 additions and 5 deletions

View File

@ -106,13 +106,13 @@ static void addr2line(void *address, const char* name, bool viewSource = false)
printf("\n");
}
void printBacktrace()
void printBacktrace(int skips)
{
void *buffer[128];
int size = backtrace(buffer, 128);
char **strings = backtrace_symbols(buffer, size);
for(int i = 1; i < size; i++) {
if(i == 1) {
for(int i = 1 + skips; i < size; i++) {
if(i == 1 + skips) {
printf("\tfrom ");
} else {
printf("\tat ");
@ -277,7 +277,7 @@ void Allocator::deallocate(void *p)
disableAllocator();
printf("attempt to delete NULL address\n");
printBacktrace();
printBacktrace(1);
enableAllocator();
} else {
@ -293,7 +293,7 @@ void Allocator::deallocate(void *p)
free(p);
} else {
printf("invalid delete address\n");
printBacktrace();
printBacktrace(1);
}
enableAllocator();