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

0 Members and 1 Guest are viewing this topic.

FellippeHeitor

  • Guest
New development build available today at 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.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
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
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Marked as best answer by on Yesterday at 04:40:48 pm

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
@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.


FellippeHeitor

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

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
@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


  [ You are not allowed to view this attachment ]  

FellippeHeitor

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

Offline Richard

  • Seasoned Forum Regular
  • Posts: 364
 @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.



  [ You are not allowed to view this attachment ]  

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.
« Last Edit: August 15, 2021, 06:36:51 am by Richard »

Offline doppler

  • Forum Regular
  • Posts: 241
@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.


Offline mpgcan

  • Newbie
  • Posts: 26
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

FellippeHeitor

  • Guest
Ah, the dreaded x86 version. I haven't done testings there yet, thanks for reporting.

FellippeHeitor

  • Guest
@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.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
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
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

Offline Dimster

  • Forum Resident
  • Posts: 500
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?


Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
@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
Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

FellippeHeitor

  • Guest
@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.

  [ You are not allowed to view this attachment ]  

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

  [ You are not allowed to view this attachment ]