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" }, { "_rwport", "Address at which a read from a write port occurred" },
{ "_scan", "Current scanline count" }, { "_scan", "Current scanline count" },
{ "_vblank", "Whether vertical blank is enabled (1 or 0)" }, { "_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: // CPU address access functions:
/*{ "__lastread", "last CPU read address" }, /*{ "__lastread", "last CPU read address" },
{ "__lastwrite", "last CPU write address" },*/ { "__lastwrite", "last CPU write address" },*/
// empty string marks end of list, do not remove // 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; ostringstream buf;
buf << message; buf << message;
if(address > -1) if(address > -1)
buf << cartDebug().getLabel(address, read); buf << cartDebug().getLabel(address, read);
myDialog->message().setText(buf.str()); myDialog->message().setText(buf.str());
return true; return true;
} }
@ -418,45 +418,47 @@ bool Debugger::writeTrap(uInt16 t)
{ {
return writeTraps().isInitialized() && writeTraps().isSet(t); return writeTraps().isInitialized() && writeTraps().isSet(t);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
uInt32 Debugger::getBaseAddress(uInt32 addr, bool read) uInt32 Debugger::getBaseAddress(uInt32 addr, bool read)
{ {
if((addr & 0x1080) == 0x0000) // (addr & 0b 0001 0000 1000 0000) == 0b 0000 0000 0000 0000 if((addr & 0x1080) == 0x0000) // (addr & 0b 0001 0000 1000 0000) == 0b 0000 0000 0000 0000
{
if(read) if(read)
// ADDR_TIA read (%xxx0 xxxx 0xxx ????) // ADDR_TIA read (%xxx0 xxxx 0xxx ????)
return addr & 0x000f; // 0b 0000 0000 0000 1111 return addr & 0x000f; // 0b 0000 0000 0000 1111
else else
// ADDR_TIA write (%xxx0 xxxx 0x?? ????) // ADDR_TIA write (%xxx0 xxxx 0x?? ????)
return addr & 0x003f; // 0b 0000 0000 0011 1111 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 if((addr & 0x1280) == 0x0080) // (addr & 0b 0001 0010 1000 0000) == 0b 0000 0000 1000 0000
return addr & 0x00ff; // 0b 0000 0000 1111 1111 return addr & 0x00ff; // 0b 0000 0000 1111 1111
// ADDR_ROM // ADDR_ROM
if(addr & 0x1000) if(addr & 0x1000)
return addr & 0x1fff; // 0b 0001 1111 1111 1111 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 if((addr & 0x1284) == 0x0280) // (addr & 0b 0001 0010 1000 0100) == 0b 0000 0010 1000 0000
return addr & 0x0283; // 0b 0000 0010 1000 0011 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 if(!read && (addr & 0x1294) == 0x0294) // (addr & 0b 0001 0010 1001 0100) == 0b 0000 0010 1001 0100
return addr & 0x029f; // 0b 0000 0010 1001 1111 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 if(read && (addr & 0x1285) == 0x0284) // (addr & 0b 0001 0010 1000 0101) == 0b 0000 0010 1000 0100
return addr & 0x028c; // 0b 0000 0010 1000 1100 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 if(read && (addr & 0x1285) == 0x0285) // (addr & 0b 0001 0010 1000 0101) == 0b 0000 0010 1000 0101
return addr & 0x0285; // 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 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; return 0;
} }

View File

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

View File

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

View File

@ -81,14 +81,14 @@ class AtariVox : public SaveKey
/** /**
Notification method invoked by the system after its reset method has Notification method invoked by the system after its reset method has
been called. It may be necessary to override this method for 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; void reset() override;
string about(bool swappedPorts) const override { return Controller::about(swappedPorts) + myAboutString; } string about(bool swappedPorts) const override { return Controller::about(swappedPorts) + myAboutString; }
private: private:
void clockDataIn(bool value); void clockDataIn(bool value);
private: private:
// Instance of an real serial port on the system // 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. Returns more detailed information about this controller.
*/ */
virtual string about(bool swappedPorts) const 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 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("Rarity: " + myProperties.get(Cartridge_Rarity));
myRomInfo.push_back("Note: " + myProperties.get(Cartridge_Note)); myRomInfo.push_back("Note: " + myProperties.get(Cartridge_Note));
bool swappedPorts = myProperties.get(Console_SwapPorts) == "YES"; 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_Left) + " (left), " + myProperties.get(Controller_Right) + " (right)"
: myProperties.get(Controller_Right) + " (left), " + myProperties.get(Controller_Left) + " (right)")); : myProperties.get(Controller_Right) + " (left), " + myProperties.get(Controller_Left) + " (right)"));
#if 0 #if 0