Date: Mon, 10 Apr 2000 17:09:37 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: Dieter Buerssner cc: djgpp-workers AT delorie DOT com Subject: Re: One more GDB for DJGPP little oddity In-Reply-To: <200004101325.JAA17297@delorie.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Errors-To: nobody AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk On Mon, 10 Apr 2000, Dieter Buerssner wrote: > > On Fri, 7 Apr 2000, Pierre Muller wrote: > > > > > if I have a long double var named x of value 1e+4893 > > > if I print it out > > > > > > "p x" > > > I get > > > " 1e+4893" > > > > > > but once loaded onto FPU stack > > > I get +Inf on the right part of the display ! > > I have asked a similar question in comp.os.msdos.djgpp. Gdb just > cannot display floating point numbers, that are loaded into the FPU. Sorry, I don't think that's what Pierre was saying (I asked for an example program to be sure I understand). I think he was saying that when this particular value, 1e+4893 (which cannot be *but* a long double), is loaded into the FPU, "info float" displays Inf instead of its value (which is large, but finite). Your question was about another situation, as far as I understood: you had a program where an FP variable was loaded into the FPU, and when that happened, GDB couldn't track its value when you used the "print" command. In contrast, Pierre seems to say that "print" does work correctly. > This seems not to be a DJGPP specific thing. It cannot print the > values on Linux either. Gdb just prints more or less random garbage. > (And I tried the -ggdb and similar options as well.) Yes, IIRC this was discussed on the GDB developers' list. The problem is that GCC doesn't emit enough info for the debugger to know when the variable is in an FP register, and in what register exactly. This is a GCC problem, not a GDB problem. > To debug floating point, you can try to use the compiler option > -ffloat-store. Then Gdb seems to be able to print the values. But > this has some disadvantages as well, because the results of the > program compiled with and without -ffloat-store may differ (and > a performance penalty, that probably won't matter while debugging) . Yes. Therefore, I think that using "info float" is a much better way. You need to get used to the way x87 operates to find where the values are, but that's not very hard.