www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/03/25/13:45:23

From: buers AT gmx DOT de (Dieter Buerssner)
Newsgroups: comp.os.msdos.djgpp
Subject: Gdb and floating point
Date: 25 Mar 2000 15:01:41 GMT
Lines: 32
Message-ID: <8bikck$54qp1$1@fu-berlin.de>
NNTP-Posting-Host: pec-45-53.tnt3.s2.uunet.de (149.225.45.53)
Mime-Version: 1.0
X-Trace: fu-berlin.de 953996501 5401377 149.225.45.53 (16 [17104])
X-Posting-Agent: Hamster/1.3.13.0
User-Agent: Xnews/03.02.04
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Is there a possibility to print floating point values, that are 
currently in a floating point register, by the name of the variable?
(info all-register shows the values, but it can be very tedious
to find out which register corresponds to which name.)

To give an example, I compiled the following program:

#include <stdio.h>

double one = 1.0;

int main(void)
{
  double d;

  d = 2.0*one;
  printf("%f\n", d);
  return 0;
}

with gcc -g -O test.c (or -gstabs+ instead of -g).
When I set a breakpoint to the printf line and type

"p d"

after the breakpoint is hit, gdb (4.18) replies with

$1 = 1.4128210791984452e-303

which is obviously wrong. ("p one" works as expected)

-- Dieter

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019