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 = 16; 30 unsigned int highAddressStep = 512; 31 unsigned int maxFrameNums = 256; 32 }; 33 34 class DfxConfig { 35 public: 36 static DfxConfigInfo& GetConfig(); 37 private: 38 static void ReadAndParseConfig(DfxConfigInfo& config); 39 static void InitConfigMaps(DfxConfigInfo& config, std::map<std::string, bool *>& boolConfig, 40 std::map<std::string, unsigned int *>& uintConfig); 41 private: 42 DfxConfig() = default; 43 ~DfxConfig() = default; 44 }; 45 } // namespace HiviewDFX 46 } // namespace OHOS 47 48 #endif 49