Yep. Try -g -O0 (or just -g w/o any additional flags). --kcc On Wed, Apr 22, 2009 at 2:18 PM, Seb James <[email protected]> wrote: > Hi Konstantin, > > Yes, with gcc -g. Now I think about it, there was also an -Os in there, > which may not have helped valgrind find its way around the code. > > Seb > > > On Wed, 2009-04-22 at 14:12 +0400, Konstantin Serebryany wrote: >> Hi Seb, >> >> How do you compile the program (is that 'gcc -g' ?)? >> >> --kcc >> >> >> On Wed, Apr 22, 2009 at 1:24 PM, Seb James <[email protected]> wrote: >> > Hi List, >> > >> > Firstly, apologies to the list maintainer, I originally sent this email >> > from the wrong address [email protected]. >> > >> > I'm trying to eliminate the errors from my program. As noted in the >> > documentation, I'm looking at the first error listed. >> > >> > A look at the error shows that it's happening in a function called >> > readCommand, which is called by getCommands() and processLines(). >> > valgrind shows that processLines() contains a call to getCommands in >> > kyodoc.cpp line 319. That's right. It seems to suggest that >> > getCommands() contains a call to readCommand in new_allocator.h, line >> > 62, but that seems to be wrong - in fact, getCommands() contains a call >> > to readCommand() in kyodoc.cpp line 106. >> > >> > The problem I have here is that because valgrind doesn't seem to be >> > telling me which line the problem in readCommand is occuring, so I'm not >> > sure how to find this out. >> > >> > Perhaps the code address, 0x80B8646 can help me. How to match that up to >> > a location in the program? >> > >> > Thanks for any help, and best regards, >> > >> > Seb James >> > >> > >> > ------------------------------------------------------------------- >> > ==5669== Memcheck, a memory error detector. >> > ==5669== Copyright (C) 2002-2006, and GNU GPL'd, by Julian Seward et al. >> > ==5669== Using LibVEX rev 1606, a library for dynamic binary translation. >> > ==5669== Copyright (C) 2004-2006, and GNU GPL'd, by OpenWorks LLP. >> > ==5669== Using valgrind-3.2.0, a dynamic binary instrumentation framework. >> > ==5669== Copyright (C) 2000-2006, and GNU GPL'd, by Julian Seward et al. >> > ==5669== For more details, rerun with: -v >> > ==5669== >> > ==5669== My PID = 5669, parent PID = 4622. Prog and args are: >> > ==5669== ./wmlcdltest >> > ==5669== data/net2/Apr2009/raw_input_Apr2009_103747.prn >> > ==5669== >> > ==5669== Invalid read of size 1 >> > ==5669== at 0x80B8646: wml::KyoCmd::readCommand(std::string&, >> > unsigned&, std::istream&, unsigned&, std::string) (basic_string.h:638) >> > ==5669== by 0x80B8ACB: wml::KyoCmd::readCommand(std::string&, >> > unsigned&, std::istream&, unsigned&, std::string) (new_allocator.h:62) >> > ==5669== by 0x809BF4F: wml::KyoDoc::getCommands() (new_allocator.h:62) >> > ==5669== by 0x809CF9B: wml::KyoDoc::processLines() (kyodoc.cpp:319) >> > ==5669== by 0x809D61D: wml::KyoDoc::preprocess() (kyodoc.cpp:381) >> > ==5669== by 0x8053A7A: wml::CdlJob::filter() (cdljob.cpp:158) >> > ==5669== by 0x804C912: main (wmlcdltest.cpp:76) >> > ==5669== Address 0x6B207AD is 0 bytes after a block of size 77 alloc'd >> > ==5669== at 0x401A8BB: operator new(unsigned) (vg_replace_malloc.c:163) >> > ==5669== by 0x41C26C4: std::string::_Rep::_S_create(unsigned, unsigned, >> > std::allocator<char> const&) (in /usr/lib/libstdc++.so.6.0.1) >> > ==5669== by 0x41C270B: std::string::_Rep::_M_clone(std::allocator<char> >> > const&, unsigned) (in /usr/lib/libstdc++.so.6.0.1) >> > ==5669== by 0x41C2B15: std::string::reserve(unsigned) (in >> > /usr/lib/libstdc++.so.6.0.1) >> > ==5669== by 0x41C31B7: std::string::append(std::string const&) (in >> > /usr/lib/libstdc++.so.6.0.1) >> > ==5669== by 0x805407F: std::basic_string<char, std::char_traits<char>, >> > std::allocator<char> > std::operator+<char, std::char_traits<char>, >> > std::allocator<char> >(std::basic_string<char, std::char_traits<char>, >> > std::allocator<char> > const&, std::basic_string<char, >> > std::char_traits<char>, std::allocator<char> > const&) >> > (basic_string.h:1985) >> > ==5669== by 0x80B8A05: wml::KyoCmd::readCommand(std::string&, >> > unsigned&, std::istream&, unsigned&, std::string) (basic_string.h:422) >> > ==5669== by 0x809BF4F: wml::KyoDoc::getCommands() (new_allocator.h:62) >> > ==5669== by 0x809CF9B: wml::KyoDoc::processLines() (kyodoc.cpp:319) >> > ==5669== by 0x809D61D: wml::KyoDoc::preprocess() (kyodoc.cpp:381) >> > ==5669== by 0x8053A7A: wml::CdlJob::filter() (cdljob.cpp:158) >> > ==5669== by 0x804C912: main (wmlcdltest.cpp:76) >> > >> > >> > >> > >> > >> > ------------------------------------------------------------------------------ >> > Stay on top of everything new and different, both inside and >> > around Java (TM) technology - register by April 22, and save >> > $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. >> > 300 plus technical and hands-on sessions. Register today. >> > Use priority code J9JMT32. http://p.sf.net/sfu/p >> > _______________________________________________ >> > Valgrind-users mailing list >> > [email protected] >> > https://lists.sourceforge.net/lists/listinfo/valgrind-users >> > >> > >> > >> >> > > > >
------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ Valgrind-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/valgrind-users
