Reverted grouping characters for multi-character debugger prompt commands

to use curly braces {} instead of apostrophes.  This matches the
functionality from older releases.

Fixed debugger prompt messages to show correct info when opening
various files (config files, autoexec, etc).

The debugger 'type' command now accepts a range of values.

Reverted handling of ROMs that aren't in the internal database;
they're inserted with their extension again, just as in older
releases.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2168 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-11-04 19:29:12 +00:00
parent 0f63b49bd6
commit e8b080551f
6 changed files with 61 additions and 116 deletions

View File

@ -387,9 +387,9 @@ we want to apply the ! to the result of the &, not just the first term
<p>"breakif !(*SWCHB&amp;1)" will do the job for us. However, it's an ugly mess
of letters, numbers, and punctuation. We can do a little better:</p>
<p>"breakif &apos; !(*SWCHB &amp; 1 ) &apos;" is a lot more readable, isn't it? If
<p>"breakif { !(*SWCHB &amp; 1 ) }" is a lot more readable, isn't it? If
you're going to use readable expressions with spaces in them,
enclose the entire expression in single quotes.</p>
enclose the entire expression in curly braces.</p>
<p>Remember that Stella only checks for input once per frame, so a break
condition that depends on input (like SWCHB) will always happen at the

View File

@ -603,7 +603,6 @@ int CartDebug::getAddress(const string& label) const
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartDebug::loadSymbolFile(string file)
{
// TODO - use similar load logic as loadconfig command
if(file == "")
file = myOSystem.romFile();
@ -613,48 +612,33 @@ string CartDebug::loadSymbolFile(string file)
else
file += ".sym";
// TODO - rewrite this to use C++ streams
int pos = 0, lines = 0, curVal;
string curLabel;
char line[1024];
ifstream in(file.c_str());
if(!in.is_open())
return "Unable to read symbols from " + file;
myUserAddresses.clear();
myUserLabels.clear();
while( !in.eof() )
FilesystemNode node(file);
if(node.exists() && !node.isDirectory())
{
curVal = 0;
curLabel = "";
ifstream in(node.getPath().c_str());
if(!in.is_open())
return DebuggerParser::red("symbol file '" + node.getPath() + "' not found");
int got = in.get();
myUserAddresses.clear();
myUserLabels.clear();
if(got == -1 || got == '\r' || got == '\n' || pos == 1023) {
line[pos] = '\0';
pos = 0;
if(strlen(line) > 0 && line[0] != '-')
{
curLabel = extractLabel(line);
if((curVal = extractValue(line)) < 0)
return "invalid symbol file";
addLabel(curLabel, curVal);
lines++;
}
}
else
while(!in.eof())
{
line[pos++] = got;
string label;
int value = -1;
getline(in, label);
stringstream buf;
buf << label;
buf >> label >> hex >> value;
if(label.length() > 0 && label[0] != '-' && value >= 0)
addLabel(label, value);
}
in.close();
return "loaded " + file + " OK";
}
in.close();
return "loaded " + file + " OK";
return DebuggerParser::red("symbol file '" + node.getPath() + "' not found");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -756,8 +740,7 @@ string CartDebug::loadConfigFile(string file)
}
else if(BSPF_startsWithIgnoreCase(directive, "SKIP"))
{
buf >> hex >> start;
buf >> hex >> end;
buf >> hex >> start >> hex >> end;
// addDirective(CartDebug::SKIP, start, end, currentbank);
}
else if(BSPF_startsWithIgnoreCase(directive, "CODE"))
@ -1024,47 +1007,6 @@ void CartDebug::disasmTypeAsString(ostream& buf, DisasmType type) const
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string CartDebug::extractLabel(const char *c) const
{
string l = "";
while(*c != ' ')
l += *c++;
return l;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int CartDebug::extractValue(const char *c) const
{
while(*c != ' ')
{
if(*c == '\0')
return -1;
c++;
}
while(*c == ' ')
{
if(*c == '\0')
return -1;
c++;
}
int ret = 0;
for(int i=0; i<4; i++)
{
if(*c >= '0' && *c <= '9')
ret = (ret << 4) + (*c) - '0';
else if(*c >= 'a' && *c <= 'f')
ret = (ret << 4) + (*c) - 'a' + 10;
else
return -1;
c++;
}
return ret;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* CartDebug::ourTIAMnemonicR[16] = {
"CXM0P", "CXM1P", "CXP0FB", "CXP1FB", "CXM0FB", "CXM1FB", "CXBLPF", "CXPPMM",

View File

@ -293,10 +293,6 @@ class CartDebug : public DebuggerSystem
// Convert disassembly enum type to corresponding string and append to buf
void disasmTypeAsString(ostream& buf, DisasmType type) const;
// Extract labels and values from the given character stream
string extractLabel(const char* c) const;
int extractValue(const char* c) const;
private:
const OSystem& myOSystem;

View File

@ -133,7 +133,7 @@ string DebuggerParser::exec(const FilesystemNode& file)
{
ifstream in(file.getPath().c_str());
if(!in.is_open())
return red("file \'" + file.getRelativePath() + "\' not found.");
return red("autoexec file \'" + file.getRelativePath() + "\' not found");
ostringstream buf;
int count = 0;
@ -151,7 +151,7 @@ string DebuggerParser::exec(const FilesystemNode& file)
return buf.str();
}
else
return red("file \'" + file.getRelativePath() + "\' not found.");
return red("autoexec file \'" + file.getRelativePath() + "\' not found");
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -343,7 +343,7 @@ bool DebuggerParser::getArgs(const string& command, string& verb)
verb += c;
break;
case kIN_SPACE:
if(c == '\'')
if(c == '{')
state = kIN_BRACE;
else if(c != ' ') {
state = kIN_ARG;
@ -351,7 +351,7 @@ bool DebuggerParser::getArgs(const string& command, string& verb)
}
break;
case kIN_BRACE:
if(c == '\'') {
if(c == '}') {
state = kIN_SPACE;
argStrings.push_back(curArg);
// cerr << "{" << curArg << "}" << endl;
@ -1545,27 +1545,37 @@ void DebuggerParser::executeTrapwrite()
// "type"
void DebuggerParser::executeType()
{
uInt8 flags = debugger->getAddressDisasmType(args[0]);
if(flags)
uInt32 beg = args[0];
uInt32 end = argCount >= 2 ? args[1] : beg;
if(beg > end) BSPF_swap(beg, end);
for(uInt32 i = beg; i <= end; ++i)
{
commandResult << Debugger::to_bin_8(flags) << ": ";
if(flags & CartDebug::SKIP)
commandResult << "SKIP ";
if(flags & CartDebug::CODE)
commandResult << "CODE ";
if(flags & CartDebug::GFX)
commandResult << "GFX ";
if(flags & CartDebug::DATA)
commandResult << "DATA ";
if(flags & CartDebug::ROW)
commandResult << "ROW ";
if(flags & CartDebug::REFERENCED)
commandResult << "*REFERENCED ";
if(flags & CartDebug::VALID_ENTRY)
commandResult << "*VALID_ENTRY ";
commandResult << HEX4 << i << " => ";
uInt8 flags = debugger->getAddressDisasmType(i);
if(flags)
{
string bin = Debugger::to_bin_8(flags);
commandResult << bin << ": ";
if(flags & CartDebug::SKIP)
commandResult << "SKIP ";
if(flags & CartDebug::CODE)
commandResult << "CODE ";
if(flags & CartDebug::GFX)
commandResult << "GFX ";
if(flags & CartDebug::DATA)
commandResult << "DATA ";
if(flags & CartDebug::ROW)
commandResult << "ROW ";
if(flags & CartDebug::REFERENCED)
commandResult << "*REFERENCED ";
if(flags & CartDebug::VALID_ENTRY)
commandResult << "*VALID_ENTRY ";
}
else
commandResult << "no flags set";
commandResult << endl;
}
else
commandResult << "no flags set";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -2187,13 +2197,14 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
{
"type",
"Show disassemly type for address xx",
"Show disassembly type for address xx [to yy]",
true,
false,
{ kARG_WORD, kARG_END_ARGS },
{ kARG_WORD, kARG_MULTI_BYTE },
&DebuggerParser::executeType
},
{
"undef",
"Undefine label xx (if defined)",

View File

@ -207,7 +207,7 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers)
for (i = 0; i < len; i++)
{
str[i] = buffer(_promptStartPos + i) & 0x7f;
if(strchr("\'*@<> ", str[i]) != NULL )
if(strchr("{*@<> ", str[i]) != NULL )
{
lastDelimPos = i;
delimiter = str[i];

View File

@ -822,10 +822,6 @@ uInt8* OSystem::openROM(string file, string& md5, uInt32& size)
FilesystemNode node(file);
file = node.getDisplayName();
// Remove extension
string::size_type pos = file.find_last_of(".");
if(pos != string::npos) file = file.substr(0, pos);
props.set(Cartridge_MD5, md5);
props.set(Cartridge_Name, file);
myPropSet->insert(props, false);