Bug 150591 - gdb fails completely for gcc4 compiled -pie executable shared objects
gdb fails completely for gcc4 compiled -pie 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: 133944
Blocks: 130423 FC5Blocker FC4Update
  Show dependency treegraph
 
Reported: 2005-03-08 15:06 EST by Jason Vas Dias
Modified: 2007-11-30 17:11 EST (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2005-08-23 11:44:53 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:


Attachments (Terms of Use)

  None (edit)
Description Jason Vas Dias 2005-03-08 15:06:41 EST
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:
Comment 1 Jason Vas Dias 2005-03-08 15:09:14 EST
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 04:18:22 EDT
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 19:17:53 EDT
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.

Comment 4 Jason Vas Dias 2005-08-23 11:44:53 EDT
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.

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