|
From: John R.
|
Nigel Horne wrote: > John Reiser wrote: >> Let the developers/maintainers of memcheck work on better detection >> and reporting of memory access errors. Don't distract them with >> trivialities that are already solved elsewhere. > > > Where are they already solved? I've had one strace suggestion that > wasn't up to the job of valgrind. What solution can you suggest? Paul Pluzhnikov's suggested strace [this list, 2006-08-13] reveals whether there are any close(not_open_fd) or not. If there are some, then rerun the application under gdb [and not strace] with a conditional breakpoint to detect calling close() with the particular not_open_fd; ask for a backtrace when it occurs. Even this two-pass process is faster and smaller than memcheck because strace is involved only at system calls, and not for every instruction. With a little more knowledge, you can use gdb directly in one pass. Examine the code for close(), and put a breakpoint in the errno return path, conditioned on EBADF. If you're truly having trouble with close(not_open_fd), then you also may be unaware of all the filenames the application uses. See the "-e trace=files" option to strace, and prepare to be astounded at the sheer number, as well as the "duplicated" work that many applications perform. -- |