From 29189f82b4f6fee348eac9a3b44fbb6a891e3d95 Mon Sep 17 00:00:00 2001 From: Roman Kulinsky Date: Mon, 6 May 2024 10:44:15 +0300 Subject: [PATCH 1/3] Added ~dump and ~strdump debug primitives description --- docs/develop/func/stdlib.mdx | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/docs/develop/func/stdlib.mdx b/docs/develop/func/stdlib.mdx index 343629478b..cfd69a32a8 100644 --- a/docs/develop/func/stdlib.mdx +++ b/docs/develop/func/stdlib.mdx @@ -632,7 +632,23 @@ A variant of `parse_std_addr` that returns the (rewritten) address as a slice `s ## Debug primitives -Currently, only one function is available. +Debug primitives can be used for inspecting state of various variables while running tests or console scripts. + +#### ~dump + +```func +forall X -> () ~dump(X value) impure asm "s0 DUMP"; +``` + +Outputs a value. + +#### ~strdump + +```func +() ~strdump(slice str) impure asm "STRDUMP"; +``` + +Dumps a string. Slice parameter bit length must be divisible by 8. #### dump_stack From 8733a6dc971ac01a5b73204556c82a95462118ae Mon Sep 17 00:00:00 2001 From: Roman Kulinsky Date: Mon, 6 May 2024 10:44:23 +0300 Subject: [PATCH 2/3] Caution block size fix in Random generator primitives section --- docs/develop/func/stdlib.mdx | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/develop/func/stdlib.mdx b/docs/develop/func/stdlib.mdx index cfd69a32a8..384cb5b85d 100644 --- a/docs/develop/func/stdlib.mdx +++ b/docs/develop/func/stdlib.mdx @@ -508,6 +508,7 @@ The pseudo-random number generator uses the random seed, an unsigned 256-bit Int Keep in mind that random numbers generated by the functions below can be predicted if you do not use additional tricks. - [Random number generation](/develop/smart-contracts/guidelines/random-number-generation) + ::: #### random From c6488c0d62be25f97d05b911c82a7ed3461eab01 Mon Sep 17 00:00:00 2001 From: Roman Kulinsky Date: Mon, 6 May 2024 20:40:32 +0300 Subject: [PATCH 3/3] Added helpful comment for ~dump --- docs/develop/func/stdlib.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/develop/func/stdlib.mdx b/docs/develop/func/stdlib.mdx index 384cb5b85d..5086df4974 100644 --- a/docs/develop/func/stdlib.mdx +++ b/docs/develop/func/stdlib.mdx @@ -641,7 +641,7 @@ Debug primitives can be used for inspecting state of various variables while run forall X -> () ~dump(X value) impure asm "s0 DUMP"; ``` -Outputs a value. +Outputs a value. Several values can be dumped as a tuple, e.g. `~dump([v1, v2, v3])`. #### ~strdump