Jump to content

cDebug, an alternative to a graphical debugger


Recommended Posts

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 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')
_GuiDebug('At line '&@ScriptLineNumber,'$cats,jack is,$cats[..][$i],$i,hex,structure{uint}', _





Edited by c.haslam

CDebug Dumps values of variables including arrays and DLL structs, to a GUI, to the Console, and to the Clipboard


Link to comment
Share on other sites

  • 1 month later...

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


My UDFs  _AuThread multithreading emulation for AutoIt · _ExtInputBox an inputbox with multiple inputs and more features · forceUTF8 fix strings encoding without knowing its original charset · JSONgen JSON generator · _TCPServer UDF multi-client and multi-task (run on background) event-based TCP server easy to do · _TCPClient_UDF multi-server and multi-task (runs on background) event-based TCP client easy to do · ParseURL and ParseStr functions ported from PHP · _CmdLine UDF easily parse command line parameters, keys or flags · AutoPHP Create documents (bills, incomes) from HTML by sending variables/arrays from AutoIt to PHP · (Un)Serialize Convert arrays and data into a storable string (PHP compatible) · RTTL Plays and exports to MP3 Nokia-format monophonic ringtones (for very old cellphones) · I18n library Simple and easy to use localization library · Scripting.Dictionary OOP and OOP-like approach · Buffer/stack limit arrays to N items by removing the last one once the limit is reached · NGBioAPI UDF to work with Nitgen fingerprint readers · Serial/Licensing system require license key based on unique machine ID from your users · HTTP a simple WinHTTP library that allows GET, POST and file uploads · Thread true AutoIt threads (under-dev) · RC4 RC4 encryption compatible with PHP and JS ·  storage.au3 localStorage and sessionStorage for AutoIt Classes _WKHtmlToX uses wkhtmlto* to convert HTML files and webpages into PDF or images (jpg, bmp, gif, png...) Snippets _Word_DocFindReplaceByLongText replace strings using Word UDF with strings longer than 255 characters (MSWord limit) rangeparser parser for printing-like pages interval (e.g.: "1,2,3-5") EnvParser parse strings/paths with environment variables and get full path GUICtrlStaticMarquee static text scrolling Random stuff Super Mario beep sound your ears will hurt


Link to comment
Share on other sites

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

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.


Link to comment
Share on other sites

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...