|
From: Ashley P. <as...@qu...> - 2007-04-04 12:28:47
|
Stephen Torri wrote: >> My (buggy) program dies like this: >> % valgrind: vg_malloc2.c:442 (bszW_to_pszW): Assertion 'pszW >= 0' failed. >> >> If Memcheck (the memory checker) shows any invalid reads, invalid >> writes and invalid frees in your program, the above may happen. Reason >> is that your program may trash Valgrind's low-level memory manager, >> which then dies with the above assertion, or something like this. The >> cure is to fix your program so that it doesn't do any illegal memory >> accesses. The above failure will hopefully go away after that. > > The above is a quotation from the Valgrind FAQ. Without sounding > sarcastic the answer is not that helpful. The point that I am using > Valgrind is to find the illegal memory accesses. I started my program > with the following flags when I got a similar assertion: > > valgrind -v --tool=memcheck --leak-resolution=high ./reverse --file > kernel32.dll > > What flags should I be using or is there another tool in valgrind I > should be using instead of memcheck? I do not have a strong skill using > Valgrind to find errors. So any help would be appreciated. I think as Olly said the Valgrind FAQ entry is only relevant if you *haven't* had any previous errors reported. My understanding is the error reported is your application did a invalid write to somewhere which corrupted some valgrind metadata which in time caused it to crash. You should proceed by fixing the error reported first and then re-run the application, the likelyhood is that valgrind will no longer crash. Ashley, |