Mail Archives: djgpp/2002/09/23/01:44:57
From: | "Dr. Pablo A. Perez-Fernandez" <pperez10 AT nyc DOT rr DOT com>
|
Newsgroups: | comp.os.msdos.djgpp
|
Subject: | problems with GDB examining long double variables in C
|
Lines: | 68
|
X-Priority: | 3
|
X-MSMail-Priority: | Normal
|
X-Newsreader: | Microsoft Outlook Express 6.00.2600.0000
|
X-MimeOLE: | Produced By Microsoft MimeOLE V6.00.2600.0000
|
Message-ID: | <Guvj9.8474$R8.2779572@twister.nyc.rr.com>
|
Date: | Mon, 23 Sep 2002 03:01:58 GMT
|
NNTP-Posting-Host: | 66.65.1.102
|
X-Complaints-To: | abuse AT rr DOT com
|
X-Trace: | twister.nyc.rr.com 1032750118 66.65.1.102 (Sun, 22 Sep 2002 23:01:58 EDT)
|
NNTP-Posting-Date: | Sun, 22 Sep 2002 23:01:58 EDT
|
Organization: | Road Runner - NYC
|
To: | djgpp AT delorie DOT com
|
DJ-Gateway: | from newsgroup comp.os.msdos.djgpp
|
Reply-To: | djgpp AT delorie DOT com
|
Below follows a short transcript of a session. Note how the printf prints
the right value and "p EBIT" screws up in GDB. Any ideas as to why this is
happening.
I am using GDB 5.1.1 and GCC 3.1 through the DJGPP
distribution on Windows 2000 PC. Incidentally, the
printf yields the correct answer. It is the "p EBIT"
command in GDB that gives the wrong answer. Below
follows a log of a session printing, compiling and
debugging the program. Observe how the printf
statement works right but the p command fails in the
debugger. Thanks in advance for you help.
C:\DOCUME~1\perezpa\Desktop\9-20-2~1>type test2.c
#define MAX_NUMBER_YEARS 151
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
long double EBIT;
EBIT = 4.0;
printf("The long double is %Lf.\n", EBIT);
exit(0);
}
C:\DOCUME~1\perezpa\Desktop\9-20-2~1>gcc -Wall -g -o a.exe test2.c
C:\DOCUME~1\perezpa\Desktop\9-20-2~1>gdb a.exe
GNU gdb 5.1.1
Copyright 2002 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 "i386-pc-msdosdjgpp"...
(gdb) break 8
Breakpoint 1 at 0x160a: file test2.c, line 8.
(gdb) run
Starting program: c:/Documents and
Settings/perezpa/Desktop/9-20-2002/a.exe
Breakpoint 1, main (argc=1, argv=0x904d0) at
test2.c:10
10 EBIT = 4.0;
(gdb) p EBIT
$1 = 1.9097962127086567e-313
(gdb) next
12 printf("The long double is %Lf.\n", EBIT);
(gdb) p EBIT
$2 = 0
(gdb) next
The long double is 4.000000.
14 exit(0);
(gdb) p EBIT
$3 = 0
(gdb) cont
Continuing.
Program exited normally.
(gdb) quit
C:\DOCUME~1\perezpa\Desktop\9-20-2~1>
- Raw text -