This project implements a Debug Adapter Protocol (DAP) server for the Cairo programming language. The protocol is used to provide a common interface between debuggers and editors, with a single server it's possible to have debuggers for the most common editors (VS Code, Emacs, and Vim). The Cairo DAP server runs the Cairo program in a supervised runner that is controlled by the editor through the server. The server keeps track of the runner state and sends execution information to the editor. This information includes the current stack frame, the available scopes, and the variables values. Users can dynamically add and remove breakpoints during execution, the server supports both setting breakpoints by file and line location or by function name.

Cairo Debugger Adapter Protocol Support showcase

How it's made

This project is implemented in Python and uses the Cairo libraries provided by Starkware. The server uses CairoRunner to execute the Cairo program and to obtain information about it. The server is fully async and uses Python's asyncio. Thanks to the debugger adapter protocol we can use the debugger UI provided by VS Code to debug Cairo programs.

Technologies used