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 

Debug PRX

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



Joined: 22 Mar 2009
Posts: 35

PostPosted: Thu Mar 26, 2009 7:12 am    Post subject: Debug PRX Reply with quote

How can I debug a kernel PRX?
printf on screen or writing to a file or ...?
Back to top
View user's profile Send private message
NoEffex



Joined: 27 Nov 2008
Posts: 108

PostPosted: Thu Mar 26, 2009 9:33 am    Post subject: Reply with quote

Be creative :).
_________________
Programming with:
Geany + Latest PSPSDK from svn
Back to top
View user's profile Send private message
MBx



Joined: 22 Mar 2009
Posts: 35

PostPosted: Thu Mar 26, 2009 5:30 pm    Post subject: Reply with quote

a hint please? :P
Back to top
View user's profile Send private message
MBx



Joined: 22 Mar 2009
Posts: 35

PostPosted: Thu Mar 26, 2009 8:09 pm    Post subject: Reply with quote

I've tried both printf and Kprintf but none of them seems to work.
I've also tried this (from psplink.h):
Code:

#define DEBUG_START { int fd; fd = sceIoOpen("ms0:/debug.txt", PSP_O_WRONLY | PSP_O_CREAT | PSP_O_TRUNC, 0666); sceIoClose(fd); }
`
#define DEBUG_PRINTF(fmt, ...) \
{ \
   int fd; \
   fd = sceIoOpen("ms0:/debug.txt", PSP_O_WRONLY | PSP_O_APPEND, 0666); \
   fdprintf(fd, fmt, ## __VA_ARGS__); \
   sceIoClose(fd); \
}

still nothing :(
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Thu Mar 26, 2009 9:29 pm    Post subject: Reply with quote

if you are using psplink, you can use stdout and stderr to output on pspsh

EDIT: ah ! kernel prx, oh well never mind.


Last edited by hlide on Thu Mar 26, 2009 11:14 pm; edited 1 time in total
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Thu Mar 26, 2009 9:52 pm    Post subject: Reply with quote

You need this for kernel mode to write to memory stick, suppose you are trying to log from an exported function that is a syscall.
include systemctrl.h and add -lpspsystemctrl_kernel from M33SDK

Code:
int k1 = pspSdkSetK1(0);
int level = sctrlKernelSetUserLevel(8);
SceUID fp = sceIoOpen("ms0:/seplugins/log.txt", PSP_O_WRONLY|PSP_O_CREAT, 0777);
sceIoLseek(fp, 0, SEEK_END);
sceIoWrite(fp, "log data", strlen("log data"));
sceIoClose(fp);
sctrlKernelSetUserLevel(level);
pspSdkSetK1(k1);
Back to top
View user's profile Send private message
MBx



Joined: 22 Mar 2009
Posts: 35

PostPosted: Fri Mar 27, 2009 2:23 am    Post subject: Reply with quote

I included the "systemctrl.h" from M33SDK (4.01M33 any newer?) and the following compile errors:

Code:
psp/sdk/include/systemctrl.h (200) : error: expected ')' before '*' t
oken
psp/sdk/include/systemctrl.h (241) : error: expected '=', ',', ';', '
asm' or '__attribute__' before 'sctrlHENSetStartModuleHandler'


is it really this HARD to just SEE some text somewhere? :(

just for curiosity: what is the user level 8?
and what is this M33SDK at all? any doc around? :p
Back to top
View user's profile Send private message
MBx



Joined: 22 Mar 2009
Posts: 35

PostPosted: Fri Mar 27, 2009 4:53 am    Post subject: Reply with quote

OK, just replaced "fdprintf" with "sceIoWrite" and everything seems to work.

what's the difference between this two anyway?
is there any write function like "sceIoWrite" with printf format support?
is there any possible way to see Kernel output on screen?
Back to top
View user's profile Send private message
Torch



Joined: 28 May 2008
Posts: 842

PostPosted: Fri Mar 27, 2009 1:50 pm    Post subject: Reply with quote

MBx wrote:

is there any possible way to see Kernel output on screen?


Print it directly into video memory. Search for blit.c blit.h font.c which can do this.
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