From bce211bcaac9c735a1c3c2249318d8ce33ce6c8e Mon Sep 17 00:00:00 2001 From: Kingcom Date: Tue, 30 Jul 2013 22:26:52 +0200 Subject: [PATCH] -check for invalid memory access when creating status bar text -when displaying word access, show a label if it exists --- Windows/Debugger/CtrlDisAsmView.cpp | 34 ++++++++++++++++++++--------- 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/Windows/Debugger/CtrlDisAsmView.cpp b/Windows/Debugger/CtrlDisAsmView.cpp index 9d305e5f02..45539ef2ef 100644 --- a/Windows/Debugger/CtrlDisAsmView.cpp +++ b/Windows/Debugger/CtrlDisAsmView.cpp @@ -834,17 +834,31 @@ void CtrlDisAsmView::updateStatusBarText() text[0] = 0; if (info.isDataAccess) { - switch (info.dataSize) + if (!Memory::IsValidAddress(info.dataAddress)) { - case 1: - sprintf(text,"[%08X] = %02X",info.dataAddress,Memory::Read_U8(info.dataAddress)); - break; - case 2: - sprintf(text,"[%08X] = %04X",info.dataAddress,Memory::Read_U16(info.dataAddress)); - break; - case 4: - sprintf(text,"[%08X] = %08X",info.dataAddress,Memory::Read_U32(info.dataAddress)); - break; + sprintf(text,"Invalid address %08X",info.dataAddress); + } else { + switch (info.dataSize) + { + case 1: + sprintf(text,"[%08X] = %02X",info.dataAddress,Memory::Read_U8(info.dataAddress)); + break; + case 2: + sprintf(text,"[%08X] = %04X",info.dataAddress,Memory::Read_U16(info.dataAddress)); + break; + case 4: + { + u32 data = Memory::Read_U32(info.dataAddress); + const char* addressSymbol = debugger->findSymbolForAddress(data); + if (addressSymbol) + { + sprintf(text,"[%08X] = %s (%08X)",info.dataAddress,addressSymbol,data); + } else { + sprintf(text,"[%08X] = %08X",info.dataAddress,data); + } + break; + } + } } }