How to detect segmentation fault details using Valgrind?

Posted by Davit Siradeghyan on Stack Overflow See other posts from Stack Overflow or by Davit Siradeghyan
Published on 2010-04-21T14:26:29Z Indexed on 2010/04/21 14:33 UTC
Read the original article Hit count: 458

Filed under:
|
|
|

Hi all

I have a std::map< std::string, std::string> which initialized with some API call. When I'm trying to use this map I'm getting segmentation fault. How can I detect invalid code or what is invalid or any detail which can help me to fix problem? Code looks like this:

std::map< std::string, std::string> cont;

some_func( cont ); // getting parameter by reference and initialize it

std::cout << cont[ "some_key" ] << '\n'; // getting segmentation fault here

© Stack Overflow or respective owner

Related posts about c++

Related posts about valgrind