1 /* 2 * Copyright (c) 2021-2023 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 DFX_CONFIG_H 16 #define DFX_CONFIG_H 17 18 #include <map> 19 #include <string> 20 21 namespace OHOS { 22 namespace HiviewDFX { 23 struct DfxConfigInfo { 24 bool displayBacktrace = true; 25 bool displayRegister = true; 26 bool displayMaps = true; 27 bool displayFaultStack = true; 28 bool dumpOtherThreads = true; 29 unsigned int lowAddressStep = 32; 30 unsigned int highAddressStep = 512; 31 unsigned int maxFrameNums = 256; 32 unsigned int reservedParseSymbolTime = 100; 33 }; 34 35 class DfxConfig { 36 public: 37 static DfxConfigInfo& GetConfig(); 38 private: 39 static void ReadAndParseConfig(DfxConfigInfo& config); 40 static void InitConfigMaps(DfxConfigInfo& config, std::map<std::string, bool *>& boolConfig, 41 std::map<std::string, unsigned int *>& uintConfig); 42 private: 43 DfxConfig() = default; 44 ~DfxConfig() = default; 45 }; 46 } // namespace HiviewDFX 47 } // namespace OHOS 48 49 #endif 50