Page 1 of 1

Error on stepping-state after end of a function

Posted: 06 May 2023 12:31
by PeterH
1) If, while stepping = on, a function is called, it starts *without* stepping. I think this is fine.

2) If, in the function:
- there is a step;
- (maybe after come Continue) you click "Continue without stepping"
- and somewhen return to the caller
=> it continues *without* stepping!

For me this is absolutely wrong!
If stepping mode is on *before* call to a function, it always must be on *after* return from it! No matter what happens inside the function!

Example:

Code: Select all

//	Test step; outside/inside a function

"Main : steptest"
   $a = 1;
   step;   // start stepping for "Main"
   $b = 2;
   f();
   $c = 3;   // stepping should be on here!
   echo "behind f()";
   step;

function f()   {
   $x = 9;
   step;
   $y = 8;	// after this: click "Continue without steping"
   $z = 9;
}

Re: Error on stepping-state after end of a function

Posted: 13 May 2023 08:31
by admin
Well, currently the stepping mode is totally scope unaware. That's not a bug but the way it is for many years.

I move this thread to Wishes.

Re: Error on stepping-state after end of a function

Posted: 13 May 2023 12:52
by PeterH
admin wrote: 13 May 2023 08:31 Well, currently the stepping mode is totally scope unaware.
Though if calling a function with stepping=on, the function runs *without* stepping.
And if I got it right: after return from the non-stepping function the prev mode will continue.
So it seems not just be all or nothing...

Now, if a function call is reached with stepping=on (thats dynamic), there must be a step; behind the call (that's static) :(

OK: if my wish for a variable to querry stepping state would exist, it could be "dynamically" handled :D

Re: Error on stepping-state after end of a function

Posted: 13 May 2023 13:12
by admin
Yes, you are right, it's indeed not totally scope-unaware.

I added that stepping state query.

Re: Error on stepping-state after end of a function

Posted: 13 May 2023 22:06
by PeterH
As said in the other thread: thanks a lot!
(And more :beer: - though it should be red wine)

Re: Error on stepping-state after end of a function

Posted: 15 May 2023 21:08
by PeterH

Code: Select all

   ...
   $cstep = <get stepping>;
   $dings = f($cmd1, ...);
   if $cstep { step; }
   ...
Doesn't it look strange? :roll:
But at least: it helps to make things work as they should! :ugeek:
(Without it I sometimes had a 'runaway'! :blackstorm: )