I need to call this function to maybe see whats causing my programs to crash and find the line and file using psp-addr2line...
the only problem is that pspDebugInstallErrorHandler() causes my psp to crash!?!? this is EXTREMELY frustrating. I have no idea whats causing it, the example in the pspsdk works perfectly though. so it's obviously something with my code. but I even made my function that calls pspDebugInstallErrorHandler look exactly like it does in the sample, and it still crashes! what the heck is going on here?
heres my code:
Spoiler:
Code:
int EGPMain()
{
SceCtrlData pad;
SetupCallbacks();
pspDebugScreenInit();
/* Install our custom exception handler. If this was NULL then the default would be used */
if(pspDebugInstallErrorHandler(MyExceptionHandler) < 0)
{
printf("Error installing Exception Handler");
}
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_DIGITAL);
pspDebugScreenPrintf("Exception Sample\n\n");
pspDebugScreenPrintf("You have two choices, press O for a bus error or X for a breakpoint\n\n");
while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CIRCLE)
{
/* Cause a bus error */
_sw(0, 0);
}
if(pad.Buttons & PSP_CTRL_CROSS)
{
/* Cause a break exception */
asm("break\r\n");
}
sceDisplayWaitVblankStart();
}
/* We will never end up here, hopefully */
printf("End\n");
sceKernelExitDeleteThread(0);
return 0;
}
Code:
PSP_MODULE_INFO("Homebrew",0x1000,1,1);
void MyExceptionHandler(PspDebugRegBlock *regs)
{
/* Do normal initial dump, setup screen etc */
pspDebugScreenInit();
/* I always felt BSODs were more interesting than white on black */
pspDebugScreenSetBackColor(0x00FF0000);
pspDebugScreenSetTextColor(0xFFFFFFFF);
pspDebugScreenClear();
pspDebugScreenPrintf("I regret to inform you your psp has just crashed\n");
pspDebugScreenPrintf("Please contact Sony technical support for further information\n\n");
pspDebugScreenPrintf("Exception Details:\n");
pspDebugDumpException(regs);
pspDebugScreenPrintf("\nBlame the 3rd party software, it cannot possibly be our fault!\n");
WaitForInput();
sceKernelExitGame();
}
int main()
{
SetupPSP();
InitGraphics();
if(Exceptions)
{
try
{
return EGPMain();
}
catch(__Ex ExceptionHandler)
{
if(Graphics)
{
sceGuTerm();
pspDebugScreenClear();
}
printf("\nAn Error Has Occured!\n");
printf("-------Error Info-------\n");
printf("Error: %s.\n",ExceptionHandler.ExInfo.Message);
printf("File: %s.\n",ExceptionHandler.ExInfo.File);
printf("Line: %s.\n",ExceptionHandler.ExInfo.Line);
printf("Object: %s.\n",ExceptionHandler.ExInfo.ObjName);
printf("Function: %s\n",ExceptionHandler.ExInfo.Function);
if(Env->RunTime->Seconds == 1){printf("Execution Time: %d Second, Total Frames Rendered: %d\n",Env->RunTime->Seconds,Env->Frame);}
if(Env->RunTime->Seconds != 1){printf("Execution Time: %d Seconds, Total Frames Rendered: %d\n",Env->RunTime->Seconds,Env->Frame);}
printf("Additional Info: %s.\n",ExceptionHandler.ExInfo.AdditionalInfo);
sceKernelSleepThreadCB();
return 1;
}
catch(...)
{
if(Graphics)
{
sceGuTerm();
pspDebugScreenClear();
}
printf("\nAn Error Has Occured!\n");
printf("-------Error Info-------\n");
printf("No Information\n");
if(Env->RunTime->Seconds == 1){printf("Execution Time: %d Second, Total Frames Rendered: %d\n",Env->RunTime->Seconds,Env->Frame);}
if(Env->RunTime->Seconds != 1){printf("Execution Time: %d Seconds, Total Frames Rendered: %d\n",Env->RunTime->Seconds,Env->Frame);}
sceKernelSleepThreadCB();
return 1;
}
}
else
{
return EGPMain();
}
return 0;
}
there is already a try/catch Exception handler I made for my program,but thats for other stuff. does anybody have any info on what might be hapenning here?
__________________
-----------------------------------------
View my current project's Progress Here