Bug 135410

Summary: Cannot debug 64-bit userspace.
Product: [Fedora] Fedora Reporter: David Woodhouse <dwmw2>
Component: gdbAssignee: Andrew Cagney <cagney>
Status: CLOSED ERRATA QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: rawhideCC: cagney, jakub, jjohnstn, jlaska, jturner
Target Milestone: ---   
Target Release: ---   
Hardware: powerpc   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2004-11-29 15:30:46 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 123268, 135876    

Description David Woodhouse 2004-10-12 15:46:25 UTC
Description of problem:
Debugging 64-bit userspace programs fails. With the shipped 32-bit gdb
package, we can't even load 64-bit executables. With the 64-bit gdb
which we don't actually ship, I get this...

Script started on Tue 12 Oct 2004 15:46:42 BST
fish /home/dwmw2 $ cat helloworld.c
#include <stdio.h>
 
int main(void)
{
        printf("Hello world\n");
        return 0;
}
 
fish /home/dwmw2 $ gcc -g -m64 helloworld.c
fish /home/dwmw2 $ rpm -q --qf
%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\\n gdb
gdb-6.1post-1.20040607.38.ppc64
fish /home/dwmw2 $ gdb a.out
GNU gdb Red Hat Linux (6.1post-1.20040607.38rh)
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 "ppc64-redhat-linux-gnu"...Using host
libthread_db library "/lib64/tls/libthread_db.so.1".
 
(gdb) break main
Breakpoint 1 at 0x10000534: file helloworld.c, line 5.
(gdb) run
Starting program: /home/dwmw2/a.out
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
warning: Breakpoint address adjusted from 0x10010960 to 0x100003b8.
 
Breakpoint 1, 0x0000000010000534 in ?? ()
(gdb) q
The program is running.  Exit anyway? (y or n) y
fish /home/dwmw2 $ gcc -g -m32 helloworld.c
fish /home/dwmw2 $ gdb a.out
GNU gdb Red Hat Linux (6.1post-1.20040607.38rh)
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 "ppc64-redhat-linux-gnu"...Using host
libthread_db library "/lib64/tls/libthread_db.so.1".
 
(gdb) break main
Breakpoint 1 at 0x1000042c: file helloworld.c, line 5.
(gdb) run
Starting program: /home/dwmw2/a.out
 
Breakpoint 1, main () at helloworld.c:5
5               printf("Hello world\n");
(gdb) q
The program is running.  Exit anyway? (y or n) y
fish /home/dwmw2 $ exit
 
Script done on Tue 12 Oct 2004 16:45:43 BST

Comment 1 Bill Nottingham 2004-10-12 16:37:48 UTC
AFAIK, if you install from the ppc64 tree, you get 64-bit gdb. If you
install from the ppc32 tree, you get 32-bit gdb.

Comment 2 David Woodhouse 2004-10-12 16:44:40 UTC
This was the 64-bit gdb. 

However, the ppc32 install tree is biarch and does contain most
packages you need for 64-bit operation -- the kernel, all libraries
etc. It's just that it doesn't include a 64-bit gdb.

Not that this is much of a loss while the 64-bit gdb doesn't actually
_work_, mind you... :)

Comment 3 Elena Zannoni 2004-10-13 18:41:23 UTC
can you do a rpm -q of binutils and glibc?

Comment 4 Andrew Cagney 2004-10-13 18:48:07 UTC
How recent is your binutils (and GCC) - can you down grade a little? 
There's a ABI change looming that strips the executable of half the
symbols that may cause this.  Does the executable contain both "main"
and ".main", or just "main".

Comment 5 David Woodhouse 2004-10-13 20:20:12 UTC
Yes my tools are recent enough to use the new ppc64 ABI. Will try
downgrading in the morning.


Comment 6 David Woodhouse 2004-10-14 06:11:53 UTC
Using the old ABI does make GDB happy again...

fish /home/dwmw2 $ gcc -g -m64 -mcall-aixdesc helloworld.c
fish /home/dwmw2 $ gdb a.out
GNU gdb Red Hat Linux (6.0post-0.20040223.19rh)
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 "ppc64-redhat-linux-gnu"...Using host
libthread_db library "/lib64/tls/libthread_db.so.1".
 
(gdb) break main
Breakpoint 1 at 0x10000534: file helloworld.c, line 5.
(gdb) run
Starting program: /home/dwmw2/a.out
warning: Unable to find dynamic linker breakpoint function.
GDB will be unable to debug shared library initializers
and track explicitly loaded dynamic code.
warning: Breakpoint address adjusted from 0x10010960 to 0x100003b8.
 
Breakpoint 1, main () at helloworld.c:5
5               printf("Hello world\n");
(gdb)


Comment 7 David Woodhouse 2004-10-14 06:17:08 UTC
Sorry, Elena: 
fish /home/dwmw2 $ rpm -q --qf
%{NAME}-%{VERSION}-%{RELEASE}.%{ARCH}\\n glibc binutils
glibc-2.3.3-66.ppc
glibc-2.3.3-66.ppc64
binutils-2.15.92.0.2-2.ppc


Comment 12 Elena Zannoni 2004-10-20 18:49:55 UTC
Andrew has a workaround in gdb now.

Comment 13 Andrew Cagney 2004-10-21 19:47:30 UTC
Nope, still present with .41. more debugging ...

Comment 14 Andrew Cagney 2004-10-21 22:01:15 UTC
Try fish:~cagney/PENDING/devel/64/gdb/gdb

On 64-bit PPC, the _dl_debug_state symbol is in the data section,
tweaking solib-svr4.c to search all sections for the symbol gets
around the problem.  Need to figure out why it's in the data section.


Comment 15 Andrew Cagney 2004-10-22 20:54:51 UTC
gdb-6.1post-1.20040607.42, if it ever makes it through beehive,
sitting in fc3-HEAD should contain the fix.

Comment 16 Elena Zannoni 2004-10-26 14:48:31 UTC
Where is the gdb .42? I can't find it. Did the build complete?

Comment 17 Andrew Cagney 2004-10-27 04:56:58 UTC
The build was canned (along with an s390), there should be a .43 build
in fc3-HEAD.

Comment 19 Jay Turner 2004-11-12 10:14:56 UTC
David, would you mind retesting with the latest gdb and let us know if it suits
your needs?  Thanks!

Comment 20 David Woodhouse 2004-11-29 15:30:18 UTC
Seems OK now, and we do actually have the ppc64 gdb in the compose.

Comment 21 John Flanagan 2004-12-21 19:37:20 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on the solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHBA-2004-561.html