diff options
| author | 2021-11-30 16:40:19 +0000 | |
|---|---|---|
| committer | 2021-12-01 10:21:47 +0000 | |
| commit | f37205412aff40e766c47b99ed21a377eb6f243f (patch) | |
| tree | fdcfdfb9f62d339e3d70b1feda0a7fbd59d8b828 | |
| parent | 5053521598e01151c138a2ce60c966cb1d23ac0a (diff) | |
Read stdout from llvm-symbolizer during native stack dump.
We initially run llvm-symbolizer just to test if it is available
and functioning. However, we run with it own stdout pipe,
which we promptly close before it even starts executing.
Properly consume the stdout output instead, to stop the tool spamming
stderr with (justified) complains. (however, other than the log spam,
this had no other negative consequences on symbolization)
Test: check logcat of crashing test; the extra errors are gone
Change-Id: Id96f8a3202976ea7208860e131e8eddb4beae612
| -rw-r--r-- | runtime/native_stack_dump.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/runtime/native_stack_dump.cc b/runtime/native_stack_dump.cc index f68a22948a..b7c3665530 100644 --- a/runtime/native_stack_dump.cc +++ b/runtime/native_stack_dump.cc @@ -287,6 +287,10 @@ static void Addr2line(const std::string& map_src, static bool RunCommand(const std::string& cmd) { FILE* stream = popen(cmd.c_str(), "r"); if (stream) { + // Consume the stdout until we encounter EOF when the tool exits. + // Otherwise the tool would complain to stderr when the stream is closed. + char buffer[64]; + while (fread(buffer, 1, sizeof(buffer), stream) == sizeof(buffer)) {} pclose(stream); return true; } else { |