• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- dwarf.h -------------------------------------------------*- C++ -*-===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #ifndef LLDB_CORE_DWARF_H
10 #define LLDB_CORE_DWARF_H
11 
12 #include "lldb/Utility/RangeMap.h"
13 #include <stdint.h>
14 
15 // Get the DWARF constant definitions from llvm
16 #include "llvm/BinaryFormat/Dwarf.h"
17 
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 uint16_t dw_form_t;
25 typedef llvm::dwarf::Tag dw_tag_t;
26 typedef uint64_t dw_addr_t; // Dwarf address define that must be big enough for
27                             // any addresses in the compile units that get
28                             // parsed
29 
30 typedef uint32_t dw_offset_t; // Dwarf Debug Information Entry offset for any
31                               // offset into the file
32 
33 /* Constants */
34 #define DW_INVALID_OFFSET (~(dw_offset_t)0)
35 #define DW_INVALID_INDEX 0xFFFFFFFFul
36 
37 // #define DW_ADDR_none 0x0
38 
39 #define DW_EH_PE_MASK_ENCODING 0x0F
40 
41 //// The following are used only internally within lldb - don't
42 //// document them in the llvm Dwarf.h header file, we won't see
43 //// them in executable files anywhere.
44 //// These constants fit between DW_OP_lo_user (0xe0) and DW_OP_hi_user (0xff).
45 //
46 //#define DW_OP_APPLE_array_ref     0xEE // first pops index, then pops array;
47 //pushes array[index]
48 //#define DW_OP_APPLE_extern        0xEF // ULEB128 index of external object
49 //(i.e., an entity from the program that was used in the expression)
50 #define DW_OP_APPLE_uninit                                                     \
51   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
53 //second item on stack (2nd item must have assignable context)
54 //#define DW_OP_APPLE_address_of    0xF2 // gets the address of the top stack
55 //item (top item must be a variable, or have value_type that is an address
56 //already)
57 //#define DW_OP_APPLE_value_of      0xF3 // pops the value off the stack and
58 //pushes the value of that object (top item must be a variable, or expression
59 //local)
60 //#define DW_OP_APPLE_deref_type    0xF4 // gets the address of the top stack
61 //item (top item must be a variable, or a clang type)
62 //#define DW_OP_APPLE_expr_local    0xF5 // ULEB128 expression local index
63 //#define DW_OP_APPLE_constf        0xF6 // 1 byte float size, followed by
64 //constant float data
65 //#define DW_OP_APPLE_scalar_cast   0xF7 // Cast top of stack to 2nd in stack's
66 //type leaving all items in place
67 //#define DW_OP_APPLE_clang_cast    0xF8 // pointer size clang::Type * off the
68 //stack and cast top stack item to this type
69 //#define DW_OP_APPLE_clear         0xFE // clears the entire expression stack,
70 //ok if the stack is empty
71 //#define DW_OP_APPLE_error         0xFF // Stops expression evaluation and
72 //returns an error (no args)
73 
74 typedef lldb_private::RangeVector<dw_addr_t, dw_addr_t, 2> DWARFRangeList;
75 
76 #endif // LLDB_CORE_DWARF_H
77