Welcome to the DAP Debugger Client project! This is a web-based application for debugging Go applications using the Debug Adapter Protocol (DAP) and Delve. Built with the Fiber web framework and using WebSockets, it provides an interactive, user-friendly GUI to help developers debug their applications with ease.
This project aims to give developers a streamlined debugging experience through a web interface that lets you connect to a Delve DAP server, control the execution flow, set breakpoints, and inspect code and variables in real-time.
Features:
- Live Debugging Interface: Control program execution with commands like Continue, Pause, Step In, Step Over, and Step Out.
- Breakpoint Management: Set, remove, and view breakpoints by line or function name.
- Code View: Display source code with proper formatting, including preserved tabs and line numbers.
- Variable Inspection: Easily inspect variables within the current scope, including nested values.
- Execution Timing: Track time intervals between breakpoints to analyze performance.
- Interactive Console: Evaluate expressions within the current context and scope.
To get this application running on your machine, follow these instructions.
- Go (version 1.16 or higher)
- Delve (Go debugger with DAP support)
- Fiber (version 2.0 or higher)
- Node.js and npm (optional, for managing frontend dependencies if you want to customize the UI; however, dependencies are loaded via CDN)
-
Clone the Repository
git clone https://github.com/arturoeanton/gofuji.git cd gofuji
-
Install Go Dependencies
Make sure to install the dependencies required for the Fiber framework:
go mod tidy
-
Run Delve with DAP Support
Start your Go application using Delve in DAP mode. For example:
dlv dap --listen=:12345 --api-version=2 --headless --log --log-output=dap,rpc ./path/to/your/main.go
Note: Replace
./path/to/your/main.go
with the path to your Go application. -
Run the Fiber Server
Start the Fiber server to serve the debugging client UI:
go run main.go
-
Access the Debugging UI
Open your browser and navigate to
http://localhost:3000
to access the DAP Debugger Client UI.
-
Enter Connection Details:
- Address: IP address of the Delve server (default:
127.0.0.1
) - Port: Port of the Delve server (default:
12345
) - Program Path: Path to the Go application to be debugged
- Address: IP address of the Delve server (default:
-
Click "Connect":
- Once connected, you will see controls and options to manage breakpoints, inspect variables, and view code execution.
- Continue, Pause, Step In, Step Over, Step Out with dedicated controls.
- Open the **Breakpoint Manager** to add breakpoints by:
- **Line Number**: Set breakpoints at specific line numbers.
- **Function Name**: Set breakpoints at the start of specific functions.
- View all active breakpoints and delete them if necessary.
- Track time elapsed between breakpoints.
- View the source code and highlight the current execution point.
- Inspect variables and scope in real-time as the code executes.
- Enter Go expressions in the console to evaluate in the current context and display the results immediately.
├── main.go # Main Go server file using Fiber
├── static/
│ ├── index2.html # Main HTML file for the client UI
│ ├── app2.js # Main JavaScript file for client functionality
│ ├── styles.css # Custom styles for the UI
└── README.md # Project documentation
The server-side code for the Fiber application, which:
- Hosts a WebSocket endpoint for DAP communication.
- Provides an endpoint for fetching Go file information (e.g., functions and line numbers) for setting breakpoints.
The main HTML file that structures the layout of the DAP Debugger Client UI, including:
- Execution Controls
- Breakpoint Manager (in a modal for ease of use)
- Console Output and Variable Viewer
JavaScript functionality for the frontend, including:
- Handling WebSocket communication with the Fiber backend.
- Managing breakpoints, execution controls, and console evaluations.
WebSocket Endpoint: Manages communication with the Delve debugger using the DAP.
Function Endpoint: Provides a JSON list of functions and their line numbers for a specified Go source file, allowing breakpoints to be set by function name.
- Connect to the debugger by providing the address, port, and program path.
- Set Breakpoints by line number or function name.
- Control Execution using the provided buttons (continue, pause, step).
- Inspect Variables in the current scope as you step through the code.
- Evaluate Expressions in the console for on-the-fly inspection and debugging.
This project uses:
- Go for server-side logic and debugging protocols.
- Fiber as the web server for efficient, minimalistic API handling.
- WebSockets for real-time updates between client and server.
- Bootstrap and Font Awesome for UI styling.
- Vanilla JavaScript to manage the frontend interactions, including breakpoints and console evaluations.
Contributions are welcome! Please feel free to submit issues, feature requests, or pull requests.
- Persistent Breakpoints: Save and load breakpoints across sessions.
- Advanced Variable Inspection: Support for complex types and nested data structures.
- Enhanced Console Functionality: Auto-complete, syntax highlighting, and additional context options.
This project is licensed under the MIT License - see the LICENSE file for details.
- Fiber: For creating a powerful, minimalistic web framework for Go.
- Delve: For providing a robust debugging tool for Go developers.
- DAP: For defining a unified protocol for debuggers across languages and platforms.
Happy debugging!