1 /* 2 * Copyright (c) 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_ERRORS_H 16 #define DFX_ERRORS_H 17 18 #include <cinttypes> 19 #include <stdint.h> 20 21 namespace OHOS { 22 namespace HiviewDFX { 23 /** 24 * @brief Dwarf unwind error code 25 */ 26 enum DwarfErrorCode : uint8_t { 27 /** No error */ 28 DWARF_ERROR_NONE, 29 /** Memory invalid */ 30 DWARF_ERROR_MEMORY_INVALID, 31 /** Illegal value */ 32 DWARF_ERROR_ILLEGAL_VALUE, 33 /** Illegal state */ 34 DWARF_ERROR_ILLEGAL_STATE, 35 /** Stack index invalid */ 36 DWARF_ERROR_STACK_INDEX_NOT_VALID, 37 /** Not implemented */ 38 DWARF_ERROR_NOT_IMPLEMENTED, 39 /** Too many iterations */ 40 DWARF_ERROR_TOO_MANY_ITERATIONS, 41 /** Cfa not defined */ 42 DWARF_ERROR_CFA_NOT_DEFINED, 43 /** Unsupported version */ 44 DWARF_ERROR_UNSUPPORTED_VERSION, 45 /** No FDEs */ 46 DWARF_ERROR_NO_FDES, 47 /** Not support */ 48 DWARF_ERROR_NOT_SUPPORT, 49 }; 50 51 /** 52 * @brief Quick unwind table error code 53 */ 54 enum QutErrorCode : uint16_t { 55 /** No error */ 56 QUT_ERROR_NONE = 0, 57 /** Unable to use unwind information to unwind */ 58 QUT_ERROR_UNWIND_INFO, 59 /** Unwind in an invalid map */ 60 QUT_ERROR_INVALID_MAP, 61 /** The number of frames exceed the total allowed */ 62 QUT_ERROR_MAX_FRAMES_EXCEEDED, 63 /** The last frame has the same pc/sp as the next */ 64 QUT_ERROR_REPEATED_FRAME, 65 /** Unwind in an invalid elf */ 66 QUT_ERROR_INVALID_ELF, 67 /** Quicken unwind table is invalid */ 68 QUT_ERROR_QUT_SECTION_INVALID, 69 /** Met a invalid quicken instruction */ 70 QUT_ERROR_INVALID_QUT_INSTR, 71 /** Could not get maps */ 72 QUT_ERROR_MAPS_IS_NULL, 73 /** Could not get context */ 74 QUT_ERROR_CONTEXT_IS_NULL, 75 /** Request QUT file failed */ 76 QUT_ERROR_REQUEST_QUT_FILE_FAILED, 77 /** Request QUT in memory failed */ 78 QUT_ERROR_REQUEST_QUT_INMEM_FAILED, 79 /** Read memory from stack failed */ 80 QUT_ERROR_READ_STACK_FAILED, 81 /** Index overflow */ 82 QUT_ERROR_TABLE_INDEX_OVERFLOW, 83 }; 84 85 /** 86 * @brief Quick unwind table file error code 87 */ 88 enum QutFileError : uint16_t { 89 /** File not found */ 90 QUT_FILE_NONE = 0, 91 /** File not init */ 92 QUT_FILE_NOT_INIT, 93 /** File not warmed up */ 94 QUT_FILE_NOT_WARMEDUP, 95 /** File load requesting */ 96 QUT_FILE_LOAD_REQUESTING, 97 /** File open failed */ 98 QUT_FILE_OPEN_FILE_FAILED, 99 /** File state error */ 100 QUT_FILE_FILE_STATE_ERROR, 101 /** File too short */ 102 QUT_FILE_FILE_TOO_SHORT, 103 /** File mmap failed */ 104 QUT_FILE_MMAP_FAILED, 105 /** Version dismatched */ 106 QUT_FILE_QUTVERSION_NOT_MATCH, 107 /** Archtecture not matched */ 108 QUT_FILE_ARCH_NOT_MATCH, 109 /** File build id dismatched */ 110 QUT_FILE_BUILDID_NOT_MATCH, 111 /** File length dismatched */ 112 QUT_FILE_FILE_LENGTH_NOT_MATCH, 113 /** Insert new quick unwind table failed */ 114 QUT_FILE_INSERT_NEW_QUT_FAILED, 115 /** Try invode request generete */ 116 QUT_FILE_TRY_INVOKE_REQUEST_GENERATE, 117 /** File load failed */ 118 QUT_FILE_LOAD_FAILED, 119 }; 120 } // namespace HiviewDFX 121 } // namespace OHOS 122 #endif 123