Added logic for auto debug file load/save checkbox option.

This commit is contained in:
Matthew Budd 2020-09-17 21:54:47 -04:00
parent 90e67b4ebb
commit b319273765
4 changed files with 60 additions and 6 deletions

View File

@ -60,6 +60,7 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
QLabel *lbl;
float fontCharWidth;
QTreeWidgetItem * item;
int opt;
font.setFamily("Courier New");
font.setStyle( QFont::StyleNormal );
@ -419,6 +420,7 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
connect( symDbgChkBox, SIGNAL(stateChanged(int)), this, SLOT(symbolDebugEnableCB(int)) );
connect( regNamChkBox, SIGNAL(stateChanged(int)), this, SLOT(registerNameEnableCB(int)) );
button = new QPushButton( tr("Reload Symbols") );
vbox->addWidget( button );
connect( button, SIGNAL(clicked(void)), this, SLOT(reloadSymbolsCB(void)) );
@ -442,9 +444,18 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
hbox->addWidget( debFileChkBox );
hbox->addWidget( idaFontChkBox );
g_config->getOption( "SDL.AutoOpenDebugger", &opt );
autoOpenChkBox->setChecked( opt );
g_config->getOption( "SDL.AutoLoadDebugFiles", &opt );
debFileChkBox->setChecked( opt );
connect( autoOpenChkBox, SIGNAL(stateChanged(int)), this, SLOT(autoOpenDebugCB(int)) );
connect( debFileChkBox , SIGNAL(stateChanged(int)), this, SLOT(debFileAutoLoadCB(int)) );
button->setEnabled(false); // TODO
autoOpenChkBox->setEnabled(false); // TODO
debFileChkBox->setEnabled(false); // TODO
//debFileChkBox->setEnabled(false); // TODO
idaFontChkBox->setEnabled(false); // TODO
setLayout( mainLayout );
@ -465,8 +476,15 @@ ConsoleDebugger::ConsoleDebugger(QWidget *parent)
// If this is the first debug window to open, load breakpoints fresh
if ( dbgWinList.size() == 1 )
{
loadGameDebugBreakpoints();
{
int autoLoadDebug;
g_config->getOption( "SDL.AutoLoadDebugFiles", &autoLoadDebug );
if ( autoLoadDebug )
{
loadGameDebugBreakpoints();
}
}
}
//----------------------------------------------------------------------------
@ -1218,6 +1236,23 @@ void ConsoleDebugger::registerNameEnableCB( int value )
asmView->setRegisterNameEnable(value != Qt::Unchecked);
}
//----------------------------------------------------------------------------
void ConsoleDebugger::autoOpenDebugCB( int value )
{
g_config->setOption( "SDL.AutoOpenDebugger", value != Qt::Unchecked);
}
//----------------------------------------------------------------------------
void ConsoleDebugger::debFileAutoLoadCB( int value )
{
int autoLoadDebug = value != Qt::Unchecked;
g_config->setOption("SDL.AutoLoadDebugFiles", autoLoadDebug);
if ( autoLoadDebug && (numWPs == 0) )
{
loadGameDebugBreakpoints();
}
}
//----------------------------------------------------------------------------
void ConsoleDebugger::reloadSymbolsCB(void)
{
debugSymbolTable.loadGameSymbols();
@ -2349,7 +2384,7 @@ void loadGameDebugBreakpoints(void)
data[j] = 0;
}
printf("ID:'%s' DATA:'%s' \n", id, data );
//printf("ID:'%s' DATA:'%s' \n", id, data );
if ( strcmp( id, "startAddr" ) == 0 )
{

View File

@ -216,6 +216,8 @@ class ConsoleDebugger : public QDialog
void displayROMoffsetCB(int value);
void symbolDebugEnableCB(int value);
void registerNameEnableCB(int value);
void autoOpenDebugCB( int value );
void debFileAutoLoadCB( int value );
void breakOnBadOpcodeCB(int value);
void breakOnCyclesCB( int value );
void breakOnInstructionsCB( int value );

View File

@ -259,6 +259,10 @@ InitConfig()
config->addOption("hexEditBgColor", "SDL.HexEditBgColor", "#000000");
config->addOption("hexEditFgColor", "SDL.HexEditFgColor", "#FFFFFF");
// Debugger Options
config->addOption("autoLoadDebugFiles", "SDL.AutoLoadDebugFiles", 1);
config->addOption("autoOpenDebugger" , "SDL.AutoOpenDebugger" , 0);
// overwrite the config file?
config->addOption("no-config", "SDL.NoConfig", 0);

View File

@ -212,7 +212,7 @@ DriverKill()
*/
int LoadGame(const char *path)
{
int gg_enabled;
int gg_enabled, autoLoadDebug, autoOpenDebugger;
if (isloaded){
CloseGame();
@ -229,8 +229,21 @@ int LoadGame(const char *path)
return 0;
}
g_config->getOption( "SDL.AutoOpenDebugger", &autoOpenDebugger );
if ( autoOpenDebugger )
{
// TODO Auto Open Debugger
}
hexEditorLoadBookmarks();
loadGameDebugBreakpoints();
g_config->getOption( "SDL.AutoLoadDebugFiles", &autoLoadDebug );
if ( autoLoadDebug )
{
loadGameDebugBreakpoints();
}
debugSymbolTable.loadGameSymbols();