• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 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 "iosfwd"
19 
20 namespace OHOS {
21 namespace HiviewDFX {
22 class DfxConfig final {
23 public:
24     static DfxConfig &GetInstance();
25 
26     void ReadConfig();
27     void ParserConfig(const std::string& key, const std::string& value);
28     void SetDisplayBacktrace(bool displayBacktrace);
29     bool GetDisplayBacktrace() const;
30     void SetDisplayRegister(bool displayRegister);
31     bool GetDisplayRegister() const;
32     void SetDisplayMaps(bool displayMaps);
33     bool GetDisplayMaps() const;
34     void SetDisplayFaultStack(bool displayFaultStack);
35     bool GetDisplayFaultStack() const;
36     void SetFaultStackLowAddressStep(unsigned int lowAddressStep);
37     unsigned int GetFaultStackLowAddressStep() const;
38     void SetFaultStackHighAddressStep(unsigned int highAddressStep);
39     unsigned int GetFaultStackHighAddressStep() const;
40     void SetLogPersist(bool logPersist);
41     bool GetLogPersist() const;
42     void SetDumpOtherThreads(bool dumpOtherThreads);
43     bool GetDumpOtherThreads() const;
44     void Trim(std::string &s);
45 
46 private:
47     DfxConfig() = default;
48     ~DfxConfig() = default;
49     bool displayBacktrace_ = true;
50     bool displayRegister_ = true;
51     bool displayMaps_ = true;
52     bool displayFaultStack_ = true;
53     bool logPersist_ = false;
54     bool dumpOtherThreads_ = false;
55     unsigned int lowAddressStep_ = 16;
56     unsigned int highAddressStep_ = 64;
57 };
58 
59 } // namespace HiviewDFX
60 } // namespace OHOS
61 
62 #endif
63