Page 1 of 1

Hello all. I'm new to PS2 development

Posted: Sun Mar 04, 2007 4:48 am
by cosmito
Hi all,

I recently bought a PS2 console in second hand at a nice price and become aware of the homebrew scene.

Using a boot disc (i'm not going to say here for avoiding advetising issues) and LaunchELF I already tried some great PS2 homebrew stuff like SMS player (great!), a sega, SNES and Amiga emulators, some demos.

I already got a precompiled toolchain for windows and compiled some stuff (some demos), booting them from a USB compatible pendrive and LaunchELF, of course.

Now I'm considering in buying a network adapter for the PS2 since as far I understood, it speeds up a lot the process of running code on PS2 over my current solution : saving to the pen drive, booting the PS2 with the disc, and repeating the whole process for the next .elf to execute is just to time consuming.

My big concern is about debugging. Yes, i'm not the best programmer of the world for sure and I make a lot of bugs, specially in C :)

Debbuging on the PS2 is a drag, isn't it ? Even with the network utilities I have the impression that ins't possible to trace the C source during debugging, only catch the exceptions and locate the error over the native code ... Am I wrong ?

Well, i'm a bit too spoiled by modern debugging systems for the PC, i guess.

I would like to hear from you some advice, specially regarding the debugging matter.

Thanks

Posted: Sun Mar 04, 2007 5:07 am
by ps2devman
when exception occurs on ee side you get address in native code yes.
(for example 0x10010a)

but if you compiled with -g, you can use this to find source line number :

addr2line -e prog.elf 10010a

it will display :
"module name: line number"

so, it's ok... not so hard to debug

Posted: Sun Mar 04, 2007 7:46 am
by cosmito
Hi ps2devman,

I already have read something like that on
http://lukasz.dk/programming/playstatio ... debugging/

But I wonder if it's possible to, for example, get the contents of variables and such things usually done during debugging, at debug time (stepping though, etc)

My impression is that isn't possible.
Well, I could be worst...

Posted: Sun Mar 04, 2007 5:48 pm
by ps2devman
Maybe try ps2gdb (I've never tried it myself).
You can download it with this command under cygwin:
svn checkout svn://svn.pspdev.org/ps2/trunk/ps2gdb


The Readme of ps2gdb says this :

INTRODUCTION
----------------------------------------------------------------------------

ps2gdbStub is a tcp stub for the gnu debugger. It could be easily changed
to not use tcp. The low level portion reads 128 bits for the 32 gprs and
also for lo and hi, although these are converted down to 32 bits before
sending to the remote GDB.

Currently, the code *must* be uploaded via pukklink or ps2link. Naplink
won't do it!

As for building the remote GDB, I configured gdb as mips-idt-elf and hacked
about with it a bit. I managed to get the latest weekly snapshot (which at
time of writing was gdb+dejagnu-20030801.tar.bz2) to work, after some hacking
around. I've included a .cmd file for use with the remote GDB. You'll need
to change the target line with the correct IP of your ps2. To invoke, from
the shell, type <gdb -x ps2.cmd>

With reference to the frame pointer, gpr $30 should be the frame pointer,
this is what the MIPS abi says anyway. However, our toolchain appears to use
grp $30 as another saved register (s8), so I just report the fp to be the
same as the sp at the moment.


COPYRIGHT FOR PS2GDBSTUB
----------------------------------------------------------------------------

Copyright (c) 2003 Ray Donnelly ([email protected])
All rights reserved.

Posted: Sun Mar 04, 2007 9:11 pm
by cosmito
Thanks for the tip, again.
It seems nice :)

I'll check it as soon I buy the network adapter.