* Copyright (c) 2023-2024 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef DFX_ERRORS_H
#define DFX_ERRORS_H
#include <cinttypes>
namespace OHOS {
namespace HiviewDFX {
* @brief Unwind error code
*/
enum UnwindErrorCode : uint16_t {
UNW_ERROR_NONE = 0,
UNW_ERROR_NO_UNWIND_INFO,
UNW_ERROR_PC_NOT_IN_UNWIND_INFO,
UNW_ERROR_INVALID_CONTEXT,
UNW_ERROR_INVALID_MEMORY,
UNW_ERROR_INVALID_REGS,
UNW_ERROR_INVALID_MAP,
UNW_ERROR_INVALID_ELF,
UNW_ERROR_INVALID_PID,
UNW_ERROR_RESERVED_VALUE,
UNW_ERROR_ILLEGAL_VALUE,
UNW_ERROR_ILLEGAL_STATE,
UNW_ERROR_UNREADABLE_SP,
UNW_ERROR_REPEATED_FRAME,
UNW_ERROR_RETURN_ADDRESS_SAME,
UNW_ERROR_RETURN_ADDRESS_UNDEFINED,
UNW_ERROR_MAX_FRAMES_EXCEEDED,
UNW_ERROR_INVALID_ALIGNMENT,
UNW_ERROR_INVALID_PERSONALITY,
UNW_ERROR_CANT_UNWIND,
UNW_ERROR_ARM_EXIDX_SPARE,
UNW_ERROR_ARM_EXIDX_FINISH,
UNW_ERROR_DWARF_INVALID_CFA,
UNW_ERROR_DWARF_INVALID_FDE,
UNW_ERROR_DWARF_INVALID_INSTR,
UNW_ERROR_STEP_ARK_FRAME,
UNW_ERROR_UNKNOWN_ARK_MAP,
UNW_ERROR_UNSUPPORTED_QUT_REG,
UNW_ERROR_UNSUPPORTED_VERSION,
UNW_ERROR_NOT_SUPPORT,
};
* @brief Unwind error data
*/
class UnwindErrorData {
public:
uint16_t GetCode() const { return code_; }
uint64_t GetAddr() const { return addr_; }
void SetAddrAndCode(uintptr_t addr, uint16_t code)
{
addr_ = addr;
code_ = code;
}
void SetCode(uint16_t code)
{
code_ = code;
}
void SetAddr(uintptr_t addr)
{
addr_ = addr;
}
private:
uint16_t code_ = 0;
uintptr_t addr_ = 0;
};
}
}
#endif