Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Func debug primitives description #564

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion docs/develop/func/stdlib.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -526,6 +526,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
Expand Down Expand Up @@ -650,7 +651,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. Several values can be dumped as a tuple, e.g. `~dump([v1, v2, v3])`.

#### ~strdump

```func
() ~strdump(slice str) impure asm "STRDUMP";
```

Dumps a string. Slice parameter bit length must be divisible by 8.

#### dump_stack

Expand Down
Loading