diff options
author | Yabin Cui <yabinc@google.com> | 2020-07-23 15:30:14 -0700 |
---|---|---|
committer | Yabin Cui <yabinc@google.com> | 2020-07-28 16:13:11 -0700 |
commit | e32ed2b96ed8692f4071b36640322600d344c1e3 (patch) | |
tree | ac39a9c593acca23c9c9e5d05a7547404eaae232 /simpleperf/dso.cpp | |
parent | 682156e46d861038047f382cdfe86b10abf52e07 (diff) | |
download | extras-e32ed2b96ed8692f4071b36640322600d344c1e3.tar.gz |
simpleperf: dump jit symfiles to a single file.
Currently, each jit symfile is dumped to a distinct temporary file. This creates
many temporary files, having two drawbacks:
1. It leaves many junk files if simpleperf is killed in the middle.
2. The names of the temporary files change in different recording files,
making them harder to compare.
This CL fixes it by making changes below:
1. Store jit symfiles in a single file. The location of a symfile is
passed via a special path format: <file_path>:<file_start>-<file_end>.
So the unwinder and ElfFile class can read it correctly.
2. Add Dso::GetReportPath() to give a unified name for jit symfiles. And
use it in different reporting methods.
Also split JITDebugReader::ReadProcess() into smaller functions.
Bug: 159155297
Test: run simpleperf_unit_test
Test: run simpleperf manually
Change-Id: I37cd1888b855b4b88bb83e453e39230b96fb304f
Diffstat (limited to 'simpleperf/dso.cpp')
-rw-r--r-- | simpleperf/dso.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/simpleperf/dso.cpp b/simpleperf/dso.cpp index df07393f..c1a474ca 100644 --- a/simpleperf/dso.cpp +++ b/simpleperf/dso.cpp @@ -373,11 +373,10 @@ bool Dso::IsForJavaMethod() { return true; } if (type_ == DSO_ELF_FILE) { - // JIT symfiles for JITed Java methods are dumped as temporary files, whose name are in format - // "TemporaryFile-XXXXXX". - size_t pos = path_.rfind('/'); - pos = (pos == std::string::npos) ? 0 : pos + 1; - return strncmp(&path_[pos], "TemporaryFile", strlen("TemporaryFile")) == 0; + // JITDebugReader generates jit symfiles in "jit_app_cache:<file_start>-<file_end>" format. + if (path_.find(':') != std::string::npos) { + return true; + } } return false; } @@ -485,6 +484,13 @@ class ElfDso : public Dso { ElfDso(const std::string& path, const std::string& debug_file_path) : Dso(DSO_ELF_FILE, path, debug_file_path) {} + std::string_view GetReportPath() const override { + if (size_t colon_pos = path_.find(':'); colon_pos != std::string::npos) { + return "[JIT app cache]"; + } + return path_; + } + void SetMinExecutableVaddr(uint64_t min_vaddr, uint64_t file_offset) override { min_vaddr_ = min_vaddr; file_offset_of_min_vaddr_ = file_offset; |