Skip to content

Commit

Permalink
Debugger: 2.9.1.7 Added: Extended SYM command to auto-generate symbol…
Browse files Browse the repository at this point in the history
… names when reverse engineering. NOTE: These symbols will be placed in User2.
  • Loading branch information
Michaelangel007 committed Jan 4, 2022
1 parent 1f5ca5d commit 17686df
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 7 deletions.
2 changes: 1 addition & 1 deletion source/Debugger/Debug.cpp
Expand Up @@ -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 _________________________________________________________________________________________
Expand Down
32 changes: 26 additions & 6 deletions source/Debugger/Debugger_Symbols.cpp
Expand Up @@ -909,25 +909,45 @@ void SymbolUpdate( SymbolTable_Index_e eSymbolTable, const char *pSymbolName, WO
}
}


// Syntax:
// sym ! <symbol>
// sym ~ <symbol>
// sym <symbol> =
// sym @ = <addr>
// 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();
Expand Down

0 comments on commit 17686df

Please sign in to comment.