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

0 Members and 1 Guest are viewing this topic.

Offline Pete

  • Forum Resident
  • Posts: 2361
  • Cuz I sez so, varmint!
    • View Profile
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

Want to learn how to write code on cave walls? https://www.tapatalk.com/groups/qbasic/qbasic-f1/

FellippeHeitor

  • Guest
The triangle should be visible without line numbers indeed. Thanks for reporting.

Offline Dimster

  • Forum Resident
  • Posts: 500
    • View Profile
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. 

FellippeHeitor

  • Guest
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 ❤️

FellippeHeitor

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

Offline Dimster

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

FellippeHeitor

  • Guest
Arrays haven't been implemented yet. With regular variables, the panel will show only while in pause mode.

FellippeHeitor

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

Offline Pete

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

Offline doppler

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

Offline Pete

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

Offline Dimster

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

FellippeHeitor

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

Offline doppler

  • Forum Regular
  • Posts: 241
    • View Profile
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?

« Last Edit: August 16, 2021, 07:24:19 pm by doppler »

Offline SpriggsySpriggs

  • Forum Resident
  • Posts: 1145
  • Larger than life
    • View Profile
    • GitHub
I recommend just starting all programs with Option Explicit turned on. Saves you lots of trouble.
Shuwatch!