debugging

This commit is contained in:
Vitor Santos Costa 2016-09-08 22:33:55 -05:00
parent c46228a03b
commit e2f8430e00

View File

@ -21,10 +21,9 @@ static char SccsId[] = "%W% %G%";
#include "Yap.h" #include "Yap.h"
#include "alloc.h"
#include "YapHeap.h" #include "YapHeap.h"
#include "Yatom.h" #include "Yatom.h"
#include "alloc.h"
#include "yapio.h" #include "yapio.h"
#if HAVE_STRING_H #if HAVE_STRING_H
#include <string.h> #include <string.h>
@ -78,6 +77,8 @@ void *my_malloc(size_t sz) {
p = malloc(sz); p = malloc(sz);
// Yap_DebugPuts(stderr,"gof\n"); // Yap_DebugPuts(stderr,"gof\n");
if (Yap_do_low_level_trace)
fprintf(stderr, "+ %p : %lu\n", p, sz);
if (sz > 500 && write_malloc++ > 0) if (sz > 500 && write_malloc++ > 0)
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "+ %d %p", write_malloc, __android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "+ %d %p", write_malloc,
p); p);
@ -88,6 +89,8 @@ void *my_realloc(void *ptr, size_t sz) {
void *p; void *p;
p = realloc(ptr, sz); p = realloc(ptr, sz);
if (Yap_do_low_level_trace)
fprintf(stderr, "+ %p -> %p : %lu\n", ptr, p, sz);
// Yap_DebugPuts(stderr,"gof\n"); // Yap_DebugPuts(stderr,"gof\n");
if (sz > 500 && write_malloc++ > 0) if (sz > 500 && write_malloc++ > 0)
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "* %d %p", write_malloc, __android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "* %d %p", write_malloc,
@ -97,6 +100,8 @@ void *my_realloc(void *ptr, size_t sz) {
void my_free(void *p) { void my_free(void *p) {
// printf("f %p\n",p); // printf("f %p\n",p);
if (Yap_do_low_level_trace)
fprintf(stderr, "+ %p\n", p);
if (write_malloc && write_malloc++ > 0) if (write_malloc && write_malloc++ > 0)
__android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "- %d %p", write_malloc, __android_log_print(ANDROID_LOG_ERROR, "YAPDroid ", "- %d %p", write_malloc,
p); p);