Re: [Objectscript-users] command line debugger
Brought to you by:
rob_d_clark
|
From: Lysander D. <sa...@sb...> - 2005-10-18 05:56:36
|
That appears to work. However after hitting the
breakpoint entering this:
writeln ( "a" )
results in nothing being written to standard out.
Does that successfully write anything to standarad out
for you ?
If not, do you know what needs to be changed in
order to allow that command to successfully output
text ?
Thanks,
Lysander
--- Rob Clark <ro...@ti...> wrote:
> not really... you might be able to use the debugger
> API to setup a
> read-eval-print shell to run at certain file and
> line numbers... for
> example:
>
>
> // dbg.os:
>
> function setBreakpoint( filename, line )
> {
> var file = pkg.fs.resolve(filename);
> Debugger.setBreakpoint(
> file, line,
> new function() extends Debugger.Breakpoint() {
>
> public function handle( scope, file, line )
> {
> var status = null;
>
>
> mixin java.io;
> writeln("hit breakpoint at " + file + ":" +
> line);
> var shell = new function() extends
> oscript.Shell(
> new BufferedReader( new
> InputStreamReader(System.in) ),
> new PrintWriter(System.out),
> new PrintWriter(System.err)
> ) {
>
> // overload to evaluate in the scope of
> the breakpoint
> public function evalStr(str)
> {
> // note: default implementation of
> read() automagically
> appends ";"
> if( (str == "exit;") || (str == "c;") )
> status = "exit";
> else if( str == "step;" || (str ==
> "s;") ) status = "step";
>
> if( status != null )
> return status;
>
> return
> oscript.OscriptInterpreter.__eval( str, scope );
> }
>
> private var _super_read = read;
>
> public function read()
> {
> if( status != null )
> return "exit";
> return _super_read();
> }
>
> }();
>
> shell.run();
>
> if( status == "step" )
> return this; // keep stepping
>
> return null; // stop stepping
> }
>
> }()
> );
> }
>
>
> ---------------------------
>
> // test.os
>
> import "dbg.os";
>
> var globalvar = 2;
>
> function test()
> {
> var a = 1; // <--- line 8
> var b = 2;
> writeln("a=" + a + ", b=" + b + ", globalvar=" +
> globalvar);
> }
>
>
> setBreakpoint("test.os",8);
>
> test();
>
>
> ---------------------------
>
> this is not very clean, but just meant to be an
> example.. maybe
> someday someone will have some time to package this
> up into a nice
> command-line debugger program.
>
>
>
> On Oct 17, 2005, at 3:08 PM, Lysander David wrote:
>
> > Hi,
> >
> > Is there a commandline debugger for objectscript ?
> >
> > Thanks,
> > Lysander
>
>
|