Jump to content

Another debugger for AutoIt


Heron
 Share

Recommended Posts

  • 1 month later...
  • 3 weeks later...

Arrays were not displaying for me. The following line under ";dynamic variable display"

Return StringFormat('Execute(Dbug(%s, -7, Execute("%s"), IsDeclared("%s")))', $lnr, $var, StringTrimLeft($var,1))

Was evaluating to: Execute(Dbug(48, -7, Execute("$arr1[2][4]"), IsDeclared("arr1[2][4]")))

"Execute("$arr1[2][4]")" would then be detected as a String within _Value()

I have addressed this by checking and removing the square brackets.

If StringLeft($var, 1) = "$" Then ;display variable
    $bracket = StringInStr($var, "[")
    if $bracket > 0 Then
        $var = StringLeft($var, $bracket -1)
    EndIf
    Return StringFormat('Execute(Dbug(%s, -7, Execute("%s"), IsDeclared("%s")))', $lnr, $var, StringTrimLeft($var,1))

Maybe there is a better way to fix this. Anyone else have this problem?

Btw, for anyone interested I've attached some code that will let you place breakpoints within the margin (of scite) by clicking. Line numbers must be on. It's not perfect and open to improvements. Lastly, Heron I just wanna say thanks for making this, good job.

EDIT: I've made some small changes to Dbug so that it behaves more like a background process. Dbug will now begin minimized, with no task bar icon unless GUI is activated (by clicking tray icon). Hotkeys now work outside of the Dbug window. F5 resume, F7 step in, F8 step over. I noticed step over would resume when stepping out of a function, I changed this to step to the next line instead. Disabled 1st line automatic breakpoint. Added sleep(50) to _CreateAndRun as to fix strange issue of target script not exiting correctly (could still see icon in tray). Have also made small fix to SciteBreakpoint.

SciteBreakpoint.au3

Dbug.au3

Edited by laffo16
Link to comment
Share on other sites

  • 2 weeks later...

Arrays were not displaying for me. The following line under ";dynamic variable display"

Return StringFormat('Execute(Dbug(%s, -7, Execute("%s"), IsDeclared("%s")))', $lnr, $var, StringTrimLeft($var,1))

Was evaluating to: Execute(Dbug(48, -7, Execute("$arr1[2][4]"), IsDeclared("arr1[2][4]")))

"Execute("$arr1[2][4]")" would then be detected as a String within _Value()

I have addressed this by checking and removing the square brackets.

If StringLeft($var, 1) = "$" Then ;display variable
    $bracket = StringInStr($var, "[")
    if $bracket > 0 Then
        $var = StringLeft($var, $bracket -1)
    EndIf
    Return StringFormat('Execute(Dbug(%s, -7, Execute("%s"), IsDeclared("%s")))', $lnr, $var, StringTrimLeft($var,1))

Maybe there is a better way to fix this. Anyone else have this problem?

Btw, for anyone interested I've attached some code that will let you place breakpoints within the margin (of scite) by clicking. Line numbers must be on. It's not perfect and open to improvements. Lastly, Heron I just wanna say thanks for making this, good job.

EDIT: I've made some small changes to Dbug so that it behaves more like a background process. Dbug will now begin minimized, with no task bar icon unless GUI is activated (by clicking tray icon). Hotkeys now work outside of the Dbug window. F5 resume, F7 step in, F8 step over. I noticed step over would resume when stepping out of a function, I changed this to step to the next line instead. Disabled 1st line automatic breakpoint. Added sleep(50) to _CreateAndRun as to fix strange issue of target script not exiting correctly (could still see icon in tray). Have also made small fix to SciteBreakpoint.

SciteBreakpoint.au3

Dbug.au3

laffo16,

try this code

#AutoIt3Wrapper_UseX64=n
#AutoIt3Wrapper_Run_Tidy=y
#AutoIt3Wrapper_Run_Au3Stripper=y
#Autoit3Wrapper_Testing=n

#include <Dbug.au3>
Global $aArray[10][10], $i, $j
For $i = 0 To 9
    For $j = 0 To 9
        $aArray[$i][$j] = $i & ";" & $j
    Next
Next
Sleep(3000)

And set breakpoint on Sleep(3000)

In my case I see array with no probs.

2015-07-16_13-35-48.thumb.png.ac573b53c6

2015-07-16_13-37-27.thumb.png.b8b68dd66c

Link to comment
Share on other sites

Hi Valdemar,

Sorry I should have been more specific, my issue was with the hover over tooltips not displaying arrays.

u6xeaJ3.png

I believe it's because _SCIGetCurWord() returns in this case $aArray[10][10] instead of $aArray.

Edited by laffo16
Link to comment
Share on other sites

Maybe there is a better way to fix this. Anyone else have this problem?

In my case I'm fix a  _SCIGetCurWord() function with deleting brackets  from stringregexp.

Func _SCIGetCurWord() ;get current word under cursor from Scite
    Local $pos[2], $line, $sta, $end, $text
    Local $tpoint ;= DllStructCreate("int X;int Y")

    $tpoint = _WinAPI_GetMousePos()
    If _WinAPI_WindowFromPoint($tpoint) <> $DBGhSci Then Return ""

    $tpoint = _WinAPI_GetMousePos(True, $DBGhSci)
    $pos[0] = DllStructGetData($tpoint, "X")
    $pos[1] = DllStructGetData($tpoint, "Y")

    $pos = _SCISendMessage($DBGhSci, 2022, $pos[0], $pos[1])
    $line = _SCISendMessage($DBGhSci, 2166, $pos)
    $sta = _SCISendMessage($DBGhSci, 2167, $line)
    $end = _SCISendMessage($DBGhSci, 2136, $line)

    $text = ""
    For $c = $pos To $sta step -1
        $char = chr(_SCISendMessage($DBGhSci, 2007, $c, 0))
        If not StringRegExp($char, "[-@$_a-zA-Z0-9]") Then ExitLoop
        $text = $char & $text
    Next
    For $c = $pos+1 To $end
        $char = chr(_SCISendMessage($DBGhSci, 2007, $c, 0))
        If not StringRegExp($char, "[-@$_a-zA-Z0-9]") Then ExitLoop
        $text &= $char
    Next

    Return $text
EndFunc ;_SCSIGetCurWord

2015-07-24_12-28-27.thumb.png.264ae5e9bb

Now it is work.

Edited by valdemar1977
Link to comment
Share on other sites

New version with array visualization fix, described by laffo16.

Also add laffo16 fix of normal exiting from script, thank you laffo16.

Add a toggle button for switch on\off breaking script on first line with saving state in dbug.ini .

At the first start of dbug always stop on first line by default, uncheck button (new button at the right  of insert breakpoint button) for disable this option.

 

 

Dbug_24jul15.zip

Edited by valdemar1977
Link to comment
Share on other sites

New version

+ Button for copy variable from list to conditional breakpoint expression(hotkey Ctrl+A)

+ Conditional expression state now saving in ini file

+ Hotkey for StepInto (F7) StepOver (F8) and RunToCursor (F9) working now also if DBUG is not in focus as described by laffo16

+ Automatically restore saved state with variables, conditional breakpoint expression and command on start

+ Changed variables list editing (now it is work as must to be work)

Dbug_28.07.15.zip

Link to comment
Share on other sites

  • 2 weeks later...

I don't know what I'm doing wrong but I can't make it work. I put the Dbug.au3 on my Include folder, and the images in 2 different paths ... at the same level then Include folder and inside include folder. I made a test script and put on top the required #include <dbug.au3> and when I run I got the shadow file, but none GUI. When I run the DbugScript.au3 it runs until be removed.

Anyone had this problem or know how I can fix.

I'm using Autoit 3.3.14.1 and last release of Dbug (10.08.15)

Link to comment
Share on other sites

I don't know what I'm doing wrong but I can't make it work. I put the Dbug.au3 on my Include folder, and the images in 2 different paths ... at the same level then Include folder and inside include folder. I made a test script and put on top the required #include <dbug.au3> and when I run I got the shadow file, but none GUI. When I run the DbugScript.au3 it runs until be removed.

Anyone had this problem or know how I can fix.

I'm using Autoit 3.3.14.1 and last release of Dbug (10.08.15)

Can I see your script?

What is your OS version?

Do you use 64-bit version of wrapper?

I'm tested Dbug in Win 7-64 and Win8.1-64 in 32 and 64 bit modes of wrapper with a lot of example (and my own) scripts without any problems.

Edited by valdemar1977
Link to comment
Share on other sites

Morning, @valdemar1977

This is my code:

#include <dbug.au3>

HotKeySet("{ESC}", "Close")

Main()

Func Main()
    ProgressOn("DBUG Test", "Testing the AutoIt DBUG", "Counting")
    For $i = 0 To 10
        ProgressSet($i * 10, 10 - $i & " to 10")
        Sleep(500)
    Next
    ProgressSet(100, "DONE", "Test Finished")
    Sleep(200)
    ProgressOff()
EndFunc

Func Close()
    Exit 0
EndFunc

when i run I get this

>"I:\LiberKey\MyApps\autoit-v3\SciTe\..\AutoIt3.exe" /ErrorStdOut "I:\LiberKey\MyApps\autoit-v3\Projects\teste.au3"    
>DBUG started with 0 arguments [PID:0].
--> Press F6 for activate DBUG window, Ctrl+Q for exit.
>Exit code: 0    Time: 1.173

I don't use wrapper anymore, and when I compile I use pragma directive. I downloaded your last version before write this topic, and still don't work. Sorry, probably I'm doing something wrong but I don't know what.

Thanks for the support :)

My System Specification:

AutoIt Version: V3.3.14.1 [X32]
Windows Version: WIN_XP [Portuguese]
Language: 0416

 

Edited by DarkwarlorD
Correcting mispelled words
Link to comment
Share on other sites

Morning, @valdemar1977

This is my code:

#include <dbug.au3>

HotKeySet("{ESC}", "Close")

Main()

Func Main()
    ProgressOn("DBUG Test", "Testing the AutoIt DBUG", "Counting")
    For $i = 0 To 10
        ProgressSet($i * 10, 10 - $i & " to 10")
        Sleep(500)
    Next
    ProgressSet(100, "DONE", "Test Finished")
    Sleep(200)
    ProgressOff()
EndFunc

Func Close()
    Exit 0
EndFunc

when i run I get this

>"I:\LiberKey\MyApps\autoit-v3\SciTe\..\AutoIt3.exe" /ErrorStdOut "I:\LiberKey\MyApps\autoit-v3\Projects\teste.au3"    
>DBUG started with 0 arguments [PID:0].
--> Press F6 for activate DBUG window, Ctrl+Q for exit.
>Exit code: 0    Time: 1.173

I don't use wrapper anymore, and when I compile I use pragma directive. I downloaded your last version before write this topic, and still don't work. Sorry, probably I'm doing something wrong but I don't know what.

Thanks for the support :)

My System Specification:

AutoIt Version: V3.3.14.1 [X32]
Windows Version: WIN_XP [Portuguese]
Language: 0416

 

Try in Win7 and Win8.1 x64 - no problems

2015-08-12_14-51-45.thumb.png.6311b59046

Will investigate

 

>DBUG started with 0 arguments [PID:0].

It is not good. Looks like that Dbug dont see you AutoIt installation.

Do you use portable version?

Edited by valdemar1977
Link to comment
Share on other sites

Update

+ DBUG Console with StdOut and StdError streams.

2015-08-17_14-31-21.thumb.png.560fe12a19

How to use:

1. Put IMAGES dir in the same dir as Autoit3.exe, Dbug.au3 to include folder

2. IMAGES now containing two console executables (32-bit and 64-bit) and icons.

3. In the listing of your script add line ;CONSOLE DBUG  (case sensitive, one space between keywords) if you want to see console during debug

For you convenience I'm put an example of script (provided by @DarkwarlorD). In example you can see how to use DBUG.

Region STOP DBUG till EndRegion START DBUG exclude region of code from debugging.

#include <Dbug.au3> ;CONSOLE DBUG

HotKeySet("{ESC}", "Close")
Main()

Func Main()
    ProgressOn("DBUG Test", "Testing the AutoIt DBUG", "Counting")
    For $i = 0 To 10
        ProgressSet($i * 10, 10 - $i & " to 10")
        Sleep(500)
    Next
#Region STOP DBUG
    ProgressSet(100, "DONE", "Test Finished")
    Sleep(200)
    ProgressOff()
#Region START DBUG
EndFunc

Func Close()
    Exit 0
EndFunc

DO NOT FORGET TO COMMENT OR DELETE 

#include <Dbug.au3>

BEFORE COMPILING

 

 Dbug_17.08.15.zip

Edited by valdemar1977
Changed archive
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...