mirror of
https://github.com/RKX1209/nsemu.git
synced 2024-06-23 14:43:16 -04:00
Add estimate counter for debug
This commit is contained in:
parent
ecce10b623
commit
bfbd53300d
|
@ -18,21 +18,21 @@ void RunLoop() {
|
|||
|
||||
void Dump() {
|
||||
int cnt = 1;
|
||||
ns_print ("CPU Dump:\n");
|
||||
debug_print ("CPU Dump:\n");
|
||||
for (int r = 0; r < GPR_DUMMY; r++) {
|
||||
if (!X(r))
|
||||
continue;
|
||||
if (r == GPR_LR)
|
||||
ns_print ("LR:\t");
|
||||
debug_print ("LR:\t");
|
||||
else if (r == GPR_SP)
|
||||
ns_print ("SP:\t");
|
||||
debug_print ("SP:\t");
|
||||
else
|
||||
ns_print ("X%d:\t", r);
|
||||
ns_print ("0x%016lx%c", X(r), cnt % 3 == 0 ? '\n' : '\t');
|
||||
debug_print ("X%d:\t", r);
|
||||
debug_print ("0x%016lx%c", X(r), cnt % 3 == 0 ? '\n' : '\t');
|
||||
cnt++;
|
||||
}
|
||||
ns_print ("PC:\t0x%016lx\n", PC);
|
||||
ns_print ("NZCV:\t0x%016lx\n", NZCV);
|
||||
debug_print ("PC:\t0x%016lx\n", PC);
|
||||
debug_print ("NZCV:\t0x%016lx\n", NZCV);
|
||||
}
|
||||
|
||||
static uint64_t counter;
|
||||
|
|
|
@ -17,21 +17,16 @@ int Interpreter::SingleStep() {
|
|||
void Interpreter::Run() {
|
||||
debug_print ("Running with Interpreter\n");
|
||||
static uint64_t counter = 0;
|
||||
uint64_t estimate = 3400000;
|
||||
while (Cpu::GetState () == Cpu::State::Running) {
|
||||
char c;
|
||||
//scanf("%c", &c);
|
||||
if (counter >= estimate) {
|
||||
Cpu::DumpMachine ();
|
||||
}
|
||||
SingleStep ();
|
||||
if (counter >= 241)
|
||||
break;
|
||||
counter++;
|
||||
// if (PC == 0x2d54) {
|
||||
// SingleStep ();
|
||||
// Cpu::DumpMachine ();
|
||||
// debug_print("Reach\n");
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
Cpu::DumpMachine ();
|
||||
}
|
||||
|
||||
/* ####### Callbacks ####### */
|
||||
|
|
|
@ -13,8 +13,8 @@ enum RunLevel {
|
|||
RUN_LEVEL_DEBUG,
|
||||
};
|
||||
|
||||
//static RunLevel curlevel = RUN_LEVEL_DEBUG;
|
||||
static RunLevel curlevel = RUN_LEVEL_RELEASE;
|
||||
static RunLevel curlevel = RUN_LEVEL_DEBUG;
|
||||
//static RunLevel curlevel = RUN_LEVEL_RELEASE;
|
||||
|
||||
static void util_print(RunLevel level, FILE *fp, const char *format, ...) {
|
||||
if (curlevel >= level) {
|
||||
|
|
Loading…
Reference in a new issue