This is the mail archive of the gdb@sources.redhat.com 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]

examining floating point data with 'print' on non floating point kernel


Hi,

I am trying to use the 'print' command on a function declared in the 
program being debugged.  This function takes in 10 values and prints them 
with a printf(%f).  The program prints the values correctly if run 
independently of gdb.  If the program is run on gdb normally (meaning with 
just run) they also print correctly.  However, when called with the print 
command the output is unexpected and it prints either 0.00000 or nan where 
the various floating point values should be.  This works fine on a power 3 
ppc box but does not work on the 440GP.

The code of the program being debugged is identical to the 
print_ten_doubles() function in the tesuite's call-ar-st test in gdb.base 
where the body of the program is:

print_ten_doubles(double d1, double d2, ..., double d9, double d10)
{
        printf("Two doubles: %f\t%f\n", d1, d2);
        ...
        printf("Two doubles: %f\t%f\n", d9, d10);
}


Here is the output:

GNU gdb 6.3.50.20050608-cvs
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 "ppc-linux"...Using host libthread_db library 
"/lib/.

(gdb) b main
Breakpoint 1 at 0x1000051c: file doubles.c, line 27.
(gdb) r
Starting program: /root/printdouble

Breakpoint 1, main () at doubles.c:27
27      doubles.c: No such file or directory.
        in doubles.c
(gdb) print print_ten_doubles(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 
0.0)
Two Doubles : 0.000000  nan
Two Doubles : 0.000000  nan
Two Doubles : 9.900000  0.000000
Two Doubles : 0.000000  nan
Two Doubles : 0.000000  nan
$1 = void
(gdb) c
Continuing.
Two Doubles : 123.456000        123.456000
Two Doubles : -0.120000 -1.230000
Two Doubles : 343434.800000     89.098000
Two Doubles : 3.140000  -5678.123450
Two Doubles : -0.111111 216.970650

Program exited normally.
(gdb)

(gdb) set debug expression 10
(gdb) r
Starting program: /root/printdouble

Breakpoint 1, main () at doubles.c:27
27      in doubles.c
(gdb) print print_ten_doubles(1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 
0.0)

Dump of expression @ 0x107aa830'
        Language c, 47 elements, 8 bytes each.
        Index                Opcode         Hex Value  String Value
            0          OP_VAR_VALUE  188978561024  ...,....
            1               OP_NULL  0  ........
            2   <unknown 273620248>  1175190016683409408  .O......
            3          OP_VAR_VALUE  188978561024  ...,....
            4             OP_DOUBLE  184683593728  ...+....
            5   <unknown 273643112>  1175288216815665152  .Ovh....
            6  <unknown 1072798105>  4607632778762754458  ?.......
            7             OP_DOUBLE  184683593728  ...+....
            8             OP_DOUBLE  184683593728  ...+....
            9   <unknown 273643112>  1175288216815665152  .Ovh....
           10  <unknown 1073846681>  4612136378390124954  @.......
           11             OP_DOUBLE  184683593728  ...+....
           12             OP_DOUBLE  184683593728  ...+....
           13   <unknown 273643112>  1175288216815665152  .Ovh....
           14  <unknown 1074423398>  4614613358185178726  @.ffffff
           15             OP_DOUBLE  184683593728  ...+....
           16             OP_DOUBLE  184683593728  ...+....
           17   <unknown 273643112>  1175288216815665152  .Ovh....
           18  <unknown 1074895257>  4616639978017495450  @.......
           19             OP_DOUBLE  184683593728  ...+....
           20             OP_DOUBLE  184683593728  ...+....
           21   <unknown 273643112>  1175288216815665152  .Ovh....
           22  <unknown 1075183616>  4617878467915022336  @.......
           23             OP_DOUBLE  184683593728  ...+....
           24             OP_DOUBLE  184683593728  ...+....
           25   <unknown 273643112>  1175288216815665152  .Ovh....
           26  <unknown 1075471974>  4619116957812549222  @.ffffff
           27             OP_DOUBLE  184683593728  ...+....
           28             OP_DOUBLE  184683593728  ...+....
           29   <unknown 273643112>  1175288216815665152  .Ovh....
           30  <unknown 1075760332>  4620355447710076109  @.......
           31             OP_DOUBLE  184683593728  ...+....
           32             OP_DOUBLE  184683593728  ...+....
           33   <unknown 273643112>  1175288216815665152  .Ovh....
           34  <unknown 1075943833>  4621143577644865946  @!......
           35             OP_DOUBLE  184683593728  ...+....
           36             OP_DOUBLE  184683593728  ...+....
           37   <unknown 273643112>  1175288216815665152  .Ovh....
           38  <unknown 1076088012>  4621762822593629389  @#......
           39             OP_DOUBLE  184683593728  ...+....
           40             OP_DOUBLE  184683593728  ...+....
           41   <unknown 273643112>  1175288216815665152  .Ovh....
           42               OP_NULL  0  ........
           43             OP_DOUBLE  184683593728  ...+....
           44            OP_FUNCALL  206158430208  ...0....
           45               OP_NULL  10  ........
           46            OP_FUNCALL  206158430208  ...0....

Dump of expression @ 0x107aa830, after conversion to prefix form:
Expression: `print_ten_doubles (1.1000000000000001, 2.2000000000000002, 
3.299999999999999, 4.4000000000000004, 5.5, 6.5999999999999996, 
7.7000000000000002, 8.8000000000000007, 9.9000000000000004, 0)'
        Language c, 47 elements, 8 bytes each.


            0  OP_FUNCALL            Number of args: 10
            3    OP_VAR_VALUE          Block @0x0, symbol @0x104f1d18 
(print_te)
            7    OP_DOUBLE             Type @0x104f7668 (double), value 
1.1
           11    OP_DOUBLE             Type @0x104f7668 (double), value 
2.2
           15    OP_DOUBLE             Type @0x104f7668 (double), value 
3.3
           19    OP_DOUBLE             Type @0x104f7668 (double), value 
4.4
           23    OP_DOUBLE             Type @0x104f7668 (double), value 
5.5
           27    OP_DOUBLE             Type @0x104f7668 (double), value 
6.6
           31    OP_DOUBLE             Type @0x104f7668 (double), value 
7.7
           35    OP_DOUBLE             Type @0x104f7668 (double), value 
8.8
           39    OP_DOUBLE             Type @0x104f7668 (double), value 
9.9
           43    OP_DOUBLE             Type @0x104f7668 (double), value 0

Two Doubles : 0.000000  nan
Two Doubles : 0.000000  nan
Two Doubles : 9.900000  0.000000
Two Doubles : 0.000000  nan
Two Doubles : 0.000000  nan

$2 = void
(gdb)

Any suggestions?

Thanks,
Claudia




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