mirror of
https://gitee.com/openharmony/developtools_hiperf
synced 2024-11-23 07:29:42 +00:00
support shmm
Signed-off-by: yuyanqinghw <yuyanqing539@huawei.com>
This commit is contained in:
parent
69b08acf5c
commit
e80ed49ce6
@ -334,6 +334,7 @@ private:
|
||||
bool CheckTargetPids();
|
||||
bool CheckReportOption();
|
||||
void WriteCommEventBeforeSampling();
|
||||
void RemoveVdsoTmpFile();
|
||||
|
||||
VirtualRuntime virtualRuntime_;
|
||||
#if USE_COLLECT_SYMBOLIC
|
||||
|
@ -1247,6 +1247,7 @@ bool SubCommandRecord::OnSubCommand(std::vector<std::string> &args)
|
||||
RecoverSavedCmdlinesSize();
|
||||
OnlineReportData();
|
||||
CloseClientThread();
|
||||
RemoveVdsoTmpFile();
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -1268,6 +1269,20 @@ void SubCommandRecord::CloseClientThread()
|
||||
}
|
||||
}
|
||||
|
||||
void SubCommandRecord::RemoveVdsoTmpFile()
|
||||
{
|
||||
std::vector<std::string> fileName = {"/data/local/tmp/shmm", "/data/local/tmp/[vdso]"};
|
||||
for (auto name : fileName) {
|
||||
if (access(name.c_str(), F_OK) == 0) {
|
||||
if (remove(name.c_str()) != 0) {
|
||||
char errInfo[ERRINFOLEN] = { 0 };
|
||||
strerror_r(errno, errInfo, ERRINFOLEN);
|
||||
HLOGE("remove file %s failed,errno:%d,errinfo:%s", name.c_str(), errno, errInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool SubCommandRecord::ProcessRecord(std::unique_ptr<PerfEventRecord> record)
|
||||
{
|
||||
CHECK_TRUE(record == nullptr, false, 1, "record is null");
|
||||
|
@ -1220,17 +1220,17 @@ void VirtualRuntime::LoadVdso()
|
||||
VirtualThread myThread(getpid(), symbolsFiles_);
|
||||
myThread.ParseMap();
|
||||
for (const auto &map : myThread.GetMaps()) {
|
||||
if (map->name == MMAP_VDSO_NAME) {
|
||||
if (map->IsVdsoMap()) {
|
||||
std::string memory(map->end - map->begin, '\0');
|
||||
std::copy(reinterpret_cast<char *>((map->begin)), reinterpret_cast<char *>((map->end)),
|
||||
&memory[0]);
|
||||
std::string tempPath("/data/local/tmp/");
|
||||
std::string tempFileName = tempPath + MMAP_VDSO_NAME;
|
||||
std::string tempFileName = tempPath + map->name;
|
||||
if (!WriteStringToFile(tempFileName, memory)) {
|
||||
printf("vdso temp file create fail at %s\n", tempFileName.c_str());
|
||||
} else {
|
||||
HLOGD("vdso temp file create at %s:%zu", tempFileName.c_str(), memory.size());
|
||||
auto symbolsFile = SymbolsFile::CreateSymbolsFile(MMAP_VDSO_NAME);
|
||||
auto symbolsFile = SymbolsFile::CreateSymbolsFile(map->name);
|
||||
symbolsFile->setSymbolsFilePath(tempPath); // also load from search path
|
||||
symbolsFiles_.emplace_back(std::move(symbolsFile));
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user