Public Group

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.

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++){
}


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++ ){

}


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++ ){

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 on other sites
Post the errors you're getting, please. Thanks!

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

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

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 on other sites
They're runtime errors.
I get no errors.
none.
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.

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>
<title>success</title>
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 on other sites
Quote:
 Original post by RDragon1The 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 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 validAbort (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 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 on other sites
Quote:
 Original post by deadimpHow 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.

1. 1
Rutin
25
2. 2
3. 3
JoeJ
19
4. 4
5. 5

• 10
• 11
• 9
• 9
• 10
• Forum Statistics

• Total Topics
631753
• Total Posts
3002098
×