ahkpp icon indicating copy to clipboard operation
ahkpp copied to clipboard

After an #include any set breakpoint afterwards in same file never stops

Open digitalAssetStore opened this issue 3 years ago • 6 comments

Description

After an #include any set breakpoint afterwards in same file never stops.

Reproduction steps

var1 := 1 ; <-- set breakpoint 1
#include myInclude01.ahk
var2 := 2 ; <-- set breakpoint 2

Expected behavior

Debugging with F9 should stop at "breakpoint 1" and "breakpoint 2".

Failure behavior

Stops at breakpoint 1, but does never stop at breakpoint 2. Seems to be that after an #include any set breakpoint afterwards in same file never stops.

Thanks in advance

digitalAssetStore avatar Mar 02 '21 20:03 digitalAssetStore

Works for me. You are using F9 to initiate debugging and stepping through with F11?

fade2gray avatar Mar 03 '21 00:03 fade2gray

I was able to reproduce if my file was just the three lines included in the snippet. However, when I added a fourth line MsgBox % var2 the debugger did stop at breakpoint 2 on the third line. Since a breakpoint at the end of a file with an unused assignment (var2 is not used later in the file since it is assigned at the end of the file) isn't a very useful breakpoint, this is low priority. Please inform if you are seeing this issue with slightly more complicated files, or breakpoints after #include but before the very end of the file.

mark-wiemer avatar Mar 03 '21 03:03 mark-wiemer

Yes, I have scripts with many #includes and after that lines of code with definitions for other HotKeys and function methods that I need to debug.

The following seems to be the case a) If #include doesn't define any HotKey --> stops correct at "breakpoint 2"

b) If #include defines any HotKey(s) --> NOT stopping at "breakpoint 2"

digitalAssetStore avatar Mar 05 '21 15:03 digitalAssetStore

Can you provide a short sample script for reproduction purposes @digitalAssetStore?

mark-wiemer avatar Mar 11 '21 01:03 mark-wiemer

Hi @digitalAssetStore, since I'm not able to reproduce this issue, I'm going to close it for now. If you can provide a sample script, I'll consider re-opening. Thanks

mark-wiemer avatar Apr 22 '21 01:04 mark-wiemer

I've edited my repro setup, I can indeed reproduce this.

; included.ahk
foo() {
    MsgBox % "Hello world"
}

x::
    MsgBox % "Does it work when included script contains a hotkey?"

; main.ahk
; [Issue #60](https://github.com/mark-wiemer/vscode-autohotkey-plus-plus/issues/60)
var1 := 1 ; <-- set breakpoint 1
#include included.ahk
var2 := 2 ; <-- set breakpoint 2
MsgBox % var2

When debugging main.ahk, I see the following:

  1. Debugger stops at breakpoint 1 correctly
  2. Debugger does not hit breakpoint 2 right away, even expected though it's expected to. Instead, the script keeps running
  3. When triggering the hotkey (by pressing x), the hotkey works as expected
  4. Once the hotkey finishes triggering (by closing the message box), debugger hits breakpoint 2

Honestly, I'm not quite sure what the expected behavior is. @digitalAssetStore , I recommend you try using zero-plusplus.vscode-autohotkey-debug in the meantime.

Apologies for the inconvenience and great delay in thoroughly investigating this issue.

mark-wiemer avatar Jun 11 '22 18:06 mark-wiemer