Hello I am trying to use your wonderful tool to profile our code. We are using the boost::spirit library to parse some input file. Callgrind segfaults during the parsing. Valgrind (Memcheck) is fine and I can also run the program in normal mode. I have tried my best to create a small testcase, see below. Platform: Kubuntu 10.04 64-bit with boost packages installed. ======================================================== // compile using: g++ -o boost_test.bin boost_test.cpp -lboost_system #include <boost/spirit/include/classic.hpp> #include <boost/spirit/include/classic_actor.hpp> #include <boost/spirit/include/classic_core.hpp> #include <boost/spirit/include/classic_file_iterator.hpp> #include <boost/spirit/include/classic_grammar.hpp> using namespace boost::spirit::classic; #include "boost/filesystem.hpp" using namespace boost::filesystem; #include <iostream> using namespace std; typedef file_iterator<char> iterator_t; typedef scanner<iterator_t> scanner_t; typedef rule<scanner_t> rule_t; string _tag; // variable name string _value; // variable value void insert_pair(iterator_t first, iterator_t last) { } struct InputGrammar: grammar<InputGrammar> { template <typename ScannerT> struct definition { rule<ScannerT> block_content; // simple block between "{" and "}" rule<ScannerT> my_block; definition(InputGrammar const& self) { block_content = *(space_p) >> ch_p('{') >> *(space_p) >> *( ( (+(alnum_p | ch_p('_') | ch_p(':') |ch_p('*') |ch_p('-') ))[assign_a(_tag)] >> '=' >> (+(graph_p-'}'))[assign_a(_value)] ) [&insert_pair] >> *(space_p) ) >> *(space_p) >> ch_p('}') >> *(space_p) ; my_block = *(space_p); } // definition rule<ScannerT> const& start() const { return my_block; } }; // definition }; // InputGrammar InputGrammar _grammar; int main() { iterator_t first("boost_test.in"); // boost_test.in can be empty iterator_t last = first.make_end(); std::cout << "parsing..."; parse_info<file_iterator<char> > info = boost::spirit::classic::parse(first, last, _grammar, comment_p("/*", "*/") | blank_p ); std::cout << " done." << std::endl; return 0; }
I forgot to mention that an empty file "boost_test.in" must be present in order for the test case to run.
Possibly the same bug as 197988. Sebastian, try out the fix at https://bugs.kde.org/show_bug.cgi?id=197988#c44
Thanks for the quick reply. Indeed this bug is a duplicate of 197988. I was using the Kubuntu repository package for valgrind before, so I now downloaded and installed valgrind-3.5.0 to be able and modify the source code. I checked that without modifications the segfault is still there. Then I changed coregrind/pub_core_aspacemgr.h: # define VG_STACK_ACTIVE_SZB (4096 * 512) // 2Mb I recompiled and ran the test again, and now it works! Am I going to see this fix in one of the later Kubuntu repository packages? Two side notes: - I needed to modify the 3.5.0 configure script because Kubuntu 10.04 has glibc 2.11 which is not yet handled in it. - When I try to use the current SVN version of valgrind, it immediately aborts with the following message: valgrind: mmap(0x400000, 114688) failed in UME with error 22 (Invalid argument). This happens even when valgrinding the simplest "Hello World" program. Sebastian
(In reply to comment #3) > I recompiled and ran the test again, and now it works! Am I going to see this > fix in one of the later Kubuntu repository packages? This fix will be in the next release (3.6.0). > - When I try to use the current SVN version of valgrind, it immediately aborts > with the following message: > > valgrind: mmap(0x400000, 114688) failed in UME with error 22 (Invalid > argument). Yes. This is due to a very recent change (r11141). Am still trying to figure out how to fix it. See https://bugs.kde.org/show_bug.cgi?id=193413#c18 for the gory details.
(In reply to comment #4) > > - When I try to use the current SVN version of valgrind, it immediately aborts > > with the following message: > > > > valgrind: mmap(0x400000, 114688) failed in UME with error 22 (Invalid > > argument). > > Yes. This is due to a very recent change (r11141). Am still trying > to figure out how to fix it. See > https://bugs.kde.org/show_bug.cgi?id=193413#c18 > for the gory details. Possibly fixed now by r11146. Give it a try.
(In reply to comment #5) > (In reply to comment #4) > > > - When I try to use the current SVN version of valgrind, it immediately aborts > > > with the following message: > > > > > > valgrind: mmap(0x400000, 114688) failed in UME with error 22 (Invalid > > > argument). > > > > Yes. This is due to a very recent change (r11141). Am still trying > > to figure out how to fix it. See > > https://bugs.kde.org/show_bug.cgi?id=193413#c18 > > for the gory details. > > Possibly fixed now by r11146. Give it a try. Yes, it seems to be fixed. Also the glibc-2.11 issue is fixed I believe. Thanks! I performed the following: svn update ./autogen.sh ./configure make clean make --prefix=$PWD make install
*** This bug has been marked as a duplicate of bug 197988 ***
| CLOSES
CLOSES