mirror of https://github.com/stella-emu/stella.git
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:
parent
0f63b49bd6
commit
e8b080551f
|
@ -387,9 +387,9 @@ we want to apply the ! to the result of the &, not just the first term
|
||||||
<p>"breakif !(*SWCHB&1)" will do the job for us. However, it's an ugly mess
|
<p>"breakif !(*SWCHB&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>
|
of letters, numbers, and punctuation. We can do a little better:</p>
|
||||||
|
|
||||||
<p>"breakif ' !(*SWCHB & 1 ) '" is a lot more readable, isn't it? If
|
<p>"breakif { !(*SWCHB & 1 ) }" is a lot more readable, isn't it? If
|
||||||
you're going to use readable expressions with spaces in them,
|
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
|
<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
|
condition that depends on input (like SWCHB) will always happen at the
|
||||||
|
|
|
@ -603,7 +603,6 @@ int CartDebug::getAddress(const string& label) const
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string CartDebug::loadSymbolFile(string file)
|
string CartDebug::loadSymbolFile(string file)
|
||||||
{
|
{
|
||||||
// TODO - use similar load logic as loadconfig command
|
|
||||||
if(file == "")
|
if(file == "")
|
||||||
file = myOSystem.romFile();
|
file = myOSystem.romFile();
|
||||||
|
|
||||||
|
@ -613,49 +612,34 @@ string CartDebug::loadSymbolFile(string file)
|
||||||
else
|
else
|
||||||
file += ".sym";
|
file += ".sym";
|
||||||
|
|
||||||
// TODO - rewrite this to use C++ streams
|
FilesystemNode node(file);
|
||||||
|
if(node.exists() && !node.isDirectory())
|
||||||
int pos = 0, lines = 0, curVal;
|
{
|
||||||
string curLabel;
|
ifstream in(node.getPath().c_str());
|
||||||
char line[1024];
|
|
||||||
|
|
||||||
ifstream in(file.c_str());
|
|
||||||
if(!in.is_open())
|
if(!in.is_open())
|
||||||
return "Unable to read symbols from " + file;
|
return DebuggerParser::red("symbol file '" + node.getPath() + "' not found");
|
||||||
|
|
||||||
myUserAddresses.clear();
|
myUserAddresses.clear();
|
||||||
myUserLabels.clear();
|
myUserLabels.clear();
|
||||||
|
|
||||||
while(!in.eof())
|
while(!in.eof())
|
||||||
{
|
{
|
||||||
curVal = 0;
|
string label;
|
||||||
curLabel = "";
|
int value = -1;
|
||||||
|
|
||||||
int got = in.get();
|
getline(in, label);
|
||||||
|
stringstream buf;
|
||||||
|
buf << label;
|
||||||
|
buf >> label >> hex >> value;
|
||||||
|
|
||||||
if(got == -1 || got == '\r' || got == '\n' || pos == 1023) {
|
if(label.length() > 0 && label[0] != '-' && value >= 0)
|
||||||
line[pos] = '\0';
|
addLabel(label, value);
|
||||||
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
|
|
||||||
{
|
|
||||||
line[pos++] = got;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
in.close();
|
in.close();
|
||||||
return "loaded " + file + " OK";
|
return "loaded " + file + " OK";
|
||||||
}
|
}
|
||||||
|
return DebuggerParser::red("symbol file '" + node.getPath() + "' not found");
|
||||||
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
string CartDebug::loadConfigFile(string file)
|
string CartDebug::loadConfigFile(string file)
|
||||||
|
@ -756,8 +740,7 @@ string CartDebug::loadConfigFile(string file)
|
||||||
}
|
}
|
||||||
else if(BSPF_startsWithIgnoreCase(directive, "SKIP"))
|
else if(BSPF_startsWithIgnoreCase(directive, "SKIP"))
|
||||||
{
|
{
|
||||||
buf >> hex >> start;
|
buf >> hex >> start >> hex >> end;
|
||||||
buf >> hex >> end;
|
|
||||||
// addDirective(CartDebug::SKIP, start, end, currentbank);
|
// addDirective(CartDebug::SKIP, start, end, currentbank);
|
||||||
}
|
}
|
||||||
else if(BSPF_startsWithIgnoreCase(directive, "CODE"))
|
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] = {
|
const char* CartDebug::ourTIAMnemonicR[16] = {
|
||||||
"CXM0P", "CXM1P", "CXP0FB", "CXP1FB", "CXM0FB", "CXM1FB", "CXBLPF", "CXPPMM",
|
"CXM0P", "CXM1P", "CXP0FB", "CXP1FB", "CXM0FB", "CXM1FB", "CXBLPF", "CXPPMM",
|
||||||
|
|
|
@ -293,10 +293,6 @@ class CartDebug : public DebuggerSystem
|
||||||
// Convert disassembly enum type to corresponding string and append to buf
|
// Convert disassembly enum type to corresponding string and append to buf
|
||||||
void disasmTypeAsString(ostream& buf, DisasmType type) const;
|
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:
|
private:
|
||||||
const OSystem& myOSystem;
|
const OSystem& myOSystem;
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ string DebuggerParser::exec(const FilesystemNode& file)
|
||||||
{
|
{
|
||||||
ifstream in(file.getPath().c_str());
|
ifstream in(file.getPath().c_str());
|
||||||
if(!in.is_open())
|
if(!in.is_open())
|
||||||
return red("file \'" + file.getRelativePath() + "\' not found.");
|
return red("autoexec file \'" + file.getRelativePath() + "\' not found");
|
||||||
|
|
||||||
ostringstream buf;
|
ostringstream buf;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
@ -151,7 +151,7 @@ string DebuggerParser::exec(const FilesystemNode& file)
|
||||||
return buf.str();
|
return buf.str();
|
||||||
}
|
}
|
||||||
else
|
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;
|
verb += c;
|
||||||
break;
|
break;
|
||||||
case kIN_SPACE:
|
case kIN_SPACE:
|
||||||
if(c == '\'')
|
if(c == '{')
|
||||||
state = kIN_BRACE;
|
state = kIN_BRACE;
|
||||||
else if(c != ' ') {
|
else if(c != ' ') {
|
||||||
state = kIN_ARG;
|
state = kIN_ARG;
|
||||||
|
@ -351,7 +351,7 @@ bool DebuggerParser::getArgs(const string& command, string& verb)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case kIN_BRACE:
|
case kIN_BRACE:
|
||||||
if(c == '\'') {
|
if(c == '}') {
|
||||||
state = kIN_SPACE;
|
state = kIN_SPACE;
|
||||||
argStrings.push_back(curArg);
|
argStrings.push_back(curArg);
|
||||||
// cerr << "{" << curArg << "}" << endl;
|
// cerr << "{" << curArg << "}" << endl;
|
||||||
|
@ -1545,10 +1545,18 @@ void DebuggerParser::executeTrapwrite()
|
||||||
// "type"
|
// "type"
|
||||||
void DebuggerParser::executeType()
|
void DebuggerParser::executeType()
|
||||||
{
|
{
|
||||||
uInt8 flags = debugger->getAddressDisasmType(args[0]);
|
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 << HEX4 << i << " => ";
|
||||||
|
uInt8 flags = debugger->getAddressDisasmType(i);
|
||||||
if(flags)
|
if(flags)
|
||||||
{
|
{
|
||||||
commandResult << Debugger::to_bin_8(flags) << ": ";
|
string bin = Debugger::to_bin_8(flags);
|
||||||
|
commandResult << bin << ": ";
|
||||||
if(flags & CartDebug::SKIP)
|
if(flags & CartDebug::SKIP)
|
||||||
commandResult << "SKIP ";
|
commandResult << "SKIP ";
|
||||||
if(flags & CartDebug::CODE)
|
if(flags & CartDebug::CODE)
|
||||||
|
@ -1566,6 +1574,8 @@ void DebuggerParser::executeType()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
commandResult << "no flags set";
|
commandResult << "no flags set";
|
||||||
|
commandResult << endl;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -2187,13 +2197,14 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
|
||||||
|
|
||||||
{
|
{
|
||||||
"type",
|
"type",
|
||||||
"Show disassemly type for address xx",
|
"Show disassembly type for address xx [to yy]",
|
||||||
true,
|
true,
|
||||||
false,
|
false,
|
||||||
{ kARG_WORD, kARG_END_ARGS },
|
{ kARG_WORD, kARG_MULTI_BYTE },
|
||||||
&DebuggerParser::executeType
|
&DebuggerParser::executeType
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
{
|
{
|
||||||
"undef",
|
"undef",
|
||||||
"Undefine label xx (if defined)",
|
"Undefine label xx (if defined)",
|
||||||
|
|
|
@ -207,7 +207,7 @@ bool PromptWidget::handleKeyDown(int ascii, int keycode, int modifiers)
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
{
|
{
|
||||||
str[i] = buffer(_promptStartPos + i) & 0x7f;
|
str[i] = buffer(_promptStartPos + i) & 0x7f;
|
||||||
if(strchr("\'*@<> ", str[i]) != NULL )
|
if(strchr("{*@<> ", str[i]) != NULL )
|
||||||
{
|
{
|
||||||
lastDelimPos = i;
|
lastDelimPos = i;
|
||||||
delimiter = str[i];
|
delimiter = str[i];
|
||||||
|
|
|
@ -822,10 +822,6 @@ uInt8* OSystem::openROM(string file, string& md5, uInt32& size)
|
||||||
FilesystemNode node(file);
|
FilesystemNode node(file);
|
||||||
file = node.getDisplayName();
|
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_MD5, md5);
|
||||||
props.set(Cartridge_Name, file);
|
props.set(Cartridge_Name, file);
|
||||||
myPropSet->insert(props, false);
|
myPropSet->insert(props, false);
|
||||||
|
|
Loading…
Reference in New Issue