Bug 455714 - gdb shows wrong source code.
Summary: gdb shows wrong source code.
Keywords:
Status: CLOSED WORKSFORME
Alias: None
Product: Red Hat Enterprise Linux 4
Classification: Red Hat
Component: gdb
Version: 4.0
Hardware: x86_64
OS: Linux
low
medium
Target Milestone: rc
: ---
Assignee: Jan Kratochvil
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2008-07-17 11:13 UTC by Yoshihiro Kagawa
Modified: 2008-07-29 08:29 UTC (History)
1 user (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2008-07-29 08:29:57 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)
Reproducer (747 bytes, application/octet-stream)
2008-07-17 11:13 UTC, Yoshihiro Kagawa
no flags Details

Description Yoshihiro Kagawa 2008-07-17 11:13:17 UTC
Description of problem:
gdb shows wrong source code. (on x86_64 server)

Version-Release number of selected component (if applicable):
gdb-6.3.0.0-1.132.EL4
gcc-3.4.6-3.1

How reproducible:
Always.

Steps to Reproduce:
1. $ tar -zxf gdb_test.tgz
   It appears directory, gdb_test.

2. make
   $ cd gdb_test/
   $ ./gdbtest_automake.sh

4. Set environment variable.
   $ export LD_LIBRARY_PATH=`pwd`

5. Exec binary.
   $ gdb gdb_tp

Actual results:
  1. (gdb) b 17
  2. (gdb) run
  3. (gdb) s
In this example, gdb should show c++ constructor's source code.
gdb showed wrong code.
For instance, my actual results are showed the following...
0x0000002a95557c9c in test_class::test_class () at
/usr/lib/gcc/x86_64-linux/3.4.6/../../../../include/c++/3.4.6/bits/locale_facets.tcc:2443

Expected results:
  1. (gdb) b 17
  2. (gdb) run
  3. (gdb) s
gdb should show c++ constructor source code.

Additional info:
I tried to identify an affecting patch in the source rpm.
When I removed gdb-6.3-ppc64section-20041026.patch, it worked as I expected.
I don't understand the meaning of this patch, yet.
I appreciate if anyone kindly explains me more abount this patch.

Is this patch needed for x86_64 server? Or only for ppc64 arch?
Is there any reason why the patch was not merged into GNU-gdb?

Comment 1 Yoshihiro Kagawa 2008-07-17 11:13:17 UTC
Created attachment 312032 [details]
Reproducer

Comment 2 Jan Kratochvil 2008-07-29 08:29:57 UTC
On F-9 x86_64:
$ cat >cmd
file ./gdb_tp
b 17
r
$ LD_LIBRARY_PATH=`pwd` /tmp/gdb-6.3.0.0-1.132.EL4.x86_64/usr/bin/gdb -silent -x
./cmd 
Using host libthread_db library "/lib64/libthread_db.so.1".
Breakpoint 1 at 0x400807: file gdb_tp.cc, line 17.

Breakpoint 1, gdb_tp () at gdb_tp.cc:17
17	    p_class = new test_class();
(gdb) q

gcc-4.3.1-4.x86_64
libstdc++-4.3.1-4.x86_64

On RHEL-4 please try to use rather `gcc4'.
Also the tested GDB release is very old, recent RHEL-4 release is
gdb-6.3.0.0-1.159.el4.


> Is there any reason why the patch was not merged into GNU-gdb?

Please ask upstream, there is not enough workforce to review all the incoming
patches.


Please submit a RHEL-4 request ticket through your RHEL-4 service contract.



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