From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 1157 invoked by alias); 15 Jul 2005 01:08:34 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 1131 invoked by uid 22791); 15 Jul 2005 01:08:27 -0000 Received: from e32.co.us.ibm.com (HELO e32.co.us.ibm.com) (32.97.110.130) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Fri, 15 Jul 2005 01:08:27 +0000 Received: from d03relay04.boulder.ibm.com (d03relay04.boulder.ibm.com [9.17.195.106]) by e32.co.us.ibm.com (8.12.10/8.12.9) with ESMTP id j6F18P2a269410 for ; Thu, 14 Jul 2005 21:08:25 -0400 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay04.boulder.ibm.com (8.12.10/NCO/VER6.6) with ESMTP id j6F18PQD236508 for ; Thu, 14 Jul 2005 19:08:25 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11/8.13.3) with ESMTP id j6F18OPq011903 for ; Thu, 14 Jul 2005 19:08:24 -0600 Received: from d03nm113.boulder.ibm.com (d03nm113.boulder.ibm.com [9.17.195.139]) by d03av02.boulder.ibm.com (8.12.11/8.12.11) with ESMTP id j6F18OCm011884; Thu, 14 Jul 2005 19:08:24 -0600 To: gdb@sources.redhat.com Cc: drow@false.org MIME-Version: 1.0 Subject: examining floating point data with 'print' on non floating point kernel Message-ID: From: Claudia Salzberg Date: Fri, 15 Jul 2005 01:08:00 -0000 Content-Type: text/plain; charset="US-ASCII" X-SW-Source: 2005-07/txt/msg00176.txt.bz2 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 1175190016683409408 .O...... 3 OP_VAR_VALUE 188978561024 ...,.... 4 OP_DOUBLE 184683593728 ...+.... 5 1175288216815665152 .Ovh.... 6 4607632778762754458 ?....... 7 OP_DOUBLE 184683593728 ...+.... 8 OP_DOUBLE 184683593728 ...+.... 9 1175288216815665152 .Ovh.... 10 4612136378390124954 @....... 11 OP_DOUBLE 184683593728 ...+.... 12 OP_DOUBLE 184683593728 ...+.... 13 1175288216815665152 .Ovh.... 14 4614613358185178726 @.ffffff 15 OP_DOUBLE 184683593728 ...+.... 16 OP_DOUBLE 184683593728 ...+.... 17 1175288216815665152 .Ovh.... 18 4616639978017495450 @....... 19 OP_DOUBLE 184683593728 ...+.... 20 OP_DOUBLE 184683593728 ...+.... 21 1175288216815665152 .Ovh.... 22 4617878467915022336 @....... 23 OP_DOUBLE 184683593728 ...+.... 24 OP_DOUBLE 184683593728 ...+.... 25 1175288216815665152 .Ovh.... 26 4619116957812549222 @.ffffff 27 OP_DOUBLE 184683593728 ...+.... 28 OP_DOUBLE 184683593728 ...+.... 29 1175288216815665152 .Ovh.... 30 4620355447710076109 @....... 31 OP_DOUBLE 184683593728 ...+.... 32 OP_DOUBLE 184683593728 ...+.... 33 1175288216815665152 .Ovh.... 34 4621143577644865946 @!...... 35 OP_DOUBLE 184683593728 ...+.... 36 OP_DOUBLE 184683593728 ...+.... 37 1175288216815665152 .Ovh.... 38 4621762822593629389 @#...... 39 OP_DOUBLE 184683593728 ...+.... 40 OP_DOUBLE 184683593728 ...+.... 41 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