Possible Improvements to the Console Debugger

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Possible Improvements to the Console Debugger

Post by akj »

I find the console debugger a useful, but somewhat unfriendly and time-consuming tool and I have a number of suggestions to try to make it more productive.

The debugger's screen prompt of 'DEBUGGER::' is not particularly informative and I would like to see it replaced by another that changes according to circumstances. What I have in mind is a prompt having the syntax:
<base> <filenumber>:<linenumber>: (where <base> is either D or X)

As a specific example, part way through debugging the prompt may be D 2:517:
This would mean the debugger is in decimal (as opposed to hexadecimal) mode and is stopped at a breakpoint in line 517 of source file 2.

Another example is X 47:
which would mean it is in hexadecimal mode and stopped in line 47 of the primary source file (i.e. file 0).

The above makes the debugger's 'line' command effectively redundant and it can therefore be removed from the command set. This improvement also helps when single stepping through a program as instead of entering the commands:
STEP LINE STEP LINE STEP LINE etc.
it would now only be necessary to enter:
STEP STEP STEP etc.
and yet still be fully aware of the program's progress.
This certainly makes for quicker debugging.

However it can be improved further. Sometimes it is necessary to enter STEP many times in order to debug just one line of the program, especially if the code in the line is complex. This makes it only too easy to enter STEP too many times and end up on the wrong statement. Naturally a breakpoint can be used, but this potentially involves three commands:
BREAKSET <line#> RUN BREAKREMOVE <line#>
The improvement I am suggesting involves the concept of a temporary breakpoint using the single command:
GOTO <line#>
This would have exactly the same effect as the above three commands combined. This may render the 'step' command redundant, especially if GOTO (without any parameter) means GOTO the line immediately following the current line.

The final change I am proposing is the introduction of abbreviations for command names, for example V as an new abbreviation for the VARIABLES command.

The full list could be as follows, with the command names being case-insensitive:

Code: Select all

New  Par- Old
Name ams? Name
---- ---- ----
!    -   shell (same as SH command)
>    Y	redirect
?    Y	debug (same as D command)
A    -	arrays
A    Y	arrayshow
B    -	breakpoints
B    Y	breakset
BX   -	breakclear
BX   Y	breakremove
C    -	run (continue)
C>   Y	file (command redirection)
D    Y	debug (same as ? command)
DEC  -	dec
E    Y	errors
F    -	files
G    -/Y (goto)
H    -/Y help
HEX  -	hex
L    -	linkedlists
L    Y	listshow
LI   Y	listset (list index)
M    Y	memory
MR   Y	memoryraw
R    -	registers
R    Y	registerset
RP   -	report
S    -/Y step
SET  Y	set (same as V command with a param.)
SH   -	shell (same as ! command)
ST   -	stack 
SV   -	saveconfig
T    -/Y history (trace)
V    -	variables
V    Y	set (same as SET command)
VX   -	variables nostructures
X    -	exit
As stated earlier, there is no abbreviation for the 'line' command as the debugger prompt provides the equivalent information in conjunction with the files (F) command.
Anthony Jordan
freak
PureBasic Team
PureBasic Team
Posts: 5940
Joined: Fri Apr 25, 2003 5:21 pm
Location: Germany

Post by freak »

These suggestions make sense (although i am not much of a fan of 1-letter commands)
I will see what can be done once the IDE/Debugger work continues...
quidquid Latine dictum sit altum videtur
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

freak wrote:These suggestions make sense (although i am not much of a fan of 1-letter commands)
I will see what can be done once the IDE/Debugger work continues...
When that work continues, please consider having the debugger in a separate / detachable window. This makes working on dual-screen computrs so much more comfortable.

Thanks!
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
akj
Enthusiast
Enthusiast
Posts: 668
Joined: Mon Jun 09, 2003 10:08 pm
Location: Nottingham

Post by akj »

Hello Freak,

I am not advocating removing the existing debugger command names (with the possible exception of the 'line' command), but merely proposing that my abbreviations should be available as alternatives.

Thus anyone who has all day to spare for debugging a program can use the orignal long names, whilst others who want to get the debugging done with in 10 minutes can use the abbreviations. (Does that last sentence sound slightly biased?)

Incidentally, I now realise there was an error in my original post relating to the new GOTO (G) command. I said that GOTO (without any parameter) means GOTO the line immediately following the current line. What it should really mean is: run the program until the current line number changes (without using any temporary breakpoint). Please notice that this is not the same as the STEP command, because often multiple STEPs are required before the line number changes.
Anthony Jordan
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

dell_jockey: the standalone debugger doesn't work for you ?
josku_x
Addict
Addict
Posts: 997
Joined: Sat Sep 24, 2005 2:08 pm

Post by josku_x »

Fred: I think the debugger works for dell_jockey, he only wants to have the debugger in a separate or a detachable window.. :lol:
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

The standalone debugger is in a detachable window, that's why i don't understand..
dell_jockey
Enthusiast
Enthusiast
Posts: 767
Joined: Sat Jan 24, 2004 6:56 pm

Post by dell_jockey »

Fred wrote:The standalone debugger is in a detachable window, that's why i don't understand..
Oops...... PBDebugger.exe command line tool..... :oops: :oops:

je suis trés desolée, should read the manual before opening my mouth...

Thanks for the hint :)
cheers,
dell_jockey
________
http://blog.forex-trading-ideas.com
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Post by Fred »

You can select it in the Prefs->Debugger->Debugger Type, no need for an external tool :)
Post Reply