accepttheownage
Joined: 18 Jun 2006 Posts: 17
|
Posted: Sat Oct 14, 2006 7:56 am Post subject: Using the PSP's hardware debugger |
|
|
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: | #include <pspkernel.h>
#include <pspdebug.h>
#include <pspsdk.h>
#include <string.h>
PSP_MODULE_INFO("HWDebugger", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
void debugEnableHW(void)
{
asm(
"mfc0 $t0, $12\n"
"lui $t1, 8\n"
"or $t1, $t1, $t0\n"
"mtc0 $t1, $12\n"
);
}
void exhandler()
{
//print hardware instr and address
}
//Keep our module running
int main_thread(SceSize args, void *argp) {
while(!sceKernelFindModuleByName("sceKernelLibrary"))
sceKernelDelayThread(100000);
sceKernelDelayThread(1000000);
debugEnableHW();
sceKernelRegisterPriorityExceptionHandler(24, 1, exhandler);
while(1)
{
sceKernelDelayThread(20000);
}
return 0;
}
int module_start(SceSize args, void *argp) __attribute__((alias("_start")));
int _start(SceSize args, void *argp)
{
sceKernelCreateThread("dbg_main_thread", main_thread, 100, 0x1000, 0, NULL);
return 0;
} |
|
|