|
From: Nicholas N. <nj...@ca...> - 2003-09-15 09:45:39
|
On Sun, 7 Sep 2003, Geoff Alexander wrote:
> The attached change works fine for valgrind 1.9.6. I get
> ==1324== Warning: invalid file descriptor -1 in syscall read()
> ==1324== at 0x403CA224: __libc_read (in /lib/libc.so.6)
> ==1324== by 0x40378920: _IO_file_underflow@@GLIBC_2.1 (in /lib/libc.so.6)
> ==1324== by 0x40379CAA: _IO_default_uflow (in /lib/libc.so.6)
> ==1324== by 0x40379BA6: __uflow (in /lib/libc.so.6)
> ==1324== by 0x40362DC9: _IO_vfscanf (in /lib/libc.so.6)
> ==1324== by 0x40366C85: __vfscanf (in /lib/libc.so.6)
> ==1324== by 0x804CF6E: _ZN12gdaUtilities15SystemFunctions6fscanfEP8_IO_FILEPKcz (SystemFunctions.cpp:57)
> ==1324== by 0x8049ED0: main (TestSystemFunctions.cpp:152)
> ==1324== by 0x40327BAE: __libc_start_main (in /lib/libc.so.6)
> ==1324== by 0x8049460: (within /home/gdlxn/gdaUtilities/test/TestSystemFunctions)
> But when I make the change in valgrind 20030725, I get
> ==15191== Warning: invalid file descriptor -1 in syscall read()
> ==15191== at 0x0: ???
> Is there a way to get a valid trace in valgrind 20030725?
Try changing the VG_(pp_ExeContext)() call in the added code snippet to
this:
VG_(pp_ExeContext)( VG_(get_ExeContext)( tid ) );
> Also, is it possible to suppress invalid file descriptor warnings in
> valgrind? I tried using the --gen-suppressions option in valgrind
> 20030725, but no suppression was generated.
No, because those warnings aren't done "properly" through the error
handling system, because they tend to be pretty rare. The easiest answer
is to comment out the code.
As for why you want to suppress it... is there a good reason why you're
passing -1 as a file descriptor to read()?
N
|
|
From: Geoff A. <gal...@nc...> - 2003-09-16 01:15:51
|
----- Original Message ----- From: "Nicholas Nethercote" <nj...@ca...> Thanks for the update. I'll try out the the change to the VG_(pp_ExeContext)() call the next time I'm on my Linux development machine. > As for why you want to suppress it... is there a good reason why you're > passing -1 as a file descriptor to read()? The error actually occurs in the execution of a vfscanf() call. This call is made in unit test code, in which I'm passing a closed stream to a function that makes a vfscanf() call to test the function's error handling logic. I'm developing and testing with glibc 2.2.0 and gcc 3.3 on SuSE 7.1. The vscanf() call does return EOF with an errno of EBADF as expected when passed the closed stream. But, in addition to the invalid file descriptor warning for read(), valgrind reports over 60 other "memory" errors from the vfscanf() call, which I suppress. Since this is unit test code, I'll simply ignore the warning. Thanks again for the info. Geoff Alexander |