message: Macros: Add dbg
diff: @@ -26,6 +26,34 @@ macro_rules! println {
  ($($arg:tt)+) => (print!("{}\n", ::core::format_args!($($arg)+)));
  }
  +/// Prints and returns the value of a given expression for quick and dirty
  +/// debugging.
  +// Copied from std/macros.rs
  +#[macro_export]
  +macro_rules! dbg {
  + // NOTE: We cannot use `concat!` to make a static string as a format argument
  + // of `eprintln!` because `file!` could contain a `{` or
  + // `$val` expression could be a block (`{ .. }`), in which case the `eprintln!`
  + // will be malformed.
  + () => {
  + $crate::println!("[{}:{}]", ::core::file!(), ::core::line!())
  + };
  + ($val:expr $(,)?) => {
  + // Use of `match` here is intentional because it affects the lifetimes
  + // of temporaries - https://stackoverflow.com/a/48732525/1063961
  + match $val {
  + tmp => {
  + $crate::println!("[{}:{}] {} = {:#?}",
  + ::core::file!(), ::core::line!(), ::core::stringify!($val), &tmp);
  + tmp
  + }
  + }
  + };
  + ($($val:expr),+ $(,)?) => {
  + ($($crate::dbg!($val)),+,)
  + };
  +}
  +
  /// Runs `f` on the kernel stack.
  ///
  /// All arguments and return values have to fit into registers:
  