forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Using the PSP's hardware debugger

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
accepttheownage



Joined: 18 Jun 2006
Posts: 17

PostPosted: Sat Oct 14, 2006 7:56 am    Post subject: Using the PSP's hardware debugger Reply with quote

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;
}
Back to top
View user's profile Send private message
accepttheownage



Joined: 18 Jun 2006
Posts: 17

PostPosted: Tue Oct 24, 2006 1:55 am    Post subject: Reply with quote

There must be someone that knows about debugging, I know Tyranid does, but he seems to be ignoring both my PMs and threads... anyone? =/
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group