Page MenuHomePhabricator

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

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

Details

Summary

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.Tue, Oct 8, 10:33 AM
Herald added projects: Restricted Project, Restricted Project. · View Herald TranscriptTue, Oct 8, 10:33 AM
Herald added subscribers: Restricted Project, delcypher. · View Herald Transcript
cryptoad planned changes to this revision.Tue, Oct 8, 11:25 AM
cryptoad updated this revision to Diff 223937.Tue, Oct 8, 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.Tue, Oct 8, 1:50 PM

clang-format is not the best at strings.

Harbormaster completed remote builds in B39196: Diff 223938.
morehouse accepted this revision.Tue, Oct 8, 6:35 PM
morehouse added inline comments.
lib/scudo/standalone/tests/combined_test.cpp
141 ↗(On Diff #223938)

Nit: std::unique_ptr or std::vector

This revision is now accepted and ready to land.Tue, Oct 8, 6:35 PM
cryptoad updated this revision to Diff 224059.Wed, Oct 9, 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.