Home | History | Annotate | Download | only in Core
      1 //===-- dwarf.h -------------------------------------------------*- C++ -*-===//
      2 //
      3 //                     The LLVM Compiler Infrastructure
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 
     10 #ifndef DebugBase_dwarf_h_
     11 #define DebugBase_dwarf_h_
     12 
     13 #include <stdint.h>
     14 #include <stdbool.h>
     15 
     16 // Get the DWARF constant defintions from llvm
     17 #include "llvm/Support/Dwarf.h"
     18 // and stuff them in our default namespace
     19 using namespace llvm::dwarf;
     20 
     21 typedef uint32_t    dw_uleb128_t;
     22 typedef int32_t     dw_sleb128_t;
     23 typedef uint16_t    dw_attr_t;
     24 typedef uint8_t     dw_form_t;
     25 typedef uint16_t    dw_tag_t;
     26 typedef uint64_t    dw_addr_t;      // Dwarf address define that must be big enough for any addresses in the compile units that get parsed
     27 
     28 #ifdef DWARFUTILS_DWARF64
     29 #define DWARF_REF_ADDR_SIZE     8
     30 typedef uint64_t    dw_offset_t;    // Dwarf Debug Information Entry offset for any offset into the file
     31 #else
     32 #define DWARF_REF_ADDR_SIZE     4
     33 typedef uint32_t    dw_offset_t;    // Dwarf Debug Information Entry offset for any offset into the file
     34 #endif
     35 
     36 /* Constants */
     37 #define DW_INVALID_OFFSET                   (~(dw_offset_t)0)
     38 #define DW_INVALID_INDEX                    0xFFFFFFFFul
     39 
     40 // #define DW_ADDR_none 0x0
     41 
     42 #define DW_EH_PE_MASK_ENCODING 0x0F
     43 
     44 //// The following are used only internally within lldb - don't
     45 //// document them in the llvm Dwarf.h header file, we won't see
     46 //// them in executable files anywhere.
     47 //// These constants fit between DW_OP_lo_user (0xe0) and DW_OP_hi_user (0xff).
     48 //
     49 //#define DW_OP_APPLE_array_ref     0xEE // first pops index, then pops array; pushes array[index]
     50 //#define DW_OP_APPLE_extern        0xEF // ULEB128 index of external object (i.e., an entity from the program that was used in the expression)
     51 #define DW_OP_APPLE_uninit        0xF0 // This is actually generated by some apple compilers in locations lists
     52 //#define DW_OP_APPLE_assign        0xF1 // pops value off and assigns it to second item on stack (2nd item must have assignable context)
     53 //#define DW_OP_APPLE_address_of    0xF2 // gets the address of the top stack item (top item must be a variable, or have value_type that is an address already)
     54 //#define DW_OP_APPLE_value_of      0xF3 // pops the value off the stack and pushes the value of that object (top item must be a variable, or expression local)
     55 //#define DW_OP_APPLE_deref_type    0xF4 // gets the address of the top stack item (top item must be a variable, or a clang type)
     56 //#define DW_OP_APPLE_expr_local    0xF5 // ULEB128 expression local index
     57 //#define DW_OP_APPLE_constf        0xF6 // 1 byte float size, followed by constant float data
     58 //#define DW_OP_APPLE_scalar_cast   0xF7 // Cast top of stack to 2nd in stack's type leaving all items in place
     59 //#define DW_OP_APPLE_clang_cast    0xF8 // pointer size clang::Type * off the stack and cast top stack item to this type
     60 //#define DW_OP_APPLE_clear         0xFE // clears the entire expression stack, ok if the stack is empty
     61 //#define DW_OP_APPLE_error         0xFF // Stops expression evaluation and returns an error (no args)
     62 
     63 
     64 #endif  // DebugBase_dwarf_h_
     65