[Betarelease]PSPDebug 0.8(GUI for PSPLink 3.0){UPD:10.01.08}

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

Moderators: cheriff, TyRaNiD

Post Reply
CrazyT
Posts: 18
Joined: Sat Dec 23, 2006 6:47 pm

[Betarelease]PSPDebug 0.8(GUI for PSPLink 3.0){UPD:10.01.08}

Post by CrazyT »

[Updateinfo]
Latest update from 08.01.08.

Improvements to 0.81:
- improved modulelist (context menu now automatically selects item)
- added contextmenu to threadlist
- added colors to threadlist

Check Makefile of the example, if you want to debug your own project.
(debugging settings need to be set with "CFLAGS = -g -O0", thx to "jbit" for helping me to find that out)


I decided to develop a little graphical userinterface for the tool called "PSPLink".
PSPLink was created by TyRaNiD,Julian T,Rasmus B and John_K and allows you to view memory and processinformation.
Because of the fact that this tool is useful, but not very userfriendly without any interface i will create this little program wich should help some people out there.
(for reversing parts of programs,creating trainers,plugins or other things ...)
At the moment you can't really debug things ... just analyse.
You can set breakpoints, but at the moment the program does not stop at that location.
(Only the PSP stops at those locations and your PSP may stop, so be careful with testing this ... but you can still use pspssh as usual)

I added some additional files that are not done by me.
This includes:
-syscalls.txt
-usbhostfs_pc.exe
-pspsh.exe
-psp-objdump.exe
-driver folder
-ScintillaNet.dll
-Examples were from pspsdk and was slightly modified(mainly the Makefile)
-remotejoy.prx + RemotejoySDL ("Remote Joy SDL for PSP (c) TyRaNiD 2k6")

Just added them incase somebody does not want to compile the whole toolchain.
The source can ofcourse be requested.
At the moment its only build for windows systems.

Quick info:
Use "Break" in threadwindow to stop the selected thread (will stop on address in debugwindow).
Use F2 to set breakpoints in debugwindow.
Use F9 for continue a process in the debugwindow.
Use F8 to step over commands in the debugwindow.
Use F7 to stop into commands in the debugwindow.
Doubleclick a line that has an offset to jump to that offset.

Screenshots: http://www.mediafire.com/?sharekey=ea35 ... 7ef9323b9c

Download base-version
(only includes additional file):
http://www.mediafire.com/?jimzmztglfz

Download PSPDebug 0.81(contains the executable):
http://www.mediafire.com/?nnzmxndmmzm

Download-Folder(with all files, also older versions):
http://www.mediafire.com/PSPDebug

You may also need to install:
http://ps2dev.org/psp/Tools/PspLink/PSPLINK_2.0
On your PSP, incase you do not already have it installed.
Seplugin-files only: http://www.mediafire.com/?yzuikj5mnzd


Current things i need help with:

-Finding out why remotejoy.prx turns the psp off, if you try to restart.

-Please let me know, if you know how to build a c# executable for linux.

There seems to be only 1 connection with pspsh possible.
That way its impossible to listen for breakpoints, because it will terminate the listener, if you need to get new information from psplink.
Is there a way to open more than one pspsh without this problem and without the need of modifying psplink itself?

I will need some information/examples for the following commands of psplink:
thpri - Change a threads current priority
thcreat - Create a new thread

-Stopping or Killing a module results an 0x80020136-Error.
Last edited by CrazyT on Mon Jan 12, 2009 3:07 am, edited 19 times in total.
CrazyT
Posts: 18
Joined: Sat Dec 23, 2006 6:47 pm

Post by CrazyT »

Versionupdate to 0.6.
http://img98.imageshack.us/img98/9775/pspdbgoz9.jpg

Guess i will try to implement something that lets you show the content of the variables.
This of course could be kinda difficult because of different structure and content.
Does somebody know how to get addresses of those variables?
(with psp-objdump or whatever?)

Note:
There still seems to be an error with the new feature.
(can sometimes not access a stream sometimes for some reason)
Hopefully i will find it out.
If you have a problem, be shure to restart PSP and the program.
The window can't be used to change the source, although you can edit it.
For some reason the box is empty, if i set the readonly feature of the component.
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

Very nice work.

Can you add more commands to GUI ?

Like all under help misc, help thread, help fileio ?

Like ability of kill threads, stop modules, change events flags, etc
Intrigued by PSP system Since December 2006.
Use it more for Development than for Gaming.
phobox
Posts: 127
Joined: Mon Mar 24, 2008 6:22 pm

Post by phobox »

erm,,, i have a problem:

at the start i have an exception.
(i have already tried to put the scintilla dll in the system32 folder...)

************** Testo dell'eccezione **************(=text of exception)
System.IO.FileNotFoundException: The Scintilla library could not be found. Please place the library in a searchable path such as the application or 'C:\WINDOWS\system32' directory. ---> System.ComponentModel.Win32Exception: Impossibile trovare il modulo specificato (=cannot find the specified module)
in ScintillaNet.Scintilla.get_CreateParams()
in System.Windows.Forms.Control..ctor(Boolean autoInstallSyncContext)
in System.Windows.Forms.Control..ctor()
in ScintillaNet.Scintilla..ctor()
in PSP_Debug.CppDebug.InitializeComponent()
in PSP_Debug.CppDebug..ctor(Mainwindow Opener)
in PSP_Debug.Mainwindow.Mainwindow_Load(Object sender, EventArgs e)
in System.Windows.Forms.Form.OnLoad(EventArgs e)
in System.Windows.Forms.Form.OnCreateControl()
in System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
in System.Windows.Forms.Control.CreateControl()
in System.Windows.Forms.Control.WmShowWindow(Message& m)
in System.Windows.Forms.Control.WndProc(Message& m)
in System.Windows.Forms.ScrollableControl.WndProc(Message& m)
in System.Windows.Forms.ContainerControl.WndProc(Message& m)
in System.Windows.Forms.Form.WmShowWindow(Message& m)
in System.Windows.Forms.Form.WndProc(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
in System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
in System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)


************** Assembly caricati **************(=loaded assembly)
mscorlib
Versione assembly: 2.0.0.0
Versione Win32: 2.0.50727.1433 (REDBITS.050727-1400)
Base di codice: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------
PSP-Debug
Versione assembly: 0.6.0.0
Versione Win32: 0.6.0.0
Base di codice: file:///D:/PSPDebug_0.6/PSPDebug_0.6/PSP-Debug.exe
----------------------------------------
System.Windows.Forms
Versione assembly: 2.0.0.0
Versione Win32: 2.0.50727.1433 (REDBITS.050727-1400)
Base di codice: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System
Versione assembly: 2.0.0.0
Versione Win32: 2.0.50727.1433 (REDBITS.050727-1400)
Base di codice: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Drawing
Versione assembly: 2.0.0.0
Versione Win32: 2.0.50727.1433 (REDBITS.050727-1400)
Base di codice: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Windows.Forms.resources
Versione assembly: 2.0.0.0
Versione Win32: 2.0.50727.42 (RTM.050727-4200)
Base di codice: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_it_b77a5c561934e089/System.Windows.Forms.resources.dll
----------------------------------------
ScintillaNet
Versione assembly: 2.0.3138.25704
Versione Win32: 2.0.0.0
Base di codice: file:///D:/PSPDebug_0.6/PSPDebug_0.6/ScintillaNet.DLL
----------------------------------------
mscorlib.resources
Versione assembly: 2.0.0.0
Versione Win32: 2.0.50727.1433 (REDBITS.050727-1400)
Base di codice: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
----------------------------------------



how can i solve my problem?

i have this problem both in xp and vista.
Ciao! from Italy
CrazyT
Posts: 18
Joined: Sat Dec 23, 2006 6:47 pm

Post by CrazyT »

I think I forgot one dll file.

You can download the installer for those files there:
http://www.codeplex.com/ScintillaNET/Re ... seId=15804

Will add the dll files in the next release, sorry for that.
phobox
Posts: 127
Joined: Mon Mar 24, 2008 6:22 pm

Post by phobox »

ok,
file missing:
-SciLexer.dll
-cygwin1.dll
-cygusb0.dll


but now a new problem: (in the dos window of usbhostfs_pc)
3 [main] usbhostfs_pc 4116 dtable::stdio_init:couldn't make stderr dinstict from stdout.

..but it seems to work properly anyway...
Ciao! from Italy
CrazyT
Posts: 18
Joined: Sat Dec 23, 2006 6:47 pm

Post by CrazyT »

Alright, files have been added.
For me it shows an empty screen for "usbhostfs_pc" although i'm only redirecting the input-stream.
No idea why this happens.
Of course explains your error, but shouldn't influence the program itself, because it does not need the output of "usbhostfs_pc" for now.
If you have other ideas like "KickinAezz" had, you can of course tell it me.
I will try to implement them.
phobox
Posts: 127
Joined: Mon Mar 24, 2008 6:22 pm

Post by phobox »

ok these are my ideas (a bit long):

-when getting module info (one click on the list of loaded modules), on the right display also threads and callbacks of that module (modinfo uid -t and modinfo uid -c) and divide the reuslts in 3 boxes..
-rightclickbox on a module with the options to "modstop" "modunld" "modstun" "kill" "modexp" "modimp"
-options to modload modstart modexec ldstart
-on the module exports and module imports pages (opened with their option in the rightclickbox as said above) that contain a list of all the exports or imports of that module, the possibility to use modfindx and modfindi.
-as it is possible to see the loaded modules, it would be nice to see the list of threads (thlist)and each line of this table will have a different color according to the status of the thread: sleeping delayed suspended dormant (thsllist, thdelist, thsulist, thdolist)
-one click on a row of this table will make visible on the right (like now for the modules) the info on that thread (thinfo)
-rightclickbox on the items of this thread list to perform some actions on these threads: suspend, esume, wakeup, terminate, delete, terminate and delete "thctx" change priority (with a message dialog to change the value), the possibility to create a new thread.
-managment of events (evlist, evdel, evset, evclr)
-managment of semaphres,message boxes, callbacks, virtual timers, variable and fixed pools, messagepipes, thread events (in one word: type in pspsh "help thread" and try to implement those features)
-then of couse you should implement all others features of the command line psplink =), take your time.

now other things:
-maybe implementing a custom version of psplink mixed with remotejoy to have the possibility to leave alone the psp and do everything on the PC: a window to see the contents of the psp screen and under this the buttons (linked to keypresses) to command the psp.
-browse files in the devices of the psp (ms0: flash0: flash1 etc etc..)and the possibility to copy remove etc these files
-transfer files from pc to psp and the opposite.

this is my wishlist, it is big so you can chose what to implement.
keep on with the good work, and thanks tyranid for PSPlink!, never forget this.


EDIT: i've seen now that the thread list is there! sorry for that
Ciao! from Italy
ne0h
Posts: 386
Joined: Thu Feb 21, 2008 2:15 am

Post by ne0h »

I've a error, unable to find my function, does this program recognize module_start?
Anyway thanks, very good and usefull app!
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

It might be worth you knowning that the interface between pspsh and usbhostfs_pc is just a TCP socket, something super easy in .NET. The protocol is also pretty simple, I can probably try and remember what it was now, but it is sort of a call/response style command set (unlike the old version of psplink which was 100% text based). I could probably try and dig out my protocol doc (if it still exists). So you could actually dump pspsh entirely and talk over a TCP socket which also might make it easier to use on linux, maybe :)

You would loose the inbuilt disasm/asm and pspkerror from pspsh but that could be relatively easily rewritten in C#, wouldn't be totally out of the realms of possibility.
CrazyT
Posts: 18
Joined: Sat Dec 23, 2006 6:47 pm

Post by CrazyT »

I've a error, unable to find my function, does this program recognize module_start?
Anyway thanks, very good and usefull app!
The current Cpp-Debugger stops on the main-function.
First i tryed to make it stop at the module entrypoint, but that produces a crash ... (I guess this happens because PSPLink loads the file and stops with it because of the breakpoint).
It might be worth you knowning that the interface between pspsh and usbhostfs_pc is just a TCP socket, something super easy in .NET. The protocol is also pretty simple, I can probably try and remember what it was now, but it is sort of a call/response style command set (unlike the old version of psplink which was 100% text based). I could probably try and dig out my protocol doc (if it still exists). So you could actually dump pspsh entirely and talk over a TCP socket which also might make it easier to use on linux, maybe :)
Yeah, actually you don't need the pspsh.exe anymore.
At the moment it uses sockets and checks for SHELL_CMD_BEGIN,SHELL_CMD_SUCCESS, SHELL_CMD_ERROR,SHELL_CMD_END.
At the moment it uses regular expressions to parse the output of psplink.
(i know ... normaly you do not do sth. like that, but it looks like it is fast enough)
I'm using psp-objdump for disassembling btw.

Added a small update.
At the moment it is a bit limited and only shows local variables.
"CS"(at the image) stands for codesection/function ... will replace that later with the function-name.
Also it only supports int and float for now.
(need to find a complete list of those types :/ just know that 0x2d1 means its int and 0x2ed means its float on the output of "psp-readelf.exe -wi sprite.elf")
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Well it was kinda half way between a completely dumb client and a smart client (my ultimate goal was probably to have almost all work done on the PC side with a simpler command set going to the PSP). Though I don't do anymore work on psplink anymore.

One thing I wish I had added is a command for exceptions though, atm when an exception occurs it dumps to text output (as I assume you noticed) but really it should return maybe a specific command (and maybe whether it is a debug exception or an error) and then the client would send back exprint and disasm $epc to print what it already does, that would make it easier handle debugging. Oh well unlikely to get done now :)
CrazyT
Posts: 18
Joined: Sat Dec 23, 2006 6:47 pm

Post by CrazyT »

Alright, i implemented the module-context menu wich allows you to load,start,unload and stop modules.
Also added a button on main-menu for restarting the psp.
A context-menu for the threadlist will be implemented later.
The idea about a virtual screen of the psp would be cool.
Sadly i have no idea how to implement it for now.
Does the PSP have a special offset-address in memory for the current screen?
If yes i could simply dump the memory of that area in an intervall and update the image.
For some reason "Load & Start" does not work for now, although it uses psplink's "modexec" command.(any idea why it does not work?)
I know i could make a work around, by just executing "modload" and "modstart", but i thought it should be possible with "modexec",too.
But you can load and start a module by using "Load" and "Start".
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

The modexec command is to do a LoadExec of a program which is unlikely to be what you want (and probably doesn't work anymore anyway :P), you want ldstart (or ld) which is load and start a module.

Oh and as for showing the screen you would have to implement the remotejoy screen protocol really, although you _could_ at a push repeatedly call scrshot say every second to get a rough idea and use a picture box to load the bitmap into (then delete it again). Ultra hack but would work :P
Post Reply