Added debugging traces to lazyusf

CQTexperiment
Chris Moeller 2015-02-21 00:55:46 -08:00
parent d066dfce6e
commit e7fb5f001e
5 changed files with 85 additions and 3 deletions

View File

@ -112,6 +112,11 @@
83C8B6F818AF58090071B040 /* usf_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C8B6A818AF58080071B040 /* usf_internal.h */; }; 83C8B6F818AF58090071B040 /* usf_internal.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C8B6A818AF58080071B040 /* usf_internal.h */; };
83C8B6F918AF58090071B040 /* usf.c in Sources */ = {isa = PBXBuildFile; fileRef = 83C8B6A918AF58080071B040 /* usf.c */; }; 83C8B6F918AF58090071B040 /* usf.c in Sources */ = {isa = PBXBuildFile; fileRef = 83C8B6A918AF58080071B040 /* usf.c */; };
83C8B6FA18AF58090071B040 /* usf.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C8B6AA18AF58080071B040 /* usf.h */; settings = {ATTRIBUTES = (Public, ); }; }; 83C8B6FA18AF58090071B040 /* usf.h in Headers */ = {isa = PBXBuildFile; fileRef = 83C8B6AA18AF58080071B040 /* usf.h */; settings = {ATTRIBUTES = (Public, ); }; };
83CA14741A987E91005E7ED4 /* preproc.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CA146E1A987E91005E7ED4 /* preproc.h */; };
83CA14751A987E91005E7ED4 /* dbg_decoder.c in Sources */ = {isa = PBXBuildFile; fileRef = 83CA14701A987E91005E7ED4 /* dbg_decoder.c */; };
83CA14761A987E91005E7ED4 /* dbg_decoder.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CA14711A987E91005E7ED4 /* dbg_decoder.h */; };
83CA14771A987E91005E7ED4 /* dbg_decoder_local.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CA14721A987E91005E7ED4 /* dbg_decoder_local.h */; };
83CA14781A987E91005E7ED4 /* dbg_types.h in Headers */ = {isa = PBXBuildFile; fileRef = 83CA14731A987E91005E7ED4 /* dbg_types.h */; };
83FBECBA18ECE86B00311448 /* ucodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FBECB918ECE86B00311448 /* ucodes.h */; }; 83FBECBA18ECE86B00311448 /* ucodes.h in Headers */ = {isa = PBXBuildFile; fileRef = 83FBECB918ECE86B00311448 /* ucodes.h */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */
@ -223,6 +228,11 @@
83C8B6A918AF58080071B040 /* usf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = usf.c; sourceTree = "<group>"; }; 83C8B6A918AF58080071B040 /* usf.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = usf.c; sourceTree = "<group>"; };
83C8B6AA18AF58080071B040 /* usf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = usf.h; sourceTree = "<group>"; }; 83C8B6AA18AF58080071B040 /* usf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = usf.h; sourceTree = "<group>"; };
83C8B6FD18AF59E70071B040 /* lazyusf-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "lazyusf-Info.plist"; sourceTree = "<group>"; }; 83C8B6FD18AF59E70071B040 /* lazyusf-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "lazyusf-Info.plist"; sourceTree = "<group>"; };
83CA146E1A987E91005E7ED4 /* preproc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = preproc.h; sourceTree = "<group>"; };
83CA14701A987E91005E7ED4 /* dbg_decoder.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dbg_decoder.c; sourceTree = "<group>"; };
83CA14711A987E91005E7ED4 /* dbg_decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dbg_decoder.h; sourceTree = "<group>"; };
83CA14721A987E91005E7ED4 /* dbg_decoder_local.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dbg_decoder_local.h; sourceTree = "<group>"; };
83CA14731A987E91005E7ED4 /* dbg_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dbg_types.h; sourceTree = "<group>"; };
83FBECB918ECE86B00311448 /* ucodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ucodes.h; sourceTree = "<group>"; }; 83FBECB918ECE86B00311448 /* ucodes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ucodes.h; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */
@ -299,6 +309,8 @@
83C8B62B18AF57770071B040 /* lazyusf */ = { 83C8B62B18AF57770071B040 /* lazyusf */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
83CA146D1A987E91005E7ED4 /* osal */,
83CA146F1A987E91005E7ED4 /* debugger */,
8319EF1F1A219BE7009DD5C4 /* audiolib.c */, 8319EF1F1A219BE7009DD5C4 /* audiolib.c */,
8319EF201A219BE7009DD5C4 /* audiolib.h */, 8319EF201A219BE7009DD5C4 /* audiolib.h */,
8319EF1B1A2198B9009DD5C4 /* os.c */, 8319EF1B1A2198B9009DD5C4 /* os.c */,
@ -415,6 +427,25 @@
path = vu; path = vu;
sourceTree = "<group>"; sourceTree = "<group>";
}; };
83CA146D1A987E91005E7ED4 /* osal */ = {
isa = PBXGroup;
children = (
83CA146E1A987E91005E7ED4 /* preproc.h */,
);
path = osal;
sourceTree = "<group>";
};
83CA146F1A987E91005E7ED4 /* debugger */ = {
isa = PBXGroup;
children = (
83CA14701A987E91005E7ED4 /* dbg_decoder.c */,
83CA14711A987E91005E7ED4 /* dbg_decoder.h */,
83CA14721A987E91005E7ED4 /* dbg_decoder_local.h */,
83CA14731A987E91005E7ED4 /* dbg_types.h */,
);
path = debugger;
sourceTree = "<group>";
};
/* End PBXGroup section */ /* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */ /* Begin PBXHeadersBuildPhase section */
@ -426,6 +457,7 @@
83C8B6AC18AF58080071B040 /* audio.h in Headers */, 83C8B6AC18AF58080071B040 /* audio.h in Headers */,
837841C118C847B2002C4FE5 /* audio.h in Headers */, 837841C118C847B2002C4FE5 /* audio.h in Headers */,
83C8B6B118AF58080071B040 /* dma.h in Headers */, 83C8B6B118AF58080071B040 /* dma.h in Headers */,
83CA14781A987E91005E7ED4 /* dbg_types.h in Headers */,
83A2249518CAC28500FE4173 /* hle.h in Headers */, 83A2249518CAC28500FE4173 /* hle.h in Headers */,
83C8B6AD18AF58080071B040 /* config.h in Headers */, 83C8B6AD18AF58080071B040 /* config.h in Headers */,
83A2249318CAC28500FE4173 /* hle_internal.h in Headers */, 83A2249318CAC28500FE4173 /* hle_internal.h in Headers */,
@ -435,6 +467,7 @@
8378417018C6E56B002C4FE5 /* arithmetics.h in Headers */, 8378417018C6E56B002C4FE5 /* arithmetics.h in Headers */,
8319EF221A219BE7009DD5C4 /* audiolib.h in Headers */, 8319EF221A219BE7009DD5C4 /* audiolib.h in Headers */,
83C8B6C018AF58080071B040 /* registers.h in Headers */, 83C8B6C018AF58080071B040 /* registers.h in Headers */,
83CA14741A987E91005E7ED4 /* preproc.h in Headers */,
83C8B6BE18AF58080071B040 /* pif.h in Headers */, 83C8B6BE18AF58080071B040 /* pif.h in Headers */,
83C8B6F618AF58090071B040 /* tlb.h in Headers */, 83C8B6F618AF58090071B040 /* tlb.h in Headers */,
83C8B6F718AF58090071B040 /* types.h in Headers */, 83C8B6F718AF58090071B040 /* types.h in Headers */,
@ -442,6 +475,7 @@
8319EF1E1A2198B9009DD5C4 /* os.h in Headers */, 8319EF1E1A2198B9009DD5C4 /* os.h in Headers */,
83C8B6BC18AF58080071B040 /* opcode.h in Headers */, 83C8B6BC18AF58080071B040 /* opcode.h in Headers */,
83C8B6B718AF58080071B040 /* interpreter_ops.h in Headers */, 83C8B6B718AF58080071B040 /* interpreter_ops.h in Headers */,
83CA14761A987E91005E7ED4 /* dbg_decoder.h in Headers */,
83C8B6B318AF58080071B040 /* exception.h in Headers */, 83C8B6B318AF58080071B040 /* exception.h in Headers */,
83C8B6AF18AF58080071B040 /* cpu.h in Headers */, 83C8B6AF18AF58080071B040 /* cpu.h in Headers */,
83C8B6F118AF58090071B040 /* vsubc.h in Headers */, 83C8B6F118AF58090071B040 /* vsubc.h in Headers */,
@ -461,6 +495,7 @@
83C8B6D218AF58080071B040 /* vge.h in Headers */, 83C8B6D218AF58080071B040 /* vge.h in Headers */,
83C8B6C518AF58080071B040 /* su.h in Headers */, 83C8B6C518AF58080071B040 /* su.h in Headers */,
83C8B6C218AF58080071B040 /* execute.h in Headers */, 83C8B6C218AF58080071B040 /* execute.h in Headers */,
83CA14771A987E91005E7ED4 /* dbg_decoder_local.h in Headers */,
83C8B6E518AF58080071B040 /* vnop.h in Headers */, 83C8B6E518AF58080071B040 /* vnop.h in Headers */,
83C8B6E418AF58080071B040 /* vne.h in Headers */, 83C8B6E418AF58080071B040 /* vne.h in Headers */,
83C8B6D418AF58080071B040 /* vmacf.h in Headers */, 83C8B6D418AF58080071B040 /* vmacf.h in Headers */,
@ -584,6 +619,7 @@
8378416A18C6E56B002C4FE5 /* alist.c in Sources */, 8378416A18C6E56B002C4FE5 /* alist.c in Sources */,
83C8B6AE18AF58080071B040 /* cpu.c in Sources */, 83C8B6AE18AF58080071B040 /* cpu.c in Sources */,
83C8B6AB18AF58080071B040 /* audio.c in Sources */, 83C8B6AB18AF58080071B040 /* audio.c in Sources */,
83CA14751A987E91005E7ED4 /* dbg_decoder.c in Sources */,
83A2249418CAC28500FE4173 /* hle.c in Sources */, 83A2249418CAC28500FE4173 /* hle.c in Sources */,
8319EF191A219846009DD5C4 /* cpu_hle.c in Sources */, 8319EF191A219846009DD5C4 /* cpu_hle.c in Sources */,
8319EF1D1A2198B9009DD5C4 /* os.c in Sources */, 8319EF1D1A2198B9009DD5C4 /* os.c in Sources */,
@ -676,6 +712,7 @@
FRAMEWORK_VERSION = A; FRAMEWORK_VERSION = A;
GCC_PREPROCESSOR_DEFINITIONS = ( GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1", "DEBUG=1",
DEBUG_INFO,
ARCH_MIN_SSE2, ARCH_MIN_SSE2,
); );
GCC_WARN_PEDANTIC = YES; GCC_WARN_PEDANTIC = YES;
@ -683,6 +720,7 @@
INSTALL_PATH = "@loader_path/../Frameworks"; INSTALL_PATH = "@loader_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = lazyusf;
WRAPPER_EXTENSION = framework; WRAPPER_EXTENSION = framework;
}; };
name = Debug; name = Debug;
@ -704,6 +742,7 @@
INSTALL_PATH = "@loader_path/../Frameworks"; INSTALL_PATH = "@loader_path/../Frameworks";
PRODUCT_NAME = "$(TARGET_NAME)"; PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES; SKIP_INSTALL = YES;
USER_HEADER_SEARCH_PATHS = lazyusf;
WRAPPER_EXTENSION = framework; WRAPPER_EXTENSION = framework;
}; };
name = Release; name = Release;

View File

@ -54,6 +54,10 @@ void AiLenChanged(usf_state_t * state) {
length = AI_LEN_REG & 0x3FFF8; length = AI_LEN_REG & 0x3FFF8;
#ifdef DEBUG_INFO
fprintf(stderr, "Audio buffer queued from %08x for %d bytes\n", AI_DRAM_ADDR_REG, length);
#endif
AddBuffer(state, state->RDRAM+address, length); AddBuffer(state, state->RDRAM+address, length);
if(length && !(AI_STATUS_REG&0x80000000)) { if(length && !(AI_STATUS_REG&0x80000000)) {

View File

@ -524,6 +524,9 @@ void RefreshScreen (usf_state_t * state){
} }
void RunRsp (usf_state_t * state) { void RunRsp (usf_state_t * state) {
#ifdef DEBUG_INFO
fprintf(stderr, "RSP Task:");
#endif
if ( ( SP_STATUS_REG & SP_STATUS_HALT ) == 0) { if ( ( SP_STATUS_REG & SP_STATUS_HALT ) == 0) {
if ( ( SP_STATUS_REG & SP_STATUS_BROKE ) == 0 ) { if ( ( SP_STATUS_REG & SP_STATUS_BROKE ) == 0 ) {
@ -537,6 +540,10 @@ void RunRsp (usf_state_t * state) {
if ((SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 ) if ((SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 )
MI_INTR_REG |= 1; MI_INTR_REG |= 1;
#ifdef DEBUG_INFO
fprintf(stderr, " DList - interrupts %d\n", MI_INTR_REG);
#endif
CheckInterrupts(state); CheckInterrupts(state);
DPC_STATUS_REG &= ~0x0002; DPC_STATUS_REG &= ~0x0002;
@ -545,7 +552,7 @@ void RunRsp (usf_state_t * state) {
} }
break; break;
case 2: { case 2: {
fprintf(stderr, " AList");
break; break;
} }
break; break;
@ -557,10 +564,15 @@ void RunRsp (usf_state_t * state) {
real_run_rsp(state, 100); real_run_rsp(state, 100);
SP_STATUS_REG |= (0x0203 ); SP_STATUS_REG |= (0x0203 );
if ((SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 ) { if ((SP_STATUS_REG & SP_STATUS_INTR_BREAK) != 0 ) {
#ifdef DEBUG_INFO
fprintf(stderr, " - interrupt");
#endif
MI_INTR_REG |= 1; MI_INTR_REG |= 1;
CheckInterrupts(state); CheckInterrupts(state);
} }
#ifdef DEBUG_INFO
fprintf(stderr, "\n");
#endif
} }
} }
} }

View File

@ -33,9 +33,20 @@ void CheckInterrupts ( usf_state_t * state ) {
MI_INTR_REG &= ~MI_INTR_AI; MI_INTR_REG &= ~MI_INTR_AI;
MI_INTR_REG |= (state->AudioIntrReg & MI_INTR_AI); MI_INTR_REG |= (state->AudioIntrReg & MI_INTR_AI);
#ifdef DEBUG_INFO
if (MI_INTR_REG)
fprintf(stderr, "Interrupt %d - ", MI_INTR_REG);
#endif
if ((MI_INTR_MASK_REG & MI_INTR_REG) != 0) { if ((MI_INTR_MASK_REG & MI_INTR_REG) != 0) {
#ifdef DEBUG_INFO
fprintf(stderr, "triggered\n");
#endif
FAKE_CAUSE_REGISTER |= CAUSE_IP2; FAKE_CAUSE_REGISTER |= CAUSE_IP2;
} else { } else {
#ifdef DEBUG_INFO
if (MI_INTR_REG)
fprintf(stderr, "masked\n");
#endif
FAKE_CAUSE_REGISTER &= ~CAUSE_IP2; FAKE_CAUSE_REGISTER &= ~CAUSE_IP2;
} }

View File

@ -703,6 +703,10 @@ void RunFunction(usf_state_t * state, uint32_t address) {
state->NextInstruction = la; state->NextInstruction = la;
} }
#ifdef DEBUG_INFO
#include "debugger/dbg_decoder.h"
#endif
void ExecuteInterpreterOpCode (usf_state_t * state) { void ExecuteInterpreterOpCode (usf_state_t * state) {
@ -714,6 +718,18 @@ void ExecuteInterpreterOpCode (usf_state_t * state) {
return; return;
} }
#ifdef DEBUG_INFO
{
static const char filler[] = " ";
char opcode[256];
char arguments[256];
r4300_decode_op(state->Opcode.u.Hex, opcode, arguments, state->PROGRAM_COUNTER);
strcat(opcode, filler);
opcode[16] = '\0';
fprintf(stderr, "%08x: %s %s\n", state->PROGRAM_COUNTER, opcode, arguments);
}
#endif
COUNT_REGISTER += 2; COUNT_REGISTER += 2;
state->Timers->Timer -= 2; state->Timers->Timer -= 2;
@ -737,7 +753,7 @@ void ExecuteInterpreterOpCode (usf_state_t * state) {
state->PROGRAM_COUNTER += 4; state->PROGRAM_COUNTER += 4;
break; break;
case JUMP: case JUMP:
if (state->cpu_hle_entry_count && if (0 && state->cpu_hle_entry_count &&
DoCPUHLE(state, state->JumpToLocation)) { DoCPUHLE(state, state->JumpToLocation)) {
state->PROGRAM_COUNTER = state->GPR[31].UW[0]; state->PROGRAM_COUNTER = state->GPR[31].UW[0];
state->NextInstruction = NORMAL; state->NextInstruction = NORMAL;