Author Topic: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩  (Read 41771 times)

0 Members and 1 Guest are viewing this topic.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
« Reply #135 on: September 28, 2021, 06:11:21 am »
@FellippeHeitor

dev v2.0  049499c   Win 10 x64 Pro 21H1 (Aug updated)



Now the watch values in my Xsep.bas are as expected - MANY THANKS.



I wonder if suffixes "for everything" in Watch List Window (referring to DIM variables)  and   * N   (fixed string length) will just happen to come along (hint, hint).


   :)



Offline mpgcan

  • Newbie
  • Posts: 26
    • View Profile
Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
« Reply #136 on: September 28, 2021, 06:39:11 am »
The following code fails on the new development builds:
Code: QB64: [Select]
  1. Print "hwnd = "; _WindowHandle
_WindowHandle returns a 0 and not a handle as expected.

The following code fails on the dev builds however works fine on stable builds (1.5 x32 x64 3043116) note added a test line:

Ref: https://www.qb64.org/wiki/Windows_Libraries#Borderless_Window

Code: QB64: [Select]
  1. '============
  2. 'NOBORDER.BAS
  3. '============
  4.  
  5.     FUNCTION FindWindow& (BYVAL ClassName AS _OFFSET, WindowName$)
  6.  
  7.     FUNCTION GetWindowLongA& (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG)
  8.     FUNCTION SetWindowLongA& (BYVAL hwnd AS LONG, BYVAL nIndex AS LONG, BYVAL dwNewLong AS LONG)
  9.     FUNCTION SetWindowPos& (BYVAL hwnd AS LONG, BYVAL hWndInsertAfter AS LONG, BYVAL x AS LONG, BYVAL y AS LONG, BYVAL cx AS LONG, BYVAL cy AS LONG, BYVAL wFlags AS LONG)
  10.  
  11. GWL_STYLE = -16
  12. WS_BORDER = &H800000
  13.  
  14. _TITLE "No Border"
  15. hwnd& = _WINDOWHANDLE 'FindWindow(0, "No Border" + CHR$(0))
  16. Print "hwnd = "; _WindowHandle '<<<<<<< Test line
  17.  
  18. PRINT "Press any key for no border...": A$ = INPUT$(1)
  19.  
  20. winstyle& = GetWindowLongA&(hwnd&, GWL_STYLE)
  21. a& = SetWindowLongA&(hwnd&, GWL_STYLE, winstyle& AND NOT WS_BORDER)
  22. a& = SetWindowPos&(hwnd&, 0, 0, 0, 0, 0, 39)
  23.  
  24. PRINT "Press any key to get back border...": SLEEP
  25.  
  26. winstyle& = GetWindowLongA&(hwnd&, GWL_STYLE)
  27. a& = SetWindowLongA&(hwnd&, GWL_STYLE, winstyle& OR WS_BORDER)
  28. a& = SetWindowPos&(hwnd&, 0, 0, 0, 0, 0, 39)
  29.  
  30. PRINT "The end"
  31.  
QB64 Development Builds:
QB64x32 2.0 049499c
QB64x64  2.0 049499c

PC spec as follows:  Windows 8.1,  Processor Intel(R) Core(TM) i3-3217U CPU 1.8 GHz, RAM 4GB, 64-bit

Marked as best answer by on Yesterday at 10:22:12 am

FellippeHeitor

  • Guest
Try adding this before you try fetching the window handle:

Code: QB64: [Select]

FellippeHeitor

  • Guest
Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
« Reply #138 on: September 28, 2021, 09:01:58 am »
@FellippeHeitor

dev v2.0  049499c   Win 10 x64 Pro 21H1 (Aug updated)



Now the watch values in my Xsep.bas are as expected - MANY THANKS.

Great to hear, Richard!

Offline Dav

  • Forum Resident
  • Posts: 792
    • View Profile
Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
« Reply #139 on: September 28, 2021, 09:03:37 am »
The following code fails on the new development builds:
Code: QB64: [Select]
  1. Print "hwnd = "; _WindowHandle
_WindowHandle returns a 0 and not a handle as expected.

The following code fails on the dev builds however works fine on stable builds (1.5 x32 x64 3043116) note added a test line:

Yeah, I get the same runing that as is.  Maybe the dev build EXE's inits the screen at a different speed now.  I didn't notice this though, because I always do this now before using _windowhandle or _title, just to be on the safe side...

DO: LOOP UNTIL _SCREENEXISTS
PRINT _WINDOWHANDLE

EDIT: Oops..I see @FellippeHeitor already answered this while I was posting.  Sorry...

- Dav

Offline mpgcan

  • Newbie
  • Posts: 26
    • View Profile
Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
« Reply #140 on: September 28, 2021, 09:31:05 am »
Hi Fellippe and Dav
Wait for the screen to exists is the solution.
It explains why some programs worked and other failed.

DO: LOOP UNTIL _SCREENEXISTS

Many thanks to you both.

FellippeHeitor

  • Guest
Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
« Reply #141 on: October 02, 2021, 03:29:41 am »

New development build available today brings the following improvements:

- Watchpoint indicator in the Watch Panel: a dot will appear next to a variable that has a watchpoint set to it. Hovering it will reveal the condition being monitored.
- Closing the Watch Panel won't immediately discard the Watch List (you may want to close it temporarily, without having to reselect every item). To show it again, just go back to the F4 dialog and close it.
- Variable selection will be kept throughout the active session even if you edit your source code, provided that you don't make changes to user-defined TYPEs.
- Breakpoint/Skip Line data will be automatically saved and restored when you open the same file (from the same location) again.

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
    • View Profile
Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
« Reply #142 on: October 02, 2021, 01:11:41 pm »
@FellippeHeitor

v2.0 48e8f38 win 10 x64 Pro 21H1 (Aug updated)


Thank you for having the version info on many more screen stages of $DEBUG - I only so far could find one where the version info does not display (Debug session aborted.) This "omission" is not a problem/issue for me.


FellippeHeitor

  • Guest
😉👍

If you take a screenshot with any menu open, you won't get the status to display version info either, cause the status bar is taken over by menu item descriptions.

Offline hanness

  • Forum Regular
  • Posts: 210
    • View Profile
Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
« Reply #144 on: October 02, 2021, 05:12:00 pm »
I'm doing some major additions to some of my code and the $Debug functionality is really helping tremendously. I've even found some unexpected ways that it's helping. As an example, I have a lot of variables that I juggle. Since my code does things like partition and format flash drives, I deal with partitions a lot. I have lots of variables like ParSize, ParType, TotalPartitions, ParDescription, and lots more. Sometimes, I can't recall the exact name of a variable I want to use so I must put an index mark where I'm working, then go fishing through my code to find the right variable name, then come back to where I was working. With debug, I simply hit F4 and in the filter box just start typing (P-A-R) and bingo! There are all the variables I want. So now I found what I'm looking for without ever moving off my current line of code.

I also like to do some fine-tuning as I go along. So, I'll run my code, look at the output, and if I see something like a text message that could be re-worded or a menu that doesn't look good, I stop execution and fix that little piece right then and there. So, there is a lot of run, fix, run fix, etc. Being able to keep my variable watches without having to recreate them every time really helps in such a repeating cycle type of flow.

Thanks! I'm really having <gasp> FUN with my amateur coding right now.

FellippeHeitor

  • Guest
Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
« Reply #145 on: October 02, 2021, 05:21:17 pm »
Glad to hear it's helping your process! I'm already at the point of no return with these too ❤️.

Offline doppler

  • Forum Regular
  • Posts: 241
    • View Profile
Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
« Reply #146 on: October 02, 2021, 07:41:53 pm »
Thanks! I'm really having <gasp> FUN with my amateur coding right now.

It's alright to have fun.  It's a three letter word.  Unfortunately GASP is a four letter word, we are having "nun" of that here.

FellippeHeitor

  • Guest
Re: [dev build] $DEBUG mode Step through your code, watch variables!
« Reply #147 on: October 03, 2021, 11:34:51 pm »

New development build available today brings the following improvements:

- Using the Input$() function to read data from a file/port won't switch focus from the IDE to the debuggee anymore.
- Minor usability/interface tweaks. See complete changelog at https://github.com/QB64Team/qb64/commits/development, as usual.

🤗