[EMAIL PROTECTED] 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

_______________________________________________
Bug-gdb mailing list
[EMAIL PROTECTED]
http://mail.gnu.org/mailman/listinfo/bug-gdb

Reply via email to