Jump to content
  • Advertisement
Sign in to follow this  
Tradone

Segmentation fault Error. What is it?

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

So here's the summary in simpler terms. Error Type: Segmentation fault (core dumped) error. No runtime error: Total Cycles:10
			for(int i=0; i<=10; i++){
				skin.Read( "Body" );
			}		


Runtime error: Total Cycles:4
			std::map< std::string, std::map< std::string, std::string > >::iterator loop;
			for ( loop=mainData.GetData().begin(); loop != mainData.GetData().end(); loop++ ){

skin.Read( "Body" );
 
			}


No Runtime error: Total Cycles:1
			std::map< std::string, std::map< std::string, std::string > >::iterator loop;
			for ( loop=mainData.GetData().begin(); loop != mainData.GetData().end(); loop++ ){

skin.Read( "Body" );
 break;
			}


//inside method skin.Read( const std::string );
std::cout << para_skinTypeValue.substr(0, para_skinTypeValue.find("($") );
para_skinTypeValue=para_skinTypeValue.substr(para_skinTypeValue.find("($")+2, para_skinTypeValue.length()-para_skinTypeValue.find("($")-2 );
EvaluateFunction( para_skinTypeValue.substr(0, para_skinTypeValue.find(")") ) );
para_skinTypeValue=para_skinTypeValue.substr(para_skinTypeValue.find(")")+1, para_skinTypeValue.length()-para_skinTypeValue.find(")")-1 );



and it seems like the std::cout << para_skinTypeValue.substr(0, para_skinTypeValue.find("($") ); code is fine. But the second line para_skinTypeValue=para_skinTypeValue.substr(para_skinTypeValue.find("($")+2, para_skinTypeValue.length()-para_skinTypeValue.find("($")-2 ); causes the segmentation fault error when run twice inside the iterator. but doesn't create an error when run on a regular for loop. [Edited by - Tradone on April 3, 2006 10:19:30 PM]

Share this post


Link to post
Share on other sites
Advertisement
Do you modify mainData or its contents in any way from within skin.Read()? If so, you are likely invalidating an iterator.

Share this post


Link to post
Share on other sites
I note that you're not doing anything with the iterator beside incrementing it, so what's the point?

Share this post


Link to post
Share on other sites
The reason the last is "fine" is beause of that 'break;' statement - you're never excuting the body of that loop more than once.

Share this post


Link to post
Share on other sites
They're runtime errors.
I get no errors.
none.
nada.
no seriously, this is driving me insane.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator, webmaster@dummy-host.example.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.

More information about this error may be available in the server error log.

this is all I get,
nothing recorded on the apache log.
no *.core file.
because it's run on the web.

the only one thing that I can do to view error messages are to execute the file directly from the console. but when I do that I get an error message as the following:

151# ./webtest.cgi
Content-type: text/html

<html>
<head>
<title>success</title>
</head>
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
Abort (core dumped)

So, all in all I can't even run the thing on the console.
but there is no error when run on the web though.

Share this post


Link to post
Share on other sites
Quote:
Original post by RDragon1
The reason the last is "fine" is beause of that 'break;' statement - you're never excuting the body of that loop more than once.


I put a break; there to test if the errors will persist even when the Read is performed only once.

well, the first thing I should do is make the program run on the console b/c I don't know what's causing the problem. It took me about an hour to trace it back to my first post.

and while I'm doing that I'll double check if skin.Read() makes changes to mainData along the way.


Share this post


Link to post
Share on other sites
okay, I got it to run on the console.
that wasn't so hard, :D
Got rid of the

terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
Abort (core dumped)


Errors.
If you're interested check out this link.
http://www.gamedev.net/community/forums/topic.asp?topic_id=385125

and since my program runs on the web, parameters must be fed, so in order to run it on the console I had to use command link arguements
http://www.site.uottawa.ca/~lucia/courses/2131-05/labs/Lab3/CommandLineArguments.html

and so I finally got it to work, and the error messages are

Segmentation fault (core dumped)



and if any of you developers know any debugging methods, or have any debugging tools. Thanks. ( I wonder if the VS Express debugging tools actually work )

Share this post


Link to post
Share on other sites
How many elements are in the map when you run the second example?
Plus, try experimenting with a std::map without another map inside of it, just for testing purposes (in another project, of course). See if you get the same kind of error when running it in a simpler mode.

Share this post


Link to post
Share on other sites
Quote:
Original post by deadimp
How many elements are in the map when you run the second example?
Plus, try experimenting with a std::map without another map inside of it, just for testing purposes (in another project, of course). See if you get the same kind of error when running it in a simpler mode.


there are dynamic amount of elements.
but generally 12 elements.

okay, i'll run the tests.

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!