Bug 183691 - breakpoints broken for -pie linked executable shared objects
breakpoints broken for -pie linked executable shared objects
Status: CLOSED RAWHIDE
Product: Fedora
Classification: Fedora
Component: gdb (Show other bugs)
rawhide
All Linux
medium Severity high
: ---
: ---
Assigned To: Elena Zannoni
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2006-03-02 15:34 EST by Jason Vas Dias
Modified: 2007-11-30 17:11 EST (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2006-03-10 17:30:44 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Jason Vas Dias 2006-03-02 15:34:25 EST
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
Comment 1 Jason Vas Dias 2006-03-02 15:39:52 EST
Reverting to gdb-6.3.0.0-1.106rh fixes the problem .
Comment 2 Jason Vas Dias 2006-03-06 11:41:03 EST
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 .
Comment 3 Jason Vas Dias 2006-03-10 17:30:44 EST
Now fixed with gdb-6.3.0.0-1.122 / binutils-2.16.91.0.6-4 / gcc-4.1.0-3 .
Thanks! 

Note You need to log in before you can comment on or make changes to this bug.