Dbgee - the Zero-Configuration Debuggee for Debuggers
Dbgee is a handy utility that allows you to launch CLI debuggers and VSCode debuggers from the debuggee side. Just start your program by a simple command in a terminal, and the debugger will automatically attach to it with zero configuration. Dbgee also has the ability to preconfigure your program to automatically start a debug session no matter how the program is started.
Dbgee is very useful especially when your program requires command line arguments or redirection, or when your program is launched by some script. In addition, Dbgee frees you from the hassle of writing launch.json
for VSCode.
Demos
The concept of Dbgee should be new and unfamiliar to you, so here are some demos to get you started.
Debug your program with zero configuration in Visual Studio Code
Configure your program to launch a debugger when it runs
Launch CUI debuggers in tmux
Supported languages and platforms
Languages
The current supported languages are C, C++, Rust, Go, Python and any languages which Gdb, LLDB, or CodeLLDB support.
Platforms
Currently only Linux (including WSL2 on Windows) is supported. However, adding macOS support is pretty easy and will be added soon if there are any macOS users. Please say hi to me in a GitHub issue.
Installation
There are two components, dbgee
command and the optional VSCode extension.
dbgee
command
curl -L -O https://github.com/nullpo-head/dbgee/releases/download/cli-v0.1.0/dbgee-linux-x64.tar.gz
tar xvf dbgee-linux-x64.tar.gz
mv dbgee /usr/local/bin/ # Or anywhere in the PATH
VSCode extension
Please install "Dbgee" extension from the marketplace.
Usage
Run and attach to your program
Use run
subcommand to launch your program and attach a proper debugger to it.
Launch a CLI debugger in a tmux window
By the following command, the proper debugger for your program launches in a new tmux window.
dbgee run -- ./program arg0 arg1 arg2...
You can manually specify your preferred debugger by the -d
option.
dbgee run -d lldb -- ./program arg0 arg1 arg2...
dbgee
launches a debugger in a new tmux window unless you run dbgee
in an integrated terminal in VSCode. However, you can choose other options by specifying -t
option. Please see the help for more information.
dbgee run -t tmuxw -- ./program arg0 arg1 arg2... # launch a debugger in a new tmux window instead of a window
Debug your program in VSCode
dbgee
launches the given debuggee and wait for VSCode to connect to your program if dbgee
is running in a VSCode's integrated terminal. Run the following command, and attach to your program in VSCode as the demo videos.
dbgee run -- ./program arg0 arg1 arg2...
Or, you can use -t vscode
option to explicitly make dbgee
wait for VSCode.
dbgee run -t vscode -- ./program arg0 arg1 arg2...
Automatically attach a debugger when your program is launched
set
subcommand will automatically attach a debugger to your program, no matter by what means it is started. This is a very useful feature when your program is launched by some start up scripts in your development flow. However, please note that set
command doesn't work if you rebuild your program after you run set
, or when your start up scripts incur rebuild, because set
command works by replacing your program with a wrapper script.
dbgee set ./program
./program arg0 arg1 arg2 # your program is launched, being attached by the debugger
Use unset
command to stop the debugger from attaching automatically
dbgee unset ./program
If you specify some to launch your program, dbgee
automatically runs unset
after your command finishes.
dbgee set ./program -- ./some_startup_script