FIX: Stepping Over Recursive Function Calls Is Broken

ID: Q223364


The information in this article applies to:


SYMPTOMS

Stepping over recursive function calls in the debugger does not work as expected. In some cases, the debugged application might hang, and in others, the debugger fails to break on the next line and instead continues as if the F5 key had been pressed.


STATUS

Microsoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article.

This bug was corrected in Visual Studio 6.0 Service Pack 3. For more information about Visual Studio service packs, please see the following articles in the Microsoft Knowledge Base:

Q194022 INFO: Visual Studio 6.0 Service Packs, What, Where, Why

Q194295 HOWTO: Tell That Visual Studio 6.0 Service Packs Are Installed


MORE INFORMATION

Consider the following code:


/*1*/     private void recursiveFunction(int levels)
/*2*/     {
/*3*/         System.out.println("Level " + levels + " in");
/*4*/         if (levels != 0)
/*5*/             recursiveFunction(levels - 1);
/*6*/         System.out.println("Level " + levels + " out");
/*7*/     }
/*8*/     
/*9*/     private void button1_click(Object source, Event e)
/*10*/    {
/*11*/        recursiveFunction(15);
/*12*/    } 

Steps to Reproduce Behavior

  1. Create a Windows-based project. Place a WFC button control on your form and double-click it to add the above code for button1_click().


  2. Set a breakpoint on line /*11*/ above.


  3. Compile and run the project.


  4. Click the button to hit the breakpoint.


  5. Press the F11 key to step into "recurisveFunction()."


  6. Press the F10 key until you get to line /*5*/, then press F11 to step into "recursiveFunction()" again.


  7. Repeat the above step to debug deeper into the recursive funtion.

    Results: Without Visual Studio Service Pack 3, following the instructions in the last step above, the debugger will act as if you had pressed the F5 key to run instead of stepping to line /*4*/.


Alternatively, try the following:
  1. Repeat steps 1-6 above; everything works as expected.


  2. You are now on line /*3*/.


  3. Press the F10 key (you are now on line /*4*/).


  4. Press the F10 key (you are now on line /*5*/).


  5. Press the F10 key to step over the next recursive call.

    Results: Without Visual Studio Service Pack 3, instead of ending up on line /*6*/ as you'd expect, your application and the debugger are now hung.


© Microsoft Corporation 1999, All Rights Reserved.
Contributions by Tim Gerken, Microsoft Corporation


REFERENCES

For the latest Knowledge Base articles and other support information on Visual J++ and the SDK for Java, please see the following pages on the Microsoft Technical Support site:

http://support.microsoft.com/support/visualj/

http://support.microsoft.com/support/java/

Additional query words:


Keywords          : kbservicepack kbDebug kbide kbJavaVM kbVJ600fix kbGrpJava kbVS600sp2 kbVS600SP1 kbVS600sp3fix 
Version           : WINDOWS:6.0
Platform          : WINDOWS 
Issue type        : kbbug 

Last Reviewed: May 19, 1999