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 

Problem with psp-gdb

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



Joined: 20 Nov 2007
Posts: 3

PostPosted: Thu Sep 18, 2008 2:04 pm    Post subject: Problem with psp-gdb Reply with quote

Hi everyone!

I just ported my engine code to PSP and I want to use gdb to be able to debug it. From what I understand, I have a really standard dev env. I've been able to reproduce the problem with the sprite sample from the sdk. I modified the makefile to compile it as a PRX since i've got a slim, and I added debug info (-g)... well to be able to debug :)

* I'm using cygwin under WinXP
* I obtained the latest pspdev from svn
* I built everything and got no error... except for remote joy. As mentionned in other threads, it does need linux/joystick.h but this package is not available under cygwin? I don't need remote joy so I don't really care :)
* I start usbhostfs_pc
* I start pspsh, then "debug sprite.prx"
* I then proceed to debug using GDB... Here's what I get :

Code:

$ psp-gdb sprite.elf
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-cygwin --target=psp"...
(gdb) target remote:10001
Remote debugging using :10001
[New Thread 0]
_start (args=0, argp=0x0) at crt0_prx.c:109
109             if (&sce_newlib_nocreate_thread_in_start != NULL) {
(gdb) break main
Breakpoint 1 at 0x88042d0: file sprite.c, line 71.
(gdb) c
Continuing.
[New Thread 72894009]
[Switching to Thread 72894009]

Breakpoint 1, main (argc=Cannot access memory at address 0xbbbfe00
) at sprite.c:71
71              setupCallbacks();
(gdb) next
75              for (i = 0; i < NUM_SLICES; ++i)
(gdb) next
77                      for (j = 0; j < NUM_ROWS; ++j)
(gdb) next
79                              float s = i + 0.5f, t = j;
(gdb) next
82                              x = (RING_SIZE + RING_RADIUS * cosf(s * ((GU_PI*2)/NUM_SLICES))) * cosf(t * ((GU_PI*2)/NUM_ROWS)
);
(gdb)



As you can see, the problem is this:
Code:

Breakpoint 1, main (argc=Cannot access memory at address 0xbbbfe00
) at sprite.c:71


GDB is reporting a wrong address for argc, even if it's not really the case. My code runs ok outside of GDB.

Has anyone seen this ? The problem is that I would like to use Eclipse, but it chokes when gdb give this error.

Thanks for your help!
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Thu Sep 18, 2008 3:11 pm    Post subject: Reply with quote

Hmm a bug surfaces :) The problem is GDB implements a range restriction on what addresses it is willing to read to prevent GDB itself from crashing. Unfortunately now people have forced psplink to run with the large memory model on slims your stack frame is above the old 32MB limit and GDB refuses to read the memory.

Not sure if I feel like fixing it personally ;) You could change it yourself if you checkout a copy of psplinkusb from subversion and hard code it. You would need to change the file usbgdb/main.c then on lines 128 and 163 change the 0x0A000000 to 0x0C000000 and copy that new version of the usbgdb.prx on to your memory stick.

A "proper" fix would inspect the size of the memory regions ;)
Back to top
View user's profile Send private message
BobJelly



Joined: 20 Nov 2007
Posts: 3

PostPosted: Fri Sep 19, 2008 1:37 pm    Post subject: Reply with quote

Oh yeah, you were right! That was exactly the problem. Now I'm able to debug using Eclipse :)

Thanks for the quick response!

And thanks a LOT for this amazing tool that is PSPLINK... It makes everything so much easier !!
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