|
Post by Enzo on Jan 1, 2024 2:34:37 GMT
I recently have been looking into 2.0 help files and see the debug option is finally made it here.
I have an idea on a external debugger.
Make every other line a 2 setting and op in and out options to allow for starts and stops of loops and as well as no 2 for branches, let it animate and have option to stop in the middle of each branch and 25% increments.
I'm going to have the program load into a combo box (i've done this before its extremely useful)
How would I access a run of debug from JB command line?
Posting GUI code soon.
|
|
|
Post by Enzo on Jan 1, 2024 3:04:12 GMT
nomainwin
WindowWidth = 520 WindowHeight = 370
BackgroundColor$="green" ListboxColor$="darkgreen" TextboxColor$="lightgray" listbox #b.listbox, code$(, [listboxfill], 142, 11, 344, 240 combobox #b.combobox2, array$(, [combobox2DoubleClick], 14, 16, 100, 100
textbox #b.textb, 22, 276, 368, 30 button #b.editbutton, "Enter", [edit], UL, 406, 276, 88, 25 menu #b, "File", "Load", [onFileLoad], "Save", [onFileSave] menu #b, "Op-In", "Every Branch", [onOnInEveryBranch], "Every Other Line (continuous)", [onOpInEveryOtherLinecontinuous], "Branch Increments", [onOpInBranchIncrements] menu #b, "Op-Out", "Loops", [onOpOutLoops], "if then", [onOpOutIfThen], "graphics commands", [onOpOutGraphicsCommands], "functions()", [onOpOutFunctions] open "Debugger" for window as #b print #b, "trapclose [quit.b]"
print #b, "font ms_sans_serif 10"
wait
'code 'load file into listbox code and code$() array,
for x = 1 to codelen
codeline$ = code$(codelen)
print codeline$
if toggle = 1 then toggle = 2 animate$="Trace 2" print animate$ else toggle = 1 step$="Trace 1" print step$ end if next x
wait
[quit.b] Close #b END
[listboxfill]' print #b.text, code$ 'put listbox code into textbox wait
[combobox2DoubleClick] 'Perform action for the combobox named 'combobox2' 'Insert your own code here wait
[edit] 'Perform action for the button named 'editbutton' 'Insert your own code here wait
[onFileLoad] 'Perform action for menu 'File', item 'Load' 'Insert your own code here wait
[onFileSave] 'Perform action for menu 'File', item 'Save' 'Insert your own code here wait
[onOpInEveryBranch] 'Perform action for menu 'Op-In', item 'Every Branch' 'Insert your own code here wait
[onOpInEveryOtherLinecontinuous] 'Perform action for menu 'Op-In', item 'Every Other Line (continuous)' 'Insert your own code here wait
[onOpInBranchIncrements] 'Perform action for menu 'Op-In', item 'Branch Increments' 'Insert your own code here wait
[onOpOutLoops] 'Perform action for menu 'Op-Out', item 'Loops' 'Insert your own code here wait
[onOpOutIfThen] 'Perform action for menu 'Op-Out', item 'if then' 'Insert your own code here wait
[onOpOutGraphicsCommands] 'Perform action for menu 'Op-Out', item 'graphics commands' 'Insert your own code here wait
[onOpOutFunctions] 'Perform action for menu 'Op-Out', item 'functions()' 'Insert your own code here wait
|
|
|
Post by Enzo on Jan 1, 2024 3:08:21 GMT
Should save copy of both run file and with every other line Trace, naturally this will need editing outside loops and before functions and subs.
Also every x number of lines too if your program follow a certain pattern that these would be useful.
The combo box is for all variables and functions if someone wanted to code that ive seen the code required for this and its not a easy one. You start by exiting out each entry that is not a JustBASIC command and variables thats not global will be left with other data.
|
|
|
Post by Rod on Jan 1, 2024 7:37:00 GMT
The debugger help file has always been there but you only get to it if you ask for help in the debugger. The debugger does most of what you describe already. The neatest feature to learn is to place breakpoints on the left margin by double clicking. Now your program will run to that line and display the contents of all variables including default variables if you click. I have never found a more flexible debugger, most folks haven’t scratched the surface of what it is capable of. Some folks don’t even know what the Ladybug is for!
People do write debugging statements into the main code, this is an old habit and works well but they then don’t explore the real debugger.
|
|
|
Post by Enzo on Jan 1, 2024 23:08:07 GMT
A true commercial app would need extra debugs for this Smalltalk language to enable full debug processes i.e. faults in computer, HDD, lag, multi-access, I've seen few people program like this, think else statements and case else for input$ keys, or a variable not updating when suppose to. Which is very rare and usually operator.
Haven't played with the debug yet and would like to see if this can be a bigger debugger, i.e, run second variables that could be updated at runtime or debug run time...
|
|
|
Post by Enzo on Jan 1, 2024 23:19:43 GMT
Some other features would include a optional run with addin-on functions that enable this variable change which would be a massive difference from current methods of refinding where you where as well as re running program.
A second copy could be implemented as means to reverse and bring back the run state a try per layer, and would also allow for a line to be change edited, and or inserted, skipped, nulled " ' ".
A decent debug tool.
|
|
|
Post by Enzo on Jan 1, 2024 23:21:20 GMT
Something this capable could make into the next release of Liberty/JustBASIC.
|
|
|
Post by Rod on Jan 2, 2024 12:12:53 GMT
The debugger will let you change variable or array contents, the input box with the "execute" button. Key in whatever basic statement you want and click on execute. This lets you amend, edit or correct variables in the midst of debugging the program. You can then go on to action or skip a line at a time or animate the run or simply run on at full speed. Setting a breakpoint and running at full speed is the fastest way to narrow down your search for the bug.
What the debugger wont allow is a change of code, you do need to recode and re run the program. But that is the nature of all interpreted BASIC languages.
I think if you spend a little more time in the debugger you will realise that it offers most of what you need.
|
|
|
Post by xxgeek on Jan 31, 2024 17:15:09 GMT
run "Path-To-Jbasic.exe -D " "path to .bas file" eg: If demo.bas is in DefaultDir$ and Just Basic v2.0 was installed to the default folder in the install.
run "c:\Program Files (x86)\Just Basic v2.0\jbasic.exe -D ";DefaultDir$;"\demo.bas" If you can make the debugger even better than it is - have at it , always room for improvement If I can help I'll be there too, mostly to test. Keep at it enzo, it will be a good learning experience.
How true.
Once I started using the debugger and playing around in it, I found a lot more to it than first noticed. I don't wish to do all the typing that would be required to explain it all, but I do recommend everyone take some time and go play around in it, learn to use it like nobody else does.
It can\will make your coding experience far easier, especially when trying to figure out a code issue.
|
|