Recent

Author Topic: F4 - Run to cursor  (Read 5666 times)

BLL

  • Sr. Member
  • ****
  • Posts: 276
F4 - Run to cursor
« on: June 25, 2016, 11:42:35 am »
Hi, Can anyone help?
I have come to lazarus from CBuilder. One of the debugging options I find very useful is the run to cursor, but it is always greyed out and therefore not available.
Why please?
Brian

rvk

  • Hero Member
  • *****
  • Posts: 4049
Re: F4 - Run to cursor
« Reply #1 on: June 25, 2016, 12:12:05 pm »
Yeah, that's also something I needed to get used to.
F4 only works within the procedure you are at that moment.
It doesn't work like in Delphi.

The workaround is... you go to the place where you want to go.
But you don't press F4 but F5 and press F9 (run).
F5 sets a breakpoint.
When the program breaks you directly press F5 again and the breakpoint is released.

It would be neat if Lazarus could implement that F5, F9 & F5 under the F4 button :)
(But for now you can do it that way)
« Last Edit: June 25, 2016, 12:13:51 pm by rvk »

BLL

  • Sr. Member
  • ****
  • Posts: 276
Re: F4 - Run to cursor
« Reply #2 on: June 25, 2016, 06:48:13 pm »
Hi, Thanks for the info. If it's that badly implemented, F4 shouldn't be there!

I also don't understand why compile, make and build are on the Run menu!

If you are going to run a programme, it must be built first! In CBuilder, these items were on the Project menu, which, I think, makes much more sense. You build a project and then you run it!

Brian

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6299
    • wiki
Re: F4 - Run to cursor
« Reply #3 on: June 25, 2016, 08:42:13 pm »
It is not badly implemented, it implements a different function. It is "step to cursor"

http://bugs.freepascal.org/view.php?id=21958#c59370

rvk

  • Hero Member
  • *****
  • Posts: 4049
Re: F4 - Run to cursor
« Reply #4 on: June 25, 2016, 08:53:28 pm »
It is not badly implemented, it implements a different function. It is "step to cursor"
Well, it doesn't say "Step to Cursor (F4)" but it says "Run to Cursor (F4)". And because the naming in Delphi is exactly the same it confuses the hell out of people just beginning with Lazarus :)

Luckily I learned quit quickly to use the F5 for breakpoint but seeing that different function uses the same name and even the same function key as Delphi, I can understand the confusion.

BLL

  • Sr. Member
  • ****
  • Posts: 276
Re: F4 - Run to cursor
« Reply #5 on: June 25, 2016, 09:34:15 pm »
I don't follow your logic! Run to cursor means run the program until it reaches the point where you have put the cursor. Of course you can set a breakpoint, but surely, the whole idea of F4 was to be quicker. Otherwise, you need 2 steps - 1 set breakpoint, 2 run program!
CBuilder had it right, lazarus, in my opinion does not!

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6299
    • wiki
Re: F4 - Run to cursor
« Reply #6 on: June 25, 2016, 10:30:52 pm »
Yes, it is currently wrongly named.

Lazarus does not have "run to cursor" at all. It has a different function.

"step to cursor" can be useful too. So the function itself is not wrong, or bad, it is just a different one.

Both needs to be done:
- fix the name
- implement "run to c"

duzenko

  • Newbie
  • Posts: 1
Re: F4 - Run to cursor
« Reply #7 on: August 30, 2019, 12:14:30 pm »
Nice to know that it's 2019 and still no Run to Cursor

RuudB

  • New Member
  • *
  • Posts: 23
Re: F4 - Run to cursor
« Reply #8 on: April 19, 2020, 02:41:42 pm »
It does work, but..... not the first time. The very first time you have to use the F5/F9 combination and then you can use F4. But I wonder as well why it cannot be used the first time.

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 6299
    • wiki
Re: F4 - Run to cursor
« Reply #9 on: April 19, 2020, 02:56:45 pm »
Because it is a "step over" variant.

Code: Pascal  [Select][+][-]
  1. procedure Foo(i : integer);
  2. begin
  3.   if i > 10 then exit
  4.   DoBefore(1);
  5.   DoFoo(i+1);
  6.   DoAfter;
  7. end;

Say you are on "DoBefore" and i = 1.
You want [1] to "Step over to cursor" to "DoAfter".

Then the line DoAfter is executed with i = 3,4,5 to 10.

But "Step over" does not "step in" => so you should expect to stop at "DoAfter" when i=1, and only then.
I.e. you only stop at the target line, if you reach the target line in the very same stack-frame in which you started.

- Any hit of the line, while in a deeper stack frame is skipped
- Exiting the current stack frame, will enter pause (break)

This is what gdb provides under that name. That is were the idea came from.

If you have not started the app yet, then all code is in "deeper stack frames", and can not be reached by "step over to cursor"


You want a completely new command. (a reasonable one, yes)

But no one had yet time to implement it.

As for me (I do a lot of the work on the debugger), I simple have tons of other todo items, that are all at a higher priority.


[1] Well, you do want something else, but this is what it is designed for at current
« Last Edit: April 19, 2020, 03:00:33 pm by Martin_fr »

 

TinyPortal © 2005-2018