debug/lib.rs
1// Copyright 2026 The Fuchsia Authors
2//
3// Use of this source code is governed by a MIT-style
4// license that can be found in the LICENSE file or at
5// https://opensource.org/licenses/MIT
6
7#![cfg_attr(not(test), no_std)]
8
9#[cfg(test)]
10use kprint as _;
11
12// For use in `kernel_oops!`.
13#[doc(hidden)]
14pub use kprint::kprint as __kprint;
15
16pub mod dprintf;
17pub mod ltrace;
18
19/// A [`kprint`]-like macro which prepend's the user's message with the special
20/// "ZIRCON KERNEL OOPS" tag. Automated builds look for tags like this and
21/// consider their presence to indicate test failures, even if the higher level
22/// test framework code thinks the test passed.
23///
24/// A kernel OOPS indicates the presence of a bug, however, the bug may not be
25/// in the kernel itself.
26///
27/// # Examples
28/// ```rust
29/// kernel_oops!("value {} is out of range", val);
30/// ```
31#[macro_export]
32macro_rules! kernel_oops {
33 ($fmt:literal, $($arg:tt)*) => {
34 $crate::__kprint!(concat!("\nZIRCON KERNEL OOPS\n", $fmt), $($arg)*)
35 };
36}