MCPcopy Create free account
hub / github.com/AppleWin/AppleWin / _CmdSymbolsUpdate

Function _CmdSymbolsUpdate

source/Debugger/Debugger_Symbols.cpp:979–1016  ·  view source on GitHub ↗

Syntax: sym ! sym ~ sym = sym @ = NOTE: Listing of the symbols is handled via returning UPDATE_NOTHING which is triggered by: sym ===========================================================================

Source from the content-addressed store, hash-verified

977// sym *
978//===========================================================================
979Update_t _CmdSymbolsUpdate( int nArgs, int bSymbolTables )
980{
981 bool bRemoveSymbol = false;
982 bool bUpdateSymbol = false;
983
984 char *pSymbolName = g_aArgs[1].sArg;
985 WORD nAddress = g_aArgs[3].nValue;
986
987 if ((nArgs == 2)
988 && ((g_aArgs[ 1 ].eToken == TOKEN_EXCLAMATION) || (g_aArgs[1].eToken == TOKEN_TILDE)) )
989 bRemoveSymbol = true;
990
991 if ((nArgs == 3) && (g_aArgs[ 2 ].eToken == TOKEN_EQUAL ))
992 bUpdateSymbol = true;
993
994 // 2.9.1.7 Added: QoL for automatic symbol names
995 if ((nArgs == 2)
996 && (g_aArgRaw[ 1 ].eToken == TOKEN_AT ) // NOTE: @ is parsed and evaluated and NOT in the cooked args
997 && (g_aArgs [ 1 ].eToken == TOKEN_EQUAL))
998 {
999 if (bSymbolTables == SYMBOL_TABLE_USER_1)
1000 bSymbolTables = SYMBOL_TABLE_USER_2; // Autogenerated symbol names go in table 2 for organization when reverse engineering. Table 1 = known, Table 2 = unknown.
1001
1002 nAddress = g_aArgs[2].nValue;
1003 strncpy_s( g_aArgs[1].sArg, StrFormat("_%04X", nAddress).c_str(), _TRUNCATE ); // Autogenerated symbol name
1004
1005 bUpdateSymbol = true;
1006 }
1007
1008 if (bRemoveSymbol || bUpdateSymbol)
1009 {
1010 int iTable = _GetSymbolTableFromFlag( bSymbolTables );
1011 SymbolUpdate( (SymbolTable_Index_e) iTable, pSymbolName, nAddress, bRemoveSymbol, bUpdateSymbol );
1012 return ConsoleUpdate();
1013 }
1014
1015 return UPDATE_NOTHING;
1016}
1017
1018
1019//===========================================================================

Callers 2

CmdSymbolsFunction · 0.85
_CmdSymbolsCommonFunction · 0.85

Calls 4

StrFormatFunction · 0.85
_GetSymbolTableFromFlagFunction · 0.85
SymbolUpdateFunction · 0.85
ConsoleUpdateFunction · 0.70

Tested by

no test coverage detected