Page MenuHomePhabricator

[scudo][standalone] Get statistics in a char buffer

Authored by cryptoad on Oct 8 2019, 10:33 AM.



Following up on D68471, this CL introduces some getStats APIs to
gather statistics in char buffers (ScopedString really) instead of
printing them out right away. Ultimately printStats will just
output the buffer, but that allows us to potentially do some work
on the intermediate buffer, and can be used for a mallocz type
of functionality. This allows us to pretty much get rid of all the
Printf calls around, but I am keeping the function in for
debugging purposes.

This changes the existing tests to use the new APIs when required.

I will add new tests as suggested in D68471 in another CL.

Diff Detail

Event Timeline

cryptoad created this revision.Oct 8 2019, 10:33 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptOct 8 2019, 10:33 AM
Herald added subscribers: Restricted Project, delcypher. · View Herald Transcript
cryptoad planned changes to this revision.Oct 8 2019, 11:25 AM
cryptoad updated this revision to Diff 223937.Oct 8 2019, 1:47 PM

Adding some getStats(char *, uptr) specific test.

Unifying the stats output a little bit for congruency purposes. I don't
want to go too far there as I am pretty sure the format of the output
will change in the near future.

cryptoad updated this revision to Diff 223938.Oct 8 2019, 1:50 PM

clang-format is not the best at strings.

Harbormaster completed remote builds in B39196: Diff 223938.
morehouse accepted this revision.Oct 8 2019, 6:35 PM
morehouse added inline comments.
141 ↗(On Diff #223938)

Nit: std::unique_ptr or std::vector

This revision is now accepted and ready to land.Oct 8 2019, 6:35 PM
cryptoad updated this revision to Diff 224059.Oct 9 2019, 7:57 AM
cryptoad marked an inline comment as done.

As pointed out by Matt, use a std::vector in the new test.

This revision was automatically updated to reflect the committed changes.