improvements to debugger

overflow fixes
reading attvars from DB was broken.


git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1472 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
vsc 2005-11-26 02:57:25 +00:00
parent da4e302b28
commit 4157f2ce61
8 changed files with 47 additions and 24 deletions

View File

@ -10,8 +10,11 @@
* *
* File: absmi.c *
* comments: Portable abstract machine interpreter *
* Last rev: $Date: 2005-11-23 03:01:32 $,$Author: vsc $ *
* Last rev: $Date: 2005-11-26 02:57:25 $,$Author: vsc $ *
* $Log: not supported by cvs2svn $
* Revision 1.186 2005/11/23 03:01:32 vsc
* fix several bugs in save/restore.b
*
* Revision 1.185 2005/11/18 18:48:51 tiagosoares
* support for executing c code when a cut occurs
*
@ -8639,7 +8642,7 @@ Yap_absmi(int inp)
BEGP(pt0);
deref_body(d0, pt0, plus_vv_unk, plus_vv_nvar);
saveregs();
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is A+B");
Yap_Error(INSTANTIATION_ERROR, TermNil, "X is _+B");
setregs();
FAIL();
ENDP(pt0);

View File

@ -125,6 +125,7 @@ TermToAttVar(Term attvar, Term to)
if (!attv)
return FALSE;
attv->Atts = attvar;
*VarOfTerm(to) = (CELL)attv;
return TRUE;
}

View File

@ -2395,16 +2395,18 @@ p_still_variant(void)
static int
copy_attachments(CELL *ts)
{
/* we will change delayed vars, and that also means the trail */
Term orig = Yap_ReadTimedVar(DelayedVars);
Term orig2 = Yap_ReadTimedVar(AttsMutableList);
tr_fr_ptr tr0 = TR;
while (TRUE) {
/* store away in case there is an overflow */
if (attas[IntegerOfTerm(ts[2])].term_to_op(ts[1], ts[0]) == FALSE) {
/* oops, we did not have enough space to copy the elements */
/* reset queue of woken up goals */
Yap_UpdateTimedVar(DelayedVars, orig);
Yap_UpdateTimedVar(AttsMutableList, orig2);
TR = tr0;
return FALSE;
}
if (ts[3] == TermNil) return TRUE;

View File

@ -16,7 +16,15 @@
<h2>Yap-5.1.0:</h2>
<ul>
<li> FIXED: prolog_load_context(directory). </li>
<li> FIXED: overflow handling in DB/AttVars was resetting old var, and
wasn't resetting trail. </li>
<li> FIXED: when rebuilding DB term with attvars, set global var to
point to attvar. </li>
<li> NEW: add school CLP(BN) example. </li>
<li> NEW: add sc CLP(BN) example. </li>
<li> FIXED: make exception port more like a true port. </li>
<li> FIXED: don't run ^ in setof if there are no excess variables. </li>
<li> FIXED: prolog_load_context(directory) relied on dead code. </li>
<li> FIXED: some small beautifications for system/1, getcwd/1, sh/1, rename/2. </li>
<li> NEW: operating_system_error. </li>
<li> FIXED: Restore could not recover DL_MALLOC info and was not recovering

View File

@ -568,10 +568,10 @@ repeat :- '$repeat'.
write_term(user_error,B,Opts) ;
format(user_error,'~w',[B])
).
'$write_goal_output'(Format-G, NG, NG) :-
'$write_goal_output'(Format-G, [G|NG], NG) :-
G = [_|_], !,
format(user_error,Format,G).
'$write_goal_output'(_-G, NG, NG) :-
'$write_goal_output'(_-G, [G|NG], NG) :-
( recorded('$print_options','$toplevel'(Opts),_) ->
write_term(user_error,G,Opts) ;
format(user_error,'~w',[G])

View File

@ -337,13 +337,19 @@ debugging :-
throw('$fail_spy'(GoalNumber)).
'$loop_spy_event'(abort, _, _, _, _) :- !,
throw('$abort').
'$loop_spy_event'(Event, GoalNumber, G, Module, InControl) :- !,
'$loop_spy_event'(Event, GoalNumber, G, Module, InControl) :-
'$debug_error'(Event),
'$system_catch'(
('$trace'(exception(Event),G,Module,GoalNumber),fail),
('$trace'(exception,G,Module,GoalNumber),fail),
Module,NewEvent,
'$loop_spy_event'(NewEvent, GoalNumber, G, Module, InControl)).
'$debug_error'(Event) :-
'$Error'(Event), fail.
'$debug_error'(_).
'$loop_fail'(GoalNumber, G, Module, InControl) :-
'$system_catch'(('$trace'(fail, G, Module, GoalNumber),
fail ),
@ -468,7 +474,7 @@ debugging :-
'$unleashed'(redo) :- get_value('$leash',L), L /\ 2'0010 =:= 0.
'$unleashed'(fail) :- get_value('$leash',L), L /\ 2'0001 =:= 0.
% the same as fail.
'$unleashed'(exception(_)) :- get_value('$leash',L), L /\ 2'0001 =:= 0.
'$unleashed'(exception) :- get_value('$leash',L), L /\ 2'0001 =:= 0.
'$debugger_write'(Stream, G) :-
recorded('$print_options','$debugger'(OUT),_), !,

View File

@ -115,20 +115,19 @@ bagof(Template, Generator, Bag) :-
'$check_list_for_bags'(Bag, bagof(Template, Generator, Bag)),
'$variables_in_term'(Template, [], TemplateV),
'$excess_vars'(Generator, StrippedGenerator, TemplateV, [], FreeVars),
FreeVars \== [],
!,
'$variables_in_term'(FreeVars, [], LFreeVars),
Key =.. ['$'|LFreeVars],
'$init_db_queue'(Ref),
'$findall_with_common_vars'(Key-Template, StrippedGenerator, Ref, Bags0),
'$keysort'(Bags0, Bags),
'$pick'(Bags, Key, Bag).
% or we just have a list of answers
'$bagof'(Template, Generator, Bag) :-
'$init_db_queue'(Ref),
'$findall'(Template, Generator, Ref, [], Bag0),
Bag0 \== [],
Bag = Bag0.
( FreeVars \== [] ->
'$variables_in_term'(FreeVars, [], LFreeVars),
Key =.. ['$'|LFreeVars],
'$init_db_queue'(Ref),
'$findall_with_common_vars'(Key-Template, StrippedGenerator, Ref, Bags0),
'$keysort'(Bags0, Bags),
'$pick'(Bags, Key, Bag)
;
'$init_db_queue'(Ref),
'$findall'(Template, StrippedGenerator, Ref, [], Bag0),
Bag0 \== [],
Bag = Bag0
).
% picks a solution attending to the free variables

View File

@ -756,3 +756,7 @@ nth_instance(X,Y,Z) :-
fail
),
'$system_catch'('$query'(once(G), []),Module,Error,user:'$Error'(Error)).
prolog_current_frame(Env) :-
X is $env.