diff --git a/include/dwarf_encoding.h b/include/dwarf_encoding.h index dfd1d6b..7219364 100644 --- a/include/dwarf_encoding.h +++ b/include/dwarf_encoding.h @@ -42,46 +42,46 @@ using dw_encode_t = unsigned char; // 4 bits + 4 bits // Table 10-5. DWARF Exception Header value format enum DW_EH_PE_VF { - DW_EH_PE_ABSPTR = 0x00, // a literal pointer whose size is determined by the architecture. - DW_EH_PE_ULEB128 = 0x01, // Unsigned value is encoded using the Little Endian Base 128 (LEB128) - DW_EH_PE_UDATA2 = 0x02, // A 2 bytes unsigned value. - DW_EH_PE_UDATA4 = 0x03, // A 4 bytes unsigned value. - DW_EH_PE_UDATA8 = 0x04, // An 8 bytes unsigned value. - DW_EH_PE_SLEB128 = 0x09, // Signed value is encoded using the Little Endian Base 128(LEB128) - DW_EH_PE_SDATA2 = 0x0A, // A 2 bytes signed value. - DW_EH_PE_SDATA4 = 0x0B, // A 4 bytes signed value. - DW_EH_PE_SDATA8 = 0x0C, // An 8 bytes signed value. + DW_EH_PE_absptr = 0x00, // a literal pointer whose size is determined by the architecture. + DW_EH_PE_uleb128 = 0x01, // Unsigned value is encoded using the Little Endian Base 128 (LEB128) + DW_EH_PE_udata2 = 0x02, // A 2 bytes unsigned value. + DW_EH_PE_udata4 = 0x03, // A 4 bytes unsigned value. + DW_EH_PE_udata8 = 0x04, // An 8 bytes unsigned value. + DW_EH_PE_sleb128 = 0x09, // Signed value is encoded using the Little Endian Base 128(LEB128) + DW_EH_PE_sdata2 = 0x0A, // A 2 bytes signed value. + DW_EH_PE_sdata4 = 0x0B, // A 4 bytes signed value. + DW_EH_PE_sdata8 = 0x0C, // An 8 bytes signed value. }; // Table 10-6. DWARF Exception Header application enum DW_EH_PE_A { - DW_EH_PE_NOTHING = 0x00, // nothing to do - DW_EH_PE_PCREL = 0x10, // relative to the current program counter. - DW_EH_PE_TEXTREL = 0x20, // relative to the beginning of the .text section. - DW_EH_PE_DATAREL = 0x30, // relative to the beginning of the .got or .eh_frame_hdr section. - DW_EH_PE_FUNCREL = 0x40, // relative to the beginning of the function. - DW_EH_PE_ALIGNED = 0x50, // aligned to an address unit sized boundary. - DW_EH_PE_OMIT = 0xff, // indicate that no value is present. + DW_EH_PE_nothing = 0x00, // nothing to do + DW_EH_PE_pcrel = 0x10, // relative to the current program counter. + DW_EH_PE_textrel = 0x20, // relative to the beginning of the .text section. + DW_EH_PE_datarel = 0x30, // relative to the beginning of the .got or .eh_frame_hdr section. + DW_EH_PE_funcrel = 0x40, // relative to the beginning of the function. + DW_EH_PE_aligned = 0x50, // aligned to an address unit sized boundary. + DW_EH_PE_omit = 0xff, // indicate that no value is present. }; const std::map DWFormatSizeMap = { #ifdef ARM - {DW_EH_PE_ABSPTR, 4}, + {DW_EH_PE_absptr, 4}, #else - {DW_EH_PE_ABSPTR, 8}, + {DW_EH_PE_absptr, 8}, #endif #ifdef NOT_USE - {DW_EH_PE_ULEB128, sizeof(char) * 128}, + {DW_EH_PE_uleb128, sizeof(char) * 128}, #endif - {DW_EH_PE_UDATA2, sizeof(char) * 2}, - {DW_EH_PE_UDATA4, sizeof(char) * 4}, - {DW_EH_PE_UDATA8, sizeof(char) * 8}, + {DW_EH_PE_udata2, sizeof(char) * 2}, + {DW_EH_PE_udata4, sizeof(char) * 4}, + {DW_EH_PE_udata8, sizeof(char) * 8}, #ifdef NOT_USE - {DW_EH_PE_SLEB128, sizeof(char) * 128}, + {DW_EH_PE_sleb128, sizeof(char) * 128}, #endif - {DW_EH_PE_SDATA2, sizeof(char) * 2}, - {DW_EH_PE_SDATA4, sizeof(char) * 4}, - {DW_EH_PE_SDATA8, sizeof(char) * 8}, + {DW_EH_PE_sdata2, sizeof(char) * 2}, + {DW_EH_PE_sdata4, sizeof(char) * 4}, + {DW_EH_PE_sdata8, sizeof(char) * 8}, }; template diff --git a/include/subcommand_dump.h b/include/subcommand_dump.h index 5dc64d8..d1ac529 100644 --- a/include/subcommand_dump.h +++ b/include/subcommand_dump.h @@ -66,7 +66,7 @@ public: // clang-format on { } - ~SubCommandDump(); + ~SubCommandDump() override; bool OnSubCommand(std::vector &args) override; bool ParseOption(std::vector &args) override; diff --git a/interfaces/innerkits/native/src/hiperf_client.cpp b/interfaces/innerkits/native/src/hiperf_client.cpp index 9405125..b9807c2 100644 --- a/interfaces/innerkits/native/src/hiperf_client.cpp +++ b/interfaces/innerkits/native/src/hiperf_client.cpp @@ -29,44 +29,42 @@ namespace OHOS { namespace Developtools { namespace HiPerf { namespace HiperfClient { -static const std::string HiperfCommandName = "hiperf"; -static const std::string SystemBinPath = "/system/bin/"; -static const std::string CurrentPath = "./"; -static const std::string PerfDataName = "perf.data"; -static const std::string CommandRecord = "record"; -static const std::string ArgOutputPath = "-o"; -static const std::string ArgDebug = "--verbose"; -static const std::string ArgDebugMuch = "--much"; -static const std::string ArgHilog = "--hilog"; -static const std::string ArgPipeInput = "--pipe_input"; -static const std::string ArgPipeOutput = "--pipe_output"; -static const std::string ArgTargetSystemWide = "-a"; -static const std::string ArgCompressData = "-z"; -static const std::string ArgSelectCpus = "-c"; -static const std::string ArgTimeStopSec = "-d"; -static const std::string ArgFrequency = "-f"; -static const std::string ArgPeriod = "--period"; -static const std::string ArgSelectEvents = "-e"; -static const std::string ArgSelectGroups = "-g"; -static const std::string ArgNoInherit = "--no-inherit"; -static const std::string ArgSelectPids = "-p"; -static const std::string ArgSelectTids = "-t"; -static const std::string ArgExcludePerf = "--exclude-hiperf"; -static const std::string ArgCpuPercent = "--cpu-limit"; -static const std::string ArgOffCPU = "--offcpu"; -static const std::string ArgCallGraph = "--call-stack"; -static const std::string ArgDelayUnwind = "--delay-unwind"; -static const std::string ArgDisableUnwind = "--disable-unwind"; -static const std::string ArgDisableCallstackMerge = "--disable-callstack-expand"; -static const std::string ArgSymbolDir = "--symbol-dir"; -static const std::string ArgOutputFilename = "-o"; -static const std::string ArgDataLimit = "--data-limit"; -static const std::string ArgAppPackage = "--app"; -static const std::string ArgClockId = "--clockid"; -static const std::string ArgVecBranchSampleTypes = "-j"; -static const std::string ArgMmapPages = "-m"; -static const std::string ArgDedupStack = "--dedup_stack"; -static const std::string ArgReport = "--report"; +static const std::string HIPERF_COMMAND_NAME = "hiperf"; +static const std::string SYSTEM_BIN_PATH = "/system/bin/"; +static const std::string CURRENT_PATH = "./"; +static const std::string PERF_DATA_NAME = "perf.data"; +static const std::string COMMAND_RECORD = "record"; +static const std::string ARG_OUTPUT_PATH = "-o"; +static const std::string ARG_DEBUG = "--verbose"; +static const std::string ARG_DEBUG_MUCH = "--much"; +static const std::string ARG_HILOG = "--hilog"; +static const std::string ARG_PIPE_INPUT = "--pipe_input"; +static const std::string ARG_PIPE_OUTPUT = "--pipe_output"; +static const std::string ARG_TARGET_SYSTEM_WIDE = "-a"; +static const std::string ARG_COMPRESS_DATA = "-z"; +static const std::string ARG_SELECT_CPUS = "-c"; +static const std::string ARG_TIME_STOP_SEC = "-d"; +static const std::string ARG_FREQUENCY = "-f"; +static const std::string ARG_PERIOD = "--period"; +static const std::string ARG_SELECT_EVENTS = "-e"; +static const std::string ARG_SELECT_GROUPS = "-g"; +static const std::string ARG_NO_INHERIT = "--no-inherit"; +static const std::string ARG_SELECT_PIDS = "-p"; +static const std::string ARG_SELECT_TIDS = "-t"; +static const std::string ARG_EXCLUDE_PERF = "--exclude-hiperf"; +static const std::string ARG_CPU_PERCENT = "--cpu-limit"; +static const std::string ARG_OFF_CPU = "--offcpu"; +static const std::string ARG_CALL_GRAPH = "--call-stack"; +static const std::string ARG_DELAY_UNWIND = "--delay-unwind"; +static const std::string ARG_DISABLE_UNWIND = "--disable-unwind"; +static const std::string ARG_DISABLE_CALLSTACK_MERGE = "--disable-callstack-expand"; +static const std::string ARG_SYMBOL_DIR = "--symbol-dir"; +static const std::string ARG_DATA_LIMIT = "--data-limit"; +static const std::string ARG_APP_PACKAGE = "--app"; +static const std::string ARG_CLOCK_ID = "--clockid"; +static const std::string ARG_VEC_BRANCH_SAMPLE_TYPES = "-j"; +static const std::string ARG_MMAP_PAGES = "-m"; +static const std::string ARG_REPORT = "--report"; static constexpr int DEFAULT_DURATION_TIME = 10; static constexpr int DEFAULT_FREQUENCY_TIME = 100; @@ -182,53 +180,53 @@ void RecordOption::SetOption(const std::string &name, const std::vector &cpus) { - SetOption(ArgSelectCpus, cpus); + SetOption(ARG_SELECT_CPUS, cpus); } void RecordOption::SetTimeStopSec(int timeStopSec) { this->timeSpec_ = true; - SetOption(ArgTimeStopSec, timeStopSec); + SetOption(ARG_TIME_STOP_SEC, timeStopSec); } void RecordOption::SetFrequency(int frequency) { - SetOption(ArgFrequency, frequency); + SetOption(ARG_FREQUENCY, frequency); } void RecordOption::SetPeriod(int period) { - SetOption(ArgPeriod, period); + SetOption(ARG_PERIOD, period); } void RecordOption::SetSelectEvents(const std::vector &selectEvents) { - SetOption(ArgSelectEvents, selectEvents); + SetOption(ARG_SELECT_EVENTS, selectEvents); } void RecordOption::SetSelectGroups(const std::vector &selectGroups) { - SetOption(ArgSelectGroups, selectGroups); + SetOption(ARG_SELECT_GROUPS, selectGroups); } void RecordOption::SetNoInherit(bool enable) { - SetOption(ArgNoInherit, enable); + SetOption(ARG_NO_INHERIT, enable); } void RecordOption::SetSelectPids(const std::vector &selectPids) { - SetOption(ArgSelectPids, selectPids); + SetOption(ARG_SELECT_PIDS, selectPids); } void RecordOption::SetCallStackSamplingConfigs(int duration) @@ -245,77 +243,77 @@ void RecordOption::SetCallStackSamplingConfigs(int duration) void RecordOption::SetSelectTids(const std::vector &selectTids) { - SetOption(ArgSelectTids, selectTids); + SetOption(ARG_SELECT_TIDS, selectTids); } void RecordOption::SetExcludePerf(bool excludePerf) { - SetOption(ArgExcludePerf, excludePerf); + SetOption(ARG_EXCLUDE_PERF, excludePerf); } void RecordOption::SetCpuPercent(int cpuPercent) { - SetOption(ArgCpuPercent, cpuPercent); + SetOption(ARG_CPU_PERCENT, cpuPercent); } void RecordOption::SetOffCPU(bool offCPU) { - SetOption(ArgOffCPU, offCPU); + SetOption(ARG_OFF_CPU, offCPU); } void RecordOption::SetCallGraph(const std::string &callGraph) { - SetOption(ArgCallGraph, callGraph); + SetOption(ARG_CALL_GRAPH, callGraph); } void RecordOption::SetDelayUnwind(bool delayUnwind) { - SetOption(ArgDelayUnwind, delayUnwind); + SetOption(ARG_DELAY_UNWIND, delayUnwind); } void RecordOption::SetDisableUnwind(bool disableUnwind) { - SetOption(ArgDisableUnwind, disableUnwind); + SetOption(ARG_DISABLE_UNWIND, disableUnwind); } void RecordOption::SetDisableCallstackMerge(bool disableCallstackMerge) { - SetOption(ArgDisableCallstackMerge, disableCallstackMerge); + SetOption(ARG_DISABLE_CALLSTACK_MERGE, disableCallstackMerge); } void RecordOption::SetSymbolDir(const std::string &symbolDir_) { - SetOption(ArgSymbolDir, symbolDir_); + SetOption(ARG_SYMBOL_DIR, symbolDir_); } void RecordOption::SetDataLimit(const std::string &limit) { - SetOption(ArgDataLimit, limit); + SetOption(ARG_DATA_LIMIT, limit); } void RecordOption::SetAppPackage(const std::string &appPackage) { - SetOption(ArgAppPackage, appPackage); + SetOption(ARG_APP_PACKAGE, appPackage); } void RecordOption::SetClockId(const std::string &clockId) { - SetOption(ArgClockId, clockId); + SetOption(ARG_CLOCK_ID, clockId); } void RecordOption::SetVecBranchSampleTypes(const std::vector &vecBranchSampleTypes) { - SetOption(ArgVecBranchSampleTypes, vecBranchSampleTypes); + SetOption(ARG_VEC_BRANCH_SAMPLE_TYPES, vecBranchSampleTypes); } void RecordOption::SetMmapPages(int mmapPages) { - SetOption(ArgMmapPages, mmapPages); + SetOption(ARG_MMAP_PAGES, mmapPages); } void RecordOption::SetReport(bool report) { - SetOption(ArgReport, report); + SetOption(ARG_REPORT, report); } Client::Client(const std::string &outputDir) @@ -327,9 +325,9 @@ Client::Client(const std::string &outputDir) bool Client::Setup(std::string outputDir) { - std::string CurrentCommandPath = CurrentPath + HiperfCommandName; - std::string SystemCommandPath = SystemBinPath + HiperfCommandName; - std::string TempCommandPath = TempBinPath + HiperfCommandName; + std::string CurrentCommandPath = CURRENT_PATH + HIPERF_COMMAND_NAME; + std::string SystemCommandPath = SYSTEM_BIN_PATH + HIPERF_COMMAND_NAME; + std::string TempCommandPath = TempBinPath + HIPERF_COMMAND_NAME; if (!outputDir.empty() && outputDir.back() != '/') { outputDir.push_back('/'); @@ -352,13 +350,13 @@ bool Client::Setup(std::string outputDir) // found command path if (access(outputDir.c_str(), W_OK) == 0) { outputDir_ = outputDir; - } else if (access(CurrentPath.c_str(), W_OK) == 0) { - outputDir_ = CurrentPath; + } else if (access(CURRENT_PATH.c_str(), W_OK) == 0) { + outputDir_ = CURRENT_PATH; } else { HIPERF_HILOGI(MODULE_CPP_API, "no writeable output path found\n"); return ready_; } - outputFileName_ = PerfDataName; + outputFileName_ = PERF_DATA_NAME; myPid_ = getpid(); @@ -404,17 +402,17 @@ void Client::PrepareExecCmd(std::vector &cmd) cmd.emplace_back(executeCommandPath_); if (debug_) { - cmd.emplace_back(ArgDebug); + cmd.emplace_back(ARG_DEBUG); } else if (debugMuch_) { - cmd.emplace_back(ArgDebugMuch); + cmd.emplace_back(ARG_DEBUG_MUCH); } if (hilog_) { - cmd.emplace_back(ArgHilog); + cmd.emplace_back(ARG_HILOG); } - cmd.emplace_back(CommandRecord); - cmd.emplace_back(ArgOutputPath); + cmd.emplace_back(COMMAND_RECORD); + cmd.emplace_back(ARG_OUTPUT_PATH); cmd.emplace_back(GetOutputPerfDataPath()); } @@ -422,9 +420,9 @@ void Client::GetExecCmd(std::vector &cmd, int pipeIn, int pipeOut, const std::vector &args) { PrepareExecCmd(cmd); - cmd.emplace_back(ArgPipeInput); + cmd.emplace_back(ARG_PIPE_INPUT); cmd.emplace_back(std::to_string(pipeIn)); - cmd.emplace_back(ArgPipeOutput); + cmd.emplace_back(ARG_PIPE_OUTPUT); cmd.emplace_back(std::to_string(pipeOut)); cmd.insert(cmd.end(), args.begin(), args.end()); diff --git a/src/dwarf_encoding.cpp b/src/dwarf_encoding.cpp index f7e5033..0fa873d 100644 --- a/src/dwarf_encoding.cpp +++ b/src/dwarf_encoding.cpp @@ -66,11 +66,11 @@ uint64_t DwarfEncoding::GetValue() const uint64_t DwarfEncoding::GetAppliedValue() const { - if ((Application() & DW_EH_PE_DATAREL) == DW_EH_PE_DATAREL) { + if ((Application() & DW_EH_PE_datarel) == DW_EH_PE_datarel) { return value_[0] + vaddrBase_; - } else if ((Application() & DW_EH_PE_TEXTREL) == DW_EH_PE_TEXTREL) { + } else if ((Application() & DW_EH_PE_textrel) == DW_EH_PE_textrel) { return value_[0] + vaddrText_; - } else if ((Application() & DW_EH_PE_PCREL) == DW_EH_PE_PCREL) { + } else if ((Application() & DW_EH_PE_pcrel) == DW_EH_PE_pcrel) { return value_[0] + vaddrPC_; } HLOGM("Application is empty"); @@ -80,7 +80,7 @@ uint64_t DwarfEncoding::GetAppliedValue() const bool DwarfEncoding::IsOmit() const { - return (dw_ == DW_EH_PE_OMIT); + return (dw_ == DW_EH_PE_omit); } dw_encode_t DwarfEncoding::Format() const @@ -94,17 +94,17 @@ dw_encode_t DwarfEncoding::Application() const uint64_t DwarfEncoding::ReadValue(const unsigned char *&data) const { switch (Format()) { - case DW_EH_PE_UDATA2: + case DW_EH_PE_udata2: return dwReadAnyTypeData(data, uint16_t()); - case DW_EH_PE_UDATA4: + case DW_EH_PE_udata4: return dwReadAnyTypeData(data, uint32_t()); - case DW_EH_PE_UDATA8: + case DW_EH_PE_udata8: return dwReadAnyTypeData(data, uint64_t()); - case DW_EH_PE_SDATA2: + case DW_EH_PE_sdata2: return dwReadAnyTypeData(data, int16_t()); - case DW_EH_PE_SDATA4: + case DW_EH_PE_sdata4: return dwReadAnyTypeData(data, int32_t()); - case DW_EH_PE_SDATA8: + case DW_EH_PE_sdata8: return dwReadAnyTypeData(data, int64_t()); default: return -1; @@ -113,25 +113,25 @@ uint64_t DwarfEncoding::ReadValue(const unsigned char *&data) const const std::string DwarfEncoding::FormatName() const { switch (Format()) { - case DW_EH_PE_ABSPTR: + case DW_EH_PE_absptr: return "DW_EH_PE_absptr"; - case DW_EH_PE_ULEB128: + case DW_EH_PE_uleb128: return "DW_EH_PE_uleb128"; - case DW_EH_PE_UDATA2: + case DW_EH_PE_udata2: return "DW_EH_PE_udata2"; - case DW_EH_PE_UDATA4: + case DW_EH_PE_udata4: return "DW_EH_PE_udata4"; - case DW_EH_PE_UDATA8: + case DW_EH_PE_udata8: return "DW_EH_PE_udata8"; - case DW_EH_PE_SLEB128: + case DW_EH_PE_sleb128: return "DW_EH_PE_sleb128"; - case DW_EH_PE_SDATA2: + case DW_EH_PE_sdata2: return "DW_EH_PE_sdata2"; - case DW_EH_PE_SDATA4: + case DW_EH_PE_sdata4: return "DW_EH_PE_sdata4"; - case DW_EH_PE_SDATA8: + case DW_EH_PE_sdata8: return "DW_EH_PE_sdata8"; - case DW_EH_PE_OMIT: + case DW_EH_PE_omit: return "DW_EH_PE_omit"; default: return "unknown format"; @@ -140,19 +140,19 @@ const std::string DwarfEncoding::FormatName() const const std::string DwarfEncoding::ApplicationName() const { switch (Application()) { - case DW_EH_PE_PCREL: + case DW_EH_PE_pcrel: return "DW_EH_PE_pcrel"; - case DW_EH_PE_TEXTREL: + case DW_EH_PE_textrel: return "DW_EH_PE_textrel"; - case DW_EH_PE_DATAREL: + case DW_EH_PE_datarel: return "DW_EH_PE_datarel"; - case DW_EH_PE_FUNCREL: + case DW_EH_PE_funcrel: return "DW_EH_PE_funcrel"; - case DW_EH_PE_ALIGNED: + case DW_EH_PE_aligned: return "DW_EH_PE_aligned"; - case DW_EH_PE_OMIT: + case DW_EH_PE_omit: return "DW_EH_PE_omit"; - case DW_EH_PE_NOTHING: + case DW_EH_PE_nothing: return "DW_EH_PE_empty"; default: return "unknown format"; diff --git a/src/perf_file_format.cpp b/src/perf_file_format.cpp index 1835ae2..1d0273d 100644 --- a/src/perf_file_format.cpp +++ b/src/perf_file_format.cpp @@ -19,7 +19,7 @@ namespace OHOS { namespace Developtools { namespace HiPerf { -static const std::vector extFeatureNames = { +static const std::vector EXT_FEATURE_NAMES = { "hiperf_files_symbol", "hiperf_workloader_cmd", "hiperf_record_time", @@ -27,7 +27,7 @@ static const std::vector extFeatureNames = { "hiperf_hm_devhost", "hiperf_stack_table", }; -static const std::vector featureNames = { +static const std::vector FEATURE_NAMES = { "unknown_feature", "tracing_data", "build_id", "hostname", "osrelease", "version", "arch", "nrcpus", "cpudesc", "cpuid", "total_mem", "cmdline", "event_desc", "cpu_topology", "numa_topology", @@ -44,15 +44,15 @@ std::string PerfFileSection::GetFeatureName(FEATURE featureId) unsigned int index = static_cast(featureId); if (featureId >= FEATURE::HIPERF_FIRST_FEATURE) { index -= static_cast(FEATURE::HIPERF_FIRST_FEATURE); - if (index >= extFeatureNames.size()) { - return featureNames[0]; + if (index >= EXT_FEATURE_NAMES.size()) { + return FEATURE_NAMES[0]; } - return extFeatureNames[index]; + return EXT_FEATURE_NAMES[index]; } else { - if (index >= featureNames.size()) { - return featureNames[0]; + if (index >= FEATURE_NAMES.size()) { + return FEATURE_NAMES[0]; } - return featureNames[index]; + return FEATURE_NAMES[index]; } } diff --git a/src/subcommand_stat.cpp b/src/subcommand_stat.cpp index fe94056..4850121 100644 --- a/src/subcommand_stat.cpp +++ b/src/subcommand_stat.cpp @@ -586,7 +586,7 @@ bool SubCommandStat::FindPercoreRunningTime(PerfEvents::Summary &summary, double } running_time_int_sec = summary.eventCount / 1e9; if (summary.timeRunning < summary.timeEnabled && summary.timeRunning != 0) { - main_scale = static_cast(summary.timeEnabled) /summary.timeRunning; + main_scale = static_cast(summary.timeEnabled) / summary.timeRunning; } return true; } diff --git a/src/symbols_file.cpp b/src/symbols_file.cpp index 135b0ef..53b2263 100644 --- a/src/symbols_file.cpp +++ b/src/symbols_file.cpp @@ -167,7 +167,7 @@ public: { } - ~ElfFileSymbols() + virtual ~ElfFileSymbols() { } diff --git a/src/virtual_thread.cpp b/src/virtual_thread.cpp index 318257b..a65bac6 100644 --- a/src/virtual_thread.cpp +++ b/src/virtual_thread.cpp @@ -29,8 +29,9 @@ namespace OHOS { namespace Developtools { namespace HiPerf { -constexpr const int MMAP_PROT_CHARS = 4; -constexpr const int MAP_PROT_EXEC_INDEX = 2; + +static constexpr int MMAP_PROT_CHARS = 4; +static constexpr int MAP_PROT_EXEC_INDEX = 2; #ifdef DEBUG_TIME diff --git a/test/unittest/common/native/dwarf_test.cpp b/test/unittest/common/native/dwarf_test.cpp index 47db116..8f9a8f0 100644 --- a/test/unittest/common/native/dwarf_test.cpp +++ b/test/unittest/common/native/dwarf_test.cpp @@ -79,19 +79,19 @@ std::vector values { 1940830438011385600ULL, }; std::vector vfs { - DW_EH_PE_ABSPTR, + DW_EH_PE_absptr, #ifdef NOT_USE - DW_EH_PE_ULEB128, + DW_EH_PE_uleb128, #endif - DW_EH_PE_UDATA2, DW_EH_PE_UDATA4, DW_EH_PE_UDATA8, + DW_EH_PE_udata2, DW_EH_PE_udata4, DW_EH_PE_udata8, #ifdef NOT_USE - DW_EH_PE_SLEB128, + DW_EH_PE_sleb128, #endif - DW_EH_PE_SDATA2, DW_EH_PE_SDATA4, DW_EH_PE_SDATA8, + DW_EH_PE_sdata2, DW_EH_PE_sdata4, DW_EH_PE_sdata8, }; vector ehas { - DW_EH_PE_NOTHING, DW_EH_PE_PCREL, DW_EH_PE_TEXTREL, DW_EH_PE_DATAREL, - DW_EH_PE_FUNCREL, DW_EH_PE_ALIGNED, DW_EH_PE_OMIT, + DW_EH_PE_nothing, DW_EH_PE_pcrel, DW_EH_PE_textrel, DW_EH_PE_datarel, + DW_EH_PE_funcrel, DW_EH_PE_aligned, DW_EH_PE_omit, }; } // namespace @@ -138,7 +138,7 @@ HWTEST_F(DwarfTest, GetEnd, TestSize.Level1) dw_encode_t dwe = ehas[i] | vfs[j]; DwarfEncoding dw {dwe, data[j]}; if (!dw.IsOmit()) { - if (vfs[j] == DW_EH_PE_ABSPTR) { + if (vfs[j] == DW_EH_PE_absptr) { EXPECT_TRUE(data[j] == dw.GetEnd() - dw.GetSize()); } else { EXPECT_TRUE(data[j] == dw.GetEnd()); @@ -157,7 +157,7 @@ HWTEST_F(DwarfTest, GetData, TestSize.Level1) dw_encode_t dwe = ehas[i] | vfs[j]; DwarfEncoding dw {dwe, data[j]}; if (!dw.IsOmit()) { - if (vfs[j] == DW_EH_PE_ABSPTR) { + if (vfs[j] == DW_EH_PE_absptr) { EXPECT_TRUE(data[j] == dw.GetData()); } else { EXPECT_TRUE(data[j] == dw.GetData() + dw.GetSize()); @@ -190,7 +190,7 @@ HWTEST_F(DwarfTest, IsOmit, TestSize.Level1) { dw_encode_t dwe = ehas[i] | vfs[j]; DwarfEncoding dw {dwe, data[j]}; - if (ehas[i] == DW_EH_PE_OMIT) { + if (ehas[i] == DW_EH_PE_omit) { EXPECT_TRUE(dw.IsOmit()); } else { EXPECT_FALSE(dw.IsOmit());