Description of problem: gdb completely fails to debug executable shared objects compiled with gcc4 . Version-Release number of selected component (if applicable): $ rpm -q gdb gcc glibc binutils --queryformat '%{NAME}-%{VERSION}-%{RELEASE}-%{ARCH}\n' gdb-6.3.0.0-0.29-i386 gcc-4.0.0-0.31-i386 glibc-2.3.4-14-i686 binutils-2.15.94.0.2-4-i386 How reproducible: 100% Steps to Reproduce: $ echo 'int main(int argc, char **argv, char **envp){ return (0); }' > t.c $ gcc -fPIE -o t.o -c t.c $ gcc -pie -o t t.o $ gdb t GNU gdb Red Hat Linux (6.3.0.0-0.29rh) Copyright 2004 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-redhat-linux-gnu"...(no debugging symbols found) Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) break main Breakpoint 1 at 0x5ba (gdb) run Starting program: /tmp/t Warning: Cannot insert breakpoint 1. Error accessing memory address 0x5ba: Input/output error. (gdb) Actual results: Cannot set breakpoint at function address Expected results: 'break main' must correctly set a breakpoint at the main() entrypoint when the program is run, regardless of whether it is -fPIE/-pie or not. Additional info:
Exactly the same result occurs if object is compiled with $ gcc -fPIE -g -o t.o -c t.c
Any status update? This bug is on the FC4Blocker list but this is probably too late now.
At least there seems to have been some progress on this issue. With gcc-4.0.0-9 and gdb-6.3.0.0-1.24rh, having ANY -fpie / -fPIE compiled object in an executable resulted in bogus break addresses for any entry point, even if the executable was not linked -pie, and you were trying to break into a non -fpie compiled object. When I upgraded to gcc-4.0.0-11, I can now break into a non -pie linked executable which contains -fpie compiled objects, and even break into -fpie compiled objects which are compiled with -g3 -gdwarf-2 . Still, gdb gets bogus break addresses for any -pie linked executable into either -fpie or non -fpie compiled objects.
Hooray! This bug now seems to be fixed with : - gcc-4.0.1-9 - binutils-2.16.91.0.2-4 - glibc-2.3.90-9 - gdb-6.3.0.0-1.61 - kernel-2.6.12-1.1504_FC5 The 't.c' compile test above now works, and gdb is now able to break into any -fPIE / no -fPIE compiled object in a -pie linked executable. As to which of the above components actually fixed this bug, I don't know, but it is now fixed in Rawhide.