This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

server/2263: double values are screwed up with the gdbserver on power pc


>Number:         2263
>Category:       server
>Synopsis:       double values are screwed up with the gdbserver on power pc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu May 24 07:58:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator:     c.matuszewski@gmx.de
>Release:        GNU gdb 6.6.50.20070523
>Organization:
>Environment:
uname -a:
Linux pluto-hg 2.6.20 #3 PREEMPT Fri Mar 23 15:34:50 CET 2007 ppc ppc ppc GNU/Linux

gcc -v:
Using built-in specs.
Target: ppc64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --enable-secureplt --with-long-double-128 --host=ppc64-redhat-linux --build=ppc64-redhat-linux --target=ppc64-redhat-linux --with-cpu=default32
Thread model: posix
gcc version 4.1.1 20070105 (Red Hat 4.1.1-51)


This GDB was configured as "powerpc-unknown-linux-gnu".
>Description:
When I debug with the help of the gdbserver on powerpc systems (cpu 750 and cpu 7455) then the program behaves strange. The error also occurs when gdbserver and gdb are running on the same machine (tested on the 7455 machine).
The following program reproduces the bug:

#include <stdio.h>
int main(void) {

    double d = 1.0;
    printf ("d: %f\n", d);
    return 0;
}

If the program is executed without a debugger, the output is :
d: 1.000000
as expected.

If it is debugged with the gdbserver and I step to the line "double d = 1.0;" and step over it (with next) and then continue the programm so that it is finished, the output of the programm is:
d: nan

Also, the double values examined inside gdb (with print or display) show screwed up values ("-nan(0x8000082024000)" when "1" is expected).

When I debug the program only with gdb (without the gdbserver), all works fine.

This bug could be related to bugs #567 and #1934.
>How-To-Repeat:
Compile following program with "gcc -g":
#include <stdio.h>
int main(void) {

    double d = 1.0;
    printf ("d: %f\n", d);
    return 0;
}

Start the program with "gdbserver localhost:1234 a.out".
On an other terminal start gdb with "gdb a.out".
Repeat the following session:

(gdb) target remote tcp:localhost:1234
Remote debugging using tcp:localhost:1234
0x0ffd6210 in _start () from /lib/ld.so.1
(gdb) break main
Breakpoint 1 at 0x10000484: file vektor_test.c, line 4.
(gdb) continue
Continuing.

Breakpoint 1, main () at vektor_test.c:4
4           double d = 1.0;
(gdb) print d
$1 = 2.9194494952774194e+307
(gdb) n
5           printf ("d: %f\n", d);
(gdb) print d
$2 = -nan(0x8000082024000)
(gdb) continue
Continuing.

Program exited normally.

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]