FIX: Stepping Over Recursive Function Calls Is Broken (223364)



The information in this article applies to:

  • Microsoft Visual J++ 6.0
  • Microsoft virtual machine

This article was previously published under Q223364

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 that this is a bug in the Microsoft products that are 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:

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

194295 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.

REFERENCES

For support information about Visual J++ and the SDK for Java, visit the following Microsoft Web site:

Modification Type:MajorLast Reviewed:6/14/2006
Keywords:kbBug kbDebug kbfix kbide kbVJ600fix kbVS600sp3fix KB223364