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 

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

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



Joined: 23 Dec 2006
Posts: 18

PostPosted: Tue Dec 30, 2008 11:37 pm    Post subject: [Betarelease]PSPDebug 0.8(GUI for PSPLink 3.0){UPD:10.01.08} Reply with quote

[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=ea35fb6bfd84d4f091b20cc0d07ba4d237dda37ef9323b9c

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



Joined: 23 Dec 2006
Posts: 18

PostPosted: Tue Jan 06, 2009 2:57 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
KickinAezz



Joined: 03 Jun 2007
Posts: 328

PostPosted: Tue Jan 06, 2009 5:24 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
phobox



Joined: 24 Mar 2008
Posts: 140

PostPosted: Tue Jan 06, 2009 6:58 am    Post subject: Reply with quote

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



Joined: 23 Dec 2006
Posts: 18

PostPosted: Tue Jan 06, 2009 7:26 am    Post subject: Reply with quote

I think I forgot one dll file.

You can download the installer for those files there:
http://www.codeplex.com/ScintillaNET/Release/ProjectReleases.aspx?ReleaseId=15804

Will add the dll files in the next release, sorry for that.
Back to top
View user's profile Send private message
phobox



Joined: 24 Mar 2008
Posts: 140

PostPosted: Tue Jan 06, 2009 7:48 am    Post subject: Reply with quote

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



Joined: 23 Dec 2006
Posts: 18

PostPosted: Tue Jan 06, 2009 6:25 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
phobox



Joined: 24 Mar 2008
Posts: 140

PostPosted: Tue Jan 06, 2009 10:53 pm    Post subject: Reply with quote

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



Joined: 21 Feb 2008
Posts: 386

PostPosted: Tue Jan 06, 2009 11:55 pm    Post subject: Reply with quote

I've a error, unable to find my function, does this program recognize module_start?
Anyway thanks, very good and usefull app!
_________________
Get Xplora!
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Wed Jan 07, 2009 3:36 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
CrazyT



Joined: 23 Dec 2006
Posts: 18

PostPosted: Wed Jan 07, 2009 4:09 am    Post subject: Reply with quote

Quote:
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).

Quote:
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")
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Wed Jan 07, 2009 4:42 am    Post subject: Reply with quote

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 :)
Back to top
View user's profile Send private message
CrazyT



Joined: 23 Dec 2006
Posts: 18

PostPosted: Thu Jan 08, 2009 3:00 am    Post subject: Reply with quote

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".
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Thu Jan 08, 2009 3:08 am    Post subject: Reply with quote

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
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