A standalone debugger for Kotlin/JVM programs
中文文档 • Features • Installation • Quick Start • VSCode Extension
- 🔍 Standalone Debugger - Works independently of IntelliJ IDEA
- 🎯 Breakpoint Management - Set, enable, disable, and conditional breakpoints
- 📚 Stack Frame Navigation - View and navigate call stacks
- 🔎 Variable Inspection - Inspect local variables and object properties
- 🧵 Thread Management - Switch between threads
- 💡 Expression Evaluation - Evaluate expressions at breakpoints
- 🔌 DAP Protocol Support - Integrates with VSCode and other DAP-compatible editors
- ⚡ Kotlin-Specific Features - Inline functions, lambdas, data classes support
- JDK 17 or higher
- Gradle 8.x (for building from source)
- Node.js 18+ (for VSCode extension development)
Download the latest release from GitHub Releases:
# Download and extract
wget https://github.com/schizobulia/kt-debugger/releases/latest/download/kotlin-debugger-all.jar
# Run the debugger
java -jar kotlin-debugger-all.jar# Clone the repository
git clone https://github.com/schizobulia/kt-debugger.git
cd kt-debugger
# Build the debugger
bash scripts/build.sh
# The JAR file will be at: build/libs/kotlin-debugger-1.0-SNAPSHOT-all.jarSee VSCode Extension section below.
# Basic debug mode (program waits for debugger)
java -agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=5005 -jar your-app.jar
# For Gradle projects
./gradlew run --debug-jvmUsing CLI:
java -jar kotlin-debugger-1.0-SNAPSHOT-all.jar
# In the debugger console:
(kdb) attach localhost:5005
(kdb) break Main.kt:10
(kdb) continueUsing VSCode:
- Install the Kotlin Debug extension
- Create
.vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "kotlin",
"request": "attach",
"name": "Attach to Kotlin",
"host": "localhost",
"port": 5005,
"sourcePaths": ["${workspaceFolder}/src/main/kotlin"]
}
]
}- Press
F5to start debugging
| Command | Alias | Description |
|---|---|---|
attach <host>:<port> |
- | Connect to remote JVM |
run <class> [-cp path] |
r |
Start program debugging |
quit |
q |
Exit debugger |
help |
h, ? |
Show help |
status |
- | Show session status |
| Command | Alias | Description |
|---|---|---|
break <file>:<line> |
b |
Set breakpoint |
break <file>:<line> if <cond> |
- | Set conditional breakpoint |
delete <id> |
d |
Delete breakpoint |
list |
l |
List all breakpoints |
enable <id> |
- | Enable breakpoint |
disable <id> |
- | Disable breakpoint |
| Command | Alias | Description |
|---|---|---|
continue |
c |
Resume execution |
step |
s |
Step into |
next |
n |
Step over |
finish |
f |
Step out |
| Command | Alias | Description |
|---|---|---|
backtrace |
bt, where |
Show call stack |
frame <n> |
fr |
Switch to frame n |
up / down |
- | Navigate frames |
locals |
- | Show local variables |
print <expr> |
p |
Print expression value |
| Command | Alias | Description |
|---|---|---|
threads |
- | List all threads |
thread <id> |
t |
Switch to thread |
The Kotlin Debug extension for VSCode provides a graphical debugging experience.
From VSCode Marketplace:
- Open VSCode
- Press
Ctrl+Shift+X(orCmd+Shift+Xon Mac) - Search for "Kotlin Debug"
- Click Install
From VSIX file:
# Build the extension
bash scripts/vscode-ext.sh build
# Install to VSCode
bash scripts/vscode-ext.sh install- Set breakpoints by clicking in the gutter
- View variables in the Variables panel
- Navigate call stacks
- Evaluate expressions in Debug Console
- Step through code with F10/F11
See VSCode Extension README for detailed usage.
kt-debug/
├── src/main/kotlin/ # Debugger core source code
├── src/test/kotlin/ # Unit tests
├── vscode-kotlin-debug/ # VSCode extension
├── scripts/
│ ├── build.sh # Main build script
│ └── vscode-ext.sh # VSCode extension build script
├── docs/ # Documentation
├── release/ # Release artifacts
└── test-program/ # Test programs
# Full build with tests
bash scripts/build.sh
# Skip tests
bash scripts/build.sh -s
# Build VSCode extension
bash scripts/vscode-ext.sh build./gradlew test- Fork the repository
- Create a feature branch
- Make your changes
- Run tests
- Submit a pull request
- Design Document - Architecture and design decisions
- Quick Reference - Command quick reference
- Tutorial - Step-by-step tutorial
- DAP Integration - DAP protocol implementation
MIT License - see LICENSE file for details.
- IntelliJ Community - Reference implementation
- java-debug - DAP protocol reference
- Kotlin - Kotlin compiler
Made with ❤️ for Kotlin developers