Changeset 4427

Show
Ignore:
Timestamp:
08/16/08 13:28:18 (5 months ago)
Author:
pmoura
Message:

Simplified the implementation of the Logtalk built-in debugger. Changed the implementation of the debugger abort command to use the de-facto standard Prolog built-in predicate abort/0. Corrected a bug that prevented the use of the command ignore at the redo port.

Location:
trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • trunk/compiler/logtalk.pl

    r4426 r4427  
    394394    throw(error(existence_error(procedure, Functor/Arity), context(Type, Entity, _))). 
    395395 
    396 '$lgt_runtime_error_handler'(error(logtalk_debugger_aborted)) :- 
    397     nl, write('    Debugging session aborted by user. Debugger still on.'), nl, 
    398     !, 
    399     fail. 
    400  
    401396'$lgt_runtime_error_handler'(error(Variable, _, Sender)) :- 
    402397    var(Variable), 
     
    405400'$lgt_runtime_error_handler'(error(Error, user::Goal, user)) :- 
    406401    throw(error(Error, Goal)). 
     402 
     403'$lgt_runtime_error_handler'(logtalk_debugger_aborted) :- 
     404    write('Debugging session aborted by user. Debugger still on.'), nl, 
     405    abort. 
    407406 
    408407'$lgt_runtime_error_handler'(Error) :- 
     
    37863785    (   '$lgt_dbg_debugging_', \+ '$lgt_dbg_skipping_' -> 
    37873786        (   '$lgt_dbg_port'(call, Goal, _, DbgCtx, CAction), 
    3788             (   CAction = skip -> 
    3789                 retractall('$lgt_dbg_skipping_'), 
    3790                 assertz('$lgt_dbg_skipping_'), 
    3791                 CAction2 = true 
    3792             ;   CAction2 = CAction 
    3793             ), 
    3794             (   CAction2 = ignore -> 
     3787            (   CAction == ignore -> 
    37953788                true 
    3796             ;   call(CAction2), 
    3797                 catch( 
    3798                     call(TGoal), 
    3799                     Error, 
    3800                     ('$lgt_dbg_port'(exception, Goal, Error, DbgCtx, TAction), (TAction = fail -> fail; throw(Error)))), 
     3789            ;   call(CAction), 
     3790                catch(TGoal, Error, '$lgt_dbg_exception'(Goal, Error, DbgCtx)), 
    38013791                (   '$lgt_dbg_port'(exit, Goal, _, DbgCtx, EAction), 
    38023792                    call(EAction) 
    38033793                ;   '$lgt_dbg_port'(redo, Goal, _, DbgCtx, RAction), 
    3804                     (   RAction = skip -> 
    3805                         retractall('$lgt_dbg_skipping_'), 
    3806                         assertz('$lgt_dbg_skipping_') 
    3807                     ), 
    3808                     RAction = ignore 
     3794                    RAction == ignore 
    38093795                ) 
    3810                 ; 
    3811                 retractall('$lgt_dbg_skipping_'), 
    3812                 '$lgt_dbg_port'(fail, Goal, _, DbgCtx, _), fail 
     3796            ;   retractall('$lgt_dbg_skipping_'), 
     3797                '$lgt_dbg_port'(fail, Goal, _, DbgCtx, _), 
     3798                fail 
    38133799            ) 
    38143800        ), 
     
    38183804 
    38193805 
    3820 '$lgt_dbg_port'(exception, _, error(logtalk_debugger_aborted), _, true) :- 
    3821     !. 
     3806'$lgt_dbg_exception'(_, logtalk_debugger_aborted, _) :- 
     3807    throw(logtalk_debugger_aborted). 
     3808 
     3809'$lgt_dbg_exception'(Goal, Error, DbgCtx) :- 
     3810    '$lgt_dbg_port'(exception, Goal, Error, DbgCtx, TAction), 
     3811    (   TAction == fail -> 
     3812        fail 
     3813    ;   throw(Error) 
     3814    ). 
     3815 
    38223816 
    38233817'$lgt_dbg_port'(Port, Goal, Error, DbgCtx, Action) :- 
     
    38643858'$lgt_dbg_valid_port_option'(i, redo, _). 
    38653859'$lgt_dbg_valid_port_option'(f, call, _). 
     3860'$lgt_dbg_valid_port_option'(f, fact, _). 
     3861'$lgt_dbg_valid_port_option'(f, rule, _). 
    38663862'$lgt_dbg_valid_port_option'(f, redo, _). 
    38673863'$lgt_dbg_valid_port_option'(n, _, _). 
     
    38883884    retractall('$lgt_dbg_tracing_'). 
    38893885 
    3890 '$lgt_dbg_do_port_option'(s, Port, _, _, _, Action) :- 
    3891     '$lgt_dbg_do_port_option_skip'(Port, Action). 
    3892  
    3893 '$lgt_dbg_do_port_option'(i, _, _, _, _, ignore). 
     3886'$lgt_dbg_do_port_option'(s, call, _, _, _, true) :- 
     3887    !, 
     3888    retractall('$lgt_dbg_skipping_'), 
     3889    assertz('$lgt_dbg_skipping_'). 
     3890'$lgt_dbg_do_port_option'(s, redo, _, _, _, fail) :- 
     3891    !, 
     3892    retractall('$lgt_dbg_skipping_'), 
     3893    assertz('$lgt_dbg_skipping_'). 
     3894'$lgt_dbg_do_port_option'(s, _, _, _, _, true). 
     3895 
     3896'$lgt_dbg_do_port_option'(i, call, _, _, _, ignore). 
     3897'$lgt_dbg_do_port_option'(i, redo, _, _, _, ignore). 
    38943898 
    38953899'$lgt_dbg_do_port_option'(f, _, _, _, _, fail). 
     
    39473951        break, 
    39483952        '$lgt_dbg_resume'(Tracing) 
    3949     ;   write('    break no supportd on this Prolog compiler.'), nl 
     3953    ;   write('    break no supportd by the back-end Prolog compiler.'), nl 
    39503954    ), 
    39513955    fail. 
    39523956 
    39533957'$lgt_dbg_do_port_option'(a, _, _, _, _, _) :- 
    3954     throw(error(logtalk_debugger_aborted)). 
     3958    retractall('$lgt_dbg_skipping_'), 
     3959    throw(logtalk_debugger_aborted). 
    39553960 
    39563961'$lgt_dbg_do_port_option'(q, _, _, _, _, _) :- 
     
    39773982    write('        l - leap (continues execution until the next spy point is found)'), nl, 
    39783983    write('        s - skip (skips debugging for the current goal; only meaningful at call and redo ports)'), nl, 
    3979     write('        i - ignore (ignores goal, assumes that it succeeded)'), nl, 
    3980     write('        f - fail (forces backtracking)'), nl, 
     3984    write('        i - ignore (ignores goal, assumes that it succeeded; only valid at call and redo ports)'), nl, 
     3985    write('        f - fail (forces backtracking; may also be used to convert an exception into a failure)'), nl, 
    39813986    write('        n - nodebug (turns off debugging)'), nl, 
    39823987    write('        ! - command (reads and executes a query)'), nl, 
     
    39984003'$lgt_dbg_do_port_option'(?, Port, Goal, Error, DbgCtx, Action) :- 
    39994004    '$lgt_dbg_do_port_option'(h, Port, Goal, Error, DbgCtx, Action). 
    4000  
    4001  
    4002  
    4003 '$lgt_dbg_do_port_option_skip'(exit, true). 
    4004 '$lgt_dbg_do_port_option_skip'(fail, true). 
    4005 '$lgt_dbg_do_port_option_skip'(fact, true). 
    4006 '$lgt_dbg_do_port_option_skip'(rule, true). 
    4007 '$lgt_dbg_do_port_option_skip'(exception, true). 
    4008 '$lgt_dbg_do_port_option_skip'(call, skip). 
    4009 '$lgt_dbg_do_port_option_skip'(redo, skip). 
    40104005 
    40114006 
  • trunk/manuals/index.html

    r4412 r4427  
    3232    <div class="copyright"> 
    3333        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    34         <span>Last updated on: July 31, 2008</span> 
     34        <span>Last updated on: August 16, 2008</span> 
    3535    </div> 
    3636    <div class="navbottom"> 
  • trunk/manuals/userman/index.html

    r4389 r4427  
    304304    <div class="copyright"> 
    305305        <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/> 
    306         <span>Last updated on: July 20, 2008</span> 
     306        <span>Last updated on: August 16, 2008</span> 
    307307    </div> 
    308308    <div class="navbottom"> 
  • trunk/manuals/userman/running.html

    r4393 r4427  
    413413        <dd>ignores goal, assumes that it succeeded</dd> 
    414414    <dt><code>f</code> &mdash; fail</dt> 
    415         <dd>forces backtracking</dd> 
     415        <dd>forces backtracking; may also be used to convert an exception into a failure</dd> 
    416416    <dt><code>n</code> &mdash; nodebug</dt> 
    417417        <dd>turns off debugging</dd> 
     
    517517<div class="footer"> 
    518518    <div class="copyright"> 
    519         <span>Copyright &copy; <a href="mailto:pmoura@logtalk.org">Paulo Moura</a> &mdash; <a href="http://logtalk.org">Logtalk.org</a></span><br/>  
    520         <span>Last updated on: July 20, 2008</span> 
     519        <span>Copyright &copy; August 16, 2008</span> 
    521520    </div> 
    522521    <div class="navbottom"> 
  • trunk/RELEASE_NOTES.txt

    r4425 r4427  
    2626    runtime. Thanks to Joachim Schimpf and Kish Shen work on the improved  
    2727    singleton variable checking code found on the new ECLiPSe 6.0 compiler. 
     28 
     29    Simplified the implementation of the Logtalk built-in debugger. Changed  
     30    the implementation of the debugger abort command to use the de-facto  
     31    standard Prolog built-in predicate abort/0. Corrected a bug that prevented 
     32    the use of the command ignore at the redo port. 
    2833 
    2934    Added ECLiPSe 6.0 config files. Modified the POSIX script "eclipselgt"