How to debug AHK?

Discuss the future of the AutoHotkey language
Geobomatic
Posts: 20
Joined: 20 Feb 2020, 05:05

How to debug AHK?

21 Jan 2024, 12:05

Hi,

I’m trying to debug an issue with dead keys so I cloned the repo, put a few breakpoints and run the debug version.

The issue is that it makes the system very unresponsive when a breakpoint is hit.

How do you guys debug AHK?
Geobomatic
Posts: 20
Joined: 20 Feb 2020, 05:05

Re: How to debug AHK?

22 Jan 2024, 13:54

I added

InstallMouseHook false, true

to my test script so I can use the mouse while in a breakpoint
User avatar
andymbody
Posts: 904
Joined: 02 Jul 2017, 23:47

Re: How to debug AHK?

22 Jan 2024, 14:39

Geobomatic wrote:
21 Jan 2024, 12:05
How do you guys debug AHK?
My personal preference...
In modules, small bites. Using msgbox or Listvars. Sometimes commenting out code or halting the script to take a chunk at a time (half-splitting), then building back until the source of the issue is located.

In general, I place most of my code in functions or classes so debugging can my done in small sections.

I don't rely any built-in IDE tools myself. That way I am not lost when the tools are unavailable with a different editor. And there is no need to learn new tools each time the editor changes. And no possibility that the built-in debugger could introduce an alternate issue or mask the one I am trying to find. And minimal resources required (as you mentioned can be a problem).

There might be better ways, and I'd be happy to learn them. Good idea for a thread... thanks for posting.
Geobomatic
Posts: 20
Joined: 20 Feb 2020, 05:05

Re: How to debug AHK?

22 Jan 2024, 15:33

Thanks for your answer :)

I’m talking about debugging Autohotkey itself, not a script :)
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: How to debug AHK?

15 Feb 2024, 21:45

When I debug issues that relate to the keyboard hook, I make heavy use of logpoints (i.e. breakpoints which log a message and continue execution).

In theory, it might be possible to debug such issues with remote debugging, putting the scripts in a VM or PC separate to the IDE; but I've never tried it.

Return to “AutoHotkey Development”

Who is online

Users browsing this forum: No registered users and 70 guests