QB64.org Forum

Active Forums => QB64 Discussion => Topic started by: FellippeHeitor on August 15, 2021, 02:15:06 am

Title: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 15, 2021, 02:15:06 am
New development build available today at https://www.qb64.org/portal/development-build/ (https://www.qb64.org/portal/development-build/). Look for these improvements to the new $Debug mode:

Specific to $Debug mode:
- You can now change the value of fixed-length strings from the Watch List dialog (F4).
- In Windows, the IDE will bring the running program to the front/set focus to it when F5 is used; the running program will bring the IDE to the front/set focus to it when a breakpoint is reached.
- When a line with INPUT/LINE INPUT is run, the IDE will also set focus to the running program automatically.

Side improvements/fixes:
- Ctrl+Insert, Shift+Insert and Shift+Delete can now be used as alternatives to Ctrl+C, Ctrl+V and Ctrl+X in dialogs.
- Old issue of UBOUND/LBOUND calls not fetching the proper case of the referenced arrays finally fixed.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Pete on August 15, 2021, 02:53:40 am
The focus addition is great. It's making me feel like I'm back in the good ol' QBasic interpreter days! That, and I have a strange urge to watch the movie Back to the Future.

Pete
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on August 15, 2021, 05:32:25 am
@FellippeHeitor



38e0ec3 win-x64 21H1 Pro


Unless I am forgetting something -


When I have many variables to watch (in my case over a hundred) with F4 I can   < Add All > and it highlights all in a green-blue color -  the watch list box only shows a small number of variables (understandably  it can not show more than the lines of code in the IDE).

By dragging on the watch list WHITE BLOCK (bottom right hand corner of Watch List Box) I can expand horizontally the width and vertically the number of watch list variables to display.

I cannot seem to be able to get access to say the 30th variable (when the IDE code view is say only about 17 lines).

Also the "thumb slider" and single step up-down arrows for stepping through the list is absent.

Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 15, 2021, 06:00:55 am
I don't seem to get that issue. Isn't this the result of filtering the list? You sure all of them were selected for watching?

Also: don't watch so many. It slows things down considerably and I doubt you will really be needing to watch that many variables when investigating a specific bug.

You are expected to actually select the ones you're interested in watching, the ones that are relevant at a certain point in your program's development and that will aid you in finding a specific bug.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on August 15, 2021, 06:02:26 am
@FellippeHeitor

update to my last reply just above


I restarted the dev build but having the config.ini file setup for larger font (since I have a high DPI display and the IDE comes out tiny) and with some IDE color changes.

On re-running my test program - the issue reported above seems to have gone away - apart from the config.ini changes as mentioned here - there were no changes in technique to run $DEBUG.

Below is now the Watch List Box I see


  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 15, 2021, 06:03:15 am
The focus addition is great. It's making me feel like I'm back in the good ol' QBasic interpreter days! That, and I have a strange urge to watch the movie Back to the Future.

Pete

Glad the experience has been positive, thank you for trying it, Pete.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on August 15, 2021, 06:34:24 am
 @FellippeHeitor

Just to let you know the conditions for my reported problem

Using purely the default settings for the IDE (and only 17 code lines visible) - using F4 (in my case selecting all variables + close) - when the Watch List box only shows 3 variables is when the strange things (for me) happens.



  [ This attachment cannot be displayed inline in 'Print Page' view ]  

Now that I recognize the situation - it is now NOT A PROBLEM anymore for me.

Thanks for your advice re number of watch variables  being viewed - of course for maximum speed (once my program has been debugged) I would not be running in debug mode anyway.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: doppler on August 15, 2021, 08:17:47 am
@FellippeHeitor

Thanks for taking on the focus thingy so soon.  If it wasn't for that pesky "Immediate window".  You could call this Quick Basic Pro V8+

Just a thought here since I just thought of it.  I know all the hooks in coding that the $debug mode puts in the "C" code. Not tested this myself.  But a comparison should be done between the old V1.5 compiled code without debugging "On" and the Dev build without debugging "On".   Just to be sure any left over hooks were not removed, or conditional expressions overlooked.  Sorry this is just the coder in me thinking about "Did we leave any policing of the parade ground undone, after the event."

Since V1.5 was release not long ago.  This version should be called V2.0 after dev time.  It's going to be such a departure of the former enhancements (minor V bumps).  Worthy of a major version bump.  The resulting code may not warrant a major bump.  The development environment would justify.  I know Micro$oft would try to extract a pound of flesh for this.

Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: mpgcan on August 15, 2021, 01:21:37 pm
I have just tested dev version:
qb64_2021-08-15-06-01-06_38e0ec3_win-x86.7z

Compiled the following file:
https://www.qb64.org/forum/index.php?topic=4111.0
mpg_input_box_1.bas

Note1: With no $Debug  statement. It compiled and ran as expected.

Note2: Added the $Debug  statement.
Recompiled and it failed. The compilelog.txt file contains:
Code: QB64: [Select]
  1. In file included from qbx.cpp:1091:
  2. ..\\temp\\regsf.txt:44:11: error: redefinition of 'HINSTANCE__* DLL_user32'
  3.  HINSTANCE DLL_user32=NULL;
  4.            ^~~~~~~~~~
  5. compilation terminated due to -Wfatal-errors.
  6.  
Note3: Had no problems with dev version qb64_2021-08-03-07-23-31_e737219_win-x86.7z
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 15, 2021, 01:27:57 pm
Ah, the dreaded x86 version. I haven't done testings there yet, thanks for reporting.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 15, 2021, 01:35:10 pm
@mpgcan Interestingly, I just tried the 32bit package from our website and it worked without issues. Did you unpack to a fresh and clean empty folder? What version of Windows are you running? Please provide as much detail as you can.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Pete on August 15, 2021, 03:32:38 pm
Small potatoes thingy...

I always set the current line background color to the same as the screen, so it doesn't show up. I know what line I'm on by looking for the cursor; however, on debug mode, when the current line background is not being used to highlight the current line, the step through process is not visible. If simple, could the ide use the standard QBasic interpreter "red" current line highlighter as either a default or at least show the cursor on the beginning of a line as it steps through the code?

Pete
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 15, 2021, 04:01:02 pm
And another small potato

Step Into, Step Out, Step Over... Am I correct in saying that none of these can be used to Skip some code. For example, where there is a loop - For x = 1 to 5: Do Something:Next. All the steps will run thru that code 5 times, none of them can be used to just skip over those lines?

Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Pete on August 15, 2021, 04:27:20 pm
@Dimster: That would have been a nice feature in QB. I remember swearing up a storm pressing through FOR/NEXT and LOOPs in search of a bug. When I realized the loop had nothing to do with it, I had to exit everything and set the break point beyond the loop, and start all over. I wish I could have just pressed a key to automatically run the loop, and resume debug upon exit. That would be a nice feature, indeed!

I haven't tried using Ctrl + P yet. I'm not sure what that would do at the start of a loop.

Pete
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 15, 2021, 05:04:45 pm
@Pete we've adopted the full red line to indicate errors, that's why we'll use the extra bg color to navigate through Debug mode, as it's less aggressive. The triangle to the left of the next line to be run should suffice in your specific color setup.

  [ This attachment cannot be displayed inline in 'Print Page' view ]  

@Dimster & @Pete: I assume you haven't tried right-clicking the code while $DEBUG mode is active. If you want to run a loop without going line by line, right click a line immediately after the loop and choose "Run to this line".

  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Pete on August 15, 2021, 05:38:29 pm
I'm using the Windows 10 64-bit version.

The triangle shows up only with "Continue" but does not show at all with F8 step procedure. The reason this happens is because I turned off LINE NUMBERS. Yep, that's right, the triangle with F8 needs line numbers (yuck) active in order to show up for work. Turn off the line number "feature" and the triangle goes on strike!

In other news, I love the "Right Click" feature with the Run to this Line to exit out of loops. Nice!

Pete

Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 15, 2021, 05:51:01 pm
The triangle should be visible without line numbers indeed. Thanks for reporting.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 16, 2021, 10:08:04 am
Couple of things:
- "Run to this line" is a one shot deal. Is that correct. Once we hit that line the debugging is aborted? There is no way to set multiple Run TO's??
-  I'm having difficulty displaying both the Variable/Array watch list with the running changes in values, and the IDE screen which identifies the line of code being acted upon at the same time. Are those two screens not supposed to be displayed at the same time no matter what the Screen _Newimage is set at??? In this case I set the Screen _Newimage (1200,800,32).
- In terms of display screens - in my mind there are 3 display screens which I use for debugging (actually only2 before $Debug came along with the Variable List), the IDE which carries all the lines of code, the Output Screen displaying the results of the coding activity and now the Variable/Array List. I believe there is no way to either display all 3 at once, or toggle between all 3 (say if the program run has been paused). Is that correct? The IDE and Variable/Array List SHOULD display at the same time? Sorry but I'm just not sure what can be visually displayed at once and if at least 2 can be displayed at the same time, how to do that.

P.S. Aren't you glad Fillippe you showed a banana coder (as opposed to a spaghetti coder) like me how to download $Debug? You will never know how much this aspect of QB64 will help with the price of bananas. 
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 16, 2021, 11:12:50 am
Quote
- "Run to this line" is a one shot deal. Is that correct. Once we hit that line the debugging is aborted? There is no way to set multiple Run TO's??

It should only get "aborted" if you chose to run to the last line, then it'll likely end indeed. Other than that, the procedure is indeed temporary, especially because "Run To This Line" actually sets a temporary (invisible) breakpoint, runs your code until the breakpoint is reached, and removes it. To make it permanent, add an actual breakpoint (F9).

Quote
-  I'm having difficulty displaying both the Variable/Array watch list with the running changes in values, and the IDE screen which identifies the line of code being acted upon at the same time. Are those two screens not supposed to be displayed at the same time no matter what the Screen _Newimage is set at??? In this case I set the Screen _Newimage (1200,800,32).
I take it you mean the Watch List is covering some portion of your code you'd like to see. The Watch List dialog (not the one where you add variables, but the floating panel with values changing in real time) can be resized and moved around, please let me know if that's what you meant.

Quote
- In terms of display screens - in my mind there are 3 display screens which I use for debugging (actually only2 before $Debug came along with the Variable List), the IDE which carries all the lines of code, the Output Screen displaying the results of the coding activity and now the Variable/Array List. I believe there is no way to either display all 3 at once, or toggle between all 3 (say if the program run has been paused). Is that correct? The IDE and Variable/Array List SHOULD display at the same time? Sorry but I'm just not sure what can be visually displayed at once and if at least 2 can be displayed at the same time, how to do that.
There's no extra window with the IDE, which is why the Watch panel is constrained by the IDE window. See the reply above.

Quote
P.S. Aren't you glad Fillippe you showed a banana coder (as opposed to a spaghetti coder) like me how to download $Debug? You will never know how much this aspect of QB64 will help with the price of bananas.
Glad you're enjoying the experience ❤️
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 16, 2021, 11:14:07 am
Still regarding "Run to this line", beware that if you set it to a line that can't be reached due to your program's logic, you will have to use F7/F8 to pause execution again.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 16, 2021, 11:49:32 am
Thanks for the info on the use of Run to this line.

Yes, it is the floating panel with the values changing in real time which I can't seem to get displayed. At the start of my debugging session I select Debug, select the Variable List, select the Array I want to watch. In this case the array has 50 indices so I enter (1-50) in the brackets. The Watch List does show the acceptance of (1-50). From there I close the watch list and from Debug I select to start Paused. As soon I do that I do get the 3 screens which I previous described and which I was hopefully that all three would remain. That floating panel with the array choices is displayed correctly with my choices.

But from there, I need to focus back on the IDE. The output screen now goes down to the task bar so I can toggle there but the floating panel with the watch list is completely gone. I no longer can access the "run" option at the top menu but the bottom menu for debug gives me a Run F5 option which i select. The program runs to the end never displaying that floating panel  or showing the selected array running values. That floating panel doesn't appear on the task bar either.

Another strange situation seems to be the I can't select any of the F keys on my key board, can only chose them via the debug options. I assume the control of the F keys by debug is intended?
 
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 16, 2021, 11:55:30 am
Arrays haven't been implemented yet. With regular variables, the panel will show only while in pause mode.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 16, 2021, 11:57:18 am
Might wanna check if your operating system has maybe assigned the function keys to multimedia control. If you have a "Fn" key, try using it with your function keys - beware those will only respond as long as the IDE has focus.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Pete on August 16, 2021, 12:33:18 pm
Might wanna check if your operating system has maybe assigned the function keys to multimedia control. If you have a "Fn" key, try using it with your function keys - beware those will only respond as long as the IDE has focus.

I can confirm this. Some video editing software will hijack your windows keys, but as Fell stated, the solution is this: Instead of pressing F3 to do a search in notepad, press Fn + F3. Holding down the function key overrides the Window key hijacking problem. You can also search online for software to repair this issue, but I don't know how the results would be if the video software is used again.

Pete
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: doppler on August 16, 2021, 01:46:41 pm
The ultimate in key hijacking. https://www.autohotkey.com/
You can make any key combination do strange to say stuff.  And when you forget to suspend it, does even stranger stuff to qb64-debug version.  I have F7 macro'ed to do something else.

I have used AHK, to do things within QB64 that are impossible to do only using QB64.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Pete on August 16, 2021, 03:23:54 pm
The ultimate in key hijacking. https://www.autohotkey.com/
You can make any key combination do strange to say stuff.  And when you forget to suspend it, does even stranger stuff to qb64-debug version.  I have F7 macro'ed to do something else.

I have used AHK, to do things within QB64 that are impossible to do only using QB64.


Ah, that's the one I was thinking of, I just couldn't remember the name. Thanks!

Pete
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 16, 2021, 03:28:53 pm
fn key was the solution, thanks guys for that.

I'm using break points to pause the running of my test program. I'm placing them inside the looping. I'm expecting to see the variable values changing one loop at a time. When the program run pauses at the break point there is no automatic display of the variable list (I am now only using the variables and not the arrays).

However if I then select F4 to add to the variable list, I do get the main Watch List display and on that list I do see the values being held in the chosen variables.

I then do not add any more variables (contrary to the stated instructions  of F4 being "ADD Watch") but now hit F5 to continue the run of the test program. This however seems to take me out of the Loop and beyond the break point code line? I was hoping to stay in that loop and expected it to hit the break point again, then I was going to toggle between F4 and F5 to watch the changing values in the selected variables.

Is there another way to pause a running program to view the values contained in the variables selected on the Watch List and do this multiple times?
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 16, 2021, 03:32:12 pm
Both F7 and F8 will trigger a pause/step through your program. The difference between both is that F8 will not enter procedures, while F7 will.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: doppler on August 16, 2021, 07:21:25 pm
Here is a side effect and benefit in using the debugger version of qb64.  For those people who want to better codify there code.  And to remove once off or improperly used variables.  The way to do it would be using OPTION _EXPLICIT in your source.  Declare everything up front and use the proper variable types.

Here is the downfall with option _explicit.  You want to fix an old program up. What if you got a hundred or so variables out there ?  Find and declare every single one.  What a pain.  What if you declare a single precision when a float was needed.  More pain.

Well have I got less painful way of finding all those variables.  Use the debug mode on your monster and put a watch on all variables.  Tada, you now have this neat window with all your used variables.  The window is not going to tell you the variable type usages, but it will give a direction about how many there are.

Now it would real cool if there was a way to export the variable list into a text file for merging backing into the program to declare all of them properly.
--> Hint, Hint, wink, wink, nudge, nudge. <-- Do I have to say more ?
"the variable type usages" more nudging maybe on the export?

Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: SpriggsySpriggs on August 16, 2021, 07:24:35 pm
I recommend just starting all programs with Option Explicit turned on. Saves you lots of trouble.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: doppler on August 16, 2021, 07:30:57 pm
Saves you lots of trouble.

No pain, no gain.
Besides this is to push the screaming masses in the proper coding direction.  I now use it exclusively since I noticed the benefit in coding.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 16, 2021, 08:00:59 pm
Ctrl+C when the variable list is focused in the F4 dialog will copy the list to the clipboard 😉
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: doppler on August 16, 2021, 09:18:32 pm
Ctrl+C when the variable list is focused  😉

I will have to remember this one.  Hopefully others will to.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 16, 2021, 11:09:08 pm
Thanks Fell .... I'm an fn pausing maniac now. Time to put this new toy to work. Can't wait to mess with the Arrays.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 17, 2021, 09:21:08 am
New dev build available today (https://www.qb64.org/portal/development-build/), from git 70b6f7b, with preliminary support for watching array elements:

Known limitations:
- doesn't check for lower/upper limits of arrays, so it's up to you to respect those, or your program will crash.
- for now, for an array defined with limits not starting at 0, like DIM a(5 to 10), for example, treat those as 0-5 when choosing which indexes to watch.
- can't watch arrays with multiple-dimensions.
- can't set values of array elements yet.
- UDTs not implemented yet.

Mandatory reminder that you shouldn't add too many array elements, or too many variables, to the watch list at once. The idea of watching values is to inspect those you believe are acting weird in your program so you can find where a bug is hiding.

Quick demo:

Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 17, 2021, 11:52:02 am
Correction:
- for now, for an array defined with limits not starting at 1, like DIM a(5 to 10), for example, treat those as 1-6 when choosing which indexes to watch. Watching index 0 will crash it.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: doppler on August 17, 2021, 01:12:41 pm
@FellippeHeitor I am seriously concerned for your health.  Do you get enough sleep?  I got this mental image of you sitting cross legged in your chair with only your underwear on.  Eating Hot-Pockets (The Core Movie) and coding qb64-debug day -n- night 24/7/365.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 17, 2021, 01:17:44 pm
I'm doing ok, thank you for your concern. Now stop picturing me in my underwear 😂
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: SMcNeill on August 17, 2021, 01:38:35 pm
I'm doing ok, thank you for your concern. Now stop picturing me in my underwear 😂

OH GOD!!  I JUST PICTURED FELLIPPE SITTING WITHOUT HIS UNDERWEAR ON!!  MY BRAIN’S EYE NEEDS BLEECHING!!
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 17, 2021, 01:52:38 pm
( ͡° ͜ʖ ͡°)
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 17, 2021, 02:15:20 pm
Another PS, latest version comes from git 30d6782.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dav on August 20, 2021, 10:22:54 am
Wow, I go away a while and come back to a great new feature added.  Maybe I should go away again and see what happens.

I'll be downloading and trying this out!

- Dav
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 20, 2021, 11:20:11 am
@Dav - don't keep disappearing! But glad you like the new feature 🤗

Latest dev build generated today (https://www.qb64.org/portal/development-build/) (don't focus on the commit id, focus on the date) contains the following tweaks:

- Array elements can now be watched in real time regardless of the lower boundary - even index 0 can be properly watched.
- Data transfer from debuggee to the IDE is now a bit more efficient (you will see faster updates in the Watch Panel as you step through your code).
- _ConsoleTitle should work ok with $Debug now.

Still to be done:
- can't watch arrays with multiple-dimensions.
- can't set values of array elements yet.
- UDTs not implemented yet.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: hanness on August 20, 2021, 12:28:42 pm
Confirmed: At least for me, this build is working with _ConsoleTitle

Question: With the change of focus between the output screen and the IDE, would it make sense to change focus to the output screen when a "Shell" command is run?

I was thinking that this might be nice because Shell may be calling something that requires input from the user. On the other hand, it's possible that Shell may be calling something that requires no input at all. I'm not sure if there is any way to detect whether what is being run via Shell is looking for input or not, so if this is a dumb idea, please do feel free to let me know :-).
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: doppler on August 22, 2021, 08:57:42 am
@FellippeHeitor After viewing the use of single dimension array watching, I have come to the conclusion that a console window should be used to paint the results.  The watch box created is going to become very busy.  Or very overloaded on occasion. (re: multi-dimensions)  Being able to move the watch box to either another monitor, or task view virtual window is going to become necessary.  For people who can't afford a bigger monitor this would be a blessing.  Moving to a task view virtual window is going to be hell to do. But it maybe a way for people who can't even afford even a second monitor.

Keep it up, getting better with every DEV release.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 24, 2021, 03:06:31 am
Latest development build (https://www.qb64.org/portal/development-build/) available today brings the ability to watch UDTs - both simple variables and arrays. Also, watching _BIT variables is now minimally supported (no arrays of type _BIT though).



Still to be done:
- can't watch arrays with multiple-dimensions.
- can't set values of array elements yet.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 24, 2021, 11:14:52 am
Every time a new dev build comes up, I advise those of you who are interested in keeping up with it to have a look at the recent commit list at https://github.com/QB64Team/qb64/commits/development (https://github.com/QB64Team/qb64/commits/development), especially since there could be some minor thing that got fixed/added that maybe is interesting to you in particular but maybe not as expressive to add to the changelog.

The commits tagged with a ✅ are the ones that went up in the https://www.qb64.org/portal/development-build/ page.

Thanks to all who keep following us as the new features get implemented. 🤩
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 27, 2021, 02:04:47 pm
Fell - I'm back, difficult past few weeks with death of very good friend.

Thanks for the array watch feature. I finally figured out that I need to shrink the size of my IDE in order to see the coding, watch list and output screen all at the same time. Do you have a recommended  or optimal Width and Height which you use? I presently changed the width from 240 to 120 and height from 63 to 31 but from what I can see in your videos your display seems to be some what longer.

I haven't yet figured out how to run the watch list in real time and see the code line being highlighted at the same time (which I see you can do in the latest video).

Also, it appears there is no "Run To" option which would  have your program run to a particular line and then pause.

Or by holding down the mouse button on "Step Into" that you run through the code just to see the changes in the watch list values a little faster than one click at a time.

Also, at the end of the program run and the we get the message "Debug session aborted" "Discontinued", is there a way to see the final values of the array in the Watch List?



Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 27, 2021, 03:27:29 pm
Hi, Dimster. Good to have you back, and sorry to hear about your loss.

Quote
Do you have a recommended  or optimal Width and Height which you use?
You'll really have to experiment with it, since our screens will vary. I, for example, have a second screen.

In the latest dev build, there's an option in the Debug menu to have the watch list be output to the console instead - works pretty well with a small list.

Quote
Also, it appears there is no "Run To" option which would  have your program run to a particular line and then pause.

Or by holding down the mouse button on "Step Into" that you run through the code just to see the changes in the watch list values a little faster than one click at a time.

There's a contextual menu accessible with a right-click that only appears while in $DEBUG mode. You will find "Run To This Line" there.

Regarding a faster way to step into,... well, I'm so used to only doing these debug actions by using the keyboard that I think you should try it too. I even forget we can click the buttons at the bottom, really.

Quote
Also, at the end of the program run and the we get the message "Debug session aborted" "Discontinued", is there a way to see the final values of the array in the Watch List?

Since there's no connection to the debuggee anymore when execution ends, I recommend you put a breakpoint at the very last line of your program, so you have time to inspect variable values one last time before execution is done with.

Thank you for trying it!
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 27, 2021, 04:56:31 pm
Thank You
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 28, 2021, 12:52:56 pm
Hello Fellippe ... Believe or not It's me again.

I just can't seem to get my $Debug to configure and work like your demonstrations. What I'm trying to achieve is the exact set up which you demonstrated in your YouTube video entitled "Watching array values in Real Time with $Debug" In your video you have 3 screens - the IDE with program code, the Watch List and the Output screen. Not only that but you are able to have some kind of continuous pausing which displays in the lower information window to indicate if the program is running or pause.

I cannot get the Watch List to continuous display and show the array values in Real Time. For me to achieve a display of the Watch List I have to fn a Step Into. My program is running too fast for me to pause and check the Watch List using fn - Step Into. I have tried the option "Output Watch List to Console" and it doesn't display as the 3rd screen either

I recall watching your YouTube video "Creating Console apps with QB64". In that video I believe you said that Windows does not display a continuous console screen but creates a new one each time $Console is called. Could this be the reason I'm having no luck in re-creating what you have demonstrated in "Watching array values in Real Time with $Debug" ??

My OS is Windows 10, I am playing with the lastest build e1c148a  64 bit.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 28, 2021, 07:43:29 pm
I cannot get the Watch List to continuous display and show the array values in Real Time.

What I'm doing in the video you mention is pressing F7 to advance to the next line. Is that what you're trying to do?
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 29, 2021, 01:52:23 pm
Yes, I am using the fn key and F4, F5 and F7.

I start by selecting the Debug option from the menu. When the Debug menu displays the fn F4 from the keyboard will not work. I have to select the Watch List item on the debug menu using my mouse. Interestingly, when I first load the test program coding, without selecting Debug, I can get the Watch List using fn F4 from the key board but with the debug menu displayed fn F4 from the key board will not access the Watch List.

Once the Array is selected and I close the watch list, I can then fn F5 to run. At this point I get a message explaining which folder the exe will run in, it then creates the exe and runs. The only other screen which displays at this point is the Output screen, not the Watch List.

So I then place the focus back on the IDE screen and fn F7. The program pauses but I still do not get the Watch List screen. I have to hunt for it on the task bar and when I do find it I can no longer use fn and any of the other F keys because he cursor is flashing on the Watch List screen.

At this point my only option is to re-focus on the IDE screen but as soon as I click on that IDE screen, to get the cursor back, all the other screens disappear. I'm left with fn F7 working to pause line by line as in your video but there are no other screen displayed so I can follow the value changes in real time. All I can see is a green arrow moving line by line as I hit fn F7.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 29, 2021, 02:09:54 pm
I think Fell I'm asking tooooo much from my computer and monitor. I think my problem is actually in the sizing of the screens and 3 screens displaying at one time could be a bridge too far. I have been able to maintain the IDE screen with the coding and the Watch List (once I can find it on the task bar) displaying at the same time, and I am able to follow the changing array values with every fn F7 call. So in my case these two displays are very helpful and I'm going to abandon my attempts to display all 3 at once.

Now that's settled, I'm looking forward to exploring the wealth of buggy things I can get into.

Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 30, 2021, 12:54:48 am
Latest dev build available brings the ability to change values of arrays/UDTs from the IDE.

Still to be done:
- can't watch arrays with multiple-dimensions yet.
- can't set _BIT arrays yet.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 30, 2021, 02:03:03 pm
On the Filter - "Multiple+Terms+Accepted" - When you have time would you be able to describe the limits you envision for this filter. If I have an array of 100 items, I believe this filter will let me view just a few of the items - ie in the Filter I would put 1,26,55,82 . Is that correct? But is the scope of the filter much greater, for example does Terms and Accepted mean the use of quasi IF's, like            filter 1,26,55,82 If > 10  ??

Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 30, 2021, 02:37:49 pm
The filter is just a temporary way to see less variables in the Watch List dialog, so you can find which variable you wanna add. Say you have thousands of variables and you're looking for all variables from a certain SUB, so you'd type SUB_ and the sub name, so only the list items pertaining to that scope will show, so you can double-click them to add to the panel.

You can also filter by data type (only STRING variables, for example), or by variable name.

"Multiple+Terms+Accepted" means you can combine those and find all string variables that are in Sub MySub, by typing STRING+SUB_MYSUB in the filter textbox, for example.

When you double-click an array you're able to specify an index range to watch (like 1-10) or several indexes (like 1,26,55,82) - but that's not related to the filtering capabilities.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 30, 2021, 04:35:02 pm
Thanks - I have a lot of variables and arrays. So the filter will help me isolate a list of arrays with similar characteristics. Are there any plans for wildcard search characters in the filter?
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 30, 2021, 04:44:04 pm
Right now, consider everything wrapped in wildcards. That means if you search for RIN you will see all STRING and RING and BRING that exist in your list.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on August 31, 2021, 07:34:34 am
Hey that's pretty cool. And it's agnostic as to capitalization. Has me re-thinking how I name my variables and arrays.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: doppler on August 31, 2021, 08:08:07 am
Just a thought here.  Not sure if it's planned but what would be useful would be breaking on a variable/value is met.  Let's say you have a string or variable that is being changed (badly).  But you have multiple processes in your program that changes the variable.  A automatic break on a match would be more helpful that breakpoints.  Especially if the process run's through 100's of time before the condition is met.

I always found that type of break point very helpful.  Very, very helpful when the O/S you are working on has over 100k pages of code.  Locating that buffer overrun or memory fragmentation problem.  This break point tool is more of a big boy power tool, but who said we can't have it too.  I have used it a lot with Intel I.C.E. equipment.  It has saved the companies butt a number of time as well.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on August 31, 2021, 12:49:25 pm
Yes, the feature is being considered 🤗
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on September 01, 2021, 10:56:33 am
Hi Fell... is there a way to incorporate a Timing in Debug? I was thinking some of my arrays may work better in a different looping routine. Or perhaps a different order of calculations. Debug lets me run to a particular line of code and I was thinking it would be handy to see the time run of an array along with the value changes.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 01, 2021, 11:09:32 am
I don't think I understand the request.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: RhoSigma on September 01, 2021, 11:54:14 am
I don't think I understand the request.

Guess he talks about a profiler, a tool to measure the runtime of a loop or how long a function call needs to complete. All that to identify bottlenecks in the code.

However, guess the debugging mode itself will compromise such a tool.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on September 01, 2021, 01:07:32 pm
One of the things I'm finding with my code is the time it takes to run through to the end of the program. I do have a Timing Routine which tells me if the total time to run the program is 1 hour or 1/2 hour or 20 minutes. It is this gage which has me going back to find ways of doing things which accomplish the correct values in a shorter period of time. Often times it's a hit and miss in re-working the code for speed improvement.

It occurred to me while observing the Watch List, that if I could let the program do a complete run through and the Watch List could display the total amount of time for Watched Array to come up with it's final value, then this could help me zero in on specific areas of my coding dealing those array taking an inordinate amount of time to complete their task.

I have so many arrays it's just doesn't seem that I can time each one individually. Your excellent Watch List has the array values updating fairly quickly and I was wondering if some kind of timing mechanism could run along side those updating values. Pausing and restarting the run time I think would be difficult. And perhaps this type of feature may not be useful for others or fall within the scope of "debugging".

I guess you just can't give a kid a toy train and not expect him to fly it like an airplane.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 01, 2021, 01:14:43 pm
Quote
I guess you just can't give a kid a toy train and not expect him to fly it like an airplane.

🤣
Love the analogy.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on September 02, 2021, 10:48:55 am
Seems I'm now having some problems with "Run to this Line".

In Debug options, I select the Watch List, highlight the variables to watch (note: Not arrays). I then place the focus back on the IDE. A couple of weeks ago I was able to then "Start Paused", then locate and select a line where I selected "Run to This Line". I hit run (F5), program stopped at the selected line and I was then able to "Step Into" (F7) and watch the Watch List selections change values as I stepped thru the program from there on.

Today for some reason the program runs to the selected "Run to this Line", the cursor winds up in the Watch List and everything seems to freeze up. Once again I also have the same "old" problem with trying to display the IDE screen and the watch list screen at the same time.

So am I not using the "Run to this Line" properly?? If so what would be the correct order of steps I should take?

The "about" indicates I'm using the e1c148a build.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on September 02, 2021, 11:08:48 am
Oh, I forgot to ask. At the end of the run of a some code, where does the Watch List go? It seems to be displayed with the IDE screen during the debugging session. At the end of run of code I do get the Output screen and when I close out of it the IDE with the coding is displayed but not the watch list carrying the final results of the variable/array values. The status window indicates the debug session aborted - Disconnected. Is the Watch List wiped out or is it still available somewhere like the IDE and Output Screen?

Title: Re: [dev build] $DEBUG mode %u2728 Step through your code, watch variables! %uD83E%uDD29
Post by: FellippeHeitor on September 02, 2021, 10:45:37 pm
It might be a matter of adjusting expectations.

F7 or F8 will start your $DEBUG-enabled program in pause mode.

While in pause mode, you can right-click a line and choose "Run To This Line". Doing so is equivalent to (1) setting a breakpoint to a line, (2) hitting F5 to run, (3) removing the breakpoint once the line is reached.

Even before execution starts you can set breakpoints to lines of interest, so when you start it, even if with F5, execution will halt at the lines you set.

The Watch Panel will only show up during execution, as long as you'd selected some variables in the Watch List dialog (F4). When execution is done with ("Debug session aborted/Disconnected"), the list of values is also gone. What remains is the last stack call list (accessible via F12) and the breakpoints you'd set before.

I'll repeat my suggestion from the other day, that you should place a breakpoint on the last line of your program so it'll pause before it ends and you can inspect your variables' values before all's gone.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on September 03, 2021, 09:55:10 am
I have printed a copy of your reply #69 and have taped it to the left of my computer screen with the heading "A Train is just a Train". Thanks Fell
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on September 03, 2021, 11:11:19 am
Seems it wasn't just that Run to Line but none of the breakpoints are being respected. I have two breakpoints, one before a major loop to check values before the looping. The line number does light up in red on the far left of the screen. The second set just before the first subroutine which I believe is the last line of the program run. Again the breakpoint line number lights up in red.

Without using Debug, I just run the program, neither one of the breakpoints hold. The program runs to the end.

Next time, I set the same two breakpoints but this time I engage Debug option and start paused, then F5. Again the program runs right through those breakpoints to the end and Debug Session Aborted/Disconnected.

Third time, set same break points, from Debug option select Start Paused. Focus goes to IDE and I can then right click and have an option that says "continue" so rather than F5 I select "Continue" . Again program runs to the end without respecting the breakpoints.

In all 3 test runs I have selected the same couple of variables for the Watch List.

So seems I can't set the break points either before or within Debug. It's got to be me, not sure what I'm doing wrong.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 03, 2021, 12:11:49 pm
Send me the file and indicate which lines you’re setting breakpoints to, please.

Do you happen to have $checking:off anywhere?
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on September 03, 2021, 02:00:02 pm
Not I do not have $checking:off anywhere

Here is the code I'm running while testing Debug. Actually the only thing I have changed here is the Read/Data. I'm actually using an Open statement which is opening 50 files each with over 3000 items of data. The data with this snippet of code is the first 50 or so items from Event #1 file.

This code is behaving as I described earlier in not recognizing the Breaks Points at line 50 and line 160.
 
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 03, 2021, 02:28:58 pm
Both lines are empty, good friend. Set breakpoints to lines with actual code.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: SMcNeill on September 03, 2021, 02:47:30 pm
Both lines are empty, good friend. Set breakpoints to lines with actual code.

Does a line with just a remark, or a label, work as a valid breakpoint?
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 03, 2021, 02:54:16 pm
Nope. Needs to be an executable line.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: RhoSigma on September 03, 2021, 03:23:24 pm
Can the debugger not simply set the breakpoint to the next/prev valid instruction, if the user set it on an invalid/empty line? - Would probably avoid a lot of similar "I've an issue" problem discussions like the one you had with dimster.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 03, 2021, 03:29:53 pm
The debugger accepts the breakpoint being set to whatever line you instruct it to, it just won’t break cause such lines will never be reached. It’ll eventually be the case people will complain a breakpoint on an executable line won’t stop, and that’ll simply be due to their program flow never reaching that line. One can only failproof so much.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on September 03, 2021, 04:20:32 pm
Not quite sure I understand how to set a breakpoint. What I was doing is going to the line number where I want the break to occur. I left click on my mouse and that line number lights up in red. I then go to the next line where I want a break to occur and again left click on my mouse and again it lights up in red. When I scan the coding both line numbers remain in red. I am not sure why the copy of my code I sent to you did not show line #50 in red and line #160 in red.

Is that not how to set a break point in Debug? If you set break points in the code that I sent you did the program run and stop at the set break? Thought I was doing it correctly because when I use the option "Clear Break Points" in Debug menu those red lit line do return to normal line numbers.


Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 03, 2021, 04:24:50 pm
You set breakpoints to lines by clicking the line number to the left of the line, or by hitting f9 while the cursor is on a line.

Lines 50 and 160 contain NO CODE in the file you sent. That’s the problem.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on September 03, 2021, 05:49:02 pm
Fell - all these many years of messing with Break Points I had not realized there had to be code on the line where you wanted the break. I've gone back and reread the Qbasic books I have and none of them specifically state that there has to be code on the line to effect the breaking. The coding I write have so many lines of code I deliberately try to avoid empty lines so my breaks were on lines with code by sheer luck.

Son of gun, I just assumed a running program read every line of code and should have read the line had a stop on it.

Old dog, new trick. Thanks Fell
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on September 05, 2021, 11:46:02 am
I have a few variables which carry a decimal point in them (ie A1 = 10,  A1.2 = A1*.02) The Watch List displays A1 and it's value ok, but that A1.2 displays using ASCII. The value for A1.2 is fine and displays the correct values.

Is that ASCII display of a decimal pointed variable meant to distinguish it from an Array index?
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 05, 2021, 12:35:51 pm
Please share the relevant DIM line and a screenshot with what you're reporting if you can.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on September 05, 2021, 05:36:31 pm
Here is the Watch List with ASCII
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 05, 2021, 05:37:41 pm
Ok, I think I see what could be causing it. Thank you for reporting.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dimster on September 07, 2021, 02:07:17 pm
Hello Fell - I have another head scratcher. Here are two screen shots where I have run the same test code. The first time I ran it everything froze up and I had to close it all down. What I did notice about this situation is a solid white square which I think is the cursor. You can see it in the Watch List about 3/4 of the way down the Watch List display.

After running the same code again, everything worked fine. This time however there was a flashing cursor in the Watch List display. I have tried a couple of times to capture the flashing cursor expecting to show you the cursor's position which is just under the last line printed in the Watch List and not 3/4 of the way down the Watch List display.

It seems I did caused the Freeze up. When the debug option to "start paused" is selected, the Watch List is behind the IDE screen. In my case I have the IDE width at 120 so I only get a sliver of the Watch List peeking out from under the IDE screen. If I right click on the BLACK of that Watch List everything is ok, but should you right click on the WHITE board of the Watch List everything  goes haywire.

Is there a way to have the Watch List open first on top of the IDE screen?
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 07, 2021, 02:10:34 pm
In Windows, if you click a console window, it'll start "select" mode - which you can confirm by checking the title of the console window. Just hit ESC and Windows returns control to the running program (in this case, the IDE).

Quote
Is there a way to have the Watch List open first on top of the IDE screen?

You will just have to alt+tab your way until the console window is frontmost, then move it as one would.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 10, 2021, 12:38:48 am
Latest development build available today (https://www.qb64.org/portal/development-build/) contains the following new features/tweaks:

- Supports watching arrays with multiple dimensions. Friendly reminder that watching too many variables/array indexes will considerably slow things down.
- Supports changing values of individual indexes in multi-dimension arrays.
- Fixes the display of variables with "." in their names (which are not UDTs).

Known issue:
- Cannot set values of _BIT variables.

Let me know if you find issues. Thank you all who have been beta testing the new feature. ❤️
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 13, 2021, 10:46:40 pm
@FellippeHeitor

dev ee96ff7 Win10 x64 Pro build 20H1 aug updated

Not really an issue or problem for me - but every time I download a new dev build, I immediately use the previous build config.ini (because it is set up for font size (since on my Q3 display everything comes up half-size) and I need the high DPI setting for my applications), IDE color scheme etc.

However recently I notice that every time I have another instance of QB64 newly running - I have to redefine IDE (eg colors) as it appears to use your default IDE settings for [IDE COLOR SETTINGS...] even though all of them (including Scheme ID=0) are defined the way I want them.

As I said - it is not an issue - just that I have not noticed this before
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 14, 2021, 12:36:50 pm
Color schemes are now individually configurable per running instance of IDE, just like it was already for window size and position. You will find separate sections for each instance in the new config file.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 14, 2021, 08:23:30 pm
@FellippeHeitor

Thanks - thinking about it - it is a very useful feature for me as I use multiple instances of QB64 a lot.

Although many will "frown" upon it - for convenience with massive re-editing of a particular program I am currently working on - I will have set up different colored backgrounds (say red instead of black) to remind me which instance "not to edit" of the exact same file (Rather than using say notebook for the "reference copy" or rather than using a number of Alt ^ bookmarks etc).
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: SMcNeill on September 14, 2021, 08:46:09 pm
What’s the hotkey to add $DEBUG into the code?

I was doing something on the  laptop today and had a mysterious popup appear on the screen saying “Do you want to insert $DEBUG here…”  What’s the combo for that, and is there a way to alter it? 

Seems like it’s probably something like a SHIFT+Right Click (or similar), as it’s not a common combo action, but was something that appeared when I was trying to copy/paste a large code segment into the  IDE. 

My normal workflow is usually something like:
Shift+Arrow Keys to select a code block. (Or sometimes CTRL+arrow keys)
Right click to open copy/paste dialog.

And it was some combo in that process that popped up an insert dialog, rather than the normal copy/paste routine.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 14, 2021, 09:19:03 pm
Any function key/key combo that has a function associated to it during $Debug mode will trigger the prompt. That includes - but is not limited to - F4, F7, F8, F9, Ctrl+P.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 14, 2021, 09:30:44 pm
@SMcNeill

Although not answering your question....

I have often been "caught" by where the cursor is - refer screenshot (the green cross-hairs illustrate the extreme right position where the "insert Debug Metacommand? is triggered (accurate to a pixel position for me).



  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Pete on September 14, 2021, 09:41:11 pm
What’s the hotkey to add $DEBUG into the code?

After hours of trial an error, I finally figured it out. It's an overly complicated key combination, but it works...

$+D+E+B+U+G

Pete
Title: Re: [dev build] $DEBUG mode %u2728 Step through your code, watch variables! %uD83E%uDD29
Post by: FellippeHeitor on September 14, 2021, 11:14:34 pm
You may also have clicked the line numbers, which is used to set a breakpoint (or to skip a line, if in conjunction with Shift). - That's also what Richard means to say happens in his screen shot above.
Title: Re: [dev build] $DEBUG mode %u2728 Step through your code, watch variables! %uD83E%uDD29
Post by: SMcNeill on September 14, 2021, 11:21:43 pm
You may also have clicked the line numbers, which is used to set a breakpoint (or to skip a line, if in conjunction with Shift). - That's also what Richard means to say happens in his screen shot above.

This is probably what happened. 

Do you think you could add an option to the menu fora toggle to disable $DEBUG interactions, much like the toggle for warnings and syntax checking?  It’d be nice to stop those accidental interactions until one wanted them explicitly.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 14, 2021, 11:26:28 pm
Sure.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: mpgcan on September 15, 2021, 09:22:08 am
The following code compiles and runs on both 32 and 64 dev versions (Note no $Debug  meta command).
Code: QB64: [Select]
  1. 'Desktop Size
  2. 'Returns the Left, Top, Right and Bottom coordinates of the current desktop area.
  3. 'https://www.qb64.org/wiki/Windows_Libraries
  4.  
  5.     Function SystemParametersInfoW& (ByVal uiAction~&, Byval uiParam~&, Byval pvParam%&, Byval fWinlni~&)
  6.  
  7. Const SPI_GETWORKAREA = &H30
  8.  
  9. Type RECT
  10.     left As Long
  11.     top As Long
  12.     right As Long
  13.     bottom As Long
  14. Dim Rec As RECT
  15.  
  16. If 0 = SystemParametersInfoW(SPI_GETWORKAREA, 0, _Offset(Rec), 0) Then
  17.     'function failed. You may call kernel32's GetLastError for more info.
  18.     Print "failed."
  19.  
  20. Print Rec.left
  21. Print Rec.top
  22. Print Rec.right
  23. Print Rec.bottom
  24.  
After adding the $Debug meta command both dev versions fail to compile above code. Error message from compilelog.txt
Code: QB64: [Select]
  1. In file included from qbx.cpp:1099:
  2. ..\\temp\\regsf.txt:5:11: error: redefinition of 'HINSTANCE__* DLL_user32'
  3.  HINSTANCE DLL_user32=NULL;
  4.            ^~~~~~~~~~
  5. compilation terminated due to -Wfatal-errors.
  6.  
Simple solution replace Declare Dynamic Library "user32" with Declare CustomType Library
However that's not a real solution it just masks the problem.

QB64 Development Builds:
QB64x32 1.6 75939af
QB64x64 1.6 75939af

PC spec as follows:
 Windows 8.1
 Processor Intel(R) Core(TM) i3-3217U CPU 1.8 GHz
 Installed memory RAM 4GB
 System type: 64-bit Operating System, x64-based processor



Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 15, 2021, 09:31:34 am
$Debug needs "user32" in Windows.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 15, 2021, 04:40:34 pm
Although many will "frown" upon it - for convenience with massive re-editing of a particular program I am currently working on - I will have set up different colored backgrounds (say red instead of black) to remind me which instance "not to edit" of the exact same file (Rather than using say notebook for the "reference copy" or rather than using a number of Alt ^ bookmarks etc).

That's precisely how I've been using it.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: SpriggsySpriggs on September 15, 2021, 05:03:23 pm
@mpgcan I'm working with Fellippe on getting that fixed. I've tested a fix for it. It's super minor. Fellippe is going to test as well. Should make the User32 error disappear completely and allow you to use the function. However, I do recommend going ahead and using Declare CustomType Library instead of Declare Dynamic Library when the function allows for it. Most User32 functions can be put in a CustomType block rather than Dynamic. Let me know if you need any help or come across any further compilation errors when using external functions.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: mpgcan on September 16, 2021, 04:05:59 am
Hi Spriggsy and Fellippe thank you both  for the feedback.  Spriggsy I do understand it is preferential to use  Declare CustomType Library instead of  Declare Dynamic Library.
That said your solution if successful will only add to the flexibility of QB64. I cant wait to test the proposed solution.

"Let me know if you need any help or come across any further compilation errors when using external functions." offer most appreciated I am sure  at a latter date will be required thank you.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! ✨🤩
Post by: FellippeHeitor on September 18, 2021, 11:18:50 pm
New dev build available, get it from https://www.qb64.org/portal/development-build/
This is what to look for:

- Issue reported above by mpgcan regarding declaring user32.dll procedures in Windows has been addressed.
- Can now set values of _BIT variables.
- Option in Debug menu to disable auto-insertion of $DEBUG meta command as suggested by Steve.

✨ **NEW** ✨
- Watchpoints: you can now set watchpoints, which are like breakpoints but for variable values. You can, for example, create a watchpoint for variable x&, with condition "= 1000" and hit F5 so your program will run until x& = 1000.

Here's how it works:
- Start your $Debug-enabled program in pause mode (either with F7 or F8).
- Hit F4 to show the "Add Watch" dialog.
- Here, you can double click variables to add them to the Watch Panel, or you can select a variable and click the "Add Watchpoint" button.
- A new dialog will pop asking for a condition:
 [ This attachment cannot be displayed inline in 'Print Page' view ]
- The valid operators are =, <=, >=, and <>. You must compare a variable's contents with a literal value (no other variables, no math, no scientific notation).
- If you also add the variable to the watchlist, it will show in the Watch Panel, as usual, and an extra red bullet will be placed right next to its name, so you know there's a watchpoint set.
 [ This attachment cannot be displayed inline in 'Print Page' view ]
- Now you can hit F5 and let your program run until the variable has the target value. If the condition is ever met, execution is paused and you get this dialog:
 [ This attachment cannot be displayed inline in 'Print Page' view ]
- From here you can click "OK" to continue in the IDE so you can look around the line that set the variable's value as you expected, or you can click "Clear Watchpoint" to remove the watchpoint so execution can continue.
- If you don't clear the watchpoint from the dialog, you can go back to the F4 dialog later and delete the watchpoint condition manually.

Let me know how it works in your tests. 🥰
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 18, 2021, 11:26:31 pm
Notice that a variable doesn't need to be in the Watch Panel for a Watchpoint to be monitored.

Also notice that adding too many watchpoints will slow things down. You should only add watchpoints to variables of interest to the specific bug you're researching.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: hanness on September 19, 2021, 12:50:44 am
So far so good. Even working well with indices in my testing so far.

Can't express how freakin' awesome this is. Only wish I had all these capabilities 12,000 lines of code ago. I would probably still have hair as a result :-)
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 19, 2021, 01:12:34 am
@FellippeHeitor

Initial testing dev d651f37 works exactly as described by you (so far) - not a problem - must always remember (get used to) the watchpoint being specific to the current module when envoked by the F4 routine (as previously advised by you (Disco)).

Feature request (user option) - "On watchpoint being reached - an audio response (e.g. cash register "cha-ching") being played. In my case the longer running QB64 programs are "buried" under other applications and it may take me a while before I remember to check up on the QB64 program(s).
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 19, 2021, 05:55:14 am
@FellippeHeitor dev d651f37 Win 10 x64 Pro 21H1 (aug update)

Not a problem - just a bit confused on how $DEBUG interacts when main module has



ON ERROR GOTO ErrHandler:

.....

Errhandler:
....
RESUME NEXT
RETURN


In my program which often comes up with a particular error, my RESUME NEXT allows the program to carry on normally (and $DEBUG status ... "Error occurred on line 351") but from then on I do not seem to be able to then use F4 to watch values.

Is it "dangerous" to rely on $DEBUG (watch values etc) in this situation (meanwhile my program is still carrying on OK 99.9% of the time)?

Not a problem - rather some advice please.

Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: mpgcan on September 19, 2021, 10:47:23 am
Previous code that failed to compile now compiles with the new dev builds, that really is excellent, thank you Spriggsy and Fellippe.

For testing I used a program that is difficult to debug, it has a new window process and uses subclassing.
I had a few teething problems with the debugger mainly setting inappropriate break points and incorrect use of menu options.
That said I was surprised how stable QB64 debug is. It really is turning into an indispensable tool keep up the great work.
 
QB64 Development Builds:
QB64x32 1.6 d651f37
QB64x64 1.6 d651f37

PC spec as follows:  Windows 8.1,  Processor Intel(R) Core(TM) i3-3217U CPU 1.8 GHz, RAM 4GB, 64-bit
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: RhoSigma on September 19, 2021, 11:34:17 am
@FellippeHeitor dev d651f37 Win 10 x64 Pro 21H1 (aug update)

Not a problem - just a bit confused on how $DEBUG interacts when main module has



ON ERROR GOTO ErrHandler:

.....

Errhandler:
....
RESUME NEXT
RETURN


In my program which often comes up with a particular error, my RESUME NEXT allows the program to carry on normally (and $DEBUG status ... "Error occurred on line 351") but from then on I do not seem to be able to then use F4 to watch values.

Is it "dangerous" to rely on $DEBUG (watch values etc) in this situation (meanwhile my program is still carrying on OK 99.9% of the time)?

Not a problem - rather some advice please.

@Richard, Have you ever tried to get rid of that damn RETURN after RESUME NEXT? - The ErrHandler: label is NOT a GOSUB called subroutine, see also the detailed discussion here: https://www.qb64.org/forum/index.php?topic=4172.msg135334#msg135334
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 19, 2021, 12:21:20 pm
Previous code that failed to compile now compiles with the new dev builds, that really is excellent, thank you Spriggsy and Fellippe.

For testing I used a program that is difficult to debug, it has a new window process and uses subclassing.
I had a few teething problems with the debugger mainly setting inappropriate break points and incorrect use of menu options.
That said I was surprised how stable QB64 debug is. It really is turning into an indispensable tool keep up the great work.

That's great to hear, mpgcan!

In my program which often comes up with a particular error, my RESUME NEXT allows the program to carry on normally (and $DEBUG status ... "Error occurred on line 351") but from then on I do not seem to be able to then use F4 to watch values.

Interaction between ON ERROR and $DEBUG has not been researched. My suggestion is to disable/comment out custom error handlers when using $Debug, cause one will use $Debug exactly to find an issue, as opposed to using ON ERROR which will trap predictable issues. ON ERROR could end up masking an error you're trying to figure out.

Feature request (user option) - "On watchpoint being reached - an audio response (e.g. cash register "cha-ching") being played. In my case the longer running QB64 programs are "buried" under other applications and it may take me a while before I remember to check up on the QB64 program(s).

No "cha-ching", Richard. One is sitting in front of the computer watching the outcome of a buggy program in order to find the bug so the program can run indefinitely. One will see the condition be met. One is not leaving a program run in debug mode and go grab lunch.

So far so good. Even working well with indices in my testing so far.

Can't express how freakin' awesome this is. Only wish I had all these capabilities 12,000 lines of code ago. I would probably still have hair as a result :-)

Thank you, hanness ❤️

Thank you all for trying it out and helping me find issues. Can't wait to have it stable for general availability. 🥰
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 19, 2021, 12:29:36 pm
@RhoSigma Now I am trying  without the RETURN - thanks.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 20, 2021, 05:34:26 am
@FellippeHeitor

Dev e30f7a1 Windows 10 x64 Pro build 21H1 (aug updated)

Feature request

IDE > Options > IDE Colors

Display a (sample window with the current line background) in addition to the already present (sample window with the background).

So the TWO sample windows both are simultaneously displaying the selected item (e.g. Normal Text, Keywords, Numbers, etc) with the respected BG (Background/Current_Line_Background)
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 20, 2021, 07:40:02 am
@FellippeHeitor

Dev e30f7a1 Windows 10 x64 Pro build 21H1 (aug updated)

Just tried $DEBUG for the first time for this dev build and got the following message:-

Failed to initiate debug session.
Cannot receive connections on port 9000. Check your firewall permissions.

First time this message ever occurred to me. Normally when using a new dev build a pop-up occurs and I allow... NO pop-up this time.



Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 20, 2021, 07:48:24 am
@FellippeHeitor

Firewall problem solved - removed all running instances of  previous $DEBUG  active processes.

Someone keeps releasing new dev builds... :)
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 20, 2021, 08:15:36 am
@FellippeHeitor

Dev e30f7a1 Windows 10 x64 Pro build 21H1 (aug updated)


I may have lost track on fixes for BIT stuff...  but I get a few problems with watch values refer screen shots:-

The variable array comes up as      a~`1( )   instead of   a~`( )
It appears only the first index a~`(0) is updated and is incorrect (displays it seems the number of times I press  F7)
The array is not initialized  - though not a problem (... never assume...)



   [ This attachment cannot be displayed inline in 'Print Page' view ]  




  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 20, 2021, 09:17:26 am
Quote
The variable array comes up as      a~`1( )   instead of   a~`( )

Those are equivalent, it is by design.

Quote
It appears only the first index a~`(0) is updated and is incorrect (displays it seems the number of times I press  F7)
The array is not initialized  - though not a problem (... never assume...)

I'll check the behavior of _bit arrays. Thanks for reporting.

Regular _Bit variables are working as expected in my tests.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 20, 2021, 09:19:44 pm

New dev build now available (https://www.qb64.org/portal/development-build/), with functional watching/sending values for _BIT arrays.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 20, 2021, 10:55:35 pm
@FellippeHeitor


dev 3e498df   Win 10 x64 Pro build 21H1 (AUG updated)



All _BIT combinations (single bit) work exactly as expected!





  [ This attachment cannot be displayed inline in 'Print Page' view ]  


Note the above screenshot before DIM was performed




  [ This attachment cannot be displayed inline in 'Print Page' view ]  




Many thanks - works like a charm.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 20, 2021, 11:28:44 pm
@FellippeHeitor

Even works for

DIM e AS UNSIGNED BIT *1
DIM f AS BIT * 1

as expected.

Thanks for fixing $NOPREFIX not recognizing BIT (needed to be _BIT)

One should be careful  because   e   and    f   variables now do not have suffixes in the watch window.






  [ This attachment cannot be displayed inline in 'Print Page' view ]  







  [ This attachment cannot be displayed inline in 'Print Page' view ]  








  [ This attachment cannot be displayed inline in 'Print Page' view ]  




Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 21, 2021, 12:00:42 am
@FellippeHeitor

Bit of a problem with this code


Code: QB64: [Select]
  1. $DEBUG
  2. i% = 0
  3. c~` = c~`
  4. d` = d`
  5. DIM e AS UNSIGNED BIT * 1: e = e
  6. DIM f AS BIT * 1: f = f
  7. DIM ee AS UNSIGNED BIT * 64: ee = ee
  8. DIM ff AS BIT * 64: ff = ff
  9. DIM a~`(0 TO 3)
  10. DIM b`(0 TO 3)
  11. DIM aa(0 TO 3) AS UNSIGNED BIT * 63: aa(0) = aa(0)
  12. DIM bb(0 TO 3) AS BIT * 63: bb(0) = bb(0)
  13. c~` = 1
  14. d` = 1
  15. e = 1
  16. f = 1
  17.  
  18. FOR i% = 0 TO 3
  19.     a~`(i%) = 1
  20.     b`(i%) = 1
  21.     aa(i%) = 1
  22.     bb(i%) = 1
  23.  





I am trying to watch everything (I know you will "frown" because there are too many variables to watch).

I seem to have trouble setting up watch list to contain

ee AS UNSIGNED BIT * 64: ee = ee
ff AS BIT * 64: ff = ff
aa(0 TO 3) AS UNSIGNED BIT * 63: aa(0) = aa(0)
bb(0 TO 3) AS BIT: bb(0) = bb(0)

something about UDT elements (refer screen shots)

I think I got confused trying to set up the four lines above





  [ This attachment cannot be displayed inline in 'Print Page' view ]  








  [ This attachment cannot be displayed inline in 'Print Page' view ]  









  [ This attachment cannot be displayed inline in 'Print Page' view ]  



Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 21, 2021, 12:04:36 am
Does it happen without $NoPrefix?
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 21, 2021, 12:12:54 am
@FellippeHeitor

NO problem when ticked out $NOPREFIX





  [ This attachment cannot be displayed inline in 'Print Page' view ]  



and no mention of UDT
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 21, 2021, 12:29:49 am
Ok, thanks. I'll get to investigating the issue.
🕵️‍♂️
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 21, 2021, 12:35:54 am
@FellippeHeitor

Actually running my code


Code: QB64: [Select]
  1. $DEBUG
  2. '$NOPREFIX
  3. i% = 0
  4. c~` = c~`
  5. d` = d`
  6. DIM e AS _UNSIGNED _BIT * 1: e = e
  7. DIM f AS _BIT * 1: f = f
  8. DIM ee AS _UNSIGNED _BIT * 64: ee = ee
  9. DIM ff AS _BIT * 64: ff = ff
  10. DIM a~`(0 TO 3)
  11. DIM b`(0 TO 3)
  12. DIM aa(0 TO 3) AS _UNSIGNED _BIT * 63: aa(0) = aa(0)
  13. DIM bb(0 TO 3) AS _BIT * 63: bb(0) = bb(0)
  14. c~` = 1
  15. d` = 1
  16. e = 1
  17. f = 1
  18.  
  19. z = z
  20. ee = 1
  21. ff = 1
  22.  
  23. FOR i% = 0 TO 3
  24.     a~`(i%) = 1
  25.     b`(i%) = 1
  26.     aa(i%) = 1
  27.     bb(i%) = 1
  28.  



there is an issue with      ee     variable   (see screen shots)




  [ This attachment cannot be displayed inline in 'Print Page' view ]  







  [ This attachment cannot be displayed inline in 'Print Page' view ]








   [ This attachment cannot be displayed inline in 'Print Page' view ]  








  [ This attachment cannot be displayed inline in 'Print Page' view ]  






will next try     ee     as   _UNSIGNED BIT * 63   (instead of   *64)
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: SMcNeill on September 21, 2021, 12:52:39 am
Can you even do a bit * 64?  WTH is the point of DIM anything AS BIT * (more than one)??

With arrays, it makes sense for bit packing purposes, but for single variables??

My mind is boggled just at the concept of it. 

If there’s a glitch here, it’s the one where the IDE fails to scream loudly and slap the user.  (With an error, of course, as sadly there’s no _SLAPSILLY command available so the PC can pummel someone with the CD tray, or whatever.)

AS BIT * should only work with arrays, in my opinion.  If you need to reserve 64 bits to reserve a single one of them to hold a 0/1 value, you’re doing something wrong.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: mpgcan on September 25, 2021, 05:05:27 am
The following function fails on dev build QB64x64 edb4d40
Error message:  Incorrect number of arguments passed to function on line 14
Note: Worked fine on previous builds

Ref: https://www.qb64.org/forum/index.php?topic=1015.msg102131#msg102131
Code: QB64: [Select]
  1. m = _Mem(x)
  2. Print m.OFFSET
  3. Print ConvertOffset(m.OFFSET)
  4.  
  5.  
  6. Function ConvertOffset&& (value As _Offset)
  7.     Dim m As _MEM 'Define a memblock
  8.     m = _Mem(value) 'Point it to use value
  9.     $If 64BIT Then
  10.         'On 64 bit OSes, an OFFSET is 8 bytes in size.  We can put it directly into an Integer64
  11.     _MEMGET m, m.OFFSET, ConvertOffset&& 'Get the contents of the memblock and put the values there directly into ConvertOffset&&
  12.  
  13.     'However, on 32 bit OSes, an OFFSET is only 4 bytes.  We need to put it into a LONG variable first
  14.     _MEMGET m, m.OFFSET, temp& 'Like this
  15.     ConvertOffset&& = temp& 'And then assign that long value to ConvertOffset&&
  16. _MEMFREE m 'Free the memblock
  17.  
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 25, 2021, 07:01:52 am
@mpgcan please refer to https://www.qb64.org/forum/index.php?topic=4209.msg135786#msg135786 (https://www.qb64.org/forum/index.php?topic=4209.msg135786#msg135786) for information regarding important new changes to the latest build.

Steve’s library will require adapting to the new compiler fixes, as it relied on a buggy behavior.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: SMcNeill on September 25, 2021, 07:50:42 am
Code: QB64: [Select]
  1.  FUNCTION ConvertOffset&& (value AS _OFFSET)
  2.     DIM m AS _MEM 'Define a memblock
  3.     m = _MEM(value) 'Point it to use value
  4.     $IF 64BIT THEN
  5.         'On 64 bit OSes, an OFFSET is 8 bytes in size.  We can put it directly into an Integer64
  6.     _MEMGET m, m.OFFSET, temp&&
  7.     ConvertOffset&& = temp&&
  8.  
  9.     'However, on 32 bit OSes, an OFFSET is only 4 bytes.  We need to put it into a LONG variable first
  10.     _MEMGET m, m.OFFSET, temp& 'Like this
  11.     ConvertOffset&& = temp& 'And then assign that long value to ConvertOffset&&
  12. _MEMFREE m 'Free the memblock
  13.  

The above should fix the recursive function issue.  Looks like I’ll have to go back and check a lot of stuff for these small discrepancies soon.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 26, 2021, 12:35:56 am
@FellippeHeitor

Feature Request - "At ALL times, in $DEBUG mode, "somewhere" in the IDE it is always visible the current build, OS etc - that way I do not have to keep typing this in my replies (whenever I supply a screenshot).

Feature Request - "EVERY TIME a DIM variable is referenced for the "Watch List" - always the suffix is displayed (to be consistent in Watch List window with the typical variables eg x%=... x&&=..."

Feature Request - "When DIM s AS STRING * n referenced for the "Watch List" - it is important that the *n value is displayed as part of a suffix for the s variable"

I claim that _FLOAT does not work - refer screenshot for the Z(2) value.






I thought that I used to be able to say something like



DIM t() as integer


but the IDE changes it to


DIM t as INTEGER





  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 26, 2021, 02:15:47 am
@FellippeHeitor

Re _FLOAT z(2)


Sorry - I should have inspected the index "1" instead of "2" to watch the value of z(2).

Note - just downloaded a newer dev build

All mentions as per previous reply still applicable with this dev build.




  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard on September 27, 2021, 08:19:25 am
@FellippeHeitor

dev 5118185  Win 10 x64 Pro 21H1 (AUG update)

It appears that the assignment of a numeric value to a variable (SINGLE DOUBLE FLOAT) is broken for very large ranges (but still well within the scope of the variable in question).  Referring to the screenshot and  program attached for same...

The program simply ranges through powers of 10 and increments by 1 to the variables of type SINGLE, DOUBLE and FLOAT. The powers of 10 are explicitly coded in (e.g. c## = 1000000000) and the other variables are assigned with the values given to the first variable.

As a cross-check the process is repeated for C##, C# and C! initial assignment. in any case the range of the powers of 10 is well within the scope of the SINGLE type.

The problem is NOT ABOUT the resolution of the storage of the values when incremented by one -as the resolution is determined by the number of bits, mantissa. exponent etc. The program is self-explanatory.



  [ This attachment cannot be displayed inline in 'Print Page' view ]  
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 27, 2021, 09:20:52 am
If you're using PRINT, then we already have another thread reporting the issue.

If it has nothing specifically to do with $DEBUG mode, please start a new thread.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 28, 2021, 03:23:41 am

Latest dev build (https://www.qb64.org/portal/development-build/) has a fix for dealing with _BIT and _FLOAT variables in $Debug mode.

@Richard, thanks for reporting the issues.

@All: you'll notice the dev build now boasts v2.0 ⚡️❤️
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard 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).


   :)


Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: mpgcan 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
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on September 28, 2021, 09:01:42 am
Try adding this before you try fetching the window handle:

Code: QB64: [Select]
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor 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!
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Dav 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
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: mpgcan 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.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor on October 02, 2021, 03:29:41 am

New development build (https://www.qb64.org/portal/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.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: Richard 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.

Title: Re: [dev build] $DEBUG mode %u2728 Step through your code, watch variables! %uD83E%uDD29
Post by: FellippeHeitor on October 02, 2021, 04:24:51 pm
😉👍

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.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: hanness 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.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: FellippeHeitor 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 ❤️.
Title: Re: [dev build] $DEBUG mode ✨ Step through your code, watch variables! 🤩
Post by: doppler 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.
Title: Re: [dev build] $DEBUG mode Step through your code, watch variables!
Post by: FellippeHeitor on October 03, 2021, 11:34:51 pm

New development build (https://www.qb64.org/portal/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 (https://github.com/QB64Team/qb64/commits/development), as usual.

🤗