Jump to content
  • Advertisement
Sign in to follow this  
Leo_E_49

Possible causes of a segmentation fault?

This topic is 4639 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, I've got a segmentation fault error on a PS2. I'm not quite sure what the problem is. The PS2 Linux kit is infamous for its lack of debugging tools so all I can do is use printfs to find the problem. It looks like the error is tied to a "new"ed (dynamically allocated) array of a class which contains a matrix class which includes a float[16] variable. I'm really shooting in the dark at the moment. Any ideas/tips?

Share this post


Link to post
Share on other sites
Advertisement
I seg fault all the time - it's my boss's fault. I'll be sitting there coding, then he'll ping me on IM w/ "Do you are it's working?"

I just blink a few times, then have to reboot.

Share this post


Link to post
Share on other sites
It might be helpful to catch the segfault signal with your own handler and not the default one that just terminates the program.


#include <signal.h>

void handler(int signo)
{
//you handling code goes here
}

int main()
{
struct sigaction segfaultaction;

/*initialize the action*/
segfaultaction.sa_handler = handler;
if(sigemptyset(&segfaultaction.sa_mask)<0)
{
printf("Error filling a sigset\n");
return -1;
}
tickaction.sa_flags=0;
if(sigaction(SIGSEGV,&segfaultaction,NULL)<0)
{
printf("Error setting action\n");
return -1;
}
}



[Edited by - snisarenko on December 3, 2005 7:02:23 PM]

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!