← REPL Enhancements | Testing Framework → |
---|---|
Debugging Tools for Dana¶
(This document is a placeholder. It will focus on the specific tooling aspects for debugging Dana programs, complementing the conceptual design in ../../02_dana_runtime_and_execution/debugging_profiling.md
. This includes command-line debuggers, IDE integration specifics, and visualization tools.)
Key Tooling Aspects for Debugging:¶
- Command-Line Debugger (Conceptual):
- Features: Setting breakpoints, stepping (over, in, out), inspecting variables and
SandboxContext
scopes, evaluating expressions in current context, viewing call stacks. - Invocation: How to start a Dana script under the debugger.
- Commands: Syntax for debugger commands (e.g.,
b <line|func>
,n
,s
,c
,p <expr>
,bt
,up
,down
). -
Interaction with REPL: Can the debugger be invoked from or drop into a REPL state?
-
VS Code Debugger Integration (via Debug Adapter Protocol - DAP):
- Implementing a Dana Debug Adapter.
- Mapping DAP requests (e.g.,
setBreakpoints
,next
,stepIn
,evaluate
) to Dana debugger functionalities. - Displaying variables, call stack, and context within the VS Code UI.
-
Configuration (
launch.json
) for debugging Dana scripts. -
Log Analysis Tools:
- Utilities for filtering, searching, and visualizing structured logs generated by
log()
statements or system components. -
Highlighting errors or specific log levels.
-
SandboxContext
Visualization/Inspection Tools: - A tool (perhaps REPL magic command or standalone utility) to dump or interactively explore the
SandboxContext
at a given point (e.g., during a debugging session or post-mortem). -
Visualizing scope hierarchy and variable states.
-
IPV Execution Tracing Tools:
- Tools to visualize or inspect the execution flow through the INFER, PROCESS, and VALIDATE phases of IPV-enabled functions.
- Displaying the
IPVCallContext
at each stage. -
Logging inputs/outputs of LLM calls made during IPV.
-
Execution Path Visualization (Advanced):
- Graphical representation of the execution flow of a Dana script, especially for complex orchestrations or agent decision trees.
-
Highlighting active paths, decision points, and resource interactions.
-
Post-Mortem Debugging Tools:
- Saving
SandboxContext
state on unhandled exceptions. - Tools to load and inspect this saved state to understand the cause of a crash.
Considerations for Debugging LLM Interactions:¶
- Debugging prompts sent to LLMs.
- Inspecting raw LLM responses.
- Tracing how LLM outputs are parsed and validated (especially in IPV
validate_phase
). - Handling non-determinism if the same LLM call can produce different results.
Self-reflection: Effective debugging tools are paramount for a productive developer experience. For Dana, this means not only traditional code debugging but also tools to understand the state and flow of context, resource interactions, and LLM calls.