bug of memprof 0.5.1 (tar.gz)



I use memprof-0.5.1.tar.gz   (ubuntu 8.10)

./configure;  make ; sudo makeinstall
gdb -args memprof a.out
(gdb) set follow-fork-mode child
(gdb) r

Starting program: /usr/local/bin/memprof ./a.out
[Thread debugging using libthread_db enabled]
[New Thread 0xb6cda960 (LWP 28442)]
[Thread debugging using libthread_db enabled]
[New Thread 0xb6cda960 (LWP 28445)]
[New process 28445]
Executing new program: /home/wangxuguang/a.out
warning: Cannot initialize thread debugging library: generic error
warning: Cannot initialize thread debugging library: generic error
[New process 28445]
memintercept (28445): _MEMPROF_SOCKET = /tmp/memprof.iotqZL
memintercept (28445): New process, operation = NEW, old_pid = 0

Program received signal SIGSEGV, Segmentation fault.
(gdb) bt
#0  0xb7f3392f in ?? () from /lib/ld-linux.so.2
#1  0xb7f3d8e7 in ?? () from /lib/ld-linux.so.2
#2  0xb7f39716 in ?? ( ) from /lib/ld-linux.so.2
#3  0xb7f3d2ee in ?? () from /lib/ld-linux.so.2
#4  0xb7ecb0a2 in ?? () from /lib/tls/i686/cmov/libc.so.6
#5  0xb7f39716 in ?? () from /lib/ld-linux.so.2
#6  0xb7ecb265 in __libc_dlopen_mode () from /lib/tls/i686/cmov/libc.so.6
#7  0xb7ea53be in backtrace () from /lib/tls/i686/cmov/libc.so.6
#8  0xb7f275a3 in mi_call_with_backtrace (to_skip=2, callback=0xb7f265c2 <write_stack>, data="" at stack-frame.c:54
#9  0xb7f266fe in do_malloc (size=45, to_skip=1) at memintercept.c:354
#10 0xb7f26741 in malloc (size=45) at memintercept.c:369
#11 0xb7f39824 in ?? () from /lib/ld-linux.so.2
#12 0xb7f34236 in ?? () from /lib/ld-linux.so.2
#13 0xb7f3d8e7 in ?? () from /lib/ld-linux.so.2
#14 0xb7f39716 in ?? () from /lib/ld-linux.so.2
#15 0xb7f3d2ee in ?? () from /lib/ld-linux.so.2
#16 0xb7ecb0a2 in ?? () from /lib/tls/i686/cmov/libc.so.6
#17 0xb7f39716 in ?? () from /lib /ld-linux.so.2
#18 0xb7ecb265 in __libc_dlopen_mode () from /lib/tls/i686/cmov/libc.so.6
#19 0xb7ea53be in backtrace () from /lib/tls/i686/cmov/libc.so.6
#20 0xb7f275a3 in mi_call_with_backtrace (to_skip=2, callback=0xb7f265c2 <write_stack>, data="" at stack-frame.c:54
#21 0xb7f266fe in do_malloc (size=45, to_skip=1) at memintercept.c:354
#22 0xb7f26741 in malloc (size=45) at memintercept.c:369
.....
# more than 3000

the source of a.out is :

int main ()
{
    while (1)
    {
        malloc (100);
        sleep (1);
        printf ("aaaaaaaaaaaaaaaaaaaaaaa\n");
    }
    return 0;
}
 
I watch the source of memprof, the calling list is
 --->domalloc --> mi_call_with_backtrace --> backtrace (in the c library it call malloc)-----
 |                                                                                            |
 |____________________________________________________________________________________________|

so the loop call causeing stack overflowing.

In memprof 0.4.1 the function "stack trace" doesnt's call "backtrace", it compute stack frame by itself.





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]