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 

Debugging with Eclipse

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



Joined: 15 Dec 2007
Posts: 31

PostPosted: Mon Dec 31, 2007 3:29 pm    Post subject: Debugging with Eclipse Reply with quote

Useful info:
PSPLINK 3.0 via USB (latest)
Eclipse 3.3 (Europa) using CDT plugin
PSP Slim 3.71 M33-2
PSPSDK (latest as of a few days ago)

So a debugging session begins in Eclipse and I can begin to step through the code (code listed at the bottom of this post). I step into the InitSnes9x() function and as soon as I attempt to step into ZeroMemory() the line stepping starts going screwy. It skips around lines in a somewhat random order and then periodically gets "back on track" and starts stepping through the code in an almost normal way (some lines will be skipped).

Since I'm still fairly new to PSP development I don't know if this is par for the course or if something else isn't functioning as it should. You can read the code in question below and you can read about my ambitions here: http://forums.ps2dev.org/viewtopic.php?t=9494 Just as an update I've been implementing the port specific functions for snes9x but I'm taking some time out now to start testing the progress I've made with simple system initialization.

Oh and this main.c file is a joke. I grabbed one of the templates from the SDK examples and plugged in code. I just wanted to see if I could make some wheels turn.

Code:
#include <pspkernel.h>
#include <pspdebug.h>
#include "port.h"
#include "snes9x.h"
#include "memmap.h"
#include "controls.h"
#include "apu.h"


#define printf pspDebugScreenPrintf

void InitSnes9x();

/* Define the module info section */
PSP_MODULE_INFO("snes9xPSP", 0, 1, 1);

/* Define the main thread's attribute value (optional) */
PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
PSP_MAIN_THREAD_STACK_SIZE_KB(256);

int main(int argc, char *argv[])
{
   pspDebugScreenInit();

   pspDebugScreenPrintf("Starting up snes9x\n");
   
   InitSnes9x();

   return 0;
}

void InitSnes9x()
{
   pspDebugScreenPrintf("Beginning initialization.\n");
   
   ZeroMemory (&Settings, sizeof (Settings));
   
   Settings.MouseMaster = TRUE;
   Settings.SuperScopeMaster = TRUE;
   Settings.MultiPlayer5Master = TRUE;
   Settings.JustifierMaster = TRUE;
   Settings.ShutdownMaster = FALSE;
   Settings.BlockInvalidVRAMAccess = TRUE;
   Settings.HDMATimingHack = 100;
   Settings.APUEnabled = TRUE;
   Settings.NextAPUEnabled = TRUE;
   Settings.SoundPlaybackRate = 32000;
   Settings.Stereo = TRUE;
   Settings.SixteenBitSound = TRUE;
   Settings.SoundEnvelopeHeightReading = TRUE;
   Settings.DisableSampleCaching = TRUE;
   Settings.InterpolatedSound = TRUE;
   Settings.Transparency = TRUE;
   Settings.SupportHiRes = TRUE;
   Settings.SDD1Pack = TRUE;
   
   if(!Memory.Init())
   {
      pspDebugScreenPrintf("Failed to initialize memory.\n");
   }
   else
   {
      pspDebugScreenPrintf("Memory Initialized!\n");
   }
   
   S9xUnmapAllControls();
}

void DeInitSnes9x()
{
   Memory.Deinit();
   S9xGraphicsDeinit();
   S9xDeinitAPU();
}
Back to top
View user's profile Send private message
kfactor



Joined: 17 Nov 2007
Posts: 4

PostPosted: Mon Dec 31, 2007 4:59 pm    Post subject: Reply with quote

Hi,

Make sure that you are building with optimizations turned-off (-O0) in your makefile, otherwise the GCC optimizer will kick in and reorder/optimize, and so your source code and the generated code will be slightly different.
Back to top
View user's profile Send private message
snow



Joined: 15 Dec 2007
Posts: 31

PostPosted: Tue Jan 01, 2008 1:06 am    Post subject: Reply with quote

Hmmm good advice but that wasn't it. I'll keep poking around or maybe actually create a serious main entry point and try again.
Back to top
View user's profile Send private message
snow



Joined: 15 Dec 2007
Posts: 31

PostPosted: Tue Jan 01, 2008 10:42 am    Post subject: Reply with quote

Actually, that was it. I did a clean/build once and it didn't work but strangely enough after I did it again it took. Thanks again.
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