From 17686df3df49b2ff3ca93f24ec317a7fbee27f2f Mon Sep 17 00:00:00 2001 From: michaelangel007 Date: Tue, 4 Jan 2022 09:25:51 -0800 Subject: [PATCH] Debugger: 2.9.1.7 Added: Extended SYM command to auto-generate symbol names when reverse engineering. NOTE: These symbols will be placed in User2. --- source/Debugger/Debug.cpp | 2 +- source/Debugger/Debugger_Symbols.cpp | 32 ++++++++++++++++++++++------ 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/source/Debugger/Debug.cpp b/source/Debugger/Debug.cpp index f47cd8231..504ebc730 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,6); + const int DEBUGGER_VERSION = MAKE_VERSION(2,9,1,7); // Public _________________________________________________________________________________________ diff --git a/source/Debugger/Debugger_Symbols.cpp b/source/Debugger/Debugger_Symbols.cpp index ffb0f9973..5466f7273 100644 --- a/source/Debugger/Debugger_Symbols.cpp +++ b/source/Debugger/Debugger_Symbols.cpp @@ -909,25 +909,45 @@ void SymbolUpdate( SymbolTable_Index_e eSymbolTable, const char *pSymbolName, WO } } - +// Syntax: +// sym ! +// sym ~ +// sym = +// sym @ = +// NOTE: Listing of the symbols is handled via returning UPDATE_NOTHING which is triggered by: +// sym * //=========================================================================== Update_t _CmdSymbolsUpdate( int nArgs, int bSymbolTables ) { bool bRemoveSymbol = false; bool bUpdateSymbol = false; - if ((nArgs == 2) && - ((g_aArgs[ 1 ].eToken == TOKEN_EXCLAMATION) || (g_aArgs[1].eToken == TOKEN_TILDE)) ) + TCHAR *pSymbolName = g_aArgs[1].sArg; + WORD nAddress = g_aArgs[3].nValue; + + if ((nArgs == 2) + && ((g_aArgs[ 1 ].eToken == TOKEN_EXCLAMATION) || (g_aArgs[1].eToken == TOKEN_TILDE)) ) bRemoveSymbol = true; if ((nArgs == 3) && (g_aArgs[ 2 ].eToken == TOKEN_EQUAL )) bUpdateSymbol = true; - if (bRemoveSymbol || bUpdateSymbol) + // 2.9.1.7 Added: QoL for automatic symbol names + if ((nArgs == 2) + && (g_aArgRaw[ 1 ].eToken == TOKEN_AT ) // NOTE: @ is parsed and evaluated and NOT in the cooked args + && (g_aArgs [ 1 ].eToken == TOKEN_EQUAL)) { - TCHAR *pSymbolName = g_aArgs[1].sArg; - WORD nAddress = g_aArgs[3].nValue; + if (bSymbolTables == SYMBOL_TABLE_USER_1) + bSymbolTables = SYMBOL_TABLE_USER_2; // Autogenerated symbol names go in table 2 for organization when reverse engineering. Table 1 = known, Table 2 = unknown. + nAddress = g_aArgs[2].nValue; + sprintf( g_aArgs[1].sArg, "_%04X", nAddress ); // Autogenerated symbol name + + bUpdateSymbol = true; + } + + if (bRemoveSymbol || bUpdateSymbol) + { int iTable = _GetSymbolTableFromFlag( bSymbolTables ); SymbolUpdate( (SymbolTable_Index_e) iTable, pSymbolName, nAddress, bRemoveSymbol, bUpdateSymbol ); return ConsoleUpdate();