惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The GitHub Blog
The GitHub Blog
J
Java Code Geeks
Engineering at Meta
Engineering at Meta
N
Netflix TechBlog - Medium
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
罗磊的独立博客
MongoDB | Blog
MongoDB | Blog
B
Blog RSS Feed
让小产品的独立变现更简单 - ezindie.com
让小产品的独立变现更简单 - ezindie.com
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
有赞技术团队
有赞技术团队
T
Tailwind CSS Blog
酷 壳 – CoolShell
酷 壳 – CoolShell
Vercel News
Vercel News
腾讯CDC
博客园 - 聂微东
The Cloudflare Blog
F
Fortinet All Blogs
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
V
Visual Studio Blog
Last Week in AI
Last Week in AI
B
Blog

Butler's Log

Figma agent vs. one button: shipping design tokens to npm Local Model Performance on an M5 Max GitButler 0.22 - "Catch 22" Agentic Version Control Benchmarks Grit: rewriting Git in Rust with agents Git Merge 2026 Agent-safe Git with GitButler We’ve raised $17M to build what comes after Git Announcing the GitButler CLI for Linux The Great CSS Expansion A couple of git nits Simplifying Git by Using GitButler Introducing the GitButler CLI GitButler 0.19 - "Commander Keen" But Head: Crafting a Custom Font MCP vs RAG: Two Very Different Ways to Gain Context Getting Started With GitButler Agents Using the GitButler MCP Server to Build Better AI-Driven Git Workflows Using GitButler With Multiple GitHub Accounts Advent of Code! Upcoming GitButler Events Use GitButler for your Gerrit workflow Integrating GitButler and GitHub Enterprise Butler Flow: shipping code faster (but less like Alfred, more like CI on steroids) - Part 3 Butler Flow: shipping code faster (but less like Alfred, more like CI on steroids) - Part 2 Butler Flow: shipping code faster (but less like Alfred, more like CI on steroids) - Part 1 Grid Happens: Because Flexbox Wasn’t Enough Using Cursor Hooks for automatic version control Deep Dive into the new Cursor Hooks A Responsive Item Counter with CSS only
Debugging Tauri in VS Code
Scott Chacon · 2023-12-05 · via Butler's Log

At GitButler, we're building our client in Tauri. Tauri is a framework for writing multi-platform GUI tools. It's similar to Electron and also uses HTML/JS/CSS for the frontend UI, but instead of Node on the backend it relies on Rust for filesystem access.

One of the challenges is in debugging the Rust code that we're running.

Most of us develop GitButler using VS Code, which has some integrated debugging capabilities, but not in a way that's necessarily easy to use with the Tauri binary that we're building. Since we couldn't find any good tutorials on this on the internets and recently got it working, we figured we would share our solution for anyone else out there running into this.

No more dbg!() for us!

Setting up VS Code and LLDB

We're using the LLDB debugger for our Rust debugging. To play along, you'll need the CodeLLDB (vadimcn.vscode-lldb) VS Code plugin and lldb installed (and in your PATH).

It's the best when the toolchain and version matches with whatever you're using to build (e.g. if you're using clang-15 or llvm-15, make sure it's lldb-15).

If you're on Linux and lldb doesn't work for some reason (e.g. you're under WSL, which notoriously hates lldb) GDB should work but is not 'officially' supported to run LLVM-based applications. Given this is Rust, everything is compiled via LLVM, so lldb is the 'go to' debugger.

You'll need to know the path to the binary that is actually being run - many projects have a few wrapper scripts and processes but you can only debug the actual Tauri process, which we don't invoke directly, and you may not be either.

For us, it's actually just target/debug/GitButler Dev. Debugging on Release mode is possible but you aren't going to get much usefulness out of it.

The script we used to verify which binary is actually being run this is (replace "GitButler Dev" with the title of the window you're observing):

SHELL

osascript -e 'on run argv
    set windowTitle to item 1 of argv
    tell application "System Events"
        set allProcesses to every process
        repeat with i from 1 to count allProcesses
            set thisProcess to item i of allProcesses
            if exists (window 1 of thisProcess) then
                repeat with j from 1 to count (windows of thisProcess)
                    set thisWindow to window j of thisProcess
                    if name of thisWindow is windowTitle then
                        return unix id of thisProcess
                    end if
                end repeat
            end if
        end repeat
    end tell
    return -1
end run' "GitButler Dev"

which returns the $PID, after which you can run ps aux | grep $PID to find the image name. That's what we need to run and debug.

The Tauri CLI for dev mode just spins up the local web server and then starts this process. So, if you're debugging, you need to start the web server (for example, with pnpm run dev) and let that sit in the background. Then you can run the Tauri app directly from VSCode's debugging system.

1. (One-time setup) Drop the launch.json file (found at the bottom of the post) into your /.vscode directory. If one is there already, merge the entries in the JSON array. 2. Start the web server in its own terminal window: pnpm run dev 3. Build the project (debugging from VSCode does NOT automatically build for you - if you forget to do this, your breakpoints and line numbers etc. will get messed up): pnpm run build:development 4. Start the debugger directly from VS Code: Run -> Start Debugging 5. If you've changed the Rust source at all, you'll have to go back to step 3.

Here is the launch.json

JS

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "lldb",
            "request": "launch",
            "name": "GitButler Dev",
            "program": "${workspaceFolder}/target/debug/GitButler Dev",
            "args": [],
            "cwd": "${workspaceFolder}"
        }
    ]
}

This now allows you to use the LLDB debugger directly from within VS Code to set breakpoints and otherwise debug the Rust portion of your Tauri app. 🎉

Scott Chacon

Written by Scott Chacon

Scott Chacon is a co-founder of GitHub and GitButler, where he builds innovative tools for modern version control. He has authored Pro Git and spoken globally on Git and software collaboration.