Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,15 @@ The project is structured into several core modules, each with dedicated respons

### 2. `debugger`
- **Responsibility**: The heart of the debugger. Orchestrates the debugging session.
- **Key Components**:
- **Key Components**:
- `DebuggerEngine`: Coordinates between the executor, breakpoint manager, and debug state.
- `BreakpointManager`: Manages set breakpoints and evaluates if execution should pause.
- `DebugState`: Maintains the current state of the debugging session (e.g., current function, pause status).
- `Stepper`: (Planned) Logic for stepping through instructions.

### 3. `runtime`
- **Responsibility**: Manages the execution environment for Soroban contracts.
- **Key Components**:
- **Key Components**:
- `ContractExecutor`: Uses `soroban-env-host` to register and invoke contracts in a test environment.
- **Function**: Executes WASM bytecode and provides access to the underlying `Host` for inspection.

Expand Down
4 changes: 2 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -575,10 +575,10 @@ show_events = true

The CLI supports **screen-reader compatible** and **low-complexity** output so that all information is conveyed via text, not only color or Unicode symbols.

- **`NO_COLOR`**
- **`NO_COLOR`**
If the `NO_COLOR` environment variable is set and not empty, the debugger disables all ANSI color output. Status is then shown with text labels (e.g. `[PASS]`, `[FAIL]`, `[INFO]`, `[WARN]`) instead of colored text.

- **`--no-unicode`**
- **`--no-unicode`**
Use ASCII-only output: no Unicode box-drawing characters (e.g. `┌`, `─`, `│`) or symbols. Box-drawing is replaced with `+`, `-`, `|`; bullets and arrows use `*` and `>`. Spinners are replaced with static text such as `[WORKING...]`.

**Example (screen reader friendly):**
Expand Down
2 changes: 1 addition & 1 deletion docs/faq.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This page covers common questions, confusing behaviors, and troubleshooting tips

### 1. `cargo install` fails with "linker 'cc' not found"
**Cause:** Your system lacks the necessary build tools (C compiler and linker) required to compile Rust dependencies.
**Fix:**
**Fix:**
- **Windows:** Install [Visual Studio Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) and select the "Desktop development with C++" workload.
- **Linux:** Install `build-essential` (Ubuntu/Debian) or `base-devel` (Arch).
- **macOS:** Run `xcode-select --install`.
Expand Down
2 changes: 1 addition & 1 deletion docs/instruction-stepping.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,4 +298,4 @@ cargo test --test instruction_stepping_tests
3. **Memory Watches**: Track memory changes during execution
4. **Gas/Budget Analysis**: Correlate instructions with resource usage

This instruction-level stepping feature provides a powerful foundation for detailed contract debugging and analysis, enabling developers to understand their code at the most granular level possible.
This instruction-level stepping feature provides a powerful foundation for detailed contract debugging and analysis, enabling developers to understand their code at the most granular level possible.
2 changes: 1 addition & 1 deletion docs/plugin-api.md
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ impl InspectorPlugin for JsonFormatter {
The plugin API follows semantic versioning:

- **Major version changes**: Breaking API changes
- **Minor version changes**: New features, backward compatible
- **Minor version changes**: New features, backward compatible
- **Patch version changes**: Bug fixes, backward compatible

Check `min_debugger_version` in your manifest to specify the minimum required debugger version.
Expand Down
10 changes: 5 additions & 5 deletions docs/remote-debugging.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ The Soroban Debugger supports remote debugging, allowing you to debug smart cont
The remote debugging feature consists of three main components:

1. **Debug Server** - Runs on the remote system, hosts the contract execution environment
2. **Remote Client** - Connects from your local machine to issue debug commands
2. **Remote Client** - Connects from your local machine to issue debug commands
3. **Wire Protocol** - JSON-over-TCP communication protocol for debug operations

## Quick Start
Expand Down Expand Up @@ -72,7 +72,7 @@ Token-based authentication prevents unauthorized access:
# Server with token
soroban-debug server --port 9229 --token "your-secret-token-here"

# Client provides matching token
# Client provides matching token
soroban-debug remote --remote host:9229 --token "your-secret-token-here"
```

Expand Down Expand Up @@ -103,7 +103,7 @@ The debug protocol uses JSON messages over TCP with line-delimited encoding.
```json
{
"id": 1,
"request": { ... }
"request": { ... }
}
```

Expand Down Expand Up @@ -280,7 +280,7 @@ Multiple developers can connect to the same debug server:
# Team member starts server
soroban-debug server --port 9229 --token team-debug-session

# Other team members connect
# Other team members connect
soroban-debug remote --remote team-lead-ip:9229 --token team-debug-session
```

Expand Down Expand Up @@ -321,7 +321,7 @@ telnet host 9229
- Check for whitespace in token strings
- Ensure token was properly set when starting server

### TLS Handshake Errors
### TLS Handshake Errors
- Verify certificate and key paths are correct
- Check certificate hasn't expired
- Ensure client trusts the certificate (or use self-signed for testing)
Expand Down
14 changes: 7 additions & 7 deletions docs/tutorials/first-debug.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ This tutorial will take you from zero to successfully debugging a Soroban smart

## 1. Installing the Debugger

To step through Soroban WebAssembly (WASM) execution, you need the Soroban debugger.
To step through Soroban WebAssembly (WASM) execution, you need the Soroban debugger.

Install it via Cargo by running the following command in your terminal:

Expand All @@ -32,7 +32,7 @@ soroban-debugger 1.0.0

## 2. Creating a Small Contract

Let's create a simple counter contract to debug.
Let's create a simple counter contract to debug.

First, initialize a new Soroban project:

Expand All @@ -57,10 +57,10 @@ impl CounterContract {
pub fn increment(env: Env) -> u32 {
// Breakpoint target 1
let mut count: u32 = env.storage().instance().get(&COUNTER).unwrap_or(0);

// Breakpoint target 2
count += 1;

env.storage().instance().set(&COUNTER, &count);
count
}
Expand Down Expand Up @@ -99,7 +99,7 @@ soroban-debugger target/wasm32-unknown-unknown/release/hello_world.wasm
```text
Loading WASM module...
Debug symbols loaded successfully.
(soroban-debug)
(soroban-debug)
```

You are now in the interactive debugging prompt. Type `help` to see all available basic debugger commands (`run`, `step`, `next`, `break`, `print`, `storage`).
Expand Down Expand Up @@ -192,7 +192,7 @@ Type `continue` (or `c`) to let the function finish executing.

*Expected Output:*
```text
Execution completed.
Execution completed.
Return value: U32(1)
```

Expand All @@ -213,7 +213,7 @@ Return value: U32(1)
## Implementation Notes

* **WASM DWARF:** This debugger relies on DWARF debugging data embedded inside custom sections of the WebAssembly binary. Stripping your WASM for mainnet deployment using tools like `wasm-opt` will remove these sections. Always debug against unstripped development builds.
* **Host Environment:** The debugger runs a mock Soroban environment. State does not persist between `soroban-debugger` CLI sessions unless you export the ledger state to a JSON file.
* **Host Environment:** The debugger runs a mock Soroban environment. State does not persist between `soroban-debugger` CLI sessions unless you export the ledger state to a JSON file.

---
*Return to the [Docs Index](../../README.md) for more tutorials.*
6 changes: 3 additions & 3 deletions examples/contracts/dex/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ soroban contract invoke --id <CONTRACT_ID> -- swap --token_in true --amount_in 1
```

4. **Inspect storage during debugging**:
- **Before swap**:
- **Before swap**:
- `ReserveA`: 1000
- `ReserveB`: 2000
- **Calculation**:
- **Calculation**:
- `reserve_in`: 1000, `reserve_out`: 2000
- `amount_out = (2000 * 100) / (1000 + 100) = 181`
- **After swap**:
Expand Down Expand Up @@ -110,7 +110,7 @@ soroban contract invoke --id <CONTRACT_ID> -- swap --token_in true --amount_in 5
# Check reserves
soroban contract invoke --id <CONTRACT_ID> -- get_price --token_in true

# Swap 2: B → A
# Swap 2: B → A
soroban contract invoke --id <CONTRACT_ID> -- swap --token_in false --amount_in 100

# Observe reserve changes in both directions
Expand Down
2 changes: 1 addition & 1 deletion examples/contracts/staking/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,4 @@ A `reward_rate` of `10` means 0.10% per second. Adjust at `initialize` time.
## Running Tests
```bash
cargo test
```
```
16 changes: 8 additions & 8 deletions extensions/vscode/src/dap/adapter.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import {
DebugSession,
InitializedEvent,
BreakpointEvent,
StoppedEvent,
import {
DebugSession,
InitializedEvent,
BreakpointEvent,
StoppedEvent,
ExitedEvent,
LogOutputEvent,
EventEmitter
Expand Down Expand Up @@ -77,7 +77,7 @@ export class SorobanDebugSession extends DebugSession {
const source = args.source.path || args.source.name || '';
const breakpoints = args.breakpoints || [];

this.state.breakpoints.set(source,
this.state.breakpoints.set(source,
breakpoints.map((bp, idx) => ({
source,
line: bp.line,
Expand Down Expand Up @@ -221,9 +221,9 @@ export class SorobanDebugSession extends DebugSession {

const stdout = this.debuggerProcess.getOutputStream();
if (stdout) {
this.rl = readline.createInterface({
this.rl = readline.createInterface({
input: stdout,
crlfDelay: Infinity
crlfDelay: Infinity
});

this.rl.on('line', (line: string) => {
Expand Down
2 changes: 1 addition & 1 deletion extensions/vscode/src/debug/adapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { SorobanDebugSession } from '../dap/adapter';

export class SorobanDebugAdapterDescriptorFactory
implements vscode.DebugAdapterDescriptorFactory, vscode.Disposable {

private context: vscode.ExtensionContext;
private session: SorobanDebugSession | null = null;

Expand Down