View Issue Details

IDProjectCategoryView StatusLast Update
0021958LazarusDebuggerpublic2020-06-06 03:12
ReporterAndrzej Borucki Assigned ToMartin Friebe  
Status resolvedResolutionfixed 
Product Version1.1 (SVN) 
Fixed in Version2.2 
Summary0021958: review of "Run to cursor" (F4)
DescriptionProbably it is no debugger error but editor loses focus
TagsNo tags attached.
Fixed in Revision63307
Attached Files


has duplicate 0023106 resolvedMarc Weustink Run to cursor (F4) not working 
related to 0022391 resolvedMartin Friebe It often say this error when I start debugging or run to cursor 


Martin Friebe

2012-05-06 13:49

manager   ~0059306

I can not reproduce (win vista 32 bit). Using F4 will go to the correct line, and the editor is focused.

- Are you using any dock manager?
- Exact revision of Lazarus, that you are using?
- Windows version
- FPC version

If you are *not* using a dock manager:
Please attach your EnvironmentOptions.xml and EditorOptions.xml (from lazarus config dir)

Andrzej Borucki

2012-05-06 17:02

reporter   ~0059312

I don't know if I use dock manager, preferably not because Lazarus windows floats.
Lazarus 1.1 revision 37150
FPC 2.6.1
Windows XP OEM Home
File EnvironmentOptions.xml is in main directory but editoroptions.xml is in C:\lazarus\tools\install\linux\

Martin Friebe

2012-05-06 17:24

manager   ~0059314

Last edited: 2012-05-06 17:26

This environmentoptions is only the default template.

Please look at the "View" menu, there is an entry "IDE internals" > "About IDE"
It will tell you where your primary config path is ("C:\users and documents\....")
This folder will contain both files.

Do you have one or more source-editor windows open?
Can you find out which window is focused after F4?
Did you install any packages?

Do you use F4 to start the application, or to continue from a breakpoint?

2012-05-07 11:13


editoroptions.xml (727 bytes)   
<?xml version="1.0"?>
  <EditorOptions Version="9">
    <Display DisableAntialiasing="True" DoNotWarnForFont="Courier New"/>
        <Version Value="6"/>
    <CodeTools CodeTemplateFileName="C:\Documents and Settings\Andrzej\Ustawienia lokalne\Dane aplikacji\lazarus\lazarus.dci" CompletionLongLineHintTypeCompletionLongLineHintType="sclpExtendRightOnly"/>
      <Default Version="1"/>
    <Color Version="9">
      <Globals Version="9">
          <ahaExecutionPoint Background="clBackground"/>
editoroptions.xml (727 bytes)   

2012-05-07 11:15


environmentoptions.xml1 (13,168 bytes)

Andrzej Borucki

2012-05-07 11:23

reporter   ~0059346

I install some components: Indy10 and Virtual Tree but now I install again
Lazarus version: 1.1
Lazarus svn revision: 37150
I can't debug with with F4. Focus go to Messages ("Komunikaty" in Polish) window.
I attach today editoroptions.xml and environmentoptions.xml1 (I change name, bacause can't delete previously added file this name)

some questions:
- can I change temporary language of interface Lazarus to English to better communicate ?
- can I delete attached files this Issue?

Martin Friebe

2012-05-07 17:01

manager   ~0059356

Last edited: 2012-05-07 17:19

- Not sure about who can delete. (ask on mail list, please). I removed the wrong one.
- Language can be set in Tools/Options > Desktop
- The packages are ok. None of them should affect focus

1) Didn't answer:
Do you use F4 to start the application, or to continue from a breakpoint?

2) Try Tools/Options > Desktop > "Focus Messages after compilation" (2nd checkbox from bottom). It should not affect you, but try unchecking it anyway.

3) Can you reproduce with a new application.
Just a form and a button. Put 3 or 4 lines in the Button1Click handler ("Caption:='1';", "Caption:='2';" ...).
Set a breakpoint on the first line, hit the button. When reached the breakpoint, try to go 2 or 3 lines using F4

4) [edit] Does the focus work, if instead of F4 you set a breakpoint and use F9?

I still can not reproduce, I will try on my laptop later (which has XP)

Andrzej Borucki

2012-05-07 21:12

reporter   ~0059367

1)Fortunately I can continue with F4 from a breakpoint, only can't start with it.
2)I can't start with F4 even when change "Focus Messages after compilation"
3)I can't start with F4 but can go to n-th line of Button1Click after stop on breakpoint in line 1.
But if it stop in line 1 of Button1Click and I press F4 in other method - line 1 in Button2Click then debugger stop in last line TControl.Click in (?)
4)Focus work

My diagnosis was wrong - it is no problem with focus, but debugger simply can't start with F4. But simple two-button program cause another problem - 3)

Martin Friebe

2012-05-07 22:00

manager   ~0059370

Indeed. This is currently the "expected" behaviour (though I agree, few people might really expect this).
And maybe all it needs is documentation?

F4 issues gdb command "until <location>".
And this is limited to be within the current frame. That is it should only break, if the location is reached while the app is in the SAME stack-frame, as when the command was issued. Or if you leave that frame (to the parent frame).

It does not stop, if the location is reached, while in a recursive call. This can be very useful.

Of course that means, if used in start-up, it is impossible to reach the location. Because the location can and will only be reached, while in nested function calls (and that will not break)

Same for using it in other procedures.

So the current behaviour certainly is worth keeping.

It means, that the current implementation, allowing to start an ap with F4 is wrong (because it makes no sense)

If it is possible to *reliably* detect cases where the caret is not in the same procedure, then it could ask. (maybe optional/configurable)

I set the issue to feature-request.

Andrzej Borucki

2012-05-08 00:25

reporter   ~0059373

Thanks for explaining.
I thought previously that will be good if F4 would be the same as temporal breakpoint, but checking frame is useful in recursive call. F8 is similar?
I note one more strange behaviour of debugger: If I debug I can debug FreePascal libraries, for example if have Button1.Caption:='1' F7 step into TControl.SetText.
But not always..
I can't go into TList.Create or TList.Add

Martin Friebe

2012-05-08 01:05

manager   ~0059374

For questions please use the mail list or forum.

You might want to read here about your question:,16873.msg92335.html#msg92335

Martin Friebe

2020-06-06 03:12

manager   ~0123245

Please test, and close if ok.

revision 63307 introduces "run to cursor" for gdb based debuggers. This will run to any line in the application.

"Step over to cursor" also remains. F4 is bound to "step over to cursor". To use "run to cursor" key-settings must be changed. (or menu used)

"run to cursor" behaves exactly as:
- insert a breakpoint at the cursor line
- run, until breakpoint reached, or other stop occurs (other breakpoint / exception)
- remove the breakpoint

"run to cursor" can be used to start the debugger, if it is not yet running.

Both commands are also available for FpDebug.
LLDB based debuggers currently feature neither command.

Issue History

Date Modified Username Field Change
2012-05-06 11:42 Andrzej Borucki New Issue
2012-05-06 11:42 Andrzej Borucki Widgetset => Win32/Win64
2012-05-06 13:49 Martin Friebe LazTarget => -
2012-05-06 13:49 Martin Friebe Note Added: 0059306
2012-05-06 13:49 Martin Friebe Assigned To => Martin Friebe
2012-05-06 13:49 Martin Friebe Status new => feedback
2012-05-06 13:52 Martin Friebe Summary Run to cursor (F4) not works => Editor looses focus on Run to cursor (F4)
2012-05-06 16:58 Andrzej Borucki File Added: environmentoptions.xml
2012-05-06 17:02 Andrzej Borucki Note Added: 0059312
2012-05-06 17:24 Martin Friebe Note Added: 0059314
2012-05-06 17:26 Martin Friebe Note Edited: 0059314
2012-05-07 11:13 Andrzej Borucki File Added: editoroptions.xml
2012-05-07 11:15 Andrzej Borucki File Added: environmentoptions.xml1
2012-05-07 11:23 Andrzej Borucki Note Added: 0059346
2012-05-07 16:52 Martin Friebe File Deleted: environmentoptions.xml
2012-05-07 17:01 Martin Friebe Note Added: 0059356
2012-05-07 17:19 Martin Friebe Note Edited: 0059356
2012-05-07 21:12 Andrzej Borucki Note Added: 0059367
2012-05-07 22:00 Martin Friebe LazTarget - => post 1.2
2012-05-07 22:00 Martin Friebe Widgetset Win32/Win64 =>
2012-05-07 22:00 Martin Friebe Note Added: 0059370
2012-05-07 22:00 Martin Friebe Severity minor => feature
2012-05-07 22:00 Martin Friebe Status feedback => assigned
2012-05-07 22:00 Martin Friebe Summary Editor looses focus on Run to cursor (F4) => review of "Run to cursor" (F4)
2012-05-08 00:25 Andrzej Borucki Note Added: 0059373
2012-05-08 01:05 Martin Friebe Note Added: 0059374
2012-07-08 02:42 Martin Friebe Relationship added related to 0022391
2012-10-11 00:21 Martin Friebe Project Packages => Lazarus
2012-10-11 00:21 Martin Friebe Category - => Debugger
2012-10-11 00:23 Martin Friebe Relationship added has duplicate 0023106
2013-09-03 12:07 Martin Friebe LazTarget post 1.2 => 1.4
2014-09-10 19:08 Juha Manninen LazTarget 1.4 => -
2020-06-06 03:12 Martin Friebe Status assigned => resolved
2020-06-06 03:12 Martin Friebe Resolution open => fixed
2020-06-06 03:12 Martin Friebe Fixed in Version => 2.2
2020-06-06 03:12 Martin Friebe Fixed in Revision => 63307
2020-06-06 03:12 Martin Friebe LazTarget - => 2.2
2020-06-06 03:12 Martin Friebe Note Added: 0123245