Bug#3007: segfault in strcpy is not debuggable
Package: libc5-dev
Version: 5.2.18-6
If I write a simple test program which causes a segfault inside
strcpy, the stack is corrupted in such a way that gdb is unable to
find the correct calling line.
I'm reporting this as a bug against libc5-dev as I believe it may be
something to do with the compilation options used for the libc;
however, it might also be the fault of the compiler, the linker or
gdb.
-chiark:~/junk> cat t.cc
/**/
#include <string.h>
void spong(void) { strcpy(0,"hi"); }
int main(void) { spong(); }
-chiark:~/junk> c++ -g -Wall t.cc
-chiark:~/junk> gdb a.out
GDB is free software and you are welcome to 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.
GDB 4.15.1 (i486-linux), Copyright 1995 Free Software Foundation, Inc...
(gdb) run
Starting program: /usr/ian-home/junk/a.out
Program received signal SIGSEGV, Segmentation fault.
0x4009d713 in strcpy ()
(gdb) where
#0 0x4009d713 in strcpy ()
#1 0x40001fb0 in _dl_interpreter_exit ()
#2 0x8000738 in main () at t.cc:4
#3 0x80006a4 in ___crt_dummy__ ()
(gdb) quit
The program is running. Quit anyway (and kill it)? (y or n) y
-chiark:~/junk> gcc -v
Reading specs from /usr/lib/gcc-lib/i486-linux/2.7.2/specs
gcc version 2.7.2
-chiark:~/junk> dpkg -l ldso gcc libc5-dev libc5 binutils gdb
Desired=Unknown/Install/Remove/Purge
| Status=Not/Installed/Config-files/Unpacked/Failed-config/Half-installed
|/ Err?=(none)/Hold/Reinst-required/X=both-problems (Status,Err: uppercase=bad)
||/ Name Version Description
+++-===============-==============-============================================
ii ldso 1.7.14-4 The Linux dynamic linker, library and utilit
ii gcc 2.7.2-8 The GNU C compiler (ELF version).
ii libc5-dev 5.2.18-6 The Linux C library version 5 (development f
ii libc5 5.2.18-6 The Linux C library version 5 (run-time libr
ii binutils 2.6-2 The GNU assembler and binary utilities (ELF
ii gdb 4.15.1-1 The GNU debugger (ELF and a.out version).
-chiark:~/junk>
Reply to: