Added 'clearconfig' debugger prompt command, to quickly remove all

directives associated with a given bank (or all banks).  Sometimes the
directives are so borked that's it's easier to remove them all at once.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2127 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-09-07 22:03:20 +00:00
parent 7f75957e11
commit db8fd2465f
5 changed files with 54 additions and 18 deletions

View File

@ -857,6 +857,32 @@ string CartDebug::listConfig(int bank)
return buf.str(); return buf.str();
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartDebug::clearConfig(int bank)
{
uInt32 startbank = 0, endbank = bankCount();
if(bank >= 0 && bank < bankCount())
{
startbank = bank;
endbank = startbank + 1;
}
uInt32 count = 0;
for(uInt32 b = startbank; b < endbank; ++b)
{
count += myBankInfo[b].directiveList.size();
myBankInfo[b].directiveList.clear();
}
ostringstream buf;
if(count > 0)
buf << "removed " << dec << count << " directives from "
<< dec << (endbank - startbank) << " banks";
else
buf << "no directives present";
return buf.str();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartDebug::getCompletions(const char* in, StringList& completions) const void CartDebug::getCompletions(const char* in, StringList& completions) const
{ {

View File

@ -223,10 +223,16 @@ class CartDebug : public DebuggerSystem
/** /**
Show Distella directives (both set by the user and determined by Distella) Show Distella directives (both set by the user and determined by Distella)
for the given bank (or all banks, if no bank is specified. for the given bank (or all banks, if no bank is specified).
*/ */
string listConfig(int bank = -1); string listConfig(int bank = -1);
/**
Clear Distella directives (set by the user) for the given bank
(or all banks, if no bank is specified.)
*/
string clearConfig(int bank = -1);
/** /**
Methods used by the command parser for tab-completion Methods used by the command parser for tab-completion
In this case, return completions from the equate list(s) In this case, return completions from the equate list(s)

View File

@ -766,6 +766,16 @@ void DebuggerParser::executeClearbreaks()
commandResult << "all breakpoints cleared"; commandResult << "all breakpoints cleared";
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "clearconfig"
void DebuggerParser::executeClearconfig()
{
if(argCount == 1)
commandResult << debugger->cartDebug().clearConfig(args[0]);
else
commandResult << debugger->cartDebug().clearConfig();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "cleartraps" // "cleartraps"
void DebuggerParser::executeCleartraps() void DebuggerParser::executeCleartraps()
@ -1568,6 +1578,15 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
&DebuggerParser::executeClearbreaks &DebuggerParser::executeClearbreaks
}, },
{
"clearconfig",
"Clear Distella config directives [bank xx]",
false,
false,
{ kARG_WORD, kARG_MULTI_BYTE },
&DebuggerParser::executeClearconfig
},
{ {
"cleartraps", "cleartraps",
"Clear all traps", "Clear all traps",

View File

@ -83,7 +83,7 @@ class DebuggerParser
private: private:
enum { enum {
kNumCommands = 64, kNumCommands = 65,
kMAX_ARG_TYPES = 10 kMAX_ARG_TYPES = 10
}; };
@ -142,6 +142,7 @@ class DebuggerParser
void executeC(); void executeC();
void executeCheat(); void executeCheat();
void executeClearbreaks(); void executeClearbreaks();
void executeClearconfig();
void executeCleartraps(); void executeCleartraps();
void executeClearwatches(); void executeClearwatches();
void executeCls(); void executeCls();

View File

@ -804,22 +804,6 @@ void DiStella::addEntry(CartDebug::DisasmType type)
tag.disasm = " "; tag.disasm = " ";
break; break;
} }
/*
switch(myDisasmBuf.peek())
{
case ' ':
tag.disasm = " ";
break;
case '.':
getline(myDisasmBuf, tag.disasm);
break;
default:
getline(myDisasmBuf, tag.disasm, '\'');
getline(myDisasmBuf, tag.ccount, '\'');
getline(myDisasmBuf, tag.bytes);
break;
}
*/
myList.push_back(tag); myList.push_back(tag);
DONE_WITH_ADD: DONE_WITH_ADD: