Using the PSP's hardware debugger

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
accepttheownage
Posts: 17
Joined: Sun Jun 18, 2006 6:56 am

Using the PSP's hardware debugger

Post by accepttheownage »

I understand that in order to use the psp's hardware to debug (I'd like to set breakpoints) you need to first enable the hardware and create an exception handler, then pass the address to set a breakpoint on. Well, I've got the first two parts down, but I have no clue how I tell the debugger to set the breakpoint on a specific address. I cannot use PSPLink because I am developing a module for Devhook. Does this look right so far? (code borrowed from PSPLink)

Code: Select all

#include <pspkernel.h>
#include <pspdebug.h>
#include <pspsdk.h>
#include <string.h>

PSP_MODULE_INFO&#40;"HWDebugger", 0x1000, 1, 1&#41;;
PSP_MAIN_THREAD_ATTR&#40;0&#41;;

void debugEnableHW&#40;void&#41;
&#123;
	asm&#40; 
			"mfc0 $t0, $12\n"
			"lui  $t1, 8\n"
			"or   $t1, $t1, $t0\n"
			"mtc0 $t1, $12\n"
	   &#41;;
&#125;

void exhandler&#40;&#41;
&#123;
	//print hardware instr and address
&#125;

//Keep our module running
int main_thread&#40;SceSize args, void *argp&#41; &#123;
    while&#40;!sceKernelFindModuleByName&#40;"sceKernelLibrary"&#41;&#41;
        sceKernelDelayThread&#40;100000&#41;;

    sceKernelDelayThread&#40;1000000&#41;;

	debugEnableHW&#40;&#41;;

	sceKernelRegisterPriorityExceptionHandler&#40;24, 1, exhandler&#41;;

    while&#40;1&#41;
    &#123;
        sceKernelDelayThread&#40;20000&#41;;
    &#125;
    return 0;
&#125;


int module_start&#40;SceSize args, void *argp&#41; __attribute__&#40;&#40;alias&#40;"_start"&#41;&#41;&#41;;
int _start&#40;SceSize args, void *argp&#41;
&#123;
    sceKernelCreateThread&#40;"dbg_main_thread", main_thread, 100, 0x1000, 0, NULL&#41;;

    return 0;
&#125;
accepttheownage
Posts: 17
Joined: Sun Jun 18, 2006 6:56 am

Post by accepttheownage »

There must be someone that knows about debugging, I know Tyranid does, but he seems to be ignoring both my PMs and threads... anyone? =/
Post Reply