summaryrefslogtreecommitdiff
path: root/simpleperf/dso.cpp
diff options
context:
space:
mode:
authorYabin Cui <yabinc@google.com>2018-03-07 15:47:15 -0800
committerYabin Cui <yabinc@google.com>2018-03-08 17:48:34 -0800
commitc68e66dcf067c052319c8da13a6a49ff06481fa5 (patch)
tree2b64e44d2fb90072733eff8053917093c6290ac5 /simpleperf/dso.cpp
parent674e6e8de2211b2856377e229c348762e82c695e (diff)
downloadextras-c68e66dcf067c052319c8da13a6a49ff06481fa5.tar.gz
simpleperf: improve managing temp files.
Instead of relying on callers to delete temp files, support managing all temp files in ScopedTempFiles. Bug: http://b/73127105 Test: run simpleperf_unit_test and simpleperf manually. Change-Id: Ib73065754657320ebd244f676e3f851544ff2718
Diffstat (limited to 'simpleperf/dso.cpp')
-rw-r--r--simpleperf/dso.cpp20
1 files changed, 9 insertions, 11 deletions
diff --git a/simpleperf/dso.cpp b/simpleperf/dso.cpp
index 7959d4b9..4825ac72 100644
--- a/simpleperf/dso.cpp
+++ b/simpleperf/dso.cpp
@@ -60,8 +60,8 @@ bool Dso::read_kernel_symbols_from_proc_;
std::unordered_map<std::string, BuildId> Dso::build_id_map_;
size_t Dso::dso_count_;
uint32_t Dso::g_dump_id_;
-std::unique_ptr<TemporaryFile> Dso::vdso_64bit_;
-std::unique_ptr<TemporaryFile> Dso::vdso_32bit_;
+std::string Dso::vdso_64bit_;
+std::string Dso::vdso_32bit_;
void Dso::SetDemangle(bool demangle) { demangle_ = demangle; }
@@ -121,11 +121,11 @@ void Dso::SetBuildIds(
build_id_map_ = std::move(map);
}
-void Dso::SetVdsoFile(std::unique_ptr<TemporaryFile> vdso_file, bool is_64bit) {
+void Dso::SetVdsoFile(const std::string& vdso_file, bool is_64bit) {
if (is_64bit) {
- vdso_64bit_ = std::move(vdso_file);
+ vdso_64bit_ = vdso_file;
} else {
- vdso_32bit_ = std::move(vdso_file);
+ vdso_32bit_ = vdso_file;
}
}
@@ -170,10 +170,10 @@ Dso::Dso(DsoType type, const std::string& path, bool force_64bit)
debug_file_path_ = path_in_symfs;
}
} else if (path == "[vdso]") {
- if (force_64bit && vdso_64bit_ != nullptr) {
- debug_file_path_ = vdso_64bit_->path;
- } else if (!force_64bit && vdso_32bit_ != nullptr) {
- debug_file_path_ = vdso_32bit_->path;
+ if (force_64bit && !vdso_64bit_.empty()) {
+ debug_file_path_ = vdso_64bit_;
+ } else if (!force_64bit && !vdso_32bit_.empty()) {
+ debug_file_path_ = vdso_32bit_;
}
}
size_t pos = path.find_last_of("/\\");
@@ -196,8 +196,6 @@ Dso::~Dso() {
read_kernel_symbols_from_proc_ = false;
build_id_map_.clear();
g_dump_id_ = 0;
- vdso_64bit_ = nullptr;
- vdso_32bit_ = nullptr;
}
}