Debug PRX

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

Moderators: cheriff, TyRaNiD

Post Reply
MBx
Posts: 35
Joined: Sun Mar 22, 2009 12:52 am

Debug PRX

Post by MBx »

How can I debug a kernel PRX?
printf on screen or writing to a file or ...?
NoEffex
Posts: 106
Joined: Thu Nov 27, 2008 6:48 am

Post by NoEffex »

Be creative :).
Programming with:
Geany + Latest PSPSDK from svn
MBx
Posts: 35
Joined: Sun Mar 22, 2009 12:52 am

Post by MBx »

a hint please? :P
MBx
Posts: 35
Joined: Sun Mar 22, 2009 12:52 am

Post by MBx »

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

Code: Select all

#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 :(
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

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.
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

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: Select all

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);
MBx
Posts: 35
Joined: Sun Mar 22, 2009 12:52 am

Post by MBx »

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

Code: Select all

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
MBx
Posts: 35
Joined: Sun Mar 22, 2009 12:52 am

Post by MBx »

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?
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

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.
Post Reply