mirror of https://github.com/stella-emu/stella.git
Fixed bug that kept us from parsing symbol files if any symbol was longer
than 24 characters. Thanks to Rich Boniface for pointing out the bug. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@544 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
e8102b3ec3
commit
a372543f0e
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Debugger.cxx,v 1.27 2005-06-22 18:30:42 stephena Exp $
|
||||
// $Id: Debugger.cxx,v 1.28 2005-06-22 20:25:19 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -622,3 +622,8 @@ bool Debugger::setHeight(int height)
|
|||
string Debugger::showWatches() {
|
||||
return myParser->showWatches();
|
||||
}
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
void Debugger::addLabel(string label, int address) {
|
||||
equateList->addEquate(label, address);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Debugger.hxx,v 1.24 2005-06-22 18:30:42 stephena Exp $
|
||||
// $Id: Debugger.hxx,v 1.25 2005-06-22 20:25:19 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef DEBUGGER_HXX
|
||||
|
@ -51,7 +51,7 @@ enum {
|
|||
for all debugging operations in Stella (parser, 6502 debugger, etc).
|
||||
|
||||
@author Stephen Anthony
|
||||
@version $Id: Debugger.hxx,v 1.24 2005-06-22 18:30:42 stephena Exp $
|
||||
@version $Id: Debugger.hxx,v 1.25 2005-06-22 20:25:19 urchlay Exp $
|
||||
*/
|
||||
class Debugger : public DialogContainer
|
||||
{
|
||||
|
@ -201,6 +201,7 @@ class Debugger : public DialogContainer
|
|||
EquateList *equates();
|
||||
PromptWidget *prompt();
|
||||
string showWatches();
|
||||
void addLabel(string label, int address);
|
||||
|
||||
PackedBitArray *breakpoints() { return breakPoints; }
|
||||
PackedBitArray *readtraps() { return readTraps; }
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: DebuggerParser.cxx,v 1.25 2005-06-22 13:00:58 urchlay Exp $
|
||||
// $Id: DebuggerParser.cxx,v 1.26 2005-06-22 20:25:19 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
@ -375,6 +375,9 @@ string DebuggerParser::run(const string& command) {
|
|||
if(subStringMatch(verb, "loadsym")) {
|
||||
result = debugger->equateList->loadFile(argStrings[0]);
|
||||
return result;
|
||||
} else if(subStringMatch(verb, "label")) {
|
||||
debugger->addLabel(argStrings[0], decipher_arg(argStrings[1]));
|
||||
return "";
|
||||
} else {
|
||||
return "invalid label or address";
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: EquateList.cxx,v 1.12 2005-06-21 23:01:25 stephena Exp $
|
||||
// $Id: EquateList.cxx,v 1.13 2005-06-22 20:25:20 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <string>
|
||||
|
@ -185,16 +185,11 @@ string EquateList::loadFile(string file) {
|
|||
break;
|
||||
|
||||
if(buffer[0] != '-') {
|
||||
curLabel = getLabel(buffer);
|
||||
if((curVal = parse4hex(buffer+25)) < 0)
|
||||
curLabel = extractLabel(buffer);
|
||||
if((curVal = extractValue(buffer)) < 0)
|
||||
return "invalid symbol file";
|
||||
|
||||
// FIXME - this is a memleak and *must* be fixed
|
||||
// ideally, the Equate class should hold a string, not a char*
|
||||
Equate e;
|
||||
e.label = strdup(curLabel.c_str());
|
||||
e.address = curVal;
|
||||
ourVcsEquates.push_back(e);
|
||||
addEquate(curLabel, curVal);
|
||||
|
||||
// cerr << "label: " << curLabel << ", address: " << curVal << endl;
|
||||
// cerr << buffer;
|
||||
|
@ -209,6 +204,16 @@ string EquateList::loadFile(string file) {
|
|||
return "loaded " + file + " OK";
|
||||
}
|
||||
|
||||
void EquateList::addEquate(string label, int address) {
|
||||
// FIXME - this is a memleak and *must* be fixed
|
||||
// ideally, the Equate class should hold a string, not a char*
|
||||
Equate e;
|
||||
e.label = strdup(label.c_str());
|
||||
e.address = address;
|
||||
ourVcsEquates.push_back(e);
|
||||
calcSize();
|
||||
}
|
||||
|
||||
int EquateList::parse4hex(char *c) {
|
||||
int ret = 0;
|
||||
for(int i=0; i<4; i++) {
|
||||
|
@ -224,7 +229,23 @@ int EquateList::parse4hex(char *c) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
string EquateList::getLabel(char *c) {
|
||||
int EquateList::extractValue(char *c) {
|
||||
while(*c != ' ') {
|
||||
if(*c == '\0')
|
||||
return -1;
|
||||
c++;
|
||||
}
|
||||
|
||||
while(*c == ' ') {
|
||||
if(*c == '\0')
|
||||
return -1;
|
||||
c++;
|
||||
}
|
||||
|
||||
return parse4hex(c);
|
||||
}
|
||||
|
||||
string EquateList::extractLabel(char *c) {
|
||||
string l = "";
|
||||
while(*c != ' ')
|
||||
l += *c++;
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: EquateList.hxx,v 1.6 2005-06-21 18:46:33 stephena Exp $
|
||||
// $Id: EquateList.hxx,v 1.7 2005-06-22 20:25:20 urchlay Exp $
|
||||
//============================================================================
|
||||
|
||||
#ifndef EQUATELIST_HXX
|
||||
|
@ -32,13 +32,15 @@ class EquateList {
|
|||
char *getLabel(int addr);
|
||||
char *getFormatted(int addr, int places);
|
||||
int getAddress(const char *label);
|
||||
void addEquate(string label, int address);
|
||||
string loadFile(string file);
|
||||
void dumpAll();
|
||||
|
||||
private:
|
||||
int calcSize();
|
||||
int parse4hex(char *c);
|
||||
string getLabel(char *c);
|
||||
string extractLabel(char *c);
|
||||
int extractValue(char *c);
|
||||
|
||||
private:
|
||||
Equates ourVcsEquates;
|
||||
|
|
Loading…
Reference in New Issue