reference, declarationdefinition
definition → references, declarations, derived classes, virtual overrides
reference to multiple definitions → definitions
unreferenced
    1
    2
    3
    4
    5
    6
    7
    8
    9
   10
   11
   12
   13
   14
   15
   16
   17
   18
   19
   20
   21
   22
   23
   24
   25
   26
   27
   28
   29
   30
   31
   32
   33
   34
   35
   36
   37
   38
   39
   40
   41
   42
   43
   44
   45
   46
   47
   48
   49
   50
   51
   52
   53
   54
   55
   56
   57
   58
   59
   60
   61
   62
   63
   64
   65
   66
   67
   68
//===-- ArmUnwindInfo.h -----------------------------------------*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//

#ifndef liblldb_ArmUnwindInfo_h_
#define liblldb_ArmUnwindInfo_h_

#include "lldb/Symbol/ObjectFile.h"
#include "lldb/Utility/DataExtractor.h"
#include "lldb/Utility/RangeMap.h"
#include "lldb/lldb-private.h"
#include <vector>

/*
 * Unwind information reader and parser for the ARM exception handling ABI
 *
 * Implemented based on:
 *     Exception Handling ABI for the ARM Architecture
 *     Document number: ARM IHI 0038A (current through ABI r2.09)
 *     Date of Issue: 25th January 2007, reissued 30th November 2012
 *     http://infocenter.arm.com/help/topic/com.arm.doc.ihi0038a/IHI0038A_ehabi.pdf
 */

namespace lldb_private {

class ArmUnwindInfo {
public:
  ArmUnwindInfo(ObjectFile &objfile, lldb::SectionSP &arm_exidx,
                lldb::SectionSP &arm_extab);

  ~ArmUnwindInfo();

  bool GetUnwindPlan(Target &target, const Address &addr,
                     UnwindPlan &unwind_plan);

private:
  struct ArmExidxEntry {
    ArmExidxEntry(uint32_t f, lldb::addr_t a, uint32_t d);

    bool operator<(const ArmExidxEntry &other) const;

    uint32_t file_address;
    lldb::addr_t address;
    uint32_t data;
  };

  const uint8_t *GetExceptionHandlingTableEntry(const Address &addr);

  uint8_t GetByteAtOffset(const uint32_t *data, uint16_t offset) const;

  uint64_t GetULEB128(const uint32_t *data, uint16_t &offset,
                      uint16_t max_offset) const;

  const lldb::ByteOrder m_byte_order;
  lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section
  lldb::SectionSP m_arm_extab_sp; // .ARM.extab section
  DataExtractor m_arm_exidx_data; // .ARM.exidx section data
  DataExtractor m_arm_extab_data; // .ARM.extab section data
  std::vector<ArmExidxEntry> m_exidx_entries;
};

} // namespace lldb_private

#endif // liblldb_ArmUnwindInfo_h_