From 8efe2561a99660147871a688bc02e4bb4c6cde60 Mon Sep 17 00:00:00 2001 From: Ben Bridle Date: Thu, 31 Oct 2024 11:16:20 +1300 Subject: Show memory address on SYM line in emulator debug output The memory address of the most recent symbol is now displayed next to the name of that symbol in the emulator debug output, to make it easier to see how close the program counter is to that symbol. The source location of that symbol is now also shown as dimmed to make it less distracting. --- src/debug.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/debug.rs b/src/debug.rs index 1593d9d..d7e7f67 100644 --- a/src/debug.rs +++ b/src/debug.rs @@ -5,6 +5,7 @@ use std::time::Instant; const NORMAL: &str = "\x1b[0m"; +const DIM: &str = "\x1b[2m"; const YELLOW: &str = "\x1b[33m"; const BLUE: &str = "\x1b[34m"; @@ -44,8 +45,8 @@ impl DebugState { debug_stack(&core.rst, 0x10); // Print information about the current symbol. if let Some(symbol) = self.symbols.for_address(core.mem.pc) { - eprint!("SYM: {BLUE}@{}{NORMAL}", symbol.name); - if let Some(location) = &symbol.location { eprint!(" {location}"); } + eprint!("SYM: {BLUE}@{}{NORMAL} 0x{:04x}", symbol.name, symbol.address); + if let Some(location) = &symbol.location { eprint!(" {DIM}{location}{NORMAL}"); } eprintln!(); } self.last_cycle = core.cycle; -- cgit v1.2.3-70-g09d2