I'm looking at the excellent dwscript for Delphi see here which provides a useful set of classes to implement a built in pascal script for your Application. I would very much appreciate some help with an example of how to link together the supplied debugging interface with an editor so that I can create breakpoints (and ideally see watches). Has anyone gone along this route please? Thanks, Brian
-
contact Eric, he already has a closed source minimal IDE for DWScript which won't be released too soon, on the other hand, it's not so dificult to achieve, but you do need some know how the debugging process takes place... have fun ;-) – Dec 30 '10 at 05:19
1 Answers
Most of the debugger doc is currently in this post
http://delphitools.info/2010/12/03/spotlight-on-dwss-idebugger/
Also the debugger interface hasn't changed much (if at all) since the original DWScript II (on SourceForge), so the old demos there should hopefully still work with minimal adjustments.
http://sourceforge.net/projects/dws/
For breakpoints, you basically just check the source position of the Expr you get in DoDebug/OnDebug against the list of breakpoints. One simple and efficient way is to merely use TBits -using it as a boolean array of which lines have a breakpoint). Evaluating/watching requires looking up a symbol, which will give you it's stack address, you can then lookup the value in the stack.
I'll try to add/update a debugging tasks demo for v2.2 (unless someone else does it before me ;) )
edit: as of 11-02-14 there is a TdwsDebugger
component to facilitate debugging tasks.

- 26,858
- 31
- 155
- 327

- 5,931
- 1
- 39
- 61
-
Thanks Eric, I would really appreciate anything you consider to be 'best practice'. I saw your excellent debugger notes and ordinarily would set off to use (say) SynEdit, although I'd just seen the notes here http://stackoverflow.com/questions/4505588/what-is-the-latest-synedit-version-or-clone re Scintilla. Wiring up script debuggers in the past has made me realize the number of 'cases' one has to consider, too, eg insert/delete maintaining breakpoint placement, so an example would be great. Brian. – Brian Frost Dec 31 '10 at 14:08
-
FWIW, I'm using SynEdit too. During edition, you can use the Marks[] for the breakpoints (using a TSynEditMark directly). Before execution, you can build a TBits for fast checks in DoDebug. During execution, if a breakpoint is cleared/set, just update the TBits accordingly. – Eric Grange Jan 03 '11 at 15:15
-
If you want to be able to save the content of TBits, or set/get bits directly from a memory allocation - have a look at: http://delphimax.wordpress.com/2010/09/16/lazarus-tbits-well-its-better/ – Jon Lennart Aasenden Apr 13 '11 at 17:50
-
I don't suppose there's a clean and easy way to simply monitor current line number without actually entering debug mode. I have a small script app where I'd just like to show the user visually which line is currently being executed, but have no need to step into code etc. I found `expr.ScriptPos` but it seems I have to actually enter debug mode to access this. – Jerry Dodge Nov 11 '18 at 16:28