Description of problem: gdb is unable to break into a -pie linked executable shared object: $ echo 'int main(int argc, char **argv, char **envp){ return 0;}' > t.c $ gcc -g -fPIE -o t.o -c t.c $ gcc -pie -o t t.o $ gdb t $ gdb t GNU gdb Red Hat Linux (6.3.0.0-1.110rh) 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"...Using host libthread_db library "/lib/libthread_db.so.1". (gdb) start Breakpoint 1 at 0x5bc: file t.c, line 1. Starting program: /tmp/t Reading symbols from shared object read from target memory...done. Loaded system supplied DSO at 0x111000 Breakpoint 1 at 0x613724: file t.c, line 1. Program exited with code 0264. (gdb) break main Note: breakpoint 1 (disabled) also set at pc 0x613724. Breakpoint 2 at 0x613724: file t.c, line 1. (gdb) run warning: cannot close "shared object read from target memory": Invalid operation Starting program: /tmp/t Reading symbols from shared object read from target memory...done. Loaded system supplied DSO at 0x111000 Breakpoint 1 at 0x973cebc: file t.c, line 1. Breakpoint 2 at 0x973cebc: file t.c, line 1. Program exited with code 0124. (gdb) The problem does not occur if the only the '-pie' option is omitted from the link - ie: $ gcc -g -fPIE -o t.o -c t.c $ gcc -o t t.o and the problem does not occur. Compiling with / without -fPIE seems to make no difference - the problem is only triggered for an executable linked with -pie . Version-Release number of selected component (if applicable): gdb-6.3.0.0-1.110 How reproducible: 100% Steps to Reproduce: Try to break into a -pie linked executable Actual results: Break fails Expected results: gdb should halt execution at the breakpoint
Reverting to gdb-6.3.0.0-1.106rh fixes the problem .
This is still a problem with gdb-6.3.0.0-1.114rh - again, reverting to gdb-6.3.0.0-1.106rh fixes the problem .
Now fixed with gdb-6.3.0.0-1.122 / binutils-2.16.91.0.6-4 / gcc-4.1.0-3 . Thanks!