Partially fixed issue with RAM labels (and also PC labels) not being

displayed in the debugger GUI.  I say 'partially', since it's not really
distinguishing between different types of labels with the same address, so
in some cases what you see in the debugger GUI won't be correct (but at
least you'll see *something*).  I need to determine how the DASM sym file
is generated to fix this final issue.


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@1405 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2008-02-24 16:51:52 +00:00
parent 360a5711ed
commit 4d9cdbc56a
7 changed files with 271 additions and 232 deletions

View File

@ -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.118 2008-02-06 13:45:19 stephena Exp $
// $Id: Debugger.cxx,v 1.119 2008-02-24 16:51:52 stephena Exp $
//============================================================================
#include "bspf.hxx"
@ -871,14 +871,16 @@ void Debugger::nextFrame(int frames)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::clearAllBreakPoints() {
void Debugger::clearAllBreakPoints()
{
delete breakPoints;
breakPoints = new PackedBitArray(0x10000);
mySystem->m6502().setBreakPoints(NULL);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::clearAllTraps() {
void Debugger::clearAllTraps()
{
delete readTraps;
delete writeTraps;
readTraps = new PackedBitArray(0x10000);
@ -887,22 +889,26 @@ void Debugger::clearAllTraps() {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::peek(int addr) {
int Debugger::peek(int addr)
{
return mySystem->peek(addr);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::dpeek(int addr) {
int Debugger::dpeek(int addr)
{
return mySystem->peek(addr) | (mySystem->peek(addr+1) << 8);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Debugger::showWatches() {
string Debugger::showWatches()
{
return myParser->showWatches();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::addLabel(string label, int address) {
void Debugger::addLabel(string label, int address)
{
equateList->addEquate(label, address);
}
@ -913,8 +919,10 @@ void Debugger::reloadROM()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::setBank(int bank) {
if(myConsole->cartridge().bankCount() > 1) {
bool Debugger::setBank(int bank)
{
if(myConsole->cartridge().bankCount() > 1)
{
myConsole->cartridge().unlockBank();
myConsole->cartridge().bank(bank);
myConsole->cartridge().lockBank();
@ -924,23 +932,27 @@ bool Debugger::setBank(int bank) {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::getBank() {
int Debugger::getBank()
{
return myConsole->cartridge().bank();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int Debugger::bankCount() {
int Debugger::bankCount()
{
return myConsole->cartridge().bankCount();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char *Debugger::getCartType() {
const char *Debugger::getCartType()
{
return myConsole->cartridge().name().c_str();
// FIXME - maybe whatever is calling this should use a string instead
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool Debugger::patchROM(int addr, int value) {
bool Debugger::patchROM(int addr, int value)
{
return myConsole->cartridge().patch(addr, value);
}
@ -1043,13 +1055,17 @@ GUI::Rect Debugger::getTabBounds() const
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::addFunction(string name, string definition, Expression *exp, bool builtin) {
void Debugger::addFunction(string name, string definition,
Expression *exp, bool builtin)
{
functions.insert(make_pair(name, exp));
if(!builtin) functionDefs.insert(make_pair(name, definition));
if(!builtin)
functionDefs.insert(make_pair(name, definition));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::delFunction(string name) {
void Debugger::delFunction(string name)
{
FunctionMap::iterator iter = functions.find(name);
if(iter == functions.end())
return;
@ -1065,7 +1081,8 @@ void Debugger::delFunction(string name) {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Expression *Debugger::getFunction(string name) {
Expression *Debugger::getFunction(string name)
{
FunctionMap::iterator iter = functions.find(name);
if(iter == functions.end())
return 0;
@ -1074,7 +1091,8 @@ Expression *Debugger::getFunction(string name) {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string Debugger::getFunctionDef(string name) {
string Debugger::getFunctionDef(string name)
{
FunctionDefMap::iterator iter = functionDefs.find(name);
if(iter == functionDefs.end())
return "";
@ -1083,15 +1101,18 @@ string Debugger::getFunctionDef(string name) {
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const FunctionDefMap Debugger::getFunctionDefMap() {
const FunctionDefMap Debugger::getFunctionDefMap()
{
return functionDefs;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string Debugger::builtinHelp() {
const string Debugger::builtinHelp()
{
string result;
for(int i=0; builtin_functions[i][0] != ""; i++) {
for(int i=0; builtin_functions[i][0] != ""; i++)
{
result += builtin_functions[i][0];
result += " {";
result += builtin_functions[i][1];
@ -1114,13 +1135,15 @@ bool Debugger::saveROM(string filename)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::lockState() {
void Debugger::lockState()
{
mySystem->lockDataBus();
myConsole->cartridge().lockBank();
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void Debugger::unlockState() {
void Debugger::unlockState()
{
mySystem->unlockDataBus();
myConsole->cartridge().unlockBank();
}

View File

@ -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: Equate.hxx,v 1.7 2008-02-06 13:45:20 stephena Exp $
// $Id: Equate.hxx,v 1.8 2008-02-24 16:51:52 stephena Exp $
//============================================================================
#ifndef EQUATE_HXX
@ -21,19 +21,19 @@
#include "bspf.hxx"
const int EQF_READ = 1; // Address can be read from
const int EQF_WRITE = 2; // Address can be written to
const int EQF_USER = 4; // Equate is user-defined, not built-in
// When used in a search, EQF_ANY matches any type of label
const int EQF_ANY = 0;
enum {
EQF_ANY = 1 << 0, // matches any type of label
EQF_READ = 1 << 1, // address can be read from
EQF_WRITE = 1 << 2, // address can be written to
EQF_USER = 1 << 3, // equate is user-defined, not built-in
// When used in a search, EQF_ROM matches only ROM addresses,
// and EQF_RAM only matches RAM addresses. Both RAM and ROM addresses
// are by definition user-defined, since the built-in equates are
// for the TIA and RIOT only.
const int EQF_ROM = EQF_READ | EQF_USER;
const int EQF_RAM = EQF_WRITE | EQF_READ | EQF_USER;
EQF_ROM = EQF_READ | EQF_USER,
EQF_RAM = EQF_WRITE | EQF_READ | EQF_USER
};
struct Equate {
string label;

View File

@ -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.26 2008-02-06 13:45:20 stephena Exp $
// $Id: EquateList.cxx,v 1.27 2008-02-24 16:51:52 stephena Exp $
//============================================================================
#include <fstream>
@ -187,15 +187,15 @@ static Equate hardCodedEquates[] = {
{ "INPT5.30", 0x3D, EQF_READ },
// Standard RIOT locations (read, write, or both):
{ "SWCHA", 0x0280, EQF_READ | EQF_WRITE },
{ "SWCHB", 0x0282, EQF_READ | EQF_WRITE },
{ "SWCHA", 0x280, EQF_READ | EQF_WRITE },
{ "SWCHB", 0x282, EQF_READ | EQF_WRITE },
{ "SWACNT", 0x281, EQF_WRITE },
{ "SWBCNT", 0x283, EQF_WRITE },
{ "INTIM", 0x0284, EQF_READ },
{ "TIM1T", 0x0294, EQF_WRITE },
{ "TIM8T", 0x0295, EQF_WRITE },
{ "TIM64T", 0x0296, EQF_WRITE },
{ "TIM1024T", 0x0297, EQF_WRITE }
{ "INTIM", 0x284, EQF_READ },
{ "TIM1T", 0x294, EQF_WRITE },
{ "TIM8T", 0x295, EQF_WRITE },
{ "TIM64T", 0x296, EQF_WRITE },
{ "TIM1024T", 0x297, EQF_WRITE }
};
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -221,7 +221,8 @@ EquateList::~EquateList()
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
int EquateList::calcSize() {
int EquateList::calcSize()
{
currentSize = myFwdMap.size();
return currentSize;
}
@ -236,17 +237,17 @@ const string& EquateList::getLabel(int addr)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const string& EquateList::getLabel(int addr, int flags)
{
static string nothing = "";
addrToLabel::const_iterator iter = myRevMap.find(addr);
if(iter == myRevMap.end())
return nothing;
else {
if(flags == EQF_ANY || flags == iter->second.flags)
if(iter != myRevMap.end())
{
// FIXME - until we fix the issue of correctly setting the equate
// flags to something other than 'EQF_ANY' by default,
// this comparison will almost always fail
if(1)//flags == EQF_ANY || iter->second.flags & flags)
return iter->second.label;
else
return nothing;
}
return EmptyString;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -284,7 +285,7 @@ int EquateList::getAddress(const string& label)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool EquateList::undefine(string& label)
bool EquateList::undefine(const string& label)
{
labelToAddr::iterator iter = myFwdMap.find(label);
if(iter == myFwdMap.end())
@ -302,7 +303,7 @@ bool EquateList::undefine(string& label)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
bool EquateList::saveFile(string file)
bool EquateList::saveFile(const string& file)
{
char buf[256];
@ -325,7 +326,7 @@ bool EquateList::saveFile(string file)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string EquateList::loadFile(string file)
string EquateList::loadFile(const string& file)
{
int pos = 0, lines = 0, curVal;
string curLabel;
@ -373,16 +374,16 @@ string EquateList::loadFile(string file)
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void EquateList::addEquate(string label, int address)
void EquateList::addEquate(const string& label, int address)
{
Equate *e = new Equate;
e->label = label;
e->address = address;
e->flags = EQF_ANY;
Equate e;
e.label = label;
e.address = address;
e.flags = EQF_ANY; // FIXME - this should be specified as a parameter
undefine(label);
myFwdMap.insert(make_pair(label, *e));
myRevMap.insert(make_pair(address, *e));
myFwdMap.insert(make_pair(label, e));
myRevMap.insert(make_pair(address, e));
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

View File

@ -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.16 2008-02-06 13:45:20 stephena Exp $
// $Id: EquateList.hxx,v 1.17 2008-02-24 16:51:52 stephena Exp $
//============================================================================
#ifndef EQUATELIST_HXX
@ -25,28 +25,23 @@
#include "Equate.hxx"
#include "Array.hxx"
using namespace std;
typedef map<int, Equate> addrToLabel;
typedef map<string, Equate> labelToAddr;
typedef Common::Array<Equate> Equates;
class EquateList {
class EquateList
{
public:
EquateList();
~EquateList();
const string& getLabel(int addr);
const string& getLabel(int addr, int flags);
const char *getFormatted(int addr, int places);
const char *getFormatted(int addr, int places, const int flags);
const char *getFormatted(int addr, int places, int flags);
int getAddress(const string& label);
int getAddress(const string& label, const int flags);
void addEquate(string label, int address);
void addEquate(const string& label, int address);
// void addEquate(string label, int address, const int flags);
bool saveFile(string file);
string loadFile(string file);
bool undefine(string& label);
bool saveFile(const string& file);
string loadFile(const string& file);
bool undefine(const string& label);
bool undefine(const char *lbl);
//string dumpAll();
int countCompletions(const char *in);
@ -58,10 +53,15 @@ class EquateList {
int parse4hex(char *c);
string extractLabel(char *c);
int extractValue(char *c);
private:
typedef map<int, Equate> addrToLabel;
typedef map<string, Equate> labelToAddr;
typedef Common::Array<Equate> Equates;
string completions;
string compPrefix;
private:
//Equates ourVcsEquates;
int currentSize;
labelToAddr myFwdMap;

View File

@ -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: RamWidget.cxx,v 1.14 2008-02-06 13:45:20 stephena Exp $
// $Id: RamWidget.cxx,v 1.15 2008-02-24 16:51:52 stephena Exp $
//
// Based on code from ScummVM - Scumm Interpreter
// Copyright (C) 2002-2004 The ScummVM project
@ -153,7 +153,6 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
// It will then send the 'kDGItemDataChangedCmd' signal to change the actual
// memory location
int addr, value;
const char* buf;
RamDebug& dbg = instance()->debugger().ramDebug();
switch(cmd)
@ -173,17 +172,16 @@ void RamWidget::handleCommand(CommandSender* sender, int cmd, int data, int id)
break;
case kDGSelectionChangedCmd:
{
addr = myRamGrid->getSelectedAddr();
value = myRamGrid->getSelectedValue();
buf = instance()->debugger().equates()->getLabel(
addr+kRamStart, EQF_RAM).c_str();
if(*buf) myLabel->setEditString(buf);
else myLabel->setEditString("");
myLabel->setEditString(
instance()->debugger().equates()->getLabel(addr+kRamStart, EQF_RAM));
myDecValue->setEditString(instance()->debugger().valueToString(value, kBASE_10));
myBinValue->setEditString(instance()->debugger().valueToString(value, kBASE_2));
break;
}
case kRevertCmd:
for(unsigned int i = 0; i < kRamSize; i++)

View File

@ -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: Cart.cxx,v 1.38 2008-02-22 15:29:52 stephena Exp $
// $Id: Cart.cxx,v 1.39 2008-02-24 16:51:52 stephena Exp $
//============================================================================
#include <cassert>
@ -430,7 +430,7 @@ bool Cartridge::isProbably4A50(const uInt8* image, uInt32 size)
{
// 4A50 carts store address $4A50 at the NMI vector, which
// in this scheme is always in the last page of ROM at
// $1FFA - $1FFB
// $1FFA - $1FFB (at least this is true in rev 1 of the format)
int idx = size - 6; // $1FFA
return (image[idx] == 0x50 && image[idx+1] == 0x4A);
}

View File

@ -13,6 +13,7 @@ typedef unsigned int uInt32;
int searchForBytes(const uInt8* image, uInt32 imagesize,
const uInt8* signature, uInt32 sigsize)
{
#if 1
uInt32 count = 0;
for(uInt32 i = 0; i < imagesize - sigsize; ++i)
{
@ -29,6 +30,22 @@ int searchForBytes(const uInt8* image, uInt32 imagesize,
}
return count;
#else
uInt32 minhits = 2;
uInt32 count = 0;
for(uInt32 i = 0; i < imagesize - 3; ++i)
{
if(image[i] == 0xEA && image[i+2] >= 0x60 && image[i+2] <= 0x6F)
{
++count;
i += 3;
}
if(count >= minhits)
break;
}
return count;
#endif
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -