MCPcopy Create free account
hub / github.com/bytecodealliance/wasmtime / test_simple

Function test_simple

crates/test-programs/src/bin/debugger_component.rs:60–84  ·  view source on GitHub ↗

Tests single-stepping. Tests against `debugger_debuggee_simple.wat`.

(d: &Debuggee)

Source from the content-addressed store, hash-verified

58///
59/// Tests against `debugger_debuggee_simple.wat`.
60fn test_simple(d: &Debuggee) {
61 // Step once to reach the first instruction.
62 let r = Resumption::single_step(d);
63 let _event = r.result(d).unwrap();
64
65 let mut pcs = vec![];
66
67 for _ in 0..5 {
68 let frames = d.exit_frames();
69 let pc = frames[0].get_pc(d).unwrap();
70 pcs.push(pc);
71
72 let r = Resumption::single_step(d);
73 match r.result(d).unwrap() {
74 Event::Breakpoint => {}
75 other => panic!("unexpected event: {other:?}"),
76 }
77 }
78
79 // There should be five PCs and they should each be distinct from the previous.
80 assert_eq!(pcs.len(), 5);
81 assert!(pcs.array_windows().all(|[a, b]| a != b));
82
83 eprintln!("OK");
84}
85
86/// Interrupt test: continue an infinite-loop debuggee, interrupt it,
87/// verify the interrupt, then set the exit flag in memory and continue

Callers 1

debugMethod · 0.70

Calls 5

get_pcMethod · 0.80
unwrapMethod · 0.45
resultMethod · 0.45
exit_framesMethod · 0.45
pushMethod · 0.45

Tested by

no test coverage detected