bug-gdb
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gdb-5.0 scope bug


From: Daniel Berlin
Subject: Re: gdb-5.0 scope bug
Date: 13 Feb 2001 22:22:10 -0500
User-agent: Gnus/5.090001 (Oort Gnus v0.01) XEmacs/21.2 (Thalia)

address@hidden writes:

> GNU gdb 5.0
> i686-pc-linux-gnu
> 
> I have code which is to this effect:
> 
> main () {
>   const double tau = 0
> 
>   for (int i = 0 ...)
>     double tau = xxx.
> 
> When a breakpoint is set inside the loop, gdb reports the wrong value
> for tau (the one outside the loop).
> 
> Do I need to give a more specific bug test case?

Yes, please do. It works perfectly here.
(gdb) b main
Breakpoint 1 at 0x180054c: file a.c, line 3.
(gdb) r
Starting program: /home/dberlin/./a.out
 
Breakpoint 1, main () at a.c:3
3               const double tau = 0;
(gdb) n
4               for (int i = 0; i < 50; i++)
(gdb) p tau
$1 = 0
(gdb) n
5                       double tau = 30;
(gdb) p tau
$2 = 1.0511395762458627e-301
(gdb) n
5                       double tau = 30;
(gdb) p tau
$3 = 30
(gdb) n
5                       double tau = 30;
(gdb) p tau
$4 = 30
(gdb) q


(It was unitialized the first time in the loop, obviously).

(gdb) p main::tau
$5 = 0
(gdb) info locals
tau = 30
i = 2
tau = 0
(gdb)

All correct.
--Dan



reply via email to

[Prev in Thread] Current Thread [Next in Thread]