Re: "if" inside Looping Constructs

Nathan Fiedler <[email protected]> 16 Sep 2003 18:57:30 -0700
Newsgroups gmane.comp.java.jswat.user
Organization Blue Marsh Softworks
Message-ID <1063763849.27734.3.camel@nuts>
I believe you answered your own question: by observing this behavior in
other debuggers that implies it is not specific to JSwat. It is, to my
knowledge, the way the JVM handles the program counter. The debugger has
no reliable means for questioning what the JPDA tells it is the current
position.

n


On Tue, 2003-09-16 at 15:03, Wilson Jimmy - jiwils wrote:
> I have encountered an interesting issue/problem with JSwat when debugging
> code that contains "if"/"else if" constructs inside looping constructs.
> 
> Some example code:
> 
> while (some condition)
> {
>     ...
> 
>     if (condition 1)
>     {
>         ...
>     }
>     else if (condition 2)
>     {
>         ...
>     }
>     else if (condition 3)
>     {
>         <condition 3 line 1>;
>         <condition 3 line 2>;
>     }
> }
> 
> In the debugger, if I step inside the "else if" block for condition 2, once
> I have executed all of the code in that block, the flow of execution moves
> immediately to the last line of the "else if" block for condition 3 (it is
> highlighted as if it is next).  However, in reality, this code is not
> executing, and if I tell the debugger to step, it steps back to the while
> condition at the top of the code sample.  It appears that JSwat does not
> know that it is actually executing the code that is terminating the "else
> if" block for condition 2 and the terminating that loop of the while loop.
> 
> In discussions with my colleagues, this was mentioned as being seen in other
> debuggers too.
> 
> Is this a problem with the Java Debugging API or is it a more specific
> problem with JSwat?
> 
> Jimmy