1 /* 2 * Copyright (c) 2024 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 16 #ifndef OHOS_ABILITY_RUNTIME_DUMP_UTILS_H 17 #define OHOS_ABILITY_RUNTIME_DUMP_UTILS_H 18 19 #include <string> 20 21 namespace OHOS { 22 namespace AAFwk { 23 /** 24 * @class DumpUtils 25 * provides dump utilities. 26 */ 27 class DumpUtils final { 28 public: 29 enum DumpKey { 30 // dump all 31 KEY_DUMP_ALL = 0, 32 33 // dump stack list 34 KEY_DUMP_STACK_LIST, 35 36 // dump stack 37 KEY_DUMP_STACK, 38 39 // dump mission 40 KEY_DUMP_MISSION, 41 42 // dump top ability 43 KEY_DUMP_TOP_ABILITY, 44 45 // dump wait queue 46 KEY_DUMP_WAIT_QUEUE, 47 48 // dump service 49 KEY_DUMP_SERVICE, 50 51 // dump data 52 KEY_DUMP_DATA, 53 54 // dump focus ability 55 KEY_DUMP_FOCUS_ABILITY, 56 57 // dump window mode 58 KEY_DUMP_WINDOW_MODE, 59 60 // dump mission list 61 KEY_DUMP_MISSION_LIST, 62 63 // dump mission info 64 KEY_DUMP_MISSION_INFOS, 65 }; 66 67 enum DumpsysKey { 68 // dump system all 69 KEY_DUMP_SYS_ALL = 0, 70 71 // dump system mission list 72 KEY_DUMP_SYS_MISSION_LIST, 73 74 // dump system ability 75 KEY_DUMP_SYS_ABILITY, 76 77 // dump system service 78 KEY_DUMP_SYS_SERVICE, 79 80 // dump system pending 81 KEY_DUMP_SYS_PENDING, 82 83 // dump system process 84 KEY_DUMP_SYS_PROCESS, 85 86 // dump system data 87 KEY_DUMP_SYS_DATA, 88 }; 89 90 /** 91 * DumpMapOne, dump map first function. 92 * 93 * @param argString The argument string. 94 * @return The pair of the dump result and the dump key. 95 */ 96 static std::pair<bool, DumpUtils::DumpKey> DumpMapOne(std::string argString); 97 98 /** 99 * DumpMapTwo, dump map second function. 100 * 101 * @param argString The argument string. 102 * @return The pair of the dump result and the dump key. 103 */ 104 static std::pair<bool, DumpUtils::DumpKey> DumpMapTwo(std::string argString); 105 106 /** 107 * DumpMap, dump map function. 108 * 109 * @param argString The argument string. 110 * @return The pair of the dump result and the dump key. 111 */ 112 static std::pair<bool, DumpUtils::DumpKey> DumpMap(std::string argString); 113 114 /** 115 * DumpsysMap, dump system map function. 116 * 117 * @param argString The argument string. 118 * @return The pair of the dump result and the dump key. 119 */ 120 static std::pair<bool, DumpUtils::DumpsysKey> DumpsysMap(std::string argString); 121 }; 122 } // namespace AAFwk 123 } // namespace OHOS 124 #endif //OHOS_ABILITY_RUNTIME_DUMP_UTILS_H 125