mirror of https://github.com/stella-emu/stella.git
Added preliminary support for DASM lst files (currently to differentiate
symbol names in the DASM symbol file). This partly fixes a deficiency in symbol files, whereby two names could have the same address (one has an address, the other as a constant), and Stella would use whichever one occurred in the file last. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2795 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
77dfaa0ebc
commit
60dd213a0a
|
@ -51,6 +51,15 @@
|
|||
hexadecimal display between upper/lower case. This setting is
|
||||
also saved in the settings file as argument 'dbg.uhex'.
|
||||
|
||||
- Removed 'loadsym' command from the debugger prompt, since the
|
||||
DASM symbol file is always loaded anyway, making the command
|
||||
redundant.
|
||||
|
||||
- Added support for DASM lst files (created with the -l option).
|
||||
For now, the contents are only partially used, to detect
|
||||
constants vs. symbolic addresses in the symbol file. Eventually,
|
||||
further information from the lst file may be used.
|
||||
|
||||
* Renamed 'Override properties' dialog (accessible from the ROM
|
||||
launcher by a right-mouse-button click) to 'Power-on options', with
|
||||
the following new options:
|
||||
|
|
|
@ -62,6 +62,10 @@ feature that no other 2600 debugger has; it's <b>completely</b> cross-platform.<
|
|||
including automatically loading symbol files if they're named
|
||||
romname.sym</li>
|
||||
|
||||
<li>Support for DASM list files (created with DASM's -l option),
|
||||
including automatically loading list files if they're named
|
||||
romname.lst</li>
|
||||
|
||||
<li>Built-in VCS.H symbols, if no symbol file is loaded.</li>
|
||||
|
||||
<li>Symbolic names in disassembly.</li>
|
||||
|
@ -343,8 +347,7 @@ to change the meaning of an expression. The prefixes are:</p>
|
|||
the section on "Startup").</p>
|
||||
|
||||
<p>Remember, you can use arbitrarily complex expressions with any
|
||||
command that takes arguments (except the ones that take filenames,
|
||||
like "loadsym").</p>
|
||||
command that takes arguments.</p>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
|
@ -653,7 +656,6 @@ listfunctions - List user-defined functions
|
|||
listtraps - List traps
|
||||
loadconfig - Load Distella config file
|
||||
loadstate - Load emulator state xx (0-9)
|
||||
loadsym - Load symbol file
|
||||
n - Negative Flag: set (0 or 1), or toggle (no arg)
|
||||
pc - Set Program Counter to address xx
|
||||
pgfx - Mark 'PGFX' range in disassembly
|
||||
|
|
|
@ -114,6 +114,8 @@ CartDebug::~CartDebug()
|
|||
{
|
||||
myUserLabels.clear();
|
||||
myUserAddresses.clear();
|
||||
myUserCLabels.clear();
|
||||
// myUserCAddresses.clear();
|
||||
mySystemAddresses.clear();
|
||||
|
||||
for(uInt32 i = 0; i < myBankInfo.size(); ++i)
|
||||
|
@ -587,6 +589,7 @@ bool CartDebug::removeLabel(const string& label)
|
|||
{
|
||||
// Erase the label
|
||||
myUserAddresses.erase(iter);
|
||||
mySystem.setDirtyPage(iter->second);
|
||||
|
||||
// And also erase the address assigned to it
|
||||
AddrToLabel::iterator iter2 = myUserLabels.find(iter->second);
|
||||
|
@ -718,6 +721,65 @@ int CartDebug::getAddress(const string& label) const
|
|||
return -1;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartDebug::loadListFile()
|
||||
{
|
||||
// Currently, the default naming/location for list files is:
|
||||
// 1) ROM dir based on properties entry name
|
||||
|
||||
if(myListFile == "")
|
||||
{
|
||||
const string& propsname =
|
||||
myConsole.properties().get(Cartridge_Name) + ".lst";
|
||||
|
||||
FilesystemNode case1(myOSystem.romFile().getParent().getPath() + propsname);
|
||||
if(case1.isFile() && case1.isReadable())
|
||||
myListFile = case1.getPath();
|
||||
else
|
||||
return DebuggerParser::red("list file not found in:\n " + case1.getShortPath());
|
||||
}
|
||||
|
||||
FilesystemNode node(myListFile);
|
||||
ifstream in(node.getPath().c_str());
|
||||
if(!in.is_open())
|
||||
return DebuggerParser::red("list file '" + node.getShortPath() + "' not readable");
|
||||
|
||||
myUserCLabels.clear();
|
||||
|
||||
while(!in.eof())
|
||||
{
|
||||
string line, addr1;
|
||||
int value = -1;
|
||||
|
||||
getline(in, line);
|
||||
|
||||
if(line.length() == 0 || line[0] == '-')
|
||||
continue;
|
||||
else // Search for constants
|
||||
{
|
||||
stringstream buf(line);
|
||||
|
||||
// Swallow first value
|
||||
buf >> value >> addr1;
|
||||
|
||||
// Search for lines containing Uxxxx
|
||||
if(addr1.length() > 0 && toupper(addr1[0]) == 'U')
|
||||
{
|
||||
// Search for pattern 'xx yy CONSTANT ='
|
||||
int xx = -1, yy = -1;
|
||||
char eq = '\0';
|
||||
buf >> hex >> xx >> hex >> yy >> line >> eq;
|
||||
if(xx == 0 && yy >= 0 && eq == '=')
|
||||
myUserCLabels.insert(make_pair(yy, line));
|
||||
}
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
myDebugger.rom().invalidate();
|
||||
|
||||
return "loaded " + node.getShortPath() + " OK";
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
string CartDebug::loadSymbolFile()
|
||||
{
|
||||
|
@ -750,12 +812,17 @@ string CartDebug::loadSymbolFile()
|
|||
int value = -1;
|
||||
|
||||
getline(in, label);
|
||||
stringstream buf;
|
||||
buf << label;
|
||||
stringstream buf(label);
|
||||
buf >> label >> hex >> value;
|
||||
|
||||
if(label.length() > 0 && label[0] != '-' && value >= 0)
|
||||
addLabel(label, value);
|
||||
{
|
||||
// Make sure the value doesn't represent a constant
|
||||
// For now, we simply ignore constants completely
|
||||
AddrToLabel::const_iterator iter = myUserCLabels.find(value);
|
||||
if(iter == myUserCLabels.end() || !BSPF_equalsIgnoreCase(label, iter->second))
|
||||
addLabel(label, value);
|
||||
}
|
||||
}
|
||||
in.close();
|
||||
myDebugger.rom().invalidate();
|
||||
|
|
|
@ -231,6 +231,11 @@ class CartDebug : public DebuggerSystem
|
|||
string getLabel(uInt16 addr, bool isRead, int places = -1) const;
|
||||
int getAddress(const string& label) const;
|
||||
|
||||
/**
|
||||
Load constants from list file (as generated by DASM).
|
||||
*/
|
||||
string loadListFile();
|
||||
|
||||
/**
|
||||
Load user equates from symbol file (as generated by DASM).
|
||||
*/
|
||||
|
@ -363,11 +368,16 @@ class CartDebug : public DebuggerSystem
|
|||
bool myAddrToLineIsROM;
|
||||
|
||||
// Mappings from label to address (and vice versa) for items
|
||||
// defined by the user (either through a symbol file or manually
|
||||
// defined by the user (either through a DASM symbol file or manually
|
||||
// from the commandline in the debugger)
|
||||
AddrToLabel myUserLabels;
|
||||
LabelToAddr myUserAddresses;
|
||||
|
||||
// Mappings from label to address (and vice versa) for constants
|
||||
// defined through a DASM lst file
|
||||
AddrToLabel myUserCLabels;
|
||||
// LabelToAddr myUserCAddresses;
|
||||
|
||||
// Mappings for labels to addresses for system-defined equates
|
||||
// Because system equate addresses can have different names
|
||||
// (depending on access in read vs. write mode), we can only create
|
||||
|
@ -383,7 +393,7 @@ class CartDebug : public DebuggerSystem
|
|||
uInt16 myLabelLength;
|
||||
|
||||
// Filenames to use for various I/O (currently these are hardcoded)
|
||||
string mySymbolFile, myCfgFile, myDisasmFile, myRomFile;
|
||||
string myListFile, mySymbolFile, myCfgFile, myDisasmFile, myRomFile;
|
||||
|
||||
/// Table of instruction mnemonics
|
||||
static const char* ourTIAMnemonicR[16]; // read mode
|
||||
|
|
|
@ -1169,13 +1169,6 @@ void DebuggerParser::executeLoadstate()
|
|||
commandResult << red("invalid slot (must be 0-9)");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// "loadsym"
|
||||
void DebuggerParser::executeLoadsym()
|
||||
{
|
||||
commandResult << debugger.cartDebug().loadSymbolFile();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
// "n"
|
||||
void DebuggerParser::executeN()
|
||||
|
@ -1925,15 +1918,6 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
|
|||
&DebuggerParser::executeLoadstate
|
||||
},
|
||||
|
||||
{
|
||||
"loadsym",
|
||||
"Load symbol file",
|
||||
false,
|
||||
true,
|
||||
{ kARG_END_ARGS },
|
||||
&DebuggerParser::executeLoadsym
|
||||
},
|
||||
|
||||
{
|
||||
"n",
|
||||
"Negative Flag: set (0 or 1), or toggle (no arg)",
|
||||
|
|
|
@ -72,7 +72,7 @@ class DebuggerParser
|
|||
|
||||
private:
|
||||
enum {
|
||||
kNumCommands = 71,
|
||||
kNumCommands = 70,
|
||||
kMAX_ARG_TYPES = 10
|
||||
};
|
||||
|
||||
|
@ -160,7 +160,6 @@ class DebuggerParser
|
|||
void executeListtraps();
|
||||
void executeLoadconfig();
|
||||
void executeLoadstate();
|
||||
void executeLoadsym();
|
||||
void executeN();
|
||||
void executePc();
|
||||
void executePGfx();
|
||||
|
|
|
@ -158,6 +158,47 @@ void DebuggerDialog::handleCommand(CommandSender* sender, int cmd,
|
|||
}
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doStep()
|
||||
{
|
||||
instance().debugger().parser().run("step");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doTrace()
|
||||
{
|
||||
instance().debugger().parser().run("trace");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doAdvance()
|
||||
{
|
||||
instance().debugger().parser().run("frame #1");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doScanlineAdvance()
|
||||
{
|
||||
instance().debugger().parser().run("scanline #1");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doRewind()
|
||||
{
|
||||
instance().debugger().parser().run("rewind");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doExitDebugger()
|
||||
{
|
||||
instance().debugger().parser().run("run");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doExitRom()
|
||||
{
|
||||
instance().debugger().parser().run("exitrom");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::createFont()
|
||||
|
@ -423,45 +464,3 @@ GUI::Rect DebuggerDialog::getTabBounds() const
|
|||
|
||||
return r;
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doStep()
|
||||
{
|
||||
instance().debugger().parser().run("step");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doTrace()
|
||||
{
|
||||
instance().debugger().parser().run("trace");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doAdvance()
|
||||
{
|
||||
instance().debugger().parser().run("frame #1");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doScanlineAdvance()
|
||||
{
|
||||
instance().debugger().parser().run("scanline #1");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doRewind()
|
||||
{
|
||||
instance().debugger().parser().run("rewind");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doExitDebugger()
|
||||
{
|
||||
instance().debugger().parser().run("run");
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void DebuggerDialog::doExitRom()
|
||||
{
|
||||
instance().debugger().parser().run("exitrom");
|
||||
}
|
||||
|
|
|
@ -494,6 +494,7 @@ void PromptWidget::loadConfig()
|
|||
// Take care of one-time debugger stuff
|
||||
print(instance().debugger().autoExec().c_str());
|
||||
print(instance().debugger().cartDebug().loadConfigFile() + "\n");
|
||||
print(instance().debugger().cartDebug().loadListFile() + "\n");
|
||||
print(instance().debugger().cartDebug().loadSymbolFile() + "\n");
|
||||
print(PROMPT);
|
||||
|
||||
|
|
Loading…
Reference in New Issue