This repository was archived by the owner on Dec 2, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change 123123//! ```
124124//! Output and monitoring proceed as in the above example.
125125//!
126+ //! ## The `dbg!` macro
127+ //!
128+ //! Analogous to [`std::dbg`](https://doc.rust-lang.org/std/macro.dbg.html) the macro
129+ //! `dbg!` returns a given expression and prints it using `heprintln!` including context
130+ //! for quick and dirty debugging.
131+ //!
132+ //! Example:
133+ //!
134+ //! ```
135+ //! const UUID: *mut u32 = 0x0009_FC70 as *mut u32;
136+ //! dbg!(UUID);
137+ //! let mut uuid: [u32; 4] = [0; 4];
138+ //! for i in 0..4 {
139+ //! dbg!(i);
140+ //! uuid[i] = unsafe { dbg!(UUID.offset(i as isize).read_volatile()) }; }
141+ //! }
142+ //! ```
143+ //! outputs
144+ //! ```
145+ //! [examples/semihosting.rs:37] UUID = 0x0009fc70
146+ //! [examples/semihosting.rs:40] i = 0
147+ //! [examples/semihosting.rs:41] UUID.offset(i as isize).read_volatile() = 3370045464
148+ //! [examples/semihosting.rs:40] i = 1
149+ //! [examples/semihosting.rs:41] UUID.offset(i as isize).read_volatile() = 1426218275
150+ //! [examples/semihosting.rs:40] i = 2
151+ //! [examples/semihosting.rs:41] UUID.offset(i as isize).read_volatile() = 2422621116
152+ //! [examples/semihosting.rs:40] i = 3
153+ //! [examples/semihosting.rs:41] UUID.offset(i as isize).read_volatile() = 1044138593
154+ //! ```
155+ //!
126156//! # Optional features
127157//!
128158//! ## `inline-asm`
You can’t perform that action at this time.
0 commit comments