Listing 5. Memory Debugging with Electric Fence within GDB
<home>$ gdb ./mytest00
GNU gdb 19991004
Copyright 1998 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General
Public License, and you are welcome to change it
and/or distribute copies of it under certain
conditions. Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show
warranty" for details.
This GDB was configured as "i386-linux-linux"...
(gdb) r
Starting program: ./mytest00
Electric Fence 2.0.5 Copyright (C) 1987-1998 Bruce
Perens.
Program received signal SIGSEGV, Segmentation fault.
strcpy (dest=0x4014fffc "hell", src=0x8049948 "hello
Linux users")
at ../sysdeps/generic/strcpy.c:40
40 ../sysdeps/generic/strcpy.c: No such file or
directory.
(gdb) bt
#0 strcpy (dest=0x4014fffc "hell", src=0x8049948
"hello Linux users")
at ../sysdeps/generic/strcpy.c:40
#1 0x804882b in main (argc=1, argv=0xbffff854) at
mytest00.c:8
(gdb)
Copyright © 1994 - 2019 Linux Journal. All rights reserved.