Fixed minor compile warnings with gcc/clang.

This commit is contained in:
Stephen Anthony 2017-10-09 19:14:49 -02:30
parent 3fddc03ff6
commit aa755c7270
6 changed files with 46 additions and 42 deletions

View File

@ -103,9 +103,9 @@ static const char* const pseudo_registers[][2] = {
{ "_rwport", "Address at which a read from a write port occurred" },
{ "_scan", "Current scanline count" },
{ "_vblank", "Whether vertical blank is enabled (1 or 0)" },
{ "_vsync", "Whether vertical sync is enabled (1 or 0)" },
{ "_vsync", "Whether vertical sync is enabled (1 or 0)" },
// CPU address access functions:
/*{ "__lastread", "last CPU read address" },
/*{ "__lastread", "last CPU read address" },
{ "__lastwrite", "last CPU write address" },*/
// empty string marks end of list, do not remove
@ -177,7 +177,7 @@ bool Debugger::start(const string& message, int address, bool read)
ostringstream buf;
buf << message;
if(address > -1)
buf << cartDebug().getLabel(address, read);
buf << cartDebug().getLabel(address, read);
myDialog->message().setText(buf.str());
return true;
}
@ -418,45 +418,47 @@ bool Debugger::writeTrap(uInt16 t)
{
return writeTraps().isInitialized() && writeTraps().isSet(t);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 Debugger::getBaseAddress(uInt32 addr, bool read)
{
if((addr & 0x1080) == 0x0000) // (addr & 0b 0001 0000 1000 0000) == 0b 0000 0000 0000 0000
{
if(read)
// ADDR_TIA read (%xxx0 xxxx 0xxx ????)
return addr & 0x000f; // 0b 0000 0000 0000 1111
else
// ADDR_TIA write (%xxx0 xxxx 0x?? ????)
return addr & 0x003f; // 0b 0000 0000 0011 1111
}
// ADDR_ZPRAM (%xxx0 xx0x 1??? ????)
// ADDR_ZPRAM (%xxx0 xx0x 1??? ????)
if((addr & 0x1280) == 0x0080) // (addr & 0b 0001 0010 1000 0000) == 0b 0000 0000 1000 0000
return addr & 0x00ff; // 0b 0000 0000 1111 1111
// ADDR_ROM
// ADDR_ROM
if(addr & 0x1000)
return addr & 0x1fff; // 0b 0001 1111 1111 1111
// ADDR_IO read/write I/O registers (%xxx0 xx1x 1xxx x0??)
// ADDR_IO read/write I/O registers (%xxx0 xx1x 1xxx x0??)
if((addr & 0x1284) == 0x0280) // (addr & 0b 0001 0010 1000 0100) == 0b 0000 0010 1000 0000
return addr & 0x0283; // 0b 0000 0010 1000 0011
// ADDR_IO write timers (%xxx0 xx1x 1xx1 ?1??)
// ADDR_IO write timers (%xxx0 xx1x 1xx1 ?1??)
if(!read && (addr & 0x1294) == 0x0294) // (addr & 0b 0001 0010 1001 0100) == 0b 0000 0010 1001 0100
return addr & 0x029f; // 0b 0000 0010 1001 1111
// ADDR_IO read timers (%xxx0 xx1x 1xxx ?1x0)
// ADDR_IO read timers (%xxx0 xx1x 1xxx ?1x0)
if(read && (addr & 0x1285) == 0x0284) // (addr & 0b 0001 0010 1000 0101) == 0b 0000 0010 1000 0100
return addr & 0x028c; // 0b 0000 0010 1000 1100
// ADDR_IO read timer/PA7 interrupt (%xxx0 xx1x 1xxx x1x1)
// ADDR_IO read timer/PA7 interrupt (%xxx0 xx1x 1xxx x1x1)
if(read && (addr & 0x1285) == 0x0285) // (addr & 0b 0001 0010 1000 0101) == 0b 0000 0010 1000 0101
return addr & 0x0285; // 0b 0000 0010 1000 0101
// ADDR_IO write PA7 edge control (%xxx0 xx1x 1xx0 x1??)
// ADDR_IO write PA7 edge control (%xxx0 xx1x 1xx0 x1??)
if(!read && (addr & 0x1294) == 0x0284) // (addr & 0b 0001 0010 1001 0100) == 0b 0000 0010 1000 0100
return addr & 0x0287; // 0b 0000 0010 1000 0111
return addr & 0x0287; // 0b 0000 0010 1000 0111
return 0;
}

View File

@ -158,7 +158,7 @@ string DebuggerParser::exec(const FilesystemNode& file)
void DebuggerParser::outputCommandError(const string& errorMsg, int command)
{
string example = commands[command].extendedDesc.substr(commands[command].extendedDesc.find("Example:"));
commandResult << red(errorMsg);
if(!example.empty())
commandResult << endl << example;
@ -594,10 +594,10 @@ void DebuggerParser::listTraps(bool listCond)
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
string DebuggerParser::trapStatus(const Trap& trap)
{
stringstream result;
stringstream result;
string lblb = debugger.cartDebug().getLabel(trap.begin, !trap.write);
string lble = debugger.cartDebug().getLabel(trap.end, !trap.write);
if(lblb != "") {
result << " (";
result << lblb;
@ -930,16 +930,16 @@ void DebuggerParser::executeDelfunction()
void DebuggerParser::executeDeltrap()
{
int index = args[0];
if(debugger.cpuDebug().m6502().delCondTrap(index))
{
for(uInt32 addr = myTraps[index]->begin; addr <= myTraps[index]->end; ++addr)
executeTrapRW(addr, myTraps[index]->read, myTraps[index]->write, false);
// @sa666666: please check this:
Vec::removeAt(myTraps, index);
Vec::removeAt(myTraps, index);
commandResult << "removed trap " << Base::toString(index);
}
else
else
commandResult << "no such trap";
}
@ -1159,7 +1159,7 @@ void DebuggerParser::executeListbreaks()
buf << debugger.cartDebug().getLabel(i, true, 4) << " ";
if(! (++count % 8) ) buf << endl;
}
}
}
if(count)
commandResult << "breaks:" << endl << buf.str();
@ -1216,7 +1216,7 @@ void DebuggerParser::executeListtraps()
commandResult << "Internal error! Different trap sizes.";
return;
}
if (names.size() > 0)
{
bool trapFound = false, trapifFound = false;
@ -1617,9 +1617,10 @@ void DebuggerParser::executeTrapwriteif()
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Wrapper function for trap(if)s
void DebuggerParser::executeTraps(bool read, bool write, const string& command, bool hasCond)
void DebuggerParser::executeTraps(bool read, bool write, const string& command,
bool hasCond)
{
int ofs = hasCond ? 1 : 0;
uInt32 ofs = hasCond ? 1 : 0;
uInt32 begin = args[ofs];
uInt32 end = argCount == 2 + ofs ? args[1 + ofs] : begin;
@ -1648,16 +1649,16 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
uInt32 beginRead = debugger.getBaseAddress(begin, true);
uInt32 endRead = debugger.getBaseAddress(end, true);
uInt32 beginWrite = debugger.getBaseAddress(begin, false);
uInt32 endWrite = debugger.getBaseAddress(end, false);
uInt32 endWrite = debugger.getBaseAddress(end, false);
stringstream conditionBuf;
// parenthesize provided and address range condition(s) (begin)
if(hasCond)
conditionBuf << "(" << argStrings[0] << ")&&(";
// add address range condition(s) to provided condition
if(read)
{
{
if(beginRead != endRead)
conditionBuf << "__lastread>=" << Base::toString(beginRead) << "&&__lastread<=" << Base::toString(endRead);
else
@ -1688,7 +1689,7 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
if(myTraps[i]->begin == begin && myTraps[i]->end == end &&
myTraps[i]->read == read && myTraps[i]->write == write &&
myTraps[i]->condition == condition)
{
{
if(debugger.cpuDebug().m6502().delCondTrap(i))
{
add = false;
@ -1717,7 +1718,7 @@ void DebuggerParser::executeTraps(bool read, bool write, const string& command,
else
{
commandResult << red("invalid expression");
}
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@ -2528,7 +2529,7 @@ DebuggerParser::Command DebuggerParser::commands[kNumCommands] = {
false,
{ kARG_WORD, kARG_MULTI_BYTE },
std::mem_fn(&DebuggerParser::executeTrapif)
},
},
{
"trapread",

View File

@ -108,7 +108,7 @@ class DebuggerParser
uInt32 end;
string condition;
};
// Reference to our debugger object
Debugger& debugger;
@ -125,10 +125,10 @@ class DebuggerParser
StringList argStrings;
uInt32 argCount;
StringList myWatches;
StringList myWatches;
// Keep track of traps (read and/or write)
vector<unique_ptr<Trap>> myTraps;
vector<unique_ptr<Trap>> myTraps;
void listTraps(bool listCond);
string trapStatus(const Trap& trap);
@ -153,7 +153,7 @@ class DebuggerParser
void executeData();
void executeDebugColors();
void executeDefine();
void executeDelbreakif();
void executeDelbreakif();
void executeDelfunction();
void executeDeltrap();
void executeDelwatch();
@ -168,7 +168,7 @@ class DebuggerParser
void executeJump();
void executeListbreaks();
void executeListconfig();
void executeListfunctions();
void executeListfunctions();
void executeListtraps();
void executeLoadconfig();
void executeLoadstate();
@ -202,8 +202,8 @@ class DebuggerParser
void executeTrapif();
void executeTrapread();
void executeTrapreadif();
void executeTrapwrite();
void executeTrapwriteif();
void executeTrapwrite();
void executeTrapwriteif();
void executeTraps(bool read, bool write, const string& command, bool cond = false);
void executeTrapRW(uInt32 addr, bool read, bool write, bool add = true); // not exposed by debugger
void executeType();

View File

@ -81,14 +81,14 @@ class AtariVox : public SaveKey
/**
Notification method invoked by the system after its reset method has
been called. It may be necessary to override this method for
controllers that need to know a reset has occurred.
controllers that need to know a reset has occurred.
*/
void reset() override;
string about(bool swappedPorts) const override { return Controller::about(swappedPorts) + myAboutString; }
private:
void clockDataIn(bool value);
void clockDataIn(bool value);
private:
// Instance of an real serial port on the system

View File

@ -209,9 +209,10 @@ class Controller : public Serializable
Returns more detailed information about this controller.
*/
virtual string about(bool swappedPorts) const
{
return name() + " in " + (myJack == Left ^ swappedPorts ? "left port" : "right port");
}
{
return name() + " in " + ((myJack == Left) ^ swappedPorts ?
"left port" : "right port");
}
/**
The following two functions are used by the debugger to set

View File

@ -117,7 +117,7 @@ void RomInfoWidget::parseProperties()
myRomInfo.push_back("Rarity: " + myProperties.get(Cartridge_Rarity));
myRomInfo.push_back("Note: " + myProperties.get(Cartridge_Note));
bool swappedPorts = myProperties.get(Console_SwapPorts) == "YES";
myRomInfo.push_back("Controllers: " + (!swappedPorts
myRomInfo.push_back("Controllers: " + (!swappedPorts
? myProperties.get(Controller_Left) + " (left), " + myProperties.get(Controller_Right) + " (right)"
: myProperties.get(Controller_Right) + " (left), " + myProperties.get(Controller_Left) + " (right)"));
#if 0