Exit Debugger when Debugger gets stuck in a loop

4 次查看(过去 30 天)
I am trying to exit Debugger, but everything I have tried resulted in this error.
I have tried stop, dbquit, Ctrl+C, Shift-F5. I have also tried to use the red stop button on the Debugger toolbar. But I still have the K>> prompt and I can't run anything else.
Is there a way to clear and stop the debugger from Matlab Online so that I could do anything else?
Maximum recursion limit of 504 reached.
Error in matlab.internal.debugger.breakpoints.getGlobalBreakpoints
Caused by:
Maximum recursion limit of 504 reached.

回答(2 个)

Abhishek
Abhishek 2025-6-30
编辑:Abhishek 2025-6-30
dbquitor ‘dbquit all’ will allow you to exit the debugger mode. But even after that, if you are not able to exit the debugger mode, you can try resetting your MATLAB Online Session and starting a new session. Here is how you can do that:
  • Visit: https://drive.matlab.com
  • Log in with your MathWorks account
  • Click on your name in the upper right and select "Show Hidden Files"
MATLAB_Online_Clear_Hidden_Files
  • Locate the ‘.session’ folder and delete its contents (only the files inside, not the folder itself)
  • Then go to https://matlab.mathworks.com and start a new session
Doing so should resolve the issue. You can also try the following workarounds:
  • Clearing the cache and cookies and reloading the page.
  • Open MATLAB Online in a different browser.
  • Ensuring the browser is up to date.
For more information on managing breakpoints and debugging, you can check the official documentation of MATLAB:

Ruchika Parag
Ruchika Parag 2025-6-30
编辑:Ruchika Parag 2025-7-1
Hi @Cg Gc, this issue occurs when the debugger gets stuck in a recursion loop and exceeds the maximum recursion limit, which corrupts the internal state. In this situation, normal exit commands like dbquit, stop, Ctrl+C, or Shift+F5 may no longer work, especially in MATLAB Online.
Here are a few things you can try:
1. Try forcing the debugger to exit:
dbclear all
This attempts to clear all breakpoints and forcibly exit debug mode. However, in severe recursion errors, this may not be effective.
2. Refresh or restart the MATLAB Online session:
If the prompt is still stuck at K>>, try refreshing your browser tab. If that doesn't work, click your profile icon (top right in MATLAB Online) and choose "End Session", then reopen MATLAB Online. This resets the current session and should clear the stuck debugger state.
3. Preventing it in the future:
This kind of issue can happen if:
  • You set breakpoints inside recursive functions.
  • A callback or function is triggering recursion unexpectedly.
  • There's an error in breakpoint management (especially with custom logic).
Hope this helps!

类别

Help CenterFile Exchange 中查找有关 Startup and Shutdown 的更多信息

标签

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by