From e579ea15e8374c34ef605c4dee6aa07902b4a84f Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Sun, 19 Mar 2023 13:15:31 +0300 Subject: [PATCH] Add DBG_CONTRACT instruction --- src/aeso_fcode_to_fate.erl | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/aeso_fcode_to_fate.erl b/src/aeso_fcode_to_fate.erl index 0c16070..4b78633 100644 --- a/src/aeso_fcode_to_fate.erl +++ b/src/aeso_fcode_to_fate.erl @@ -122,7 +122,7 @@ function_to_scode(ChildContracts, ContractName, Functions, Name, Attrs0, Args, B %% DBG_LOC is added before the function body to make it possible to break %% at the function signature - SCode = dbg_loc(Env, Attrs0) ++ to_scode(Env, Body), + SCode = dbg_contract(Env) ++ dbg_loc(Env, Attrs0) ++ to_scode(Env, Body), ScopedSCode = dbg_scoped_vars(Env, ArgsNames, SCode), {Attrs, {ArgTypes, ResType1}, ScopedSCode}. @@ -738,6 +738,11 @@ tuple(N) -> aeb_fate_ops:tuple(?a, N). %% -- Debug info functions -- +dbg_contract(#env{debug_info = false}) -> + []; +dbg_contract(#env{contract = Contract}) -> + [{'DBG_CONTRACT', {immediate, Contract}}]. + dbg_loc(#env{debug_info = false}, _) -> []; dbg_loc(_Env, Ann) -> @@ -934,6 +939,7 @@ attributes(I) -> {'DBG_LOC', _, _} -> Impure(none, []); {'DBG_DEF', _, _} -> Impure(none, []); {'DBG_UNDEF', _, _} -> Impure(none, []); + {'DBG_CONTRACT', _} -> Impure(none, []); {'RETURNR', A} -> Impure(pc, A); {'CALL', A} -> Impure(?a, [A]); {'CALL_R', A, _, B, C, D} -> Impure(?a, [A, B, C, D]);