Bug 183691 - breakpoints broken for -pie linked executable shared objects
Summary: breakpoints broken for -pie linked executable shared objects
Keywords:
Status: CLOSED RAWHIDE
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: rawhide
Hardware: All
OS: Linux
medium
high
Target Milestone: ---
Assignee: Elena Zannoni
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2006-03-02 20:34 UTC by Jason Vas Dias
Modified: 2007-11-30 22:11 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2006-03-10 22:30:44 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jason Vas Dias 2006-03-02 20:34:25 UTC
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 20:39:52 UTC
Reverting to gdb-6.3.0.0-1.106rh fixes the problem .

Comment 2 Jason Vas Dias 2006-03-06 16:41:03 UTC
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 22:30:44 UTC
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.