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 DFX_DUMPCATCH_ERRNO_H 17 #define DFX_DUMPCATCH_ERRNO_H 18 19 #include <cinttypes> 20 #include <string> 21 22 namespace OHOS { 23 namespace HiviewDFX { 24 25 /** 26 * @brief Dumpcatch error code 27 * It describes the error status of dumpcatch. 28 */ 29 enum DumpCatchErrorCode : int32_t { 30 DUMPCATCH_ESUCCESS = 0, /* success */ 31 32 DUMPCATCH_EPARAM = 101, /* param error */ 33 DUMPCATCH_NO_PROCESS, /* process has exited */ 34 DUMPCATCH_IS_DUMPING, /* process is dumping */ 35 DUMPCATCH_EPERMISSION, /* check permission error */ 36 DUMPCATCH_HAS_CRASHED, /* process has been crashed */ 37 DUMPCATCH_ECONNECT, /* failed to connect to faultloggerd */ 38 DUMPCATCH_EWRITE, /* failed to write data to faultloggerd */ 39 DUMPCATCH_EFD, /* buf or res fd error */ 40 DUMPCATCH_EPOLL, /* poll error */ 41 DUMPCATCH_EFAULTLOGGERD, /* faultloggerd maybe exception occurred */ 42 43 DUMPCATCH_DUMP_EPTRACE = 201, /* failed to ptrace thread */ 44 DUMPCATCH_DUMP_EUNWIND, /* failed to unwind */ 45 DUMPCATCH_DUMP_EMAP, /* failed to find map */ 46 DUMPCATCH_DUMP_ESYMBOL_NO_PARSE, /* no enough time to parse symbol */ 47 DUMPCATCH_DUMP_ESYMBOL_PARSE_TIMEOUT, /* parse symbol timeout */ 48 DUMPCATCH_DUMP_SELF_FAIL, /* dump self fail */ 49 DUMPCATCH_DUMP_ERROR, /* exception occurred in processdump */ 50 51 DUMPCATCH_TIMEOUT_SIGNAL_BLOCK = 301, /* signal has been block by target process */ 52 DUMPCATCH_TIMEOUT_KERNEL_FROZEN, /* target process has been frozen in kernel */ 53 DUMPCATCH_TIMEOUT_PROCESS_KILLED, /* target process has been killed during dumping */ 54 DUMPCATCH_TIMEOUT_DUMP_SLOW, /* failed to fully dump due to timeout */ 55 DUMPCATCH_TIMEOUT_DUMP_IN_SLOWPERIOD, /* check in dumpcatch slow period and return kernel stack*/ 56 DUMPCATCH_TIMEOUT_PARSE_FAIL_READ_ESTATUS, /* dump timeout, parse reason fail for read status fail*/ 57 DUMPCATCH_TIMEOUT_PARSE_FAIL_READ_ECGROUP, /* dump timeout, parse reason fail for read cgroup fail*/ 58 59 DUMPCATCH_UNKNOWN = 400, /* unknown reason */ 60 61 DUMPCATCH_KERNELSTACK_ECREATE = 401, /* kernelstack fail due to create hstackval fail */ 62 DUMPCATCH_KERNELSTACK_EOPEN, /* kernelstack fail due to open bbox fail */ 63 DUMPCATCH_KERNELSTACK_EIOCTL, /* kernelstack fail due to ioctl fail */ 64 DUMPCATCH_KERNELSTACK_TIMEOUT, /* kernelstack fail due to wait timeout */ 65 DUMPCATCH_KERNELSTACK_OVER_LIMIT, /* kernelstack fail due to over limit */ 66 DUMPCATCH_KERNELSTACK_NONEED, /* no need to dump kernelstack */ 67 }; 68 69 class DfxDumpCatchError { 70 public: 71 static std::string ToString(const int32_t res); 72 }; 73 } // namespace HiviewDFX 74 } // namespace OHOS 75 #endif 76