🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.csharpbuilder.ide.editor
Article #1

Odd Watch behavior in the debugger

#1
From: Lambert Heenan
Date: Sun, 14 Nov 2004 14:48
69 lines
2965 bytes
Here is a very simple console app., and below it the output. No surprises 
there but...

using System;

namespace TestDoodles
{
	
	class ClassTest
	{
		[STAThread]
		static void Main(string[] args)
		{
			//
			// TODO: Add code to launch test methods here
			//
			forWatchInDebug();
		}

	/// <summary>
	/// Observation on the behavior of C#Builder debugger
	/// </summary>
		static void forWatchInDebug()
		{
			const int LOOPMAX=3;

			for(int n=0;n<=LOOPMAX;n++)
				Console.WriteLine(n + " 1st loop ");
			Console.WriteLine("---");
			for(int n=0;n<=LOOPMAX;n++)
				Console.WriteLine(n + " 2nd loop ");
			Console.WriteLine("---");
			for(int n=LOOPMAX;n>=0;n--)
				Console.WriteLine(n + " 3rd loop ");
			Console.WriteLine("---");
		}
	}
}

Output:

0 1st loop
1 1st loop
2 1st loop
3 1st loop
---
0 2nd loop
1 2nd loop
2 2nd loop
3 2nd loop
---
3 3rd loop
2 3rd loop
1 3rd loop
0 3rd loop

If I set a breakpoint in each of the three for loops, and set a watch on 
each 'n' loop variable in each for loop and then step through this is 
what I see.

In the frist loop, the watch window shows all thee watch n's go from 0 to 
4 (on exiting the loop). While the 2nd and 3rd loops execute the watched 
value remains on 4.

If n is declared before the first foor loop and then the loops rewritten 
as "for( n=0;n<=LOOPMAX;n++)" etc. then I see the three watch values in 
lock step change in each loop. I guess that it is a namespace thing going 
on here, but it this a bug in the debugger not being able to watch like 
named objects?
Technical Details
Message-ID: <Xns95A16E014B605LH28@207.105.83.66>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed-east.nntpserver.com!nntpserver.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: 1efe34,8fa4edc05e312762,start
X-Google-Thread: 165859,8fa4edc05e312762,start
X-Google-Thread: 1eff7e,8fa4edc05e312762,start
X-Google-Thread: 1528ba,8fa4edc05e312762,start
X-Google-Thread: 1efe35,8fa4edc05e312762,start
X-Google-Attributes: gid1efe34,gid165859,gid1eff7e,gid1528ba,gid1efe35,public
X-Google-Language: ENGLISH,ASCII-7-bit
Newsgroups: borland.public.csharpbuilder.ide.editor,borland.public.csharpbuilder.ide.general,borland.public.csharpbuilder.ide.debugger,borland.public.csharpbuilder.compiler,borland.public.csharpbuilder.language.csharp
Subject: Odd Watch behavior in the debugger
From: Lambert Heenan <l_spam_a_not_b_here_ert.heenan@mindspring.com>
Message-ID: <Xns95A16E014B605LH28@207.105.83.66>
Followup-To: borland.public.csharpbuilder.ide.editor,borland.public.csharpbuilder.ide.general,borland.public.csharpbuilder.ide.debugger,borland.public.csharpbuilder.compiler,borland.public.csharpbuilder.language.csharp
User-Agent: Xnews/06.08.25
NNTP-Posting-Host: 69.22.251.100
Date: 14 Nov 2004 07:48:46 -0700
X-Trace: newsgroups.borland.com 1100447326 69.22.251.100 (14 Nov 2004 07:48:46 -0700)
Lines: 69
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!news.glorb.com!newsfeed-east.nntpserver.com!nntpserver.com!newsfeed.media.kyoto-u.ac.jp!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail