For Qt GUI added code to warn user that symbol table will be wiped when importing ld65 dbg files. Added code to clear and redraw debugger window data after importing new symbols.

This commit is contained in:
harry 2023-02-14 20:33:46 -05:00
parent 791ff7478d
commit 903e035a95
3 changed files with 34 additions and 4 deletions

View File

@ -386,6 +386,18 @@ void debugSymbolTable_t::clear(void)
pageMap.clear();
}
//--------------------------------------------------------------
int debugSymbolTable_t::numSymbols(void)
{
int n = 0;
FCEU::autoScopedLock alock(cs);
for (auto it=pageMap.begin(); it!=pageMap.end(); it++)
{
n += it->second->size();
}
return n;
}
//--------------------------------------------------------------
static int generateNLFilenameForBank(int bank, std::string &NLfilename)
{
int i;

View File

@ -92,7 +92,7 @@ class debugSymbolPage_t
int save(void);
void print(void);
int size(void){ return symMap.size(); }
int size(void){ return static_cast<int>(symMap.size()); }
int addSymbol( debugSymbol_t *sym );
@ -131,8 +131,10 @@ class debugSymbolTable_t
~debugSymbolTable_t(void);
int loadFileNL( int addr );
int loadRegisterMap(void);
int loadGameSymbols(void);
int numPages(void){ return pageMap.size(); }
int numSymbols(void);
void save(void);
void clear(void);
@ -161,9 +163,6 @@ class debugSymbolTable_t
private:
std::map <int, debugSymbolPage_t*> pageMap;
FCEU::mutex *cs;
int loadRegisterMap(void);
};
extern debugSymbolTable_t debugSymbolTable;

View File

@ -336,8 +336,27 @@ void ConsoleDebugger::ld65ImportDebug(void)
}
//qDebug() << "selected file path : " << filename.toUtf8();
if (debugSymbolTable.numSymbols() > 0)
{
QString msg = tr("Do you wish to clear the existing symbol table and replace with the data contained in the selected file?\n\n") + filename;
ret = QMessageBox::warning( this, tr("Symbol Table Clear Warning"), msg,
QMessageBox::Yes | QMessageBox::No );
if ( ret == QMessageBox::No )
{
//printf("Aborting dbg file load.\n");
return;
}
}
debugSymbolTable.clear();
debugSymbolTable.loadRegisterMap();
debugSymbolTable.ld65LoadDebugFile( filename.toStdString().c_str() );
queueUpdate();
return;
}
//----------------------------------------------------------------------------