• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

henrythasler / rust-tiny-wasm / 23683716461

28 Mar 2026 10:55AM UTC coverage: 95.115% (-0.3%) from 95.372%
23683716461

push

github

henrythasler
add breakpoint before calling a JIT function

10 of 13 new or added lines in 2 files covered. (76.92%)

954 of 1003 relevant lines covered (95.11%)

23.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

57.14
/src/runtime/debugger.rs
1
/// This function is used to trigger a breakpoint for debugging purposes.
2
///
3
/// It uses architecture-specific assembly instructions to cause a trap if the `QEMU_DEBUG` environment variable is set, allowing developers to inspect the state of the program at that point.
4
///
5
/// # Notes
6
/// - On x86_64, it uses the `int3` instruction, which is a software breakpoint interrupt.
7
/// - On aarch64, it uses the `brk #0` instruction, which is a breakpoint instruction that causes a trap to the debugger.
8
///
9
/// # Important
10
///
11
/// `set $pc = $pc + 4` must be used to skip the breakpoint instruction itself when resuming execution after hitting the breakpoint.
12
///
13
/// # Example
14
///
15
/// ```bash
16
/// QEMU_DEBUG=1 qemu-aarch64 -L /usr/aarch64-linux-gnu/ -g 1234 target/aarch64-unknown-linux-gnu/debug/tiny-wasm
17
/// ```
18
#[inline(always)]
19
pub fn set_breakpoint() {
16✔
20
    // check for environment variable to determine if we should trigger a breakpoint
21
    if std::env::var_os("QEMU_DEBUG").is_some() {
16✔
22
        #[cfg(target_arch = "x86_64")]
23
        unsafe {
24
            std::arch::asm!("int3");
25
        }
26

27
        #[cfg(target_arch = "aarch64")]
NEW
28
        unsafe {
×
NEW
29
            std::arch::asm!("brk #0");
×
NEW
30
        }
×
31
    }
16✔
32
}
16✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc