dbg-cli 0.3.1

A universal debugger CLI that lets AI agents observe runtime state instead of guessing from source code
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
//! Canonical debug command dispatcher.
//!
//! Recognizes a small, stable vocabulary (`break`, `step`, `next`,
//! `continue`, `finish`, `stack`, `frame`, `locals`, `print`, `watch`,
//! `threads`, `thread`, `list`, `run`, `breaks`, `unbreak`, `raw`,
//! `tool`) and routes each through the active backend's
//! `CanonicalOps`. Unknown input falls through so existing native-cmd
//! passthrough keeps working.

use super::Dispatched;
use crate::backend::{Backend, BreakId, BreakLoc, CanonicalOps, CanonicalReq};

/// Dispatch a user-facing canonical debug command. Unknown input
/// returns `Fallthrough` so the daemon can run the legacy passthrough
/// path.
pub fn dispatch_to(input: &str, backend: &dyn Backend) -> Dispatched {
    let input = input.trim();
    let (verb, rest) = split_verb(input);

    // `tool` is a meta-command that works even when the backend
    // doesn't expose CanonicalOps.
    if verb == "tool" {
        return Dispatched::Immediate(render_tool_info(backend));
    }

    // `raw <text>` is always available, even without CanonicalOps —
    // it's the escape hatch by design.
    if verb == "raw" {
        if rest.is_empty() {
            return Dispatched::Immediate(
                "usage: dbg raw <native-command>  (sends the rest of the line verbatim)".into(),
            );
        }
        return Dispatched::Native {
            canonical_op: "raw",
            native_cmd: rest.to_string(),
            decorate: false,
            structured: None,
        };
    }

    let ops = match backend.canonical_ops() {
        Some(o) => o,
        None => return Dispatched::Fallthrough,
    };

    match verb {
        "break" => dispatch_break(ops, rest),
        "unbreak" => dispatch_unbreak(ops, rest),
        "breaks" => one_arg_native(ops.op_breaks(), "breaks"),
        "run" => dispatch_run(ops, rest),
        "continue" => one_arg_native(ops.op_continue(), "continue"),
        // `step-into`, `step-in`, `stepi` are the spellings agents
        // reach for when they don't know a given backend's preferred
        // verb — all of them mean "step into the call at this
        // line", which is exactly what canonical `step` does.
        "step" | "step-into" | "step-in" | "stepi" => {
            one_arg_native(ops.op_step(), "step")
        }
        // `step-over` / `stepover` consistently mean "next" across
        // IDEs; route them accordingly so scenario instructions that
        // use the IDE spellings don't bounce off the dispatcher.
        "next" | "step-over" | "stepover" => {
            one_arg_native(ops.op_next(), "next")
        }
        "finish" | "step-out" | "stepout" => {
            one_arg_native(ops.op_finish(), "finish")
        }
        "pause" => one_arg_native(ops.op_pause(), "pause"),
        "restart" => one_arg_native(ops.op_restart(), "restart"),
        "stack" => dispatch_stack(ops, rest),
        "frame" => dispatch_frame(ops, rest),
        "locals" => dispatch_locals(ops),
        "print" => dispatch_print(ops, rest),
        "set" => dispatch_set(ops, rest),
        "watch" => dispatch_watch(ops, rest),
        "threads" => one_arg_native(ops.op_threads(), "threads"),
        "thread" => dispatch_thread(ops, rest),
        "list" => dispatch_list(ops, rest),
        "catch" => dispatch_catch(ops, rest),
        _ => Dispatched::Fallthrough,
    }
}

fn split_verb(s: &str) -> (&str, &str) {
    match s.find(|c: char| c.is_ascii_whitespace()) {
        Some(i) => (&s[..i], s[i..].trim_start()),
        None => (s, ""),
    }
}

/// Render `dbg tool`'s output — always works, even if the backend has
/// no CanonicalOps (we fall back to the raw backend name).
fn render_tool_info(backend: &dyn Backend) -> String {
    match backend.canonical_ops() {
        Some(ops) => {
            let ver = ops
                .tool_version()
                .unwrap_or_else(|| "(version unavailable)".into());
            format!(
                "tool: {tool}\nversion: {ver}\nbackend: {name}{desc}\nescape-hatch: `dbg raw <native-command>`",
                tool = ops.tool_name(),
                ver = ver,
                name = backend.name(),
                desc = backend.description(),
            )
        }
        None => format!(
            "tool: {name}\nversion: (not exposed via canonical ops)\nbackend: {name}{desc}\ncanonical ops not available for this backend — all commands go through raw passthrough.",
            name = backend.name(),
            desc = backend.description(),
        ),
    }
}

fn one_arg_native(
    cmd: anyhow::Result<String>,
    canonical_op: &'static str,
) -> Dispatched {
    match cmd {
        Ok(native_cmd) => Dispatched::Native {
            canonical_op,
            native_cmd,
            decorate: true,
            structured: None,
        },
        Err(e) => Dispatched::Immediate(format!("[error: {e}]")),
    }
}

fn dispatch_break(ops: &dyn CanonicalOps, rest: &str) -> Dispatched {
    if rest.is_empty() {
        return Dispatched::Immediate(
            "usage: dbg break <file:line | symbol | module!method> [if <cond>] [log <msg>]".into(),
        );
    }
    // Peel ` log <template>` first (templates can contain ` if ` text),
    // then an optional ` if <expr>`. The remainder is the location.
    let (head, log_msg) = match rest.find(" log ") {
        Some(i) => (&rest[..i], &rest[i + 5..]),
        None => (rest, ""),
    };
    let (loc_str, cond) = match head.find(" if ") {
        Some(i) => (&head[..i], &head[i + 4..]),
        None => (head, ""),
    };
    let loc = BreakLoc::parse(loc_str.trim());
    let cond_trim = cond.trim();
    let log_trim = log_msg.trim();
    let result = if !log_trim.is_empty() {
        // Logpoints take precedence: condition + logMessage both land
        // on the same native breakpoint in DAP, and the backend's
        // `op_break_log` is responsible for threading both through.
        // For now, if a caller combines `if` and `log`, we drop the
        // condition — agents wanting both should use `dbg raw`.
        ops.op_break_log(&loc, log_trim)
    } else if cond_trim.is_empty() {
        ops.op_break(&loc)
    } else {
        ops.op_break_conditional(&loc, cond_trim)
    };
    match result {
        Ok(cmd) => Dispatched::Native {
            canonical_op: "break",
            native_cmd: cmd,
            decorate: true,
            structured: Some(CanonicalReq::Break {
                loc,
                cond: if cond_trim.is_empty() { None } else { Some(cond_trim.to_string()) },
                log: if log_trim.is_empty() { None } else { Some(log_trim.to_string()) },
            }),
        },
        Err(e) => Dispatched::Immediate(format!("[error: {e}]")),
    }
}

fn dispatch_unbreak(ops: &dyn CanonicalOps, rest: &str) -> Dispatched {
    let id = match rest.parse::<u32>() {
        Ok(n) => BreakId(n),
        Err(_) => {
            return Dispatched::Immediate(
                "usage: dbg unbreak <id>  (id comes from `dbg breaks`)".into(),
            );
        }
    };
    one_arg_native(ops.op_unbreak(id), "unbreak")
}

fn dispatch_run(ops: &dyn CanonicalOps, rest: &str) -> Dispatched {
    let args: Vec<String> = if rest.is_empty() {
        vec![]
    } else {
        // Naive split: canonical run rarely needs quoted args; agents
        // wanting complex runtime argv should use `dbg raw`.
        rest.split_whitespace().map(str::to_string).collect()
    };
    one_arg_native(ops.op_run(&args), "run")
}

fn dispatch_stack(ops: &dyn CanonicalOps, rest: &str) -> Dispatched {
    let n = rest.parse::<u32>().ok();
    one_arg_native(ops.op_stack(n), "stack")
}

fn dispatch_frame(ops: &dyn CanonicalOps, rest: &str) -> Dispatched {
    let n = match rest.parse::<u32>() {
        Ok(n) => n,
        Err(_) => {
            return Dispatched::Immediate("usage: dbg frame <index>".into());
        }
    };
    one_arg_native(ops.op_frame(n), "frame")
}

fn dispatch_print(ops: &dyn CanonicalOps, rest: &str) -> Dispatched {
    if rest.is_empty() {
        return Dispatched::Immediate("usage: dbg print <expression>".into());
    }
    one_arg_native(ops.op_print(rest), "print")
}

fn dispatch_set(ops: &dyn CanonicalOps, rest: &str) -> Dispatched {
    // `dbg set <lhs> = <expr>`. Split on the first `=` so LHS may
    // contain dots, indexing, etc.
    let (lhs, rhs) = match rest.find('=') {
        Some(i) => (rest[..i].trim(), rest[i + 1..].trim()),
        None => return Dispatched::Immediate("usage: dbg set <lhs> = <expr>".into()),
    };
    if lhs.is_empty() || rhs.is_empty() {
        return Dispatched::Immediate("usage: dbg set <lhs> = <expr>".into());
    }
    one_arg_native(ops.op_set(lhs, rhs), "set")
}

/// `locals` is special: when a backend's CLI doesn't expose a bulk
/// "list all locals" verb (netcoredbg CLI, jdb in some states) the
/// previous behaviour surfaced `[error: bulk locals not supported …]`
/// which agents had to special-case. Instead, translate a capability
/// gap into a structured Ok result so callers can branch on it the
/// same way they do for any other `unsupported` flag, and reserve the
/// `[error: …]` path for genuine runtime failures.
fn dispatch_locals(ops: &dyn CanonicalOps) -> Dispatched {
    match ops.op_locals() {
        Ok(native_cmd) => Dispatched::Native {
            canonical_op: "locals",
            native_cmd,
            decorate: true,
            structured: None,
        },
        Err(e) => {
            let reason = e.to_string();
            // If the backend signalled "unsupported" (via the shared
            // `unsupported(...)` helper) return a structured JSON
            // result — otherwise the original error stands.
            if reason.contains("not supported by") || reason.contains("unsupported") {
                let payload = serde_json::json!({
                    "unsupported": true,
                    "op": "locals",
                    "reason": reason,
                });
                Dispatched::Immediate(payload.to_string())
            } else {
                Dispatched::Immediate(format!("[error: {reason}]"))
            }
        }
    }
}

fn dispatch_watch(ops: &dyn CanonicalOps, rest: &str) -> Dispatched {
    if rest.is_empty() {
        return Dispatched::Immediate("usage: dbg watch <expression>".into());
    }
    one_arg_native(ops.op_watch(rest), "watch")
}

fn dispatch_thread(ops: &dyn CanonicalOps, rest: &str) -> Dispatched {
    let n = match rest.parse::<u32>() {
        Ok(n) => n,
        Err(_) => {
            return Dispatched::Immediate("usage: dbg thread <index>".into());
        }
    };
    one_arg_native(ops.op_thread(n), "thread")
}

fn dispatch_list(ops: &dyn CanonicalOps, rest: &str) -> Dispatched {
    let loc = if rest.is_empty() { None } else { Some(rest) };
    one_arg_native(ops.op_list(loc), "list")
}

fn dispatch_catch(ops: &dyn CanonicalOps, rest: &str) -> Dispatched {
    // `dbg catch off` clears; otherwise tokens become filter names.
    let filters: Vec<String> = if rest.is_empty() || rest.trim() == "off" {
        vec![]
    } else {
        rest.split(|c: char| c.is_ascii_whitespace() || c == ',')
            .filter(|s| !s.is_empty())
            .map(str::to_string)
            .collect()
    };
    one_arg_native(ops.op_catch(&filters), "catch")
}

/// Given the canonical-op name the daemon stamped on the response,
/// run the backend's per-op postprocess hook and prepend a
/// `[via <tool> <version>]` header.
pub fn decorate_output_for_op(
    backend: &dyn Backend,
    canonical_op: &str,
    output: &str,
) -> String {
    let Some(ops) = backend.canonical_ops() else {
        return output.to_string();
    };
    let processed = ops.postprocess_output(canonical_op, output);
    let name = ops.tool_name();
    let header = match ops.tool_version() {
        Some(v) => format!("[via {name} {v}]\n"),
        None => format!("[via {name}]\n"),
    };
    format!("{header}{processed}")
}

#[cfg(test)]
mod tests {
    use super::*;
    use crate::backend::lldb::LldbBackend;
    use crate::backend::pdb::PdbBackend;
    use crate::backend::perf::PerfBackend;

    // ---------- canonical routing over lldb ----------

    fn lldb() -> LldbBackend { LldbBackend }

    fn native_of(d: Dispatched) -> (&'static str, String, bool) {
        match d {
            Dispatched::Native { canonical_op, native_cmd, decorate, .. } => {
                (canonical_op, native_cmd, decorate)
            }
            other => panic!("expected Native, got {:?}", describe(&other)),
        }
    }

    fn describe(d: &Dispatched) -> String {
        match d {
            Dispatched::Native { canonical_op, native_cmd, decorate, .. } => {
                format!("Native({canonical_op}, {native_cmd:?}, decorate={decorate})")
            }
            Dispatched::Immediate(s) => format!("Immediate({s:?})"),
            Dispatched::Query(q) => format!("Query({})", q.canonical_op()),
            Dispatched::Lifecycle(l) => format!("Lifecycle({})", l.canonical_op()),
            Dispatched::Fallthrough => "Fallthrough".into(),
        }
    }

    fn structured_of(d: Dispatched) -> Option<crate::backend::CanonicalReq> {
        match d {
            Dispatched::Native { structured, .. } => structured,
            other => panic!("expected Native, got {:?}", describe(&other)),
        }
    }

    #[test]
    fn break_carries_structured_req_plain() {
        use crate::backend::{BreakLoc, CanonicalReq};
        let d = dispatch_to("break app.go:10", &lldb());
        match structured_of(d) {
            Some(CanonicalReq::Break { loc, cond, log }) => {
                assert_eq!(loc, BreakLoc::FileLine { file: "app.go".into(), line: 10 });
                assert!(cond.is_none());
                assert!(log.is_none());
            }
            other => panic!("expected Break, got {other:?}"),
        }
    }

    #[test]
    fn break_carries_structured_req_with_cond_and_log() {
        use crate::backend::delve_proto::DelveProtoBackend;
        use crate::backend::{BreakLoc, CanonicalReq};
        let d = dispatch_to("break app.go:10 if x > 0", &DelveProtoBackend);
        match structured_of(d) {
            Some(CanonicalReq::Break { loc, cond, log }) => {
                assert_eq!(loc, BreakLoc::FileLine { file: "app.go".into(), line: 10 });
                assert_eq!(cond.as_deref(), Some("x > 0"));
                assert!(log.is_none());
            }
            other => panic!("expected Break, got {other:?}"),
        }

        let d = dispatch_to("break app.go:10 log hit {x}", &DelveProtoBackend);
        match structured_of(d) {
            Some(CanonicalReq::Break { loc, cond, log }) => {
                assert_eq!(loc, BreakLoc::FileLine { file: "app.go".into(), line: 10 });
                assert!(cond.is_none());
                assert_eq!(log.as_deref(), Some("hit {x}"));
            }
            other => panic!("expected Break, got {other:?}"),
        }
    }

    #[test]
    fn non_break_ops_have_no_structured_req() {
        assert!(structured_of(dispatch_to("continue", &lldb())).is_none());
        assert!(structured_of(dispatch_to("step", &lldb())).is_none());
    }

    #[test]
    fn break_file_line_routes_to_lldb_syntax() {
        let b = lldb();
        let d = dispatch_to("break src/foo.rs:42", &b);
        let (op, cmd, dec) = native_of(d);
        assert_eq!(op, "break");
        assert_eq!(cmd, "breakpoint set --file src/foo.rs --line 42");
        assert!(dec);
    }

    #[test]
    fn break_fqn_routes_by_name() {
        let d = dispatch_to("break main", &lldb());
        let (_, cmd, _) = native_of(d);
        assert_eq!(cmd, "breakpoint set --name main");
    }

    #[test]
    fn break_module_method_routes_via_shlib() {
        let d = dispatch_to("break libfoo.so!bar", &lldb());
        let (_, cmd, _) = native_of(d);
        assert_eq!(cmd, "breakpoint set --shlib libfoo.so --name bar");
    }

    #[test]
    fn exec_verbs_translate() {
        let b = lldb();
        for (verb, expected) in [
            ("continue", "process continue"),
            ("step", "thread step-in"),
            ("next", "thread step-over"),
            ("finish", "thread step-out"),
        ] {
            let (op, cmd, _) = native_of(dispatch_to(verb, &b));
            assert_eq!(op, verb);
            assert_eq!(cmd, expected, "{verb}");
        }
    }

    #[test]
    fn ide_style_step_aliases_route_to_canonical() {
        // Regression: adapter docs and scenario instructions used
        // IDE-standard spellings (`step-into`, `step-over`,
        // `step-out`) that bounced off the dispatcher as "unknown
        // command", forcing users to know each backend's native verb.
        let b = lldb();
        for (alias, canonical_op, expected_cmd) in [
            ("step-into", "step", "thread step-in"),
            ("step-in", "step", "thread step-in"),
            ("stepi", "step", "thread step-in"),
            ("step-over", "next", "thread step-over"),
            ("stepover", "next", "thread step-over"),
            ("step-out", "finish", "thread step-out"),
            ("stepout", "finish", "thread step-out"),
        ] {
            let (op, cmd, _) = native_of(dispatch_to(alias, &b));
            assert_eq!(op, canonical_op, "alias {alias} routed to wrong op");
            assert_eq!(cmd, expected_cmd, "alias {alias} produced wrong native cmd");
        }
    }

    #[test]
    fn stack_with_count_passes_arg() {
        let (_, cmd, _) = native_of(dispatch_to("stack 5", &lldb()));
        assert_eq!(cmd, "thread backtrace --count 5");
    }

    #[test]
    fn stack_without_count_plain() {
        let (_, cmd, _) = native_of(dispatch_to("stack", &lldb()));
        assert_eq!(cmd, "thread backtrace");
    }

    #[test]
    fn print_forwards_expression_verbatim() {
        let (_, cmd, _) = native_of(dispatch_to("print a + b * 2", &lldb()));
        assert_eq!(cmd, "expression -- a + b * 2");
    }

    #[test]
    fn unknown_verb_is_fallthrough() {
        match dispatch_to("breakpoint list", &lldb()) {
            Dispatched::Fallthrough => {}
            other => panic!("expected Fallthrough, got {}", describe(&other)),
        }
    }

    #[test]
    fn raw_passthrough_no_decoration() {
        let d = dispatch_to("raw breakpoint set --file main.c --line 1", &lldb());
        let (op, cmd, dec) = native_of(d);
        assert_eq!(op, "raw");
        assert_eq!(cmd, "breakpoint set --file main.c --line 1");
        assert!(!dec, "raw must not decorate");
    }

    #[test]
    fn raw_without_payload_is_usage_hint() {
        let d = dispatch_to("raw", &lldb());
        match d {
            Dispatched::Immediate(s) => assert!(s.contains("usage")),
            other => panic!("expected Immediate, got {}", describe(&other)),
        }
    }

    // ---------- error routing ----------

    #[test]
    fn watch_unsupported_on_pdb_is_immediate_error() {
        let d = dispatch_to("watch x", &PdbBackend);
        match d {
            Dispatched::Immediate(s) => {
                assert!(s.contains("pdb"));
                assert!(s.contains("watchpoints"));
                assert!(s.contains("dbg raw"));
            }
            other => panic!("expected Immediate error, got {}", describe(&other)),
        }
    }

    #[test]
    fn break_usage_hint_when_empty() {
        match dispatch_to("break", &lldb()) {
            Dispatched::Immediate(s) => assert!(s.contains("usage")),
            other => panic!("expected Immediate, got {}", describe(&other)),
        }
    }

    #[test]
    fn unbreak_rejects_non_numeric() {
        match dispatch_to("unbreak foo", &lldb()) {
            Dispatched::Immediate(s) => assert!(s.contains("usage")),
            other => panic!("expected Immediate, got {}", describe(&other)),
        }
    }

    #[test]
    fn frame_rejects_non_numeric() {
        match dispatch_to("frame foo", &lldb()) {
            Dispatched::Immediate(s) => assert!(s.contains("usage")),
            other => panic!("expected Immediate, got {}", describe(&other)),
        }
    }

    // ---------- meta commands ----------

    #[test]
    fn tool_works_on_backend_with_canonical_ops() {
        let d = dispatch_to("tool", &lldb());
        match d {
            Dispatched::Immediate(s) => {
                assert!(s.starts_with("tool: lldb"));
                assert!(s.contains("escape-hatch"));
                assert!(s.contains("dbg raw"));
            }
            other => panic!("expected Immediate, got {}", describe(&other)),
        }
    }

    #[test]
    fn tool_works_even_without_canonical_ops() {
        // perf is a profiler backend; it doesn't opt into CanonicalOps.
        let d = dispatch_to("tool", &PerfBackend);
        match d {
            Dispatched::Immediate(s) => {
                assert!(s.contains("perf"));
                assert!(s.contains("canonical ops not available"));
            }
            other => panic!("expected Immediate, got {}", describe(&other)),
        }
    }

    #[test]
    fn fallthrough_when_backend_has_no_canonical_ops() {
        // Any non-meta verb on perf should fall through to raw.
        match dispatch_to("continue", &PerfBackend) {
            Dispatched::Fallthrough => {}
            other => panic!("expected Fallthrough, got {}", describe(&other)),
        }
    }

    // ---------- decoration ----------

    #[test]
    fn decorate_prepends_via_header_when_ops_available() {
        let out = decorate_output_for_op(&lldb(), "", "hello\n");
        assert!(out.starts_with("[via lldb"));
        assert!(out.contains("\nhello\n"));
    }

    #[test]
    fn decorate_passthrough_on_backend_without_ops() {
        let out = decorate_output_for_op(&PerfBackend, "", "unchanged");
        assert_eq!(out, "unchanged");
    }

    // ---------- cross-backend wiring ----------

    #[test]
    fn pdb_break_routes_to_pdb_syntax() {
        let (_, cmd, _) = native_of(dispatch_to("break app.py:10", &PdbBackend));
        assert_eq!(cmd, "break app.py:10");
    }

    #[test]
    fn pdb_exec_verbs_match_pdb_vocabulary() {
        let b = PdbBackend;
        for (verb, expected) in [
            ("continue", "continue"),
            ("step", "step"),
            ("next", "next"),
            ("finish", "return"),
        ] {
            let (_, cmd, _) = native_of(dispatch_to(verb, &b));
            assert_eq!(cmd, expected);
        }
    }
}