PSP Hacks - Forums

Go Back   PSP Hacks - Forums > PSP Community > PSP Programming & Development

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 10-28-2009, 01:52 AM
Stinkee2's Avatar
Stinkee2 Stinkee2 is offline
Programmer
PSP Smarty
 

Join Date: Jul 2009
Location: int main()
Posts: 190
Stinkee2 is on a distinguished road
Default pspDebugInstallErrorHandler()?

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

Last edited by Stinkee2; 10-28-2009 at 02:02 AM.
Reply With Quote
  #2  
Old 10-29-2009, 12:43 PM
pirata nervo pirata nervo is offline
Moderator
PSP Titan
 

Join Date: Mar 2007
Location: www.consoleworld.net
Posts: 5,556
pirata nervo is on a distinguished road
Default

pspDebugInstallErrorHandler () is for 1.50 kernel only as far as I remember
__________________

Reply With Quote
  #3  
Old 10-29-2009, 09:32 PM
Stinkee2's Avatar
Stinkee2 Stinkee2 is offline
Programmer
PSP Smarty
 

Join Date: Jul 2009
Location: int main()
Posts: 190
Stinkee2 is on a distinguished road
Default

Ok, thanks pirata.
__________________
-----------------------------------------
View my current project's Progress Here
Reply With Quote
Reply

 



Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:18 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©