From 18b458109931c26b0834b2d8d549bf6e105348dd Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Tue, 4 Jan 2022 09:28:33 -0800 Subject: [PATCH] Debugger: 2.9.1.8 Changed: Disassembly window now lists symbol labels and symbol target address from User2 in orange. --- docs/Debugger_Changelog.txt | 10 +++++++++- source/Debugger/Debug.cpp | 2 +- source/Debugger/Debugger_Disassembler.cpp | 6 +++--- source/Debugger/Debugger_Display.cpp | 16 +++++++++++++--- source/Debugger/Debugger_Types.h | 2 ++ 5 files changed, 28 insertions(+), 8 deletions(-) diff --git a/docs/Debugger_Changelog.txt b/docs/Debugger_Changelog.txt index 697d5945f..9e7785e26 100644 --- a/docs/Debugger_Changelog.txt +++ b/docs/Debugger_Changelog.txt @@ -1,6 +1,14 @@ /* -2.9.1.6 Added: Branch instructions now show target address +2.9.1.8 Changed: Disassembly window now lists symbol labels and symbol target address from User2 in orange. + Example: + U 300 + SYM @ = 303 + 300: 20 03 03 +2.9.1.7 Added: Extended SYM command to auto-generate symbol names when reverse engineering. NOTE: These symbols will be placed in User2. + Example: + SYM @ = 800 // Alias for: SYM _0800 = 0800 +2.9.1.6 Added: Branch instructions now show target address. 2.9.1.5 Added: Disassembly window now shows signed decimal values for immediate values. 2.9.1.4 Changed: Show symbol warnings in Orange, and length of symbols in light blue. 2.9.1.3 Added: DB commanoptionally supports = diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index 504ebc730..43a2ee11d 100644 --- a/source/Debugger/Debug.cpp +++ b/source/Debugger/Debug.cpp @@ -51,7 +51,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #define ALLOW_INPUT_LOWERCASE 1 // See /docs/Debugger_Changelog.txt for full details - const int DEBUGGER_VERSION = MAKE_VERSION(2,9,1,7); + const int DEBUGGER_VERSION = MAKE_VERSION(2,9,1,8); // Public _________________________________________________________________________________________ diff --git a/source/Debugger/Debugger_Disassembler.cpp b/source/Debugger/Debugger_Disassembler.cpp index 5f64f8897..0ee12f90e 100644 --- a/source/Debugger/Debugger_Disassembler.cpp +++ b/source/Debugger/Debugger_Disassembler.cpp @@ -275,7 +275,7 @@ int GetDisassemblyLine(WORD nBaseAddress, DisasmLine_t& line_) const char* pTarget = NULL; const char* pSymbol = 0; - pSymbol = FindSymbolFromAddress(nTarget); + pSymbol = FindSymbolFromAddress(nTarget, &line_.iTargetTable); // Data Assembler if (pData && (!pData->bSymbolLookup)) @@ -290,7 +290,7 @@ int GetDisassemblyLine(WORD nBaseAddress, DisasmLine_t& line_) if (!(bDisasmFormatFlags & DISASM_FORMAT_SYMBOL)) { - pSymbol = FindSymbolFromAddress(nTarget - 1); + pSymbol = FindSymbolFromAddress(nTarget - 1, &line_.iTargetTable); if (pSymbol) { bDisasmFormatFlags |= DISASM_FORMAT_SYMBOL; @@ -312,7 +312,7 @@ int GetDisassemblyLine(WORD nBaseAddress, DisasmLine_t& line_) // nSecondTarget = g_bDebugConfig_DisasmMatchSymbolOffsetMinus1First ? nTarget+1 : nTarget-1; if (!(bDisasmFormatFlags & DISASM_FORMAT_SYMBOL) || pData) { - pSymbol = FindSymbolFromAddress(nTarget + 1); + pSymbol = FindSymbolFromAddress(nTarget + 1,&line_.iTargetTable); if (pSymbol) { bDisasmFormatFlags |= DISASM_FORMAT_SYMBOL; diff --git a/source/Debugger/Debugger_Display.cpp b/source/Debugger/Debugger_Display.cpp index 80443f761..b4fcccffc 100644 --- a/source/Debugger/Debugger_Display.cpp +++ b/source/Debugger/Debugger_Display.cpp @@ -1330,7 +1330,9 @@ WORD DrawDisassemblyLine ( int iLine, const WORD nBaseAddress ) int iOpmode; int nOpbyte; DisasmLine_t line; - const char* pSymbol = FindSymbolFromAddress( nBaseAddress ); + + int iTable = NUM_SYMBOL_TABLES; + const char* pSymbol = FindSymbolFromAddress( nBaseAddress, &iTable ); const char* pMnemonic = NULL; // Data Disassembler @@ -1557,7 +1559,12 @@ WORD DrawDisassemblyLine ( int iLine, const WORD nBaseAddress ) if (pSymbol) { if (! bCursorLine) - DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_SYMBOL ) ); + { + if (iTable == SYMBOLS_USER_2) + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS ) ); // Show user symbols 2 in different color for organization when reverse engineering. Table 1 = known, Table 2 = unknown. + else + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_SYMBOL ) ); + } PrintTextCursorX( pSymbol, linerect ); } @@ -1606,7 +1613,10 @@ WORD DrawDisassemblyLine ( int iLine, const WORD nBaseAddress ) { if (bDisasmFormatFlags & DISASM_FORMAT_SYMBOL) { - DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_SYMBOL ) ); + if (line.iTargetTable == SYMBOLS_USER_2) + DebuggerSetColorFG( DebuggerGetColor( FG_INFO_ADDRESS ) ); // Show user symbols 2 in different color for organization when reverse engineering. Table 1 = known, Table 2 = unknown. + else + DebuggerSetColorFG( DebuggerGetColor( FG_DISASM_SYMBOL ) ); } else { diff --git a/source/Debugger/Debugger_Types.h b/source/Debugger/Debugger_Types.h index 2bf23b2be..f47459882 100644 --- a/source/Debugger/Debugger_Types.h +++ b/source/Debugger/Debugger_Types.h @@ -960,6 +960,8 @@ const DisasmData_t* pDisasmData; // If != NULL then bytes are marked up as data char sTargetValue [ CHARS_FOR_ADDRESS ]; // char sTargetAddress[ CHARS_FOR_ADDRESS ]; + int iTargetTable; // Which symbol table this appears in if any. See: SYMBOLS_USER_2, DrawDisassemblyLine(), GetDisassemblyLine(), FindSymbolFromAddress() + char sImmediateSignedDec[ 6 ]; // "-128" .. "+127" char sImmediate[ 4 ]; // 'c' char nImmediate;