Bug 146087 - Can't debug 32 bit apps running on x86_64
Can't debug 32 bit apps running on x86_64
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gdb (Show other bugs)
x86_64 Linux
medium Severity medium
: ---
: ---
Assigned To: Andrew Cagney
Depends On: IT_66003
  Show dependency treegraph
Reported: 2005-01-25 05:23 EST by Johan Walles
Modified: 2007-11-30 17:07 EST (History)
6 users (show)

See Also:
Fixed In Version: RHBA-2005-241
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2005-05-19 08:09:50 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)
Example program. Build on ia32, run on x86_64. (483 bytes, text/plain)
2005-01-25 05:25 EST, Johan Walles
no flags Details
A patch to support vDSO on x86_64 (432 bytes, patch)
2005-02-01 15:53 EST, H.J. Lu
no flags Details | Diff

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2005:187 normal SHIPPED_LIVE gdb bug fix update 2005-05-19 00:00:00 EDT
Red Hat Product Errata RHBA-2005:241 high SHIPPED_LIVE gdb bug fix update 2005-06-09 00:00:00 EDT

  None (edit)
Description Johan Walles 2005-01-25 05:23:39 EST
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.7)
Gecko/20041013 Firefox/0.9.3 (Ubuntu)

Description of problem:

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Build the to-be-attached program on a 32 bit machine
2. Run it on an x86_64 system
3. Attach to it with gdb
4. Print a backtrace

Actual Results:  (gdb) bt
#0  0xffffe410 in ?? ()
#1  0xffffd878 in ?? ()
#2  0x00d2bff4 in ?? () from /lib/tls/libc.so.6
#3  0xffffd6d4 in ?? ()
#4  0x00c90d30 in __nanosleep_nocancel () from /lib/tls/libc.so.6
#5  0x00c90b53 in sleep () from /lib/tls/libc.so.6
Previous frame inner to this frame (corrupt stack?)

Expected Results:  Something like what happens when I try to debug the
same program built for x86_64:

(gdb) bt
#0  0x0000003c0c68e992 in __nanosleep_nocancel () from
#1  0x0000003c0c68e840 in sleep () from /lib64/tls/libc.so.6
#2  0x00000000004005f3 in main (argc=0x1, argv=0x7fbffff808) at

Additional info:
Comment 1 Johan Walles 2005-01-25 05:25:34 EST
Created attachment 110186 [details]
Example program.  Build on ia32, run on x86_64.
Comment 2 Jakub Jelinek 2005-01-25 08:02:16 EST
That's a bug in gdb, not glibc.
If you step stepi out of the vDSO, you get the correct backtrace, so that sounds
like gdb not taking vDSO into account.

The vDSO seems to have correct unwind info as far as I can see:
The section .eh_frame contains:

00000000 00000014 00000000 CIE
  Version:               1
  Augmentation:          "zR"
  Code alignment factor: 1
  Data alignment factor: -4
  Return address column: 8
  Augmentation data:     1b

  DW_CFA_def_cfa: r4 ofs 4
  DW_CFA_offset: r8 at cfa-4

00000018 00000018 0000001c FDE cie=00000000 pc=ffffe400..ffffe410
  DW_CFA_advance_loc: 1 to ffffe401
  DW_CFA_def_cfa_offset: 8
  DW_CFA_offset: r5 at cfa-8
  DW_CFA_advance_loc: 14 to ffffe40f
  DW_CFA_restore: r5
  DW_CFA_def_cfa_offset: 4

Disassembly of section .text.vsyscall:

ffffe400 <__kernel_vsyscall>:
ffffe400:       55                      push   %ebp
ffffe401:       89 cd                   mov    %ecx,%ebp
ffffe403:       0f 05                   syscall
ffffe405:       b9 2b 00 00 00          mov    $0x2b,%ecx
ffffe40a:       8e d1                   mov    %ecx,%ss
ffffe40c:       89 e9                   mov    %ebp,%ecx
ffffe40e:       5d                      pop    %ebp
ffffe40f:       c3                      ret

(and if not, that would be a kernel bug, not glibc).
Comment 3 H.J. Lu 2005-02-01 15:53:50 EST
Created attachment 110523 [details]
A patch to support vDSO on x86_64 

This patch seems to work for me.
Comment 5 Johan Walles 2005-02-11 08:55:16 EST
I can't get that patch to work.

When I run the test program in a gdb that has your patch applied, this
is what happens:

johan@sthqa88:/usr/src/redhat/SOURCES$ gdb ~/src/test/sleepalot
GNU gdb Red Hat Linux (6.1post-1.20040607.62.johan1rh)
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 "x86_64-redhat-linux-gnu"...Using host
libthread_db library "/lib64/tls/libthread_db.so.1".

(gdb) run
Starting program: /home/johan/src/test/sleepalot
Message from syslogd@sthqa88 at Fri Feb 11 14:54:21 2005 ...
sthqa88 kernel: invalid operand: 0000 [3] SMP

Can you confirm that the patch should contain *no* code changes, but
only one change to how gdb is linked?
Comment 6 H.J. Lu 2005-02-11 12:24:59 EST
There are 2 bugs, gdb and kernel. See bug 146803.
Comment 7 Johan Walles 2005-02-11 12:35:04 EST
Unforturnately bug 146803 is secret, so I can't see it :-(.
Comment 8 H.J. Lu 2005-02-14 17:25:22 EST
I submitted a kernel patch for bug 146803, which should be
visible now.
Comment 11 Andrew Cagney 2005-02-21 14:55:51 EST
GDB >= includes the required code.
That leaves the kernel problem.

Comment 12 Tim Powers 2005-05-19 08:09:51 EDT
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.


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