Updated debugger prompt commands 'trap', 'trapread' and 'trapwrite'

to work like the old 'm' versions, so they work on all mirrors and
also allow one to enter a range of values to trap.  Added more
stringent error checking for parameters.
This commit is contained in:
Stephen Anthony 2017-04-06 20:22:00 -02:30
parent 9736bdd3e8
commit 4e794ba778
3 changed files with 69 additions and 78 deletions

View File

@ -14,6 +14,8 @@
4.7.3 to 5.0: (xxx. xx, 2017) 4.7.3 to 5.0: (xxx. xx, 2017)
* Stella has moved from Sourceforge to Github.
* New TIA core: TODO - gather info on all new functionality: * New TIA core: TODO - gather info on all new functionality:
- RSYNC - RSYNC
- YStart autodetection - YStart autodetection
@ -24,7 +26,8 @@
finding documentation that finally describes in more detail how the finding documentation that finally describes in more detail how the
M6532 chip actually works. M6532 chip actually works.
* Added BUS and CDF bankswitching schemes, thanks to SpiceWare. * Added BUS and CDF bankswitching schemes, and also ARM Timer 1
support; special thanks to SpiceWare for the code.
* Fixed bug with SaveKey and AtariVox not properly closing their memory * Fixed bug with SaveKey and AtariVox not properly closing their memory
files before starting another instance of the same ROM, when the ROM files before starting another instance of the same ROM, when the ROM
@ -39,8 +42,11 @@
currently active TIA palette currently active TIA palette
- The previous trap'm' commands now work when setting TIA read - The previous trap'm' commands now work when setting TIA read
addresses; previously they only worked for write addresses addresses; previously they only worked for write addresses
- The previous trap'm' commands are now renamed 'trap', 'trapread'
and 'trapwrite'
- Command completion now works with internal functions and pseudo-ops - Command completion now works with internal functions and pseudo-ops
(basically, anything starting with the '_' character) (basically, anything starting with the '_' character)
- In general, input error checking is much more strictly enforced.
* Mouse grabbing is now enabled in windowed mode only when the ROM is * Mouse grabbing is now enabled in windowed mode only when the ROM is
using a virtual analog controller (paddles, trakball, etc). using a virtual analog controller (paddles, trakball, etc).
@ -61,7 +67,7 @@
this bug has only ever occurred in Windows XP, but it's been there this bug has only ever occurred in Windows XP, but it's been there
since Stella 4.1. since Stella 4.1.
* When in 'ROM launcher mode', Stella now uses less CPU time. * When in 'ROM launcher mode', Stella now uses slightly less CPU time.
* Added ROM properties for D.K. VCS homebrew ROM, thanks to Andreas * Added ROM properties for D.K. VCS homebrew ROM, thanks to Andreas
Dietrich. Dietrich.

View File

@ -1459,75 +1459,77 @@ void DebuggerParser::executeTrace()
// "trap" // "trap"
void DebuggerParser::executeTrap() void DebuggerParser::executeTrap()
{ {
executeTrapRW(true, true); if(argCount > 2)
{
commandResult << red("Command takes one or two arguments") << endl;
return;
}
uInt32 beg = args[0];
uInt32 end = argCount == 2 ? args[1] : beg;
if(beg > 0xFFFF || end > 0xFFFF)
{
commandResult << red("One or more addresses are invalid") << endl;
return;
}
for(uInt32 addr = beg; addr <= end; ++addr)
executeTrapRW(addr, true, true);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "trapread" // "trapread"
void DebuggerParser::executeTrapread() void DebuggerParser::executeTrapread()
{ {
executeTrapRW(true, false); if(argCount > 2)
{
commandResult << red("Command takes one or two arguments") << endl;
return;
}
uInt32 beg = args[0];
uInt32 end = argCount == 2 ? args[1] : beg;
if(beg > 0xFFFF || end > 0xFFFF)
{
commandResult << red("One or more addresses are invalid") << endl;
return;
}
for(uInt32 addr = beg; addr <= end; ++addr)
executeTrapRW(addr, true, false);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "trapwrite" // "trapwrite"
void DebuggerParser::executeTrapwrite() void DebuggerParser::executeTrapwrite()
{ {
executeTrapRW(false, true); if(argCount > 2)
{
commandResult << red("Command takes one or two arguments") << endl;
return;
}
uInt32 beg = args[0];
uInt32 end = argCount == 2 ? args[1] : beg;
if(beg > 0xFFFF || end > 0xFFFF)
{
commandResult << red("One or more addresses are invalid") << endl;
return;
}
for(uInt32 addr = beg; addr <= end; ++addr)
executeTrapRW(addr, false, true);
} }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// wrapper function for trap/trapread/trapwrite commands // wrapper function for trap/trapread/trapwrite commands
void DebuggerParser::executeTrapRW(bool read, bool write) void DebuggerParser::executeTrapRW(uInt32 addr, bool read, bool write)
{ {
uInt32 beg = args[0];
uInt32 end = argCount >= 2 ? args[1] : beg;
if(beg > end) std::swap(beg, end);
for(uInt32 i = beg; i <= end; ++i)
{
if(read) debugger.toggleReadTrap(i);
if(write) debugger.toggleWriteTrap(i);
commandResult << trapStatus(i) << endl;
}
}
#if 0
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "trapm"
void DebuggerParser::executeTrapM()
{
executeTrapMRW(true, true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "trapreadm"
void DebuggerParser::executeTrapreadM()
{
executeTrapMRW(true, false);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "trapwritem"
void DebuggerParser::executeTrapwriteM()
{
executeTrapMRW(false, true);
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// wrapper function for trapm/trapreadm/trapwritem commands
void DebuggerParser::executeTrapMRW(bool read, bool write)
{
uInt32 addr = args[0];
uInt32 beg = argCount > 1 ? args[1] : 0;
uInt32 end = argCount > 2 ? args[2] : 0xFFFF;
if(beg > end) std::swap(beg, end);
switch(debugger.cartDebug().addressType(addr)) switch(debugger.cartDebug().addressType(addr))
{ {
case CartDebug::ADDR_TIA: case CartDebug::ADDR_TIA:
{ {
for(uInt32 i = beg; i <= end; ++i) for(uInt32 i = 0; i <= 0xFFFF; ++i)
{ {
if((i & 0x1080) == 0x0000) if((i & 0x1080) == 0x0000)
{ {
@ -1541,7 +1543,7 @@ void DebuggerParser::executeTrapMRW(bool read, bool write)
} }
case CartDebug::ADDR_IO: case CartDebug::ADDR_IO:
{ {
for(uInt32 i = beg; i <= end; ++i) for(uInt32 i = 0; i <= 0xFFFF; ++i)
{ {
if((i & 0x1080) == 0x0080 && (i & 0x0200) != 0x0000 && (i & 0x02FF) == addr) if((i & 0x1080) == 0x0080 && (i & 0x0200) != 0x0000 && (i & 0x02FF) == addr)
{ {
@ -1553,7 +1555,7 @@ void DebuggerParser::executeTrapMRW(bool read, bool write)
} }
case CartDebug::ADDR_ZPRAM: case CartDebug::ADDR_ZPRAM:
{ {
for(uInt32 i = beg; i <= end; ++i) for(uInt32 i = 0; i <= 0xFFFF; ++i)
{ {
if((i & 0x1080) == 0x0080 && (i & 0x0200) == 0x0000 && (i & 0x00FF) == addr) if((i & 0x1080) == 0x0080 && (i & 0x0200) == 0x0000 && (i & 0x00FF) == addr)
{ {
@ -1565,25 +1567,9 @@ void DebuggerParser::executeTrapMRW(bool read, bool write)
} }
case CartDebug::ADDR_ROM: case CartDebug::ADDR_ROM:
{ {
// Enforce range? if(addr >= 0x1000 && addr <= 0xFFFF)
if(argCount > 1)
{ {
if(beg < addr) beg = addr & 0xF000; for(uInt32 i = 0x1000; i <= 0xFFFF; ++i)
if(end < beg) beg = end;
}
else
{
beg = 0x1000;
end = 0xFFFF;
}
// Are we in range?
if(!(addr >= beg && addr <= end))
{
commandResult << "Address " << addr << " is outside range" << endl;
return;
}
for(uInt32 i = beg; i <= end; ++i)
{ {
if((i % 0x2000 >= 0x1000) && (i & 0x0FFF) == (addr & 0x0FFF)) if((i % 0x2000 >= 0x1000) && (i & 0x0FFF) == (addr & 0x0FFF))
{ {
@ -1591,14 +1577,13 @@ void DebuggerParser::executeTrapMRW(bool read, bool write)
if(write) debugger.toggleWriteTrap(i); if(write) debugger.toggleWriteTrap(i);
} }
} }
}
break; break;
} }
} }
commandResult << trapStatus(addr) << " + mirrors from $" commandResult << trapStatus(addr) << " + mirrors" << endl;
<< Base::HEX4 << beg << " - $" << end << endl;
} }
#endif
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// "type" // "type"

View File

@ -180,7 +180,7 @@ class DebuggerParser
void executeTrap(); void executeTrap();
void executeTrapread(); void executeTrapread();
void executeTrapwrite(); void executeTrapwrite();
void executeTrapRW(bool read, bool write); // not exposed by debugger void executeTrapRW(uInt32 addr, bool read, bool write); // not exposed by debugger
void executeType(); void executeType();
void executeUHex(); void executeUHex();
void executeUndef(); void executeUndef();