From 0f7529b26a28c619326f6e2dcf10b26c85b2fff2 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Thu, 25 May 2023 18:09:42 +0300 Subject: [PATCH] Introduce debugging instructions (#113) * Add DBGLOC fate op * Add DBGDEF and DBGUNDEF * Change the type of arg for dbgdef and dbgundef * Change DBGUNDEF to end_bb = true * No safe sanity check for dbgundef * Rename DBGDEF and DBGUNDEF to DBG_DEF and DBG_UNDEF * Revert "No safe sanity check for dbgundef" This reverts commit ee4949777fd988b76b9f854a2523a64a6dcdf591. * Rename DBGLOC to DBG_LOC * Remove column from DBG_LOC * Add DBG_CALL and DBG_RETURN * Update the docs for debug opcodes * Add a DBG_CALL_R for remote calls * Remove is_tail_call from DBG_CALL_R * Revert "Remove is_tail_call from DBG_CALL_R" This reverts commit a620c9c34b1c0ace77253ec0eabe6ac0b8e77ad2. * Revert "Add a DBG_CALL_R for remote calls" This reverts commit a336314cfc3930b348fb73352de8c108eba72973. * Revert "Add DBG_CALL and DBG_RETURN" This reverts commit db9766ac746b7f2d34a6f09a2f528be07b4226ea. * Add DBG_CONTRACT op * Upgrade aeserialization dep * Use aeserialization v1.0.0 * Use aeserialization tag v1.0.0 * Remove debug instructions from AEVM --- rebar.config | 4 ++-- rebar.lock | 2 +- src/aeb_fate_generate_ops.erl | 5 +++++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/rebar.config b/rebar.config index e89721d..29dce2d 100644 --- a/rebar.config +++ b/rebar.config @@ -6,7 +6,7 @@ {deps, [ {eblake2, "1.0.0"} , {aeserialization, {git, "https://github.com/aeternity/aeserialization.git", - {ref, "eb68fe3"}}} + {tag, "v1.0.0"}}} , {getopt, "1.0.1"} ]}. @@ -40,7 +40,7 @@ {profiles, [{binary, [ {deps, [ {eblake2, "1.0.0"} , {aeserialization, {git, "https://github.com/aeternity/aeserialization.git", - {ref, "47aaa8f"}}} + {tag, "v1.0.0"}}} , {getopt, "1.0.1"} ]}, diff --git a/rebar.lock b/rebar.lock index 3e111f3..2eb30ee 100644 --- a/rebar.lock +++ b/rebar.lock @@ -1,7 +1,7 @@ {"1.2.0", [{<<"aeserialization">>, {git,"https://github.com/aeternity/aeserialization.git", - {ref,"eb68fe331bd476910394966b7f5ede7a74d37e35"}}, + {ref,"177bf604b2a05e940f92cf00e96e6e269e708245"}}, 0}, {<<"base58">>, {git,"https://github.com/aeternity/erl-base58.git", diff --git a/src/aeb_fate_generate_ops.erl b/src/aeb_fate_generate_ops.erl index 220fef1..66347e1 100644 --- a/src/aeb_fate_generate_ops.erl +++ b/src/aeb_fate_generate_ops.erl @@ -242,6 +242,11 @@ ops_defs() -> , { 'BSL', 16#af, false, true, true, ?GAS(10), [a, a, a], bin_sl, {integer, integer}, integer, "Arg0 := Arg1 << Arg2"} , { 'BSR', 16#b0, false, true, true, ?GAS(10), [a, a, a], bin_sr, {integer, integer}, integer, "Arg0 := Arg1 >> Arg2"} + , { 'DBG_LOC', 16#b1, false, true, true, ?GAS(0), [a, a], dbg_loc, {string, integer}, none, "Debug Op: Execution location. Args = {file_name, line_num}" } + , { 'DBG_DEF', 16#b2, false, true, true, ?GAS(0), [a, a], dbg_def, {string, any}, none, "Debug Op: Define a variable. Args = {var_name, register}" } + , { 'DBG_UNDEF', 16#b3, false, true, true, ?GAS(0), [a, a], dbg_undef, {string, any}, none, "Debug Op: Undefine a variable. Args = {var_name, register}" } + , { 'DBG_CONTRACT', 16#b4, false, true, true, ?GAS(0), [a], dbg_contract, {string}, none, "Debug Op: Name the current contract. Args: {contract_name}"} + , { 'DEACTIVATE', 16#fa, false, true, true, ?GAS(10), [], deactivate, {}, none, "Mark the current contract for deactivation."} , { 'ABORT', 16#fb, true, true, true, ?GAS(10), [a], abort, {string}, none, "Abort execution (dont use all gas) with error message in Arg0."} , { 'EXIT', 16#fc, true, true, true, ?GAS(10), [a], exit, {string}, none, "Abort execution (use upp all gas) with error message in Arg0."}