1 /* 2 * Copyright (c) 2025 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 #ifndef PROCESS_DUMP_CONFIG_H 16 #define PROCESS_DUMP_CONFIG_H 17 18 #include <map> 19 #include <vector> 20 #include <string> 21 #include "dfx_dump_request.h" 22 23 namespace OHOS { 24 namespace HiviewDFX { 25 struct DumpConfig { 26 int32_t maxFrameNums = 256; 27 int32_t faultStackLowAddrStep = 32; 28 int32_t faultStackHighAddrStep = 512; 29 bool extendPcLrPrinting = false; 30 bool simplifyVmaPrinting = false; 31 int32_t reservedParseSymbolTime = 100; 32 uint32_t logFileCutoffSizeBytes = 0; 33 std::map<ProcessDumpType, std::vector<std::string>> dumpInfo; 34 }; 35 class ProcessDumpConfig { 36 public: 37 ProcessDumpConfig(const ProcessDumpConfig&) = delete; 38 ProcessDumpConfig(ProcessDumpConfig&&) = delete; 39 40 ProcessDumpConfig &operator=(const ProcessDumpConfig&) = delete; 41 ProcessDumpConfig &operator=(ProcessDumpConfig&&) = delete; 42 static ProcessDumpConfig& GetInstance(); 43 [[nodiscard]] const DumpConfig& GetConfig() const; SetConfig(DumpConfig && dumpConfig)44 void SetConfig(DumpConfig&& dumpConfig) 45 { 46 dumpConfig_ = std::move(dumpConfig); 47 } 48 private: 49 ProcessDumpConfig(); 50 ~ProcessDumpConfig() = default; 51 void LoadDefaultConfig(); 52 DumpConfig dumpConfig_; 53 }; 54 } // namespace HiviewDFX 55 } // namespace OHOS 56 #endif 57