Using a Debugger with any text editor (DebugView/++)

Helpful script writing tricks and HowTo's
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Using a Debugger with any text editor (DebugView/++)

30 Sep 2021, 10:32

I do still use a Msgobx now and then for very quick checking of code, but in the long run, to do any meaningful debugging of a complex script, one must use a debugger.

For some reason I didn't feel confident using a debugger for a very long time. It's actually not hard at all, and is well worth the time to setup.

I hope this tutorial will be a help to those who need to go past the Msgbox or the Tooltip for debugging but aren't sure how to do so.

In this tutorial I will show the default settings I use, and explain why.


DebugView++

DebugView


==============================================================================

Use a helper function

==============================================================================

Example

==============================================================================

Editors like VisualStudio Code, AHK Studio, and SciTE for AutoHotkey, catch the OutputputDebug-Output directly within the builtin terminal in a separate panel.

So the Debug-Output will be shown within these text editors. And some other Text Editors / IDE's will support plugins to do the same.
Last edited by TheArkive on 11 Oct 2021, 22:44, edited 12 times in total.
swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: Using a Debugger with any text editor (DebugView)

30 Sep 2021, 11:45

debugview is old, debugview++ is new, these screenshots are annoying to open
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: Using a Debugger with any text editor (DebugView)

30 Sep 2021, 11:47

@swagfag
Ok, sorry, i was trying to contribute, and I didn't see anything like this posted.

I'll look into DebugView++ and update this.
User avatar
JoeSchmoe
Posts: 129
Joined: 08 Dec 2014, 08:58

Re: Using a Debugger with any text editor (DebugView)

30 Sep 2021, 14:23

This looks very helpful. Thank you!
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: Using a Debugger with any text editor (DebugView/++)

01 Oct 2021, 06:38

@JoeSchmoe
No problem :)

@swagfag
Updated to include DebugView++. Any more pointers?
User avatar
hoppfrosch
Posts: 443
Joined: 07 Oct 2013, 04:05
Location: Rhine-Maine-Area, Hesse, Germany
Contact:

Re: Using a Debugger with any text editor (DebugView/++)

02 Oct 2021, 01:50

Just one more hint - as you asked for:

Editors like VisualStudio Code catch the OutputputDebug-Output directly within the builtin terminal - no need to have a extra app run, just showing the Debug-Output within the IDE
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: Using a Debugger with any text editor (DebugView/++)

02 Oct 2021, 03:51

@hoppfrosch
Thanks, I certainly did forget to mention that. OP edited.
20170201225639
Posts: 144
Joined: 01 Feb 2017, 22:57

Re: Using a Debugger with any text editor (DebugView/++)

09 Oct 2021, 20:17

Can you outputdebug HTML to vscode's terminal and have it render as HTML?

I want to set it up so each time I enter a function, I do OutputDebug("<div>" A_ThisFunc )

And each time I exit I do OutputDebug(A_ThisFunc "</div>")

And that way I get a hierarchical representation of my callstack using nested html divs! How cool is that?

This is my current setup with debugview++, using indentation to represent the callstack (of my auto exec function). But it'd be nice to represent with html
2021_1009_2115_48 (Forsaken Icefish).png
2021_1009_2115_48 (Forsaken Icefish).png (97.99 KiB) Viewed 4614 times
doug9fo
Posts: 2
Joined: 21 Jun 2020, 11:18

Re: Using a Debugger with any text editor (DebugView/++)

23 Dec 2021, 11:09

I don't see how to actually use DebugView++ with Notepad++. What is the magic incantation, please?
User avatar
TheArkive
Posts: 1027
Joined: 05 Aug 2016, 08:06
Location: The Construct
Contact:

Re: Using a Debugger with any text editor (DebugView/++)

24 Dec 2021, 16:00

@doug9fo
You don't actually use "DebugView++ with Nodepad++". That statement isn't entirely accurate or complete.

Your script can be edited in Notepad++. And you can design your script to use the DebugOutput command. And then you setup DebugView++ to filter only AHK messages (given the included helper function mentioned in the OP).

If you follow the directions in the OP, you should be able to use Notepad++ to edit your script, and then capture debug output in DebugView++ (with the proper settings/filters set - also described in the OP).

Return to “Tutorials (v1)”

Who is online

Users browsing this forum: No registered users and 36 guests