Re: using valgrind to debug uninitialized mem in servern

Matthias Apitz <[email protected]>
Newsgroups gmane.comp.debugging.valgrind
Message-ID <[email protected]>
El día jueves, febrero 04, 2021 a las 09:48:23a. m. +0000, Tom Hughes escribió:

> On 04/02/2021 09:26, Matthias Apitz wrote:
> 
> > At the moment we use the following "trick": the librarian runs in
> > parallel to the client on the desktop a second window with a "tail -f ..."
> > on valgrinds log file (STDOUT) and the full screen is recorded with
> > Microsoft teams functionality. So we can use the timestamps in the log
> > to go to the replay of the recording and can see what the user did
> > exactly, which data was entered and which button pressed etc.
> > 
> > Are there other ideas to bring together the valgrind log and the usage
> > of the application?
> 
> You could instrument the request processing logic to log details
> of the request if any errors are detected while processing it, so
> something like:
> 
>   #include "valgrind/valgrind.h"
> 
>   return_type process_request(...)
>   {
>     int errors = VALGRIND_COUNT_ERRORS;
> 
>     // process request as normal
> 
>     if (VALGRIND_COUNT_ERRORS > errors)
>     {
>       VALGRIND_PRINTF("Saw errors processing request %s", request_name);
>     }
>   }
> 
> Obviously you can change it to log whatever details you want.

Thanks, this looks like a good plan!

The above are macros, are there additional shared libs to link with our
process?

> 
> The only issue might be that if the code is multithreaded and can
> process multiple requests in parallel then you won't know which
> thread the errors came from.

No, they're singlethreaded. A master daemon forks for any connecting
client a new server proc.

	matthias

-- 
Matthias Apitz, ✉ [email protected], http://www.unixarea.de/ +49-176-38902045
Public GnuPG key: http://www.unixarea.de/key.pub


_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.