So, my main goal is to modify a MIPS simulator to display the contents of the register file during run time. I searched around in the simulator's cpp files and this is what I've determined:
There is a file called "ThreadContext.h" which contains the lines:
typedef long ValueGPR;
...
class ThreadContext {
...
public:
ValueGPR reg[33];
...
...
}
...
And "reg[]" is what I need to access in the following file called "ExecutionFlow.cpp":
...
#include ".../ThreadContext.h"
...
long ExecutionFlow::exeInst(void) {
...
//ADD PRINTF OF reg[1] - reg[32] HERE
...
}
...
How do I access reg in ExecutionFlow.cpp? Do I make a global pointer in the ThreadContext object? How do I do that and where do I look for said object?