Tests single-stepping. Tests against `debugger_debuggee_simple.wat`.
(d: &Debuggee)
| 58 | /// |
| 59 | /// Tests against `debugger_debuggee_simple.wat`. |
| 60 | fn 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 |