Android Question Debugger Stop Command

Jeanc161

Member
Licensed User
Longtime User
If there a debugger STOP command that can enable to stop momentary the code currently executing, to allow to see variables etc. on the current excuting module, and then pressing F5 to continue the execution.
LIke
STOP in vb6

This can allow me a long loop that read a file or many file, stop the execution, verify variables, and then continue.
The goal is to allow to execute a long loop up to a certain point and if it reach that point it stop to go in debug mode like this
and this is without using breakpoints on that block of code

B4X:
' Very simple code
For i = 0 to 10000
  if i = 137 then [B]STOP [/B] ' [I]stop executing and go to debug mode view[/I]'
  ' do other stuff
Next
 

JohnC

Expert
Licensed User
Longtime User
I like the idea of being able to have the debugger *automatically* break when it comes along a "STOP" command in the code while running in debug mode.

This would allow us to easily catch errors without the time consuming hunting/stepping through of where the error occurs.

And when in release mode, the app can simply generate its normal error log if it comes across a STOP command in the code.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
Erel,

I understand that there is currently not keyword called "STOP".

But what would be cool is if we could put "STOP" keywords in various parts of our app, specifically in places that program execution should NEVER run to. And when execution does run into one of these STOPS when in debug mode, the IDE will break on that line as if there was a break point *automatically* placed on that line. And if the app is in release mode, the app could just crash and report it in the log window.

"STOP"s have a few nice advantages over regular red break lines:

1) STOP lines don't messy up the code view with a bunch of red lines
2) STOP lines wont get removed via "Remove all Breakpoints"
3) STOP lines follow in cut and paste operations where breakpoint lines don't
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Better to post it in the wishlist forum.

However there are downsides to such feature which are related to the way the debugger works.
The debugger is made of two pipelines, one is slow and very flexible and the second is almost as fast as release mode but not flexible at all. The compiler does a lot of work to decide when it can use the fast pipeline and when it needs to switch to the slow pipeline. When there is a breakpoint in a sub that sub will be executed on the slow pipeline.

In many cases if the program runs too slow in debug mode you can make it run fast by cleaning the project and removing breakpoints. Adding (and later forgetting) STOP commands in the code can cause the debugger to become unusable.
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
My bad - I thought the OP was done as a wish.

Understood about the pipelines.
 
Upvote 0

Jeanc161

Member
Licensed User
Longtime User
Even if the debugguer run slow, in DEBUGGING MODE, the point is that the stop command will stop there it is just for debugging purposes, and testing various aspect of the program, I use the VB6 STOP command only on some occasions while debugging complex subs, and i remove it after debugging, and even if you forgot to remove the stop when releasing the app, when you test your app il will either STOP or since it is in release mode, DO NOTHING, the command will simply been ignored and move to the next executable statements, i don't see why this could not be implemented in debug mode but not in release mode, is it true then when you make an app in release mode, the debug code or module is not included in the app when compiling. thus allowing the stop command to be ignored ???
 
Upvote 0
Top