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,48 +612,33 @@ 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;
|
|
||||||
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() )
|
|
||||||
{
|
{
|
||||||
curVal = 0;
|
ifstream in(node.getPath().c_str());
|
||||||
curLabel = "";
|
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) {
|
while(!in.eof())
|
||||||
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
|
|
||||||
{
|
{
|
||||||
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 DebuggerParser::red("symbol file '" + node.getPath() + "' not found");
|
||||||
return "loaded " + file + " OK";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||||
|
@ -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,27 +1545,37 @@ void DebuggerParser::executeTrapwrite()
|
||||||
// "type"
|
// "type"
|
||||||
void DebuggerParser::executeType()
|
void DebuggerParser::executeType()
|
||||||
{
|
{
|
||||||
uInt8 flags = debugger->getAddressDisasmType(args[0]);
|
uInt32 beg = args[0];
|
||||||
if(flags)
|
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) << ": ";
|
commandResult << HEX4 << i << " => ";
|
||||||
if(flags & CartDebug::SKIP)
|
uInt8 flags = debugger->getAddressDisasmType(i);
|
||||||
commandResult << "SKIP ";
|
if(flags)
|
||||||
if(flags & CartDebug::CODE)
|
{
|
||||||
commandResult << "CODE ";
|
string bin = Debugger::to_bin_8(flags);
|
||||||
if(flags & CartDebug::GFX)
|
commandResult << bin << ": ";
|
||||||
commandResult << "GFX ";
|
if(flags & CartDebug::SKIP)
|
||||||
if(flags & CartDebug::DATA)
|
commandResult << "SKIP ";
|
||||||
commandResult << "DATA ";
|
if(flags & CartDebug::CODE)
|
||||||
if(flags & CartDebug::ROW)
|
commandResult << "CODE ";
|
||||||
commandResult << "ROW ";
|
if(flags & CartDebug::GFX)
|
||||||
if(flags & CartDebug::REFERENCED)
|
commandResult << "GFX ";
|
||||||
commandResult << "*REFERENCED ";
|
if(flags & CartDebug::DATA)
|
||||||
if(flags & CartDebug::VALID_ENTRY)
|
commandResult << "DATA ";
|
||||||
commandResult << "*VALID_ENTRY ";
|
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",
|
"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