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; ostringstream buf;
// autoexec.script is always run // autoexec.script is always run
FilesystemNode autoexec(myOSystem.baseDir() + "autoexec.script"); FilesystemNode autoexec(myOSystem.baseDir() + "autoexec.script");
buf << "autoExec():" << endl buf << "autoExec():" << endl
<< myParser->exec(autoexec) << endl; << myParser->exec(autoexec, history) << endl;
// Also, "romname.script" if present // Also, "romname.script" if present
FilesystemNode romname(myOSystem.romFile().getPathWithExt(".script")); FilesystemNode romname(myOSystem.romFile().getPathWithExt(".script"));
buf << myParser->exec(romname) << endl; buf << myParser->exec(romname, history) << endl;
// Init builtins // Init builtins
for(int i = 0; builtin_functions[i][0] != 0; i++) 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); const string run(const string& command);
string autoExec(); string autoExec(StringList* history);
string showWatches(); 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()) if(file.exists())
{ {
@ -143,6 +143,8 @@ string DebuggerParser::exec(const FilesystemNode& file)
break; break;
run(command); run(command);
if (history != nullptr)
history->push_back(command);
count++; count++;
} }
buf << "\nExecuted " << count << " commands from \"" buf << "\nExecuted " << count << " commands from \""
@ -1026,7 +1028,7 @@ void DebuggerParser::executeExec()
file += ".script"; file += ".script";
FilesystemNode node(debugger.myOSystem.defaultSaveDir() + file); 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); string run(const string& command);
/** Execute parser commands given in 'file' */ /** 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 /** Given a substring, determine matching substrings from the list
of available commands. Used in the debugger prompt for tab-completion */ of available commands. Used in the debugger prompt for tab-completion */

View File

@ -501,7 +501,14 @@ void PromptWidget::loadConfig()
print(PROMPT); print(PROMPT);
// Take care of one-time debugger stuff // 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().loadConfigFile() + "\n");
print(instance().debugger().cartDebug().loadListFile() + "\n"); print(instance().debugger().cartDebug().loadListFile() + "\n");
print(instance().debugger().cartDebug().loadSymbolFile() + "\n"); print(instance().debugger().cartDebug().loadSymbolFile() + "\n");