add --dumpoptions to help

Change-Id: Ief4c77ace988c82399de2ed48305ca9e9042808c
Signed-off-by: leiguangyu <leiguangyu@huawei.com>
This commit is contained in:
leiguangyu 2024-09-25 10:49:14 +08:00
parent 7af252ad07
commit c0b8fabb37
5 changed files with 14 additions and 8 deletions

View File

@ -183,6 +183,8 @@ public:
" the value should be between 512 and 4096\n"
" --report\n"
" Report with callstack after record. Conflicts with the -a option.\n"
" --dumpoptions\n"
" Dump command options.\n"
)
// clang-format on
{

View File

@ -96,6 +96,8 @@ public:
" report file name. if empty will use stdout print\n"
" --hide_count\n"
" will not show count in report\n"
" --dumpoptions\n"
" Dump command options.\n"
"\n"
), recordFile_ {"perf.data", ""} // default file path is perf.data
// clang-format on

View File

@ -80,6 +80,8 @@ public:
" Record will exit if the process is not started within 30 seconds.\n"
" --verbose\n"
" Show more detailed reports.\n"
" --dumpoptions\n"
" Dump command options.\n"
// clang-format on
),
targetSystemWide_(false)

View File

@ -45,38 +45,38 @@ static const std::string HIVIEW_CMDLINE = "/system/bin/hiview";
std::string CanonicalizeSpecPath(const char* src)
{
if (src == nullptr) {
fprintf(stderr, "Error: CanonicalizeSpecPath failed");
HLOGE("Error: CanonicalizeSpecPath failed");
return "";
} else if (strlen(src) >= PATH_MAX) {
fprintf(stderr, "Error: CanonicalizeSpecPath %s failed", src);
HLOGE("Error: CanonicalizeSpecPath %s failed", src);
return "";
}
char resolvedPath[PATH_MAX] = { 0 };
#if defined(_WIN32)
if (!_fullpath(resolvedPath, src, PATH_MAX)) {
fprintf(stderr, "Error: _fullpath %s failed", src);
HLOGE("Error: _fullpath %s failed", src);
return "";
}
#else
if (access(src, F_OK) == 0) {
if (strstr(src, "/proc/") == src && strstr(src, "/data/storage") != nullptr) { // for sandbox
if (strncpy_s(resolvedPath, sizeof(resolvedPath), src, strlen(src)) == -1) {
fprintf(stderr, "Error: strncpy_s %s failed", src);
HLOGE("Error: strncpy_s %s failed", src);
return "";
}
} else if (realpath(src, resolvedPath) == nullptr) {
fprintf(stderr, "Error: realpath %s failed", src);
HLOGE("Error: realpath %s failed", src);
return "";
}
} else {
std::string fileName(src);
if (fileName.find("..") == std::string::npos) {
if (sprintf_s(resolvedPath, PATH_MAX, "%s", src) == -1) {
fprintf(stderr, "Error: sprintf_s %s failed", src);
HLOGE("Error: sprintf_s %s failed", src);
return "";
}
} else {
fprintf(stderr, "Error: find .. %s failed", src);
HLOGE("Error: find .. %s failed", src);
return "";
}
}

View File

@ -1172,7 +1172,7 @@ bool VirtualRuntime::SetSymbolsPaths(const std::vector<std::string> &symbolsPath
symbolsPaths_ = symbolsPaths;
} else {
if (!symbolsPaths.empty()) {
printf("some symbols path unable access\n");
HLOGE("some symbols path unable access");
}
}
return accessible;