cannot get psplink and psp-gdb to work

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

Moderators: cheriff, TyRaNiD

Post Reply
Alberto
Posts: 51
Joined: Mon Feb 12, 2007 8:16 pm
Location: Sofia

cannot get psplink and psp-gdb to work

Post by Alberto »

Hi,

first, I must say that I made a seach on all the threads, and found many with my same problem, althou following their instructions didn't help me... here I go:
First, must say that I use a Fedora 7 box, downloaded and built the toolchain few days ago, use a PSP 1001 with CFW 5.00 M33-6.
I compile with the -g and -O0 flags, MAKE_PRX=1 and linking the relevant build_prx.mak file.
All works fine if I make an EBOOT.PBP and load it, either on the PSP, or by ./EBOOT.PBP in the psplink shell.

1. I run PSPLink v3.0 OE on my PSP
2. on a terminal I run usbhostfs_pc -t 100, and get the following:
USBHostFS (c) TyRaNiD 2k6
Built Nov 11 2009 16:04:22 - $Revision: 2368 $
Connected to device
3. on another terminal I run pspsh, and on the usbhostfs_pc terminal, I can see the following:
Accepting async connection (0) from 127.0.0.1
Accepting async connection (2) from 127.0.0.1
Accepting async connection (3) from 127.0.0.1
4. on the pspsh terminal, I type debug ./helloworld.prx, and get the following:
PSPLink USB GDBServer (c) 2k7 TyRaNiD
host0:/> Loaded host0:/helloworld.prx - UID 0x03B45F59, Entry 0x08804300
just to make sure, I set "gdbdebug on" in the usbhost temrinal.
Then I am supposed to run, in a new terminal, psp-gdb ./helloworld.elf ()
now, I am supposed to launch psp-gdb ./helloworld.elf, then the target thing..., which shows the following:
GNU gdb 6.8
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=i686-pc-linux-gnu --target=psp"...
(gdb) target remote localhost:10001
Remote debugging using localhost:10001
[New Thread 0]
exit_callback (arg1=Cannot access memory at address 0xffffffe8
) at main.cpp:16
16 int exit_callback(int arg1, int arg2, void *common)
(gdb)

...

if I type c, it shows only "Continuing." and then nothing happens, no prompt, no actions.

if, OTOH, I type start, it shows the following:
Breakpoint 1 at 0x88043c8: file main.cpp, line 44.
Starting program: /home/batman/Projects/PSP/HelloWorld/helloworld.elf
Don't know how to run. Try "help target".
after this I can type c, and it behaves like I described above in case of directly type c.

Can anybody help me have this to run properly?

P.S.
The program is just a basic helloworld, with the setupcallbacks thing, etc.

Thank you,
A.
jojojoris
Posts: 255
Joined: Sun Mar 30, 2008 4:06 am

Post by jojojoris »

Are you using a old version SDK?

Code: Select all

int main&#40;&#41;&#123;
     SetupCallbacks&#40;&#41;;
     makeNiceGame&#40;&#41;;
     sceKernelExitGame&#40;&#41;;
&#125;
Alberto
Posts: 51
Joined: Mon Feb 12, 2007 8:16 pm
Location: Sofia

Post by Alberto »

jojojoris wrote:Are you using a old version SDK?
I told you I downloaded few days ago, maybe on the 11th.
From svn co svn.ps2dev.org/psp/trunk/psptoolchain.

The program works, as I say; I just cannot debug it.
I have seen in other threads (while looking for a solution) that usually the debugger stops in crt0, in the _start thing... while for me it jumps directly far ahead...

Anybody can just post here the simplest helloworld and its makefile to compile it for the debugger, so that I can check it agains mine, and possibly exclude the possibility that the problem is in the toolchain/SDK?

TIA
A.
Alberto
Posts: 51
Joined: Mon Feb 12, 2007 8:16 pm
Location: Sofia

Post by Alberto »

ok,

say that after thinking on what I last wrote, I found that leaving MAKE_PRX = 1 in the Makefile, and including build.mak (instead of build_prx.mak, which seems obvious) I got something working... ;-)

Now the program stops inside _start, correctly. Then I just set a breakpoint at the beginning of main, with break main, and finally I can do c-ontinue, and various n-ext. Also until <line number> works fine.

Now the question is: how should the behavior of gdb be, when reaching the end of the program? I mean, if I have the setupcallbacks thing, I can (almost) end the program, but the program actually doesn't terminate (it hangs on the "plaease wait" sony system screen) and gdb is hung too (no prompt whatsoever).
It seems that the call to sceKernelExitGame() hangs it. Indeed if I terminate the program without the HOME button press, but instead have a loop on button presses, once I terminate all, and finally reach the sceKernelExitGame() call, the program exits, psplink resets (this is correct) but gdb still hungs, and I have to kill it somehow (almost always with ctrl-c a couple of times after resetting pspsh, then "y" and "quit")

Any enlightment on these issues?

Cheers, A.
Alberto
Posts: 51
Joined: Mon Feb 12, 2007 8:16 pm
Location: Sofia

Post by Alberto »

Alberto wrote: say that after thinking on what I last wrote, I found that leaving MAKE_PRX = 1 in the Makefile, and including build.mak (instead of build_prx.mak, which seems obvious) I got something working... ;-)
forgot to say that in this case I don't get any *.prx, but only the *.elf, which can be (to my surprise) loaded into pspsh with the debug statement... and I can confirm it works... Am I the only one??? Have I dioscovered a strange -thou beautifule, to some extent- behavior of the whole system?

Again, cheers, A.
Post Reply