walnuthq / cairovm.codes

Source code for cairovm.codes — a web app to compile Cairo programs into Sierra and CASM with step-through execution capabilities.
https://cairovm.codes
MIT License
29 stars 24 forks source link

feat: Implement Single-Step Debugging Mode for Sierra Statements #152

Closed barabanovro closed 2 months ago

barabanovro commented 2 months ago

Description: This task involves adding a feature that enables developers to debug Sierra statements on an individual basis. A mode selector will be added to the right-hand panel of the user interface, allowing the user to switch between Execution Trace and the new Sierra debug view.

Task Objectives:

  1. Selector: Place a selector in the right panel to choose between Debug VM Execution Trace and Debug Sierra, where Execution Trace currently is.

  2. Sierra Mode Display:

    • Display Sierra statements in place of the Execution Trace when Sierra mode is selected.
    • Omit registers and execution steps from the Debug Info window in Sierra mode.
    • Exclude FP (Frame Pointer), CALL PC (Call Program Counter), and RET PC (Return Program Counter) from the call stack table in Sierra mode.
  3. Step-Through Logic for Sierra Mode:

    • For steps mapped to multiple Sierra statements:
      • Initially highlight the first Sierra statement.
      • Progress to highlight subsequent statements on user action (e.g., clicking "Step Next").
    • Manage the step-through process using two counters:
      • A "substep" counter specific to Sierra mode.
      • The existing executionTraceStepNumber.
    • Increment the "substep" counter first; once all "substeps" are executed, increase the executionTraceStepNumber and reset the "substep" counter.
  4. Code Editor Synchronization in Sierra Mode:

    • Ensure that in Sierra mode, the Cairo editor highlights only the code segments corresponding to the active Sierra statement being debugged.

Notes:

jaipaljadeja commented 2 months ago

Hey, I would like to work on this. I have been through the visualization task and all so well aware with the working. I can make a new component for this, also add the sierra mode and substep counter state in context and render accordingly.

BlackStarkGoku commented 2 months ago

Hello, I would love to have the chance to work on a hard task :) My last contribution gave me an overview of how works the debugging with highlights so I think I am able to work on this !

barabanovro commented 2 months ago

Assigned @jaipaljadeja for his in-depth codebase expertise, essential for this complex task. @BlackStarkGoku, your enthusiasm is valued, and more challenging opportunities will come. Thanks to both for your dedication!