From fbe12357d4aaa2725add205fca71cbbc3cc82f9d Mon Sep 17 00:00:00 2001 From: Paul Pluzhnikov Date: Mon, 1 Aug 2011 16:02:03 +0000 Subject: [PATCH] 2011-08-01 Paul Pluzhnikov PR gdb/13045 * doublest.c (convert_doublest_to_floatformat): Pass correct mantissa length to put_field. testsuite/ChangeLog: 2011-07-30 Paul Pluzhnikov PR gdb/13045 * gdb.base/float.exp: Add new test case for PR gdb/13045 * gdb.base/float.c: New file. --- gdb/ChangeLog | 8 +++++++- gdb/doublest.c | 6 +----- gdb/testsuite/ChangeLog | 6 ++++++ gdb/testsuite/gdb.base/float.c | 32 ++++++++++++++++++++++++++++++++ gdb/testsuite/gdb.base/float.exp | 5 ++++- 5 files changed, 50 insertions(+), 7 deletions(-) create mode 100644 gdb/testsuite/gdb.base/float.c diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 2904980e64d..6e20c0a48ed 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2011-08-01 Paul Pluzhnikov + + PR gdb/13045 + * doublest.c (convert_doublest_to_floatformat): Pass correct + mantissa length to put_field. + 2011-08-01 Jan Kratochvil * stack.c (do_gdb_disassembly): Use RETURN_MASK_ERROR, simplify the @@ -25,7 +31,7 @@ (struct backtrace_command_args, backtrace_command_stub): Remove, merge them into ... (backtrace_command, backtrace_full_command): ... here with a TRY_CATCH. - New variable e, remove variable btargs and its initialization. + New variable e, remove variable btargs and its initialization. 2011-08-01 Tristan Gingold diff --git a/gdb/doublest.c b/gdb/doublest.c index a339887f8ec..0739fdb91a0 100644 --- a/gdb/doublest.c +++ b/gdb/doublest.c @@ -274,10 +274,6 @@ convert_floatformat_to_doublest (const struct floatformat *fmt, *to = dto; } -static void put_field (unsigned char *, enum floatformat_byteorders, - unsigned int, - unsigned int, unsigned int, unsigned long); - /* Set a field which starts at START and is LEN bytes long. DATA and TOTAL_LEN are the thing we are extracting it from, in byteorder ORDER. */ static void @@ -449,7 +445,7 @@ convert_doublest_to_floatformat (CONST struct floatformat *fmt, fmt->exp_len, fmt->exp_nan); /* Be sure it's not infinity, but NaN value is irrel. */ put_field (uto, order, fmt->totalsize, fmt->man_start, - 32, 1); + fmt->man_len, 1); goto finalize_byteorder; } diff --git a/gdb/testsuite/ChangeLog b/gdb/testsuite/ChangeLog index 9e21026e571..0c95a61d0e2 100644 --- a/gdb/testsuite/ChangeLog +++ b/gdb/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2011-07-30 Paul Pluzhnikov + + PR gdb/13045 + * gdb.base/float.exp: Add new test case for PR gdb/13045 + * gdb.base/float.c: New file. + 2011-07-28 Phil Muldoon * gdb.python/py-mi.exp: Test printers returning string hint, and diff --git a/gdb/testsuite/gdb.base/float.c b/gdb/testsuite/gdb.base/float.c new file mode 100644 index 00000000000..052f1d7da4d --- /dev/null +++ b/gdb/testsuite/gdb.base/float.c @@ -0,0 +1,32 @@ +/* This test program is part of GDB, the GNU debugger. + + Copyright 2011 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + */ + +float +foo () +{ + float x = 0.0; + x = 1.0 / x; + return x; +} + +int +main () +{ + foo (); + return 0; +} diff --git a/gdb/testsuite/gdb.base/float.exp b/gdb/testsuite/gdb.base/float.exp index 170ba774af9..21ee7d261d8 100644 --- a/gdb/testsuite/gdb.base/float.exp +++ b/gdb/testsuite/gdb.base/float.exp @@ -27,7 +27,7 @@ if $tracelevel { # -if { [prepare_for_testing float.exp float run.c] } { +if { [prepare_for_testing float.exp float float.c] } { return -1 } @@ -99,3 +99,6 @@ if { [istarget "alpha*-*-*"] } then { } else { gdb_test "info float" "No floating.point info available for this processor." "info float (unknown target)" } + +gdb_test "step" +gdb_test "finish" "Value returned is .* = (inf|nan).*" -- 2.30.2