Bug 395434 - valgrind XML output should setlinebuf() to facilitate online use
Summary: valgrind XML output should setlinebuf() to facilitate online use
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (other bugs)
Version First Reported In: 3.14 SVN
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-06-15 15:16 UTC by John Reiser
Modified: 2018-06-15 16:04 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description John Reiser 2018-06-15 15:16:55 UTC
The XML output from valgrind tools should be written to a stdio FILE that has setlinebuf() so that the output for each error appears immediately, yet with reasonable buffering efficiency.  Currently the output is buffered to the default block size (4KB or 8KB), so recent errors often are delayed as viewed by another process which is watching the XML output.  This inhibits "online" use, which can be handy for debugging.  (Motivated by a recent request in [valgrind-developers] mailing list.)
Comment 1 Tom Hughes 2018-06-15 16:04:49 UTC
Well I doubt it goes through stdio, as valgrind isn't linked against the C library so it has to do everything directly.

Looking at it as far as I can see each call to VG_(printf_xml) winds up sending the bytes to the logging sink when it is done (or before if the buffer fills) and send_bytes_to_logging_sink just does a write to the file descriptor using the write system call.

So I'm at a bit of a loss to understand where any buffering is happening...