DSH Plugin: C++ Trace Studio – C++ Step-by-Step Visualizer in DeepSeek Harness

Introduction

When agents invoke local C++ programs, the debugging experience typically remains limited to breakpoints and printf: breakpoints can only pause execution at fixed locations, and printf can only print the current value. Once a program encounters an error within a loop or complex logic, it becomes difficult to trace which line of code executed, how variables changed, or where the control flow went. This information gap makes it hard for agents to precisely locate issues when working with C++ code.

C++ Trace Studio is a DeepSeek Harness plugin that visualizes the execution of C++ programs through real GDB execution traces: the left pane displays source code, the right pane shows variables and data structures, and the bottom provides a replayable timeline. The plugin records every executed source line and displays, at each step, variable changes, condition evaluation results, the call stack, and structured data.

Plugin Overview

  • Name: kalkmilchkatze/dsh-cpp-demo (C++ Trace Studio)
  • Maintainer: kalkmilchkatze
  • Category: Client
  • License: MIT
  • Version: 0.2.0

The plugin is built around the concept of “real execution”: it compiles with g++ -O0 -g3 and uses GDB to record each execution step via the MinGW-w64 toolchain on Windows, rather than relying on a simulated interpreter. All traces are saved locally in trace.json, and the client replays them offline with no external dependencies required.

Core Features

Line-by-Line Execution Tracing

The plugin sets breakpoints on every line of user code and records each execution step. The current line is highlighted in the source view, and previously executed lines leave a visual trail. This solves the problem of traditional debuggers that can only pause at breakpoints and cannot fully replay the execution flow.

Variable Diff View

Each step displays the before/after values of variables in the current stack frame, with support for nested structures. For example, a diff view like sum: 0 -> 3 allows agents to intuitively see which line modified which variable.

Structured Data Rendering

The plugin can render various C++ data structures: arrays, std::vector, std::string, structs, pointers, and libstdc++ pretty printers. These values are presented in a structured format rather than raw text, making it easier for agents to understand complex data.

Conditions and Control Flow

Conditional expressions such as if, while, and for are evaluated at each step, with results displayed in the UI. The call stack is updated on function calls and returns, showing function names and line numbers.

Timeline Playback

The bottom timeline supports play, pause, step forward, step backward, and keyboard arrow key controls. This allows agents to replay the entire execution process at a controlled pace.

Flow & Output Views

  • Flow: Displays the recent execution path and the hit count for each line of code.
  • Output: Shows the program’s stdout and trace error messages.

Dual Entry Points

  • Sidebar Panel: Designed for human users, providing a visual interactive interface.
  • cpp_trace tool: Designed for agents, invoking the same tracing engine via API.

Installation & Activation

The plugin requires Windows 10/11, DeepSeek Harness desktop (with a profile), Node.js 20+, and MinGW-w64 (including G++ and GDB). The installation process does not depend on any third-party runtimes; it uses install.mjs to copy runtime files into the profile directory and register the plugin.

Installation steps:

git clone https://github.com/kalkmilchkatze/dsh-cpp-demo.git
cd dsh-cpp-demo
node install.mjs

install.mjs copies the runtime files to %USERPROFILE%\.dsh\profiles\<profile>\node_modules\dsh-cpp-demo, backs up package.json, and adds the plugin to the profile configuration. After installation, you must completely quit and restart DeepSeek Harness, and a “Demo” entry will appear in the sidebar.

Uninstall:

node install.mjs --uninstall

Compiler Path Configuration

The plugin automatically detects g++.exe and gdb.exe in the following paths:

  1. The CPP_TRACE_MINGW environment variable
  2. E:\devtools\mingw64\bin
  3. C:\msys64\mingw64\bin
  4. C:\mingw64\bin
  5. C:\Program Files\mingw64\bin

If your toolchain is located elsewhere, you can set the environment variable:

$env:CPP_TRACE_MINGW = 'D:\tools\mingw64\bin'

Typical Usage

Using the Sidebar Panel

  1. Click “Demo” in the left sidebar of DeepSeek Harness.
  2. Paste C++17 code (a sample is provided and ready to run), or switch to “File Path” mode and enter an absolute .cpp path.
  3. Optionally fill in stdin (the program cannot read keyboard input during recording).
  4. Click “Start Recording”.
  5. Use the timeline, arrow keys, or playback buttons to control the replay.

The panel contains three tabs:

  • Data: Displays the variable diff, condition results, call stack, and variable details for the current step.
  • Flow: Shows the recent execution path and line hit counts.
  • Output: Displays stdout and trace errors.

The cpp_trace Tool

Agents can invoke the same engine through the cpp_trace tool:

cpp_trace(path="E:/path/to/main.cpp", max_steps=20000)
cpp_trace(code="int main(){int a=1; a+=2; return a;}", stdin="")

The tool returns an execution summary and a trace_path. The trace file is self-contained, including source_text and stdout.

Use Cases & Notes

Use Cases

  • Agents need to debug or understand the execution logic of local C++ programs.
  • Visualization of variable changes, data structures, and call stacks is required.
  • The entire execution process needs to be replayed at a controlled speed.

Caveats

  • The plugin runs under the current DSH process permissions and compiles and executes arbitrary local C++ code. This is expected behavior; use it only with trusted code.
  • The plugin currently only supports Windows and requires the MinGW-w64 toolchain.
  • Tracing relies on GDB’s libstdc++ pretty printers; expansion of STL containers depends on this feature.
  • The plugin does not support advanced features such as threads, multi-file projects, or template metaprogramming.
  • The step limit for a single recording is 50,000; longer programs will be truncated.
  • The plugin communicates with the UI via a local HTTP route. The route is local and same-origin—do not expose the DSH port to untrusted networks.

Security Notice

The plugin achieves its functionality by compiling and executing local C++ code. It is recommended to review the source code and the LICENSE file before installation to confirm that its behavior meets your security requirements.

Summary

C++ Trace Studio integrates GDB’s execution tracing capabilities into DeepSeek Harness, providing agents with a visualized approach to C++ debugging. Through line-by-line tracing, variable diff views, structured data rendering, and timeline playback, it helps agents understand the execution process of C++ programs more intuitively.

Plugin directory page: https://www.skillhub.cn/plugins/kalkmilchkatze/dsh-cpp-demo
GitHub repository: https://github.com/kalkmilchkatze/dsh-cpp-demo

羽毛球分组比赛记分
小程序二维码

欢迎使用《羽毛球分组比赛记分》微信小程序

Xiaoye