prompt is initially filled by the executed script files commands

This commit is contained in:
thrust26 2017-10-10 12:00:10 +02:00
parent 29eb553a0c
commit 5db2d836f4
5 changed files with 17 additions and 8 deletions

View File

@ -207,18 +207,18 @@ void Debugger::quit(bool exitrom)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Debugger::autoExec()
string Debugger::autoExec(StringList* history)
{
ostringstream buf;
// autoexec.script is always run
FilesystemNode autoexec(myOSystem.baseDir() + "autoexec.script");
buf << "autoExec():" << endl
<< myParser->exec(autoexec) << endl;
<< myParser->exec(autoexec, history) << endl;
// Also, "romname.script" if present
FilesystemNode romname(myOSystem.romFile().getPathWithExt(".script"));
buf << myParser->exec(romname) << endl;
buf << myParser->exec(romname, history) << endl;
// Init builtins
for(int i = 0; builtin_functions[i][0] != 0; i++)

View File

@ -154,7 +154,7 @@ class Debugger : public DialogContainer
*/
const string run(const string& command);
string autoExec();
string autoExec(StringList* history);
string showWatches();

View File

@ -126,7 +126,7 @@ string DebuggerParser::run(const string& command)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string DebuggerParser::exec(const FilesystemNode& file)
string DebuggerParser::exec(const FilesystemNode& file, StringList* history)
{
if(file.exists())
{
@ -143,6 +143,8 @@ string DebuggerParser::exec(const FilesystemNode& file)
break;
run(command);
if (history != nullptr)
history->push_back(command);
count++;
}
buf << "\nExecuted " << count << " commands from \""
@ -1026,7 +1028,7 @@ void DebuggerParser::executeExec()
file += ".script";
FilesystemNode node(debugger.myOSystem.defaultSaveDir() + file);
commandResult << exec(node);
commandResult << exec(node, NULL);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -39,7 +39,7 @@ class DebuggerParser
string run(const string& command);
/** Execute parser commands given in 'file' */
string exec(const FilesystemNode& file);
string exec(const FilesystemNode& file, StringList* history = nullptr);
/** Given a substring, determine matching substrings from the list
of available commands. Used in the debugger prompt for tab-completion */

View File

@ -501,7 +501,14 @@ void PromptWidget::loadConfig()
print(PROMPT);
// Take care of one-time debugger stuff
print(instance().debugger().autoExec());
// fill the history from the saves breaks, traps and watches commands
StringList history;
print(instance().debugger().autoExec(&history));
for(uInt32 i = 0; i < history.size(); i++)
{
addToHistory(history[i].c_str());
}
history.clear();
print(instance().debugger().cartDebug().loadConfigFile() + "\n");
print(instance().debugger().cartDebug().loadListFile() + "\n");
print(instance().debugger().cartDebug().loadSymbolFile() + "\n");