debug
This commit is contained in:
parent
abdc8a35f9
commit
af29600f09
18
C/alloc.c
18
C/alloc.c
@ -8,10 +8,9 @@
|
|||||||
* *
|
* *
|
||||||
**************************************************************************
|
**************************************************************************
|
||||||
* *
|
* *
|
||||||
* File: alloc.c *
|
* File: alloc.c * Last
|
||||||
* Last rev: *
|
*rev: * mods:
|
||||||
* mods: *
|
** comments: allocating space *
|
||||||
* comments: allocating space *
|
|
||||||
* version:$Id: alloc.c,v 1.95 2008-05-10 23:24:11 vsc Exp $ *
|
* version:$Id: alloc.c,v 1.95 2008-05-10 23:24:11 vsc Exp $ *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
#ifdef SCCS
|
#ifdef SCCS
|
||||||
@ -78,7 +77,7 @@ 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)
|
if (Yap_do_low_level_trace)
|
||||||
fprintf(stderr, "+ %p: %" Sizet_F "\n", p, sz);
|
fprintf(stderr, "+s %p\n @%p %ld\n", p, TR, LCL0 - (CELL *)LCL0);
|
||||||
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);
|
||||||
@ -93,15 +92,15 @@ void *my_realloc(void *ptr, size_t sz) {
|
|||||||
// fprintf(stderr, "+ %p -> %p : " Sizet_F "\n", ptr, p, sz);
|
// fprintf(stderr, "+ %p -> %p : " Sizet_F "\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",
|
||||||
p);
|
write_malloc, p);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
if (Yap_do_low_level_trace)
|
||||||
fprintf(stderr, "+ %p\n", p);
|
fprintf(stderr, "- %p\n @%p %ld\n", p, TR, LCL0 - (CELL *)LCL0);
|
||||||
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);
|
||||||
@ -1496,7 +1495,8 @@ void Yap_InitMemory(UInt Trail, UInt Heap, UInt Stack) {
|
|||||||
(UInt)LOCAL_TrailTop);
|
(UInt)LOCAL_TrailTop);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
fprintf(stderr, "Heap+Aux: " UInt_FORMAT "\tLocal+Global: " UInt_FORMAT
|
fprintf(stderr,
|
||||||
|
"Heap+Aux: " UInt_FORMAT "\tLocal+Global: " UInt_FORMAT
|
||||||
"\tTrail: " UInt_FORMAT "\n",
|
"\tTrail: " UInt_FORMAT "\n",
|
||||||
pm - sa - ta, sa, ta);
|
pm - sa - ta, sa, ta);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user