diff options
author | Pavel Kosov <kosov.pavel@huawei.com> | 2021-11-18 10:46:18 +0400 |
---|---|---|
committer | Pavel Kosov <kosov.pavel@huawei.com> | 2021-11-18 10:46:18 +0400 |
commit | 40cb83afa7480b4efff9e3cde122549beb1cef90 (patch) | |
tree | bdf25062424f3407fb3241bc09d164d81dbe8291 | |
parent | 76b54007a8fd8525365526805029674f7998f3cf (diff) |
Use BinaryCacheRoot calling IsSharedObject()
https://reviews.llvm.org/D110839 introduced BinaryCacheRoot.
It must be used calling IsSharedObject() too.
OS Laboratory, Huawei Russian Research Institute (Saint-Petersburg)
Reviewed By: thopre, danilaml
Differential Revision: https://reviews.llvm.org/D114098
-rw-r--r-- | lnt/testing/profile/cPerf.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lnt/testing/profile/cPerf.cpp b/lnt/testing/profile/cPerf.cpp index 5f6acb2..96f966c 100644 --- a/lnt/testing/profile/cPerf.cpp +++ b/lnt/testing/profile/cPerf.cpp @@ -132,7 +132,7 @@ void Assert(bool Expr, const char *ExprStr, const char *File, int Line) { // Returns true if the ELF file given by filename // is a shared object (DYN). -bool IsSharedObject(char *Fname) { +bool IsSharedObject(const std::string &Fname) { // We replicate the first part of an ELF header here // so as not to rely on <elf.h>. struct PartialElfHeader { @@ -141,7 +141,7 @@ bool IsSharedObject(char *Fname) { }; const int ET_DYN = 3; - FILE *stream = fopen(Fname, "r"); + FILE *stream = fopen(Fname.c_str(), "r"); if (stream == NULL) return false; @@ -664,7 +664,7 @@ unsigned char *PerfReader::readEvent(unsigned char *Buf) { // EXEC ELF objects aren't relocated. DYN ones are, // so if it's a DYN object adjust by subtracting the // map base. - bool IsSO = IsSharedObject(E->filename); + bool IsSO = IsSharedObject(BinaryCacheRoot + std::string(E->filename)); Maps.push_back({E->start, E->start + E->extent, IsSO ? E->start - E->pgoff : 0, E->filename}); @@ -684,7 +684,7 @@ unsigned char *PerfReader::readEvent(unsigned char *Buf) { // EXEC ELF objects aren't relocated. DYN ones are, // so if it's a DYN object adjust by subtracting the // map base. - bool IsSO = IsSharedObject(E->filename); + bool IsSO = IsSharedObject(BinaryCacheRoot + std::string(E->filename)); Maps.push_back({E->start, E->start + E->extent, IsSO ? E->start - E->pgoff : 0, E->filename}); |