Debug Panel
The Debug Panel is your central hub for all debugging activities in Glass.Panel Overview
- Variables
- Call Stack
- Breakpoints
- Console
Inspect local variables, arguments, and captured values in the current scope. The variables view updates automatically as you step through code.
Panel Actions
Common debug panel actions:Starting Debug Sessions
Glass supports multiple ways to start debugging your code.Launch Configuration
Define debug scenarios in your project’s
.glass/tasks.json or .vscode/launch.json:Debug Adapters
- debugpy - Python debugging
- lldb / codelldb - C, C++, Rust debugging
- node - JavaScript/TypeScript debugging
- go - Go debugging
- And more through DAP extensions
Debug adapters are automatically detected and installed based on your project’s language. You can also manually configure adapter paths in settings.
Breakpoints
Set and manage breakpoints to pause execution at specific locations.Breakpoint Types
- Line Breakpoints
- Conditional Breakpoints
- Hit Count Breakpoints
- Logpoints
Click the gutter next to any line number to set a breakpoint. The breakpoint will pause execution when that line is reached.
Breakpoint Management
- Toggle breakpoint at current line
- Clear all breakpoints in the project
- Enable/disable individual breakpoints
- Add conditions or hit counts
Execution Control
Control program execution with precision.Step Commands
Step Over
Execute the current line and move to the next line, treating function calls as single steps.
Session Management
- Start new session with a debug scenario
- Stop session to terminate debugging
- Restart session to rerun with same configuration
- Detach from attached processes
Variable Inspection
Examine and modify program state while debugging.Variables View
- Local variables in current scope
- Global variables and static values
- Closure captures in functional languages
- Object properties expanded hierarchically
Scopes
- Local - Function parameters and local variables
- Global - Module-level and global variables
- Closure - Captured variables from outer scopes
Call Stack
Understand the execution path that led to the current state.Stack Frames
- Function names at each level
- Source locations with file and line
- Frame indices for reference
- Thread information in multi-threaded apps
- View its source code
- Inspect its variables
- Evaluate expressions in its context
Debug Console
Interact with your running application through the debug console.Evaluate Expressions
Type expressions to evaluate them in the context of the current stack frame:REPL Integration
Some debug adapters provide full REPL functionality, allowing you to:- Execute arbitrary code
- Call functions
- Modify variables
- Import modules
Debug Adapter Protocol
Glass implements the Debug Adapter Protocol for universal debugging support.DAP Implementation
- Standardized protocol across languages
- Extensible through adapters
- Rich debugging capabilities
- Terminal integration for console output
Session Configuration
TCP Debugging
For remote debugging scenarios:- Specify host and port
- Configure connection timeout
- Debug containerized applications
- Remote server debugging
Build Tasks
Run build tasks before debugging:Build tasks ensure your code is compiled with debug symbols before debugging starts, providing accurate source mapping and variable information.
Advanced Features
Multiple Sessions
- Multiple concurrent debug sessions
- Parent-child session relationships
- Session picker to switch between active sessions
Thread Management
For multi-threaded applications:- Thread picker to select which thread to inspect
- Per-thread call stacks
- Thread-specific stepping
Inline Values
Best Practices
- Use conditional breakpoints to avoid stopping on every iteration in loops
- Leverage logpoints for non-intrusive debugging in production-like environments
- Organize breakpoints - disable rather than delete breakpoints you might need later
- Use the debug console to quickly test hypotheses without modifying code
- Configure build tasks in debug scenarios to ensure code is always up-to-date
- Master stepping - know when to step over vs. step into
- Explore stack frames to understand call chains and variable scopes
Troubleshooting
Debugger Won’t Start
- Verify debug adapter is installed
- Check debug configuration syntax
- Review console output for error messages
- Ensure build tasks complete successfully
Breakpoints Not Hitting
- Confirm code is compiled with debug symbols
- Check that source maps are correct
- Verify the file path matches the running code
- Look for “pending” breakpoint status
Variables Show “optimized out”
- Compile with debug symbols and without optimizations
- Some values may be legitimately optimized away by the compiler
Related Features
- Testing - Run tests and tasks from the editor
- Navigation - Navigate code while debugging
- Git Integration - Debug specific commits or branches