Sign in to follow this  

Possible causes of a segmentation fault?

This topic is 4393 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
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

This topic is 4393 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this