From 0ca0a8700156dae69f8dbbdf8d39fd61aa928691 Mon Sep 17 00:00:00 2001 From: yuyanqinghw Date: Tue, 18 Feb 2025 08:51:05 +0800 Subject: [PATCH] fix check debug app Signed-off-by: yuyanqinghw --- include/subcommand_stat.h | 1 + src/subcommand_record.cpp | 3 +++ src/subcommand_stat.cpp | 8 +++++--- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/include/subcommand_stat.h b/include/subcommand_stat.h index c6fd88f..84744b5 100644 --- a/include/subcommand_stat.h +++ b/include/subcommand_stat.h @@ -107,6 +107,7 @@ private: int checkAppMs_ = DEFAULT_CHECK_APP_MS; std::vector selectPids_; std::vector selectTids_; + std::vector inputPidTidArgs_ = {}; bool perCpus_ {false}; bool perThreads_ {false}; bool verboseReport_ {false}; diff --git a/src/subcommand_record.cpp b/src/subcommand_record.cpp index fc54241..f15feea 100644 --- a/src/subcommand_record.cpp +++ b/src/subcommand_record.cpp @@ -419,6 +419,9 @@ bool SubCommandRecord::CheckSelectCpuPidOption() } } } + if (!IsExistDebugByPid(selectTids_)) { + return false; + } return true; } diff --git a/src/subcommand_stat.cpp b/src/subcommand_stat.cpp index 0fb4b03..b12e319 100644 --- a/src/subcommand_stat.cpp +++ b/src/subcommand_stat.cpp @@ -109,13 +109,12 @@ bool SubCommandStat::ParseOption(std::vector &args) HLOGD("get option -p failed"); return false; } - if (!IsExistDebugByPid(selectPids_)) { - return false; - } + inputPidTidArgs_ = selectPids_; if (!Option::GetOptionValue(args, "-t", selectTids_)) { HLOGD("get option -t failed"); return false; } + inputPidTidArgs_.insert(inputPidTidArgs_.end(), selectTids_.begin(), selectTids_.end()); if (!Option::GetOptionValue(args, "--restart", restart_)) { HLOGD("get option --restart failed"); return false; @@ -668,6 +667,9 @@ bool SubCommandStat::OnSubCommand(std::vector &args) HLOGV("CheckOptionPidAndApp() failed"); return false; } + if (!IsExistDebugByPid(inputPidTidArgs_)) { + return false; + } SetPerfEvent(); if (!PrepairEvents()) { HLOGV("PrepairEvents() failed"); -- Gitee