debug: get rid of excessive "Reading beyond end of cart" messages

This commit is contained in:
zeromus 2010-03-18 18:57:36 +00:00
parent ee66bde8a0
commit 298c5256e3
4 changed files with 57 additions and 3 deletions

View File

@ -1343,7 +1343,7 @@ u32 MMU_readFromGC()
if(card.address >= gameInfo.romsize)
{
INFO("Reading beyond end of cart! ... %08X > %08X\n",card.address, gameInfo.romsize);
DEBUG_Notify.ReadBeyondEndOfCart(card.address,gameInfo.romsize);
}
//but, this is actually handled by the cart rom buffer being oversized and full of 0xFF.
//is this a good idea? We think so.

View File

@ -1911,6 +1911,7 @@ void NDS_exec(s32 nb)
lagframecounter = 0;
}
currFrameCounter++;
DEBUG_Notify.NextFrame();
if (cheats)
cheats->process();
}

View File

@ -203,6 +203,7 @@ void DEBUG_reset()
debugFlag = 1;
#endif
DEBUG_Notify = DebugNotify();
DEBUG_statistics = DebugStatistics();
printf("DEBUG_reset: %08X\n",&DebugStatistics::print); //force a reference to this function
}
@ -346,4 +347,37 @@ void NocashMessage(armcpu_t* cpu)
sprintf(tmp,"%lld",nds_timer); todo = mass_replace(todo,"%totalclks%",tmp);
printf("%s",todo.c_str());
}
}
//-------
DebugNotify DEBUG_Notify;
//enable bits arent being used right now.
//if you want exhaustive logging, move the print before the early return (or comment the early return)
//the intent of this system is to provide a compact dialog box showing which debug notifies have been
//triggered in this frame (with a glowing LED!) and which debug notifies have been triggered EVER
//which can be cleared, like a clip indicator in an audio tool.
//obviously all this isnt implemented yet.
void DebugNotify::NextFrame()
{
#ifdef DEVELOPER
pingBits.reset();
#endif
}
void DebugNotify::ReadBeyondEndOfCart(u32 addr, u32 romsize)
{
#ifdef DEVELOPER
if(!ping(DEBUG_NOTIFY_READ_BEYOND_END_OF_CART)) return;
INFO("Reading beyond end of cart! ... %08X > %08X\n",addr,romsize);
#endif
}
bool DebugNotify::ping(EDEBUG_NOTIFY which)
{
bool wasPinged = pingBits[(int)which];
pingBits[(int)which] = true;
return !wasPinged;
}

View File

@ -24,6 +24,7 @@
#include <vector>
#include <iostream>
#include <cstdarg>
#include <bitset>
#include "types.h"
#include "mem.h"
@ -146,9 +147,27 @@ enum EDEBUG_EVENT
DEBUG_EVENT_WRITE=2, //write on arm9 or arm7 bus
DEBUG_EVENT_EXECUTE=4, //prefetch on arm9 or arm7, triggered after the read event
DEBUG_EVENT_ACL_EXCEPTION=8, //acl exception on arm9
};
enum EDEBUG_NOTIFY
{
DEBUG_NOTIFY_READ_BEYOND_END_OF_CART,
DEBUG_NOTIFY_MAX
};
class DebugNotify
{
public:
void NextFrame();
void ReadBeyondEndOfCart(u32 addr, u32 romsize);
private:
std::bitset<DEBUG_NOTIFY_MAX> pingBits;
std::bitset<DEBUG_NOTIFY_MAX> enableBits;
bool ping(EDEBUG_NOTIFY which);
};
extern DebugNotify DEBUG_Notify;
//information about a debug event will be stuffed into here by the generator
struct TDebugEventData
{