Bug 150591 - gdb fails completely for gcc4 compiled -pie executable shared objects
Summary: gdb fails completely for gcc4 compiled -pie executable shared objects
Alias: None
Product: Fedora
Classification: Fedora
Component: gdb
Version: rawhide
Hardware: All
OS: Linux
Target Milestone: ---
Assignee: Elena Zannoni
QA Contact:
Depends On: 133944
Blocks: 130423 FC5Blocker FC4Update
TreeView+ depends on / blocked
Reported: 2005-03-08 20:06 UTC by Jason Vas Dias
Modified: 2007-11-30 22:11 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Last Closed: 2005-08-23 15:44:53 UTC
Type: ---

Attachments (Terms of Use)

Description Jason Vas Dias 2005-03-08 20:06:41 UTC
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

How reproducible:


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 (
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
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for
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
Cannot insert breakpoint 1.
Error accessing memory address 0x5ba: Input/output error.

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:

Comment 1 Jason Vas Dias 2005-03-08 20:09:14 UTC
Exactly the same result occurs if object is compiled with
  $ gcc -fPIE -g -o t.o -c t.c

Comment 2 Warren Togami 2005-05-28 08:18:22 UTC
Any status update?  This bug is on the FC4Blocker list but this is probably too
late now.

Comment 3 Jason Vas Dias 2005-06-10 23:17:53 UTC
At least there seems to have been some progress on this issue.

With gcc-4.0.0-9 and gdb-, 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.

Comment 4 Jason Vas Dias 2005-08-23 15:44:53 UTC
This bug now seems to be fixed with :
  - gcc-4.0.1-9
  - binutils-
  - glibc-2.3.90-9
  - gdb-
  - 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.

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