ULTIMA8: Update and enable commands for usecode tracing

Basic infomation logged in usecode tracing, Define DEBUG_USECODE for detailed opcode tracing.
This commit is contained in:
Matthew Jimenez 2022-12-29 22:07:43 -06:00
parent a9297cbb45
commit b2b75baad5
4 changed files with 145 additions and 191 deletions

View File

@ -190,14 +190,11 @@ Debugger::Debugger() : Shared::Debugger() {
registerCmd("UCMachine::getGlobal", WRAP_METHOD(Debugger, cmdGetGlobal));
registerCmd("UCMachine::setGlobal", WRAP_METHOD(Debugger, cmdSetGlobal));
#ifdef DEBUG
registerCmd("UCMachine::traceObjID", WRAP_METHOD(Debugger, cmdTraceObjID));
registerCmd("UCMachine::tracePID", WRAP_METHOD(Debugger, cmdTracePID));
registerCmd("UCMachine::traceClass", WRAP_METHOD(Debugger, cmdTraceClass));
registerCmd("UCMachine::traceEvents", WRAP_METHOD(Debugger, cmdTraceEvents));
registerCmd("UCMachine::traceAll", WRAP_METHOD(Debugger, cmdTraceAll));
registerCmd("UCMachine::stopTrace", WRAP_METHOD(Debugger, cmdStopTrace));
#endif
registerCmd("FastAreaVisGump::toggle", WRAP_METHOD(Debugger, cmdToggleFastArea));
registerCmd("InverterProcess::invertScreen", WRAP_METHOD(Debugger, cmdInvertScreen));
@ -1618,8 +1615,6 @@ bool Debugger::cmdSetGlobal(int argc, const char **argv) {
return true;
}
#ifdef DEBUG
bool Debugger::cmdTracePID(int argc, const char **argv) {
if (argc != 2) {
debugPrintf("Usage: UCMachine::tracePID _pid\n");
@ -1677,15 +1672,6 @@ bool Debugger::cmdTraceAll(int argc, const char **argv) {
return true;
}
bool Debugger::cmdTraceEvents(int argc, const char **argv) {
UCMachine *uc = UCMachine::get_instance();
uc->_tracingEnabled = true;
uc->_traceEvents = true;
debugPrintf("UCMachine: tracing usecode events\n");
return true;
}
bool Debugger::cmdStopTrace(int argc, const char **argv) {
UCMachine *uc = UCMachine::get_instance();
uc->_traceObjIDs.clear();
@ -1693,15 +1679,11 @@ bool Debugger::cmdStopTrace(int argc, const char **argv) {
uc->_traceClasses.clear();
uc->_tracingEnabled = false;
uc->_traceAll = false;
uc->_traceEvents = false;
debugPrintf("Trace stopped\n");
return true;
}
#endif
bool Debugger::cmdVerifyQuit(int argc, const char **argv) {
QuitGump::verifyQuit();
return false;

View File

@ -234,14 +234,11 @@ private:
// UCMachine
bool cmdGetGlobal(int argc, const char **argv);
bool cmdSetGlobal(int argc, const char **argv);
#ifdef DEBUG
bool cmdTracePID(int argc, const char **argv);
bool cmdTraceObjID(int argc, const char **argv);
bool cmdTraceClass(int argc, const char **argv);
bool cmdTraceAll(int argc, const char **argv);
bool cmdTraceEvents(int argc, const char **argv);
bool cmdStopTrace(int argc, const char **argv);
#endif
// Miscellaneous
bool cmdToggleFastArea(int argc, const char **argv);

File diff suppressed because it is too large Load Diff

View File

@ -111,11 +111,9 @@ private:
static UCMachine *_ucMachine;
#ifdef DEBUG
// tracing
bool _tracingEnabled;
bool _traceAll;
bool _traceEvents;
Std::set<ObjId> _traceObjIDs;
Std::set<ProcId> _tracePIDs;
Std::set<uint16> _traceClasses;
@ -129,11 +127,6 @@ private:
return false;
}
public:
bool trace_event() const {
return (_tracingEnabled && (_traceAll || _traceEvents));
}
#endif
};
} // End of namespace Ultima8