1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Copyright 2013-2014, Rene Gollent, rene@gollent.com. 4 * Distributed under the terms of the MIT License. 5 */ 6 #ifndef DEBUG_INFO_ENTRY_H 7 #define DEBUG_INFO_ENTRY_H 8 9 #include <String.h> 10 11 #include <util/DoublyLinkedList.h> 12 13 #include "Types.h" 14 15 16 #define DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(name) \ 17 virtual status_t AddAttribute_##name(uint16 attributeName, \ 18 const AttributeValue& value); 19 20 enum { 21 ATTRIBUTE_NOT_HANDLED = 1, 22 ENTRY_NOT_HANDLED = 2 23 }; 24 25 26 struct AttributeValue; 27 struct ConstantAttributeValue; 28 struct DeclarationLocation; 29 struct DynamicAttributeValue; 30 struct LocationDescription; 31 struct MemberLocation; 32 struct SourceLanguageInfo; 33 34 35 struct DebugInfoEntryInitInfo { 36 const SourceLanguageInfo* languageInfo; 37 }; 38 39 40 class DebugInfoEntry : public DoublyLinkedListLinkImpl<DebugInfoEntry> { 41 public: 42 DebugInfoEntry(); 43 virtual ~DebugInfoEntry(); 44 45 virtual status_t InitAfterHierarchy( 46 DebugInfoEntryInitInfo& info); 47 virtual status_t InitAfterAttributes( 48 DebugInfoEntryInitInfo& info); 49 50 virtual uint16 Tag() const = 0; 51 52 DebugInfoEntry* Parent() const { return fParent; } 53 void SetParent(DebugInfoEntry* parent); 54 55 virtual bool IsType() const; 56 virtual bool IsNamespace() const; 57 // a namespace-like thingy (namespace, 58 // class, ...) 59 60 virtual const char* Name() const; 61 virtual const char* Description() const; 62 virtual DebugInfoEntry* Specification() const; 63 virtual DebugInfoEntry* AbstractOrigin() const; 64 virtual DebugInfoEntry* SignatureType() const; 65 virtual LocationDescription* GetLocationDescription(); 66 67 bool GetDeclarationFile(uint32& _file) const; 68 bool GetDeclarationLine(uint32& _line) const; 69 bool GetDeclarationColumn(uint32& _column) const; 70 71 virtual status_t AddChild(DebugInfoEntry* child); 72 73 virtual status_t AddAttribute_decl_file(uint16 attributeName, 74 const AttributeValue& value); 75 virtual status_t AddAttribute_decl_line(uint16 attributeName, 76 const AttributeValue& value); 77 virtual status_t AddAttribute_decl_column(uint16 attributeName, 78 const AttributeValue& value); 79 virtual status_t AddAttribute_location(uint16 attributeName, 80 const AttributeValue& value); 81 virtual status_t AddAttribute_sibling(uint16 attributeName, 82 const AttributeValue& value); 83 84 // TODO: Handle (ignore?) DW_AT_description here? 85 86 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(name) 87 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(ordering) 88 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(byte_size) 89 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(bit_offset) 90 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(bit_size) 91 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(stmt_list) 92 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(low_pc) 93 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(high_pc) 94 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(language) 95 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(discr) 96 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(discr_value) 97 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(visibility) 98 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(import) 99 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(string_length) 100 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(common_reference) 101 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(comp_dir) 102 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(const_value) 103 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(containing_type) 104 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(default_value) 105 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(inline) 106 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(is_optional) 107 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(lower_bound) 108 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(producer) 109 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(prototyped) 110 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(return_addr) 111 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(start_scope) 112 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(bit_stride) 113 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(upper_bound) 114 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(abstract_origin) 115 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(accessibility) 116 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(address_class) 117 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(artificial) 118 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(base_types) 119 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(calling_convention) 120 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(count) 121 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(data_member_location) 122 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(declaration) 123 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(discr_list) 124 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(encoding) 125 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(external) 126 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(frame_base) 127 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(friend) 128 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(identifier_case) 129 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(macro_info) 130 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(namelist_item) 131 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(priority) 132 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(segment) 133 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(specification) 134 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(static_link) 135 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(type) 136 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(use_location) 137 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(variable_parameter) 138 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(virtuality) 139 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(vtable_elem_location) 140 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(allocated) 141 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(associated) 142 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(data_location) 143 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(byte_stride) 144 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(entry_pc) 145 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(use_UTF8) 146 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(extension) 147 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(ranges) 148 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(trampoline) 149 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_column) 150 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_file) 151 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_line) 152 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(description) 153 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(binary_scale) 154 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(decimal_scale) 155 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(small) 156 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(decimal_sign) 157 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(digit_count) 158 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(picture_string) 159 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(mutable) 160 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(threads_scaled) 161 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(explicit) 162 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(object_pointer) 163 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(endianity) 164 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(elemental) 165 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(pure) 166 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(recursive) 167 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(signature) 168 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(main_subprogram) 169 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(data_bit_offset) 170 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(const_expr) 171 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(enum_class) 172 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(linkage_name) 173 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(string_length_bit_size) 174 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(string_length_byte_size) 175 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(rank) 176 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(str_offsets_base) 177 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(addr_base) 178 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(rnglists_base) 179 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(dwo_name) 180 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(reference) 181 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(rvalue_reference) 182 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(macros) 183 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_all_calls) 184 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_all_source_calls) 185 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_all_tail_calls) 186 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_return_pc) 187 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_value) 188 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_origin) 189 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_parameter) 190 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_pc) 191 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_tail_call) 192 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_target) 193 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_target_clobbered) 194 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_data_location) 195 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_data_value) 196 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(noreturn) 197 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(alignment) 198 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(export_symbols) 199 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(deleted) 200 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(defaulted) 201 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(loclists_base) 202 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_site_value) 203 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_site_data_value) 204 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_site_target) 205 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(call_site_target_clobbered) 206 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(tail_call) 207 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(all_tail_call_sites) 208 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(all_call_sites) 209 DECLARE_DEBUG_INFO_ENTRY_ATTR_SETTER(all_source_call_sites) 210 211 protected: 212 virtual DeclarationLocation* GetDeclarationLocation(); 213 214 status_t SetDynamicAttributeValue( 215 DynamicAttributeValue& toSet, 216 const AttributeValue& value); 217 status_t SetConstantAttributeValue( 218 ConstantAttributeValue& toSet, 219 const AttributeValue& value); 220 status_t SetMemberLocation(MemberLocation& toSet, 221 const AttributeValue& value); 222 223 protected: 224 DebugInfoEntry* fParent; 225 }; 226 227 228 typedef DoublyLinkedList<DebugInfoEntry> DebugInfoEntryList; 229 230 231 #endif // DEBUG_INFO_ENTRY_H 232