Распечатка 8.7 Использование Electric Fence |
Предыдущая Содержание Следующая |
Распечатка 8.7.
/* efence-test.c */
#include <stdio.h>
main() { int i,j; char * c = (char *)malloc(20); printf("start of efence test\n"); for(i=0; i < 24; i++) c[i] = 'c'; free(c); printf("end of efence test\n"); }
# ls -l libefence.a -rw-rw-r-- 1 raghav raghav 76650 Sep 4 20:38 libefence.a
# gcc -g efence-test.c -L. -lefence -lpthread -o efence-test # gdb ./efence-test
... (gdb) run Starting program: /home/raghav/BK/tmp/memory-debugging/src/efence/ efence-test [New Thread 1073838752 (LWP 6413)]
Electric Fence 2.4.10 Copyright (C) 1987-1999 Bruce Perens <bruce@perens.com> Copyright (C) 2002- 2004 Hayati Ayguen <hayati.ayguen@epost.de>, Procitec GmbH start of efence test:4004dfec
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1073838752 (LWP 6413)] 0x08048a20 in main () at efence-test.c:9 9 c[i] = 'c'; (gdb) print i $1 = 20 (gdb)
|
Предыдущая Содержание Следующая |