Skip to content

Commit

Permalink
#4: sanitizer: improve output
Browse files Browse the repository at this point in the history
  • Loading branch information
lifflander committed Dec 15, 2020
1 parent 161efca commit 78fd095
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/runtime/sanitize_rt.cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,10 @@ void Sanitizer::printSummary() {
return m1->getInstances() > m2->getInstances();
});
FILE* fd = stdout;
std::string pid_str = "";
if (output_as_file) {
auto str = fmt::format("{}.sanitize.out", getpid());
auto pid = str.c_str();
pid_str = fmt::format("{}.sanitize.out", getpid());
auto pid = pid_str.c_str();
auto nfd = fopen(pid, "a");
if (nfd) {
fd = nfd;
Expand All @@ -165,6 +166,10 @@ void Sanitizer::printSummary() {
}
}

fmt::print(fd, "===========================================\n");
fmt::print(fd, "===== Serialization Sanitizer Output ======\n");
fmt::print(fd, "===========================================\n");

for (auto&& e : m) {
auto const& name = e->getName();
auto const& tinfo = e->getTinfo();
Expand All @@ -188,6 +193,7 @@ void Sanitizer::printSummary() {
}

if (fd != stdout) {
fmt::print("Sanitizer: wrote output to {}\n", pid_str);
fclose(fd);
}
}
Expand Down

0 comments on commit 78fd095

Please sign in to comment.