Bug 390310 - Output summaries in XML files
Summary: Output summaries in XML files
Status: REPORTED
Alias: None
Product: valgrind
Classification: Developer tools
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR wishlist
Target Milestone: ---
Assignee: Julian Seward
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-12 10:27 UTC by renaultd
Modified: 2019-01-15 17:33 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments
Patch file (8.94 KB, patch)
2018-02-12 10:27 UTC, renaultd
Details
Patch file (8.87 KB, patch)
2019-01-15 17:29 UTC, renaultd
Details

Note You need to log in before you can comment on or make changes to this bug.
Description renaultd 2018-02-12 10:27:03 UTC
Created attachment 110555 [details]
Patch file

The XML output of valgrind does not contain the different summaries from the text format (namely the heap, leak and error summaries). In consequence, the creation of a digest of the results (for example for an external GUI) is more difficult. This question has apparently already been asked without answers (cf. e.g https://stackoverflow.com/questions/40902804/leak-summary-is-missing-from-valgrind-log-file) and the persons I asked actually parse the text output to create their digests. I haven't found a similar question in the bugtracker. 

I propose a patch (to apply to the master git branch) that adds these summaries into the XML output. As a result of the patch, it is possible to output to XML and simply test (for example) whether all heap blocks have been freed : 

valgrind --xml=yes --xml-file=res.xml some_executable_to_test

xmllint --xpath "string(/valgrindoutput/all_heap_blocks_freed/@val)" res.xml 

# -> outputs "true" of "false"

This patch impacts a minor part of valgrind (namely just the output). I tried to follow the coding standards from the source. I am willing to discuss the form of the output if necessary. For example, at the moment, I store the results inside attributes instead of the nodes themselves, and this can be changed. I tried to run the regression and performance tests, but they fail on my machine with or without the patch. 

Example of output in XML format : 
<heap_summary>
  <memory_in_use_at_exit bytes="48" in_blocks="3"/>
  <total_heap_usage allocs="4" frees="1" bytes_allocated="1,072"/>
</heap_summary>
<leak_summary>
  <definitely_lost bytes="48" in_blocks="3"/>
  <indirectly_lost bytes="0" in_blocks="0"/>
  <possibly_lost bytes="0" in_blocks="0"/>
  <still_reachable bytes="0" in_blocks="0"/>
  <suppressed bytes="0" in_blocks="0"/>
</leak_summary>
<error_summary errors="3" from="3" suppressed="0" suppressed_from="0"/>
Comment 1 renaultd 2019-01-15 17:29:50 UTC
Created attachment 117477 [details]
Patch file

Updates and replaces the previous patch file.
Comment 2 renaultd 2019-01-15 17:33:48 UTC
To be more precise, the second patch file is an update to the previous one that applies cleanly on top of d7d82317 (the HEAD of master as of January the 12th, 2019). Fell free to comment or advise if this does not follow the coding standards of the project.