!608 add --dumpoptions to help

Merge pull request !608 from leiguangyu/help
This commit is contained in:
openharmony_ci 2024-09-25 01:56:22 +00:00 committed by Gitee
commit d19a59de52
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 14 additions and 8 deletions

View File

@ -185,6 +185,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

@ -49,38 +49,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

@ -1142,7 +1142,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;