Skip to content

Debugger struct support#76

Merged
someone235 merged 7 commits intokaspanet:masterfrom
Manyfestation:debugger-struct-support
Mar 25, 2026
Merged

Debugger struct support#76
someone235 merged 7 commits intokaspanet:masterfrom
Manyfestation:debugger-struct-support

Conversation

@Manyfestation
Copy link
Copy Markdown
Collaborator

@Manyfestation Manyfestation commented Mar 16, 2026

Resolves #63 -

  • The debugger now accepts JSON objects for State and declared struct params.
  • It also accepts JSON arrays of objects for State[] and struct-array params.
  • vars and print rebuild those params as source-shaped objects instead of exposing only lowered leaves.
  • Debug metadata records param bindings as either:
    • SingleValue: one runtime stack slot
    • StructuredValue: one lowered leaf slot per flattened field

Example

cli-debugger ./vault.sil -f inspect --arg '{"amount":7,"tag":"0xbeef"}'

seen as -

Call Arguments:
  next (State) = {amount: 7, tag: 0xbeef}

The same also works in .test.json:

{
  "tests": [
    {
      "name": "inspect_state",
      "function": "inspect",
      "args": [{ "amount": 7, "tag": "0xbeef" }],
      "expect": "pass"
    }
  ]
}

How it work

JSON arg
  -> parsed into structured Expr values
  -> compiler lowers struct-like inputs into leaf values
  -> debug metadata records either one slot or many leaf slots
  -> debug session rebuilds object / object-array values from those leaf slots

@Manyfestation Manyfestation force-pushed the debugger-struct-support branch from 7b537be to 8f99214 Compare March 16, 2026 20:14
@Manyfestation Manyfestation force-pushed the debugger-struct-support branch from 8c5e06c to d2e45f9 Compare March 16, 2026 22:10
@Manyfestation Manyfestation force-pushed the debugger-struct-support branch from 1f77d83 to 4589e56 Compare March 22, 2026 17:53
@Manyfestation Manyfestation force-pushed the debugger-struct-support branch from 4589e56 to fdb065b Compare March 22, 2026 20:30
@Manyfestation Manyfestation force-pushed the debugger-struct-support branch from b87de35 to 4549491 Compare March 24, 2026 15:44
@someone235 someone235 dismissed their stale review March 25, 2026 15:45

It seems like it's necessary after all

@someone235 someone235 merged commit e093057 into kaspanet:master Mar 25, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Debugger should support State and State[] arguments consistently with the compiler

2 participants