Jump to content

Recommended Posts

Posted (edited)

cDebug.au3 includes four main debugging UDFs: _GuiDebug(), _ConsDebug(), _ClipDebug() and _FormatValsForDebug(). They all dump the values of all AutoIt subtypes and expressions, in a structured manner, including nested arrays and slices of them, and even DLL structs and maps. It is an alternative to a graphical debugger, offering GUI output.

The format for calling the UDFs has been designed to make coding a call as convenient and fast as possible, minimizing coding effort and the chances of errors: the $name argument is often the same as the variables arguments, enclosed in quote marks.

For DLL structures, if you specify a tag, cDebug checks for differences between it and what it detects. If you only specify a structure variable, it can report the structure it detects, with the values of elements.

It does much more than MsgBox(), ConsoleWrite() and _ArrayDisplay(), in a definitely user-friendly manner, and does its best to avoid hiding your code in SciTE.

It is fully documented.  During development of new features, the current version is used to debug the upcoming version, so there is much testing.

These UDFs have been in regular use for some years. Suggestions and bug reports are most welcome.

Get the latest version in Example Scripts

#AutoIt3Wrapper_Version=B       ; beta 3.3.15.0 or greater is mandatory for cDebug.au3, not for cDebug no maps.au3
#include "cDebug.au3"
Local $seasons[]
$seasons.summer = 'May to September'
$seasons.spring = 'April'
$seasons.fall = 'October to November'
$seasons.winter = 'December to March'
Local $aCats[3][3] = [['jack','black',3],['suki','grey',4],[$seasons,'','']]
Local $i = 1
Local $tStruct = DllStructCreate('uint')
DllStructSetData($tStruct,1,2018)
_GuiDebug('At line '&@ScriptLineNumber,'$cats,jack is,$cats[..][$i],$i,hex,structure{uint}', _
$aCats,$aCats[0][2],$aCats,$i,Hex(-$i),$tstruct)

reports

5ac5173ef0a97_cDebugteaser.jpg.13f0095152c84a857349b9f331fac171.jpg

 

 

Edited by c.haslam
  Reveal hidden contents

 

  • 1 month later...
Posted

Thank you! I've always tried to imagine a way to create a whoops-like error reporting system and a var_dump/print_r-like debugging helper for AU3 that could be easier than ConsoleWritting everything (and that does not only support arrays, as _ArrayDisplay, although it already helps a lot), and it looks like you could accomplish much of what I've thought. Going to use it now!

My stuff

  Reveal hidden contents

 

  • 7 months later...
  • 1 year later...
Posted

Thanks for this, @c.haslam! I'm developing a script using Maps, so a debug tool with full support for them is simply awesome!

Unfortunately, I can't seem to get it to work properly. There was a teeny syntax error in line 2020 caused by a missing space before the underscore continuation char, but that was trivial to fix.

But when I invoke _GuiDebug like this:

 _GuiDebug('Line '&@ScriptLineNumber, '$G_CurWinMap = ', $G_CurWinMap )

... it correctly displays the contents of the Map, but after that, none of the buttons do anything. I'm forced to terminate the script tree manually. Any suggestions?

I see that you haven't visited since April, so I don't expect a reply soon. But until this is fixed, I can't use your otherwise amazing UDF.

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...