dbg_iload:guard_test/1 patch

Dan Gudmundsson <>
Thu Apr 1 12:11:16 CEST 2004


I have already fixed that, along with a long list of other bugs.
It will be available in next erlang release.

Cheers
/Dan

Luke Gorrie writes:
 > Ahoy,
 > 
 > The patch below adds support for two types of guards in the
 > debugger's Erlang interpreter:
 > 
 >   Var
 >   not <Expr>
 > 
 > It just translates them into:
 > 
 >   Var == true
 >   <Expr> /= true
 > 
 > These seem to be new features added to Erlang but not this
 > interpreter.
 > 
 > If you use these guards in your programs and you have seen Distel
 > blowing up when you interpret your modules, I recommend applying this
 > in lib/debugger/src/ :-)
 > 
 > P.S., is there any technical reason not to rewrite the Erlang
 > interpreters in the debugger and/or shell to interpret Core Erlang
 > instead?
 > 
 > --- dbg_iload.erl.~1.1.1.5.~	2003-09-02 15:34:28.000000000 +0200
 > +++ dbg_iload.erl	2004-04-01 11:29:01.000000000 +0200
 > @@ -243,6 +243,8 @@
 >  	error ->
 >  	    {safe_bif,Line,erlang,F,As}
 >      end;
 > +guard_test({op,Line,'not',L0}) ->
 > +    guard_test({op,Line,'/=',L0,{atom,Line,true}});
 >  guard_test({op,Line,Op,L0}) ->
 >      true = erl_internal:arith_op(Op, 1),	%Assertion.
 >      L1 = gexpr(L0),
 > @@ -258,7 +260,8 @@
 >  guard_test({char,_,_}=C) -> C;
 >  guard_test({float,_,_}=F) -> F;
 >  guard_test({atom,_,_}=A) -> A;
 > -guard_test({nil,_}=N) -> N.
 > +guard_test({nil,_}=N) -> N;
 > +guard_test({var,Line,_}=V) -> guard_test({op,Line,'==',V,{atom,Line,true}}).
 >  
 >  map_guard_bif(integer, 1) -> {ok,is_integer};
 >  map_guard_bif(float, 1) -> {ok,is_float};

-- 
Dan Gudmundsson               Project:    Mnesia, Erlang/OTP
Ericsson Utvecklings AB       Phone:      +46  8 727 5762 
UAB/F/P                       Mobile:     +46 70 519 9469
S-125 25 Stockholm            Visit addr: Armborstv 1 




More information about the erlang-patches mailing list