vfs: check userland buffers before reading them.
[haiku.git] / src / kits / debugger / dwarf / DebugInfoEntries.h
blob71170e053024e24663a14ee6733580582ec5d3c5
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_ENTRIES_H
7 #define DEBUG_INFO_ENTRIES_H
10 #include "DebugInfoEntry.h"
12 #include "AttributeValue.h"
15 // common:
16 // DW_AT_name
17 // // not supported by all types:
18 // DW_AT_allocated
19 // DW_AT_associated
20 // DW_AT_data_location
21 // DW_AT_start_scope
23 // modified:
24 // DW_AT_type
26 // declared:
27 // DECL
28 // DW_AT_accessibility // !file, !pointer to member
29 // DW_AT_declaration // !file
30 // DW_AT_abstract_origin // !interface
31 // DW_AT_description // !interface
32 // DW_AT_visibility // !interface
34 // derived: declared
35 // DW_AT_type
37 // addressing: modified
38 // DW_AT_address_class
40 // compound: declared
41 // DW_AT_byte_size // !interface
42 // DW_AT_specification // !interface
44 // class base: compound
46 // array index: derived
47 // DW_AT_bit_stride
48 // DW_AT_byte_stride
49 // DW_AT_byte_size
52 // unspecified: common
53 // DECL
54 // DW_AT_description
58 // class/structure: class base
60 // interface: class base
62 // union: compound
64 // string: declared
65 // DW_AT_byte_size
66 // DW_AT_string_length
68 // subroutine: declared
69 // DW_AT_address_class
70 // DW_AT_prototyped
71 // DW_AT_type
74 // enumeration: array index
75 // DW_AT_specification
77 // pointer to member: derived
78 // DW_AT_address_class
79 // DW_AT_containing_type
80 // DW_AT_use_location
82 // set: derived
83 // DW_AT_byte_size
85 // subrange: array index
86 // DW_AT_count
87 // DW_AT_lower_bound
88 // DW_AT_threads_scaled
89 // DW_AT_upper_bound
91 // array: derived
92 // DW_AT_bit_stride
93 // DW_AT_byte_size
94 // DW_AT_ordering
95 // DW_AT_specification
97 // typedef: derived
99 // file: derived
100 // DW_AT_byte_size
103 // shared: modified
104 // DECL
105 // DW_AT_count
107 // const: modified
109 // packed: modified
111 // volatile: modified
112 // DECL
114 // restrict: modified
116 // pointer: addressing
117 // DW_AT_specification
119 // reference: addressing
122 // basetype:
123 // DW_AT_binary_scale
124 // DW_AT_bit_offset
125 // DW_AT_bit_size
126 // DW_AT_byte_size
127 // DW_AT_decimal_scale
128 // DW_AT_decimal_sign
129 // DW_AT_description
130 // DW_AT_digit_count
131 // DW_AT_encoding
132 // DW_AT_endianity
133 // DW_AT_picture_string
134 // DW_AT_small
137 class DIECompileUnitBase : public DebugInfoEntry {
138 public:
139 DIECompileUnitBase();
140 ~DIECompileUnitBase();
142 virtual status_t InitAfterAttributes(
143 DebugInfoEntryInitInfo& info);
145 virtual const char* Name() const;
147 const char* CompilationDir() const
148 { return fCompilationDir; }
150 uint16 Language() const { return fLanguage; }
152 const DebugInfoEntryList& Types() const { return fTypes; }
153 const DebugInfoEntryList& OtherChildren() const
154 { return fOtherChildren; }
155 off_t AddressRangesOffset() const
156 { return fAddressRangesOffset; }
158 target_addr_t LowPC() const { return fLowPC; }
159 target_addr_t HighPC() const { return fHighPC; }
161 off_t StatementListOffset() const
162 { return fStatementListOffset; }
164 bool ContainsMainSubprogram() const
165 { return fContainsMainSubprogram; }
167 virtual status_t AddChild(DebugInfoEntry* child);
169 virtual status_t AddAttribute_name(uint16 attributeName,
170 const AttributeValue& value);
171 virtual status_t AddAttribute_comp_dir(uint16 attributeName,
172 const AttributeValue& value);
173 virtual status_t AddAttribute_low_pc(uint16 attributeName,
174 const AttributeValue& value);
175 virtual status_t AddAttribute_high_pc(uint16 attributeName,
176 const AttributeValue& value);
177 virtual status_t AddAttribute_producer(uint16 attributeName,
178 const AttributeValue& value);
179 virtual status_t AddAttribute_stmt_list(uint16 attributeName,
180 const AttributeValue& value);
181 virtual status_t AddAttribute_macro_info(uint16 attributeName,
182 const AttributeValue& value);
183 virtual status_t AddAttribute_base_types(uint16 attributeName,
184 const AttributeValue& value);
185 virtual status_t AddAttribute_language(uint16 attributeName,
186 const AttributeValue& value);
187 virtual status_t AddAttribute_identifier_case(
188 uint16 attributeName,
189 const AttributeValue& value);
190 virtual status_t AddAttribute_use_UTF8(uint16 attributeName,
191 const AttributeValue& value);
192 virtual status_t AddAttribute_ranges(uint16 attributeName,
193 const AttributeValue& value);
194 virtual status_t AddAttribute_main_subprogram(
195 uint16 attributeName,
196 const AttributeValue& value);
198 //TODO:
199 // virtual status_t AddAttribute_segment(uint16 attributeName,
200 // const AttributeValue& value);
202 // TODO: DW_AT_import
204 protected:
205 const char* fName;
206 const char* fCompilationDir;
207 target_addr_t fLowPC;
208 target_addr_t fHighPC;
209 off_t fStatementListOffset;
210 off_t fMacroInfoOffset;
211 off_t fAddressRangesOffset;
212 DIECompileUnitBase* fBaseTypesUnit;
213 DebugInfoEntryList fTypes;
214 DebugInfoEntryList fOtherChildren;
215 uint16 fLanguage;
216 uint8 fIdentifierCase;
217 bool fUseUTF8;
218 bool fContainsMainSubprogram;
222 class DIEType : public DebugInfoEntry {
223 public:
224 DIEType();
226 virtual bool IsType() const;
228 virtual const char* Name() const;
230 virtual bool IsDeclaration() const;
231 virtual const DynamicAttributeValue* ByteSize() const;
233 virtual status_t AddAttribute_name(uint16 attributeName,
234 const AttributeValue& value);
235 virtual status_t AddAttribute_allocated(uint16 attributeName,
236 const AttributeValue& value);
237 virtual status_t AddAttribute_associated(uint16 attributeName,
238 const AttributeValue& value);
240 // TODO:
241 // DW_AT_data_location
242 // DW_AT_start_scope
244 protected:
245 const char* fName;
246 DynamicAttributeValue fAllocated;
247 DynamicAttributeValue fAssociated;
251 class DIEModifiedType : public DIEType {
252 public:
253 DIEModifiedType();
255 DIEType* GetType() const { return fType; }
257 virtual status_t AddAttribute_type(uint16 attributeName,
258 const AttributeValue& value);
260 protected:
261 DIEType* fType;
265 class DIEAddressingType : public DIEModifiedType {
266 public:
267 DIEAddressingType();
269 virtual status_t AddAttribute_address_class(uint16 attributeName,
270 const AttributeValue& value);
272 protected:
273 uint8 fAddressClass;
277 class DIEDeclaredType : public DIEType {
278 public:
279 DIEDeclaredType();
281 virtual const char* Description() const;
282 virtual DebugInfoEntry* AbstractOrigin() const;
284 virtual DebugInfoEntry* SignatureType() const;
286 virtual bool IsDeclaration() const;
288 virtual status_t AddAttribute_accessibility(uint16 attributeName,
289 const AttributeValue& value);
290 // TODO: !file, !pointer to member
291 virtual status_t AddAttribute_declaration(uint16 attributeName,
292 const AttributeValue& value);
293 // TODO: !file
294 virtual status_t AddAttribute_description(uint16 attributeName,
295 const AttributeValue& value);
296 // TODO: !interface
297 virtual status_t AddAttribute_abstract_origin(
298 uint16 attributeName,
299 const AttributeValue& value);
300 // TODO: !interface
301 virtual status_t AddAttribute_signature(uint16 attributeName,
302 const AttributeValue& value);
304 // TODO:
305 // DW_AT_visibility // !interface
307 protected:
308 virtual DeclarationLocation* GetDeclarationLocation();
310 protected:
311 const char* fDescription;
312 DeclarationLocation fDeclarationLocation;
313 DebugInfoEntry* fAbstractOrigin;
314 DebugInfoEntry* fSignatureType;
315 uint8 fAccessibility;
316 bool fDeclaration;
320 class DIEDerivedType : public DIEDeclaredType {
321 public:
322 DIEDerivedType();
324 DIEType* GetType() const { return fType; }
326 virtual status_t AddAttribute_type(uint16 attributeName,
327 const AttributeValue& value);
329 protected:
330 DIEType* fType;
334 class DIECompoundType : public DIEDeclaredType {
335 public:
336 DIECompoundType();
338 virtual bool IsNamespace() const;
340 virtual DebugInfoEntry* Specification() const;
342 virtual const DynamicAttributeValue* ByteSize() const;
344 const DebugInfoEntryList& DataMembers() const
345 { return fDataMembers; }
347 virtual status_t AddChild(DebugInfoEntry* child);
349 virtual status_t AddAttribute_byte_size(uint16 attributeName,
350 const AttributeValue& value);
351 // TODO: !interface
352 virtual status_t AddAttribute_specification(uint16 attributeName,
353 const AttributeValue& value);
354 // TODO: !interface
356 protected:
357 DynamicAttributeValue fByteSize;
358 DIECompoundType* fSpecification;
359 DebugInfoEntryList fDataMembers;
363 class DIEClassBaseType : public DIECompoundType {
364 public:
365 DIEClassBaseType();
367 const DebugInfoEntryList& BaseTypes() const
368 { return fBaseTypes; }
369 const DebugInfoEntryList& TemplateParameters() const
370 { return fTemplateParameters; }
372 virtual status_t AddChild(DebugInfoEntry* child);
374 protected:
375 DebugInfoEntryList fBaseTypes;
376 DebugInfoEntryList fFriends;
377 DebugInfoEntryList fAccessDeclarations;
378 DebugInfoEntryList fMemberFunctions;
379 DebugInfoEntryList fInnerTypes;
380 DebugInfoEntryList fTemplateParameters;
384 class DIENamedBase : public DebugInfoEntry {
385 public:
386 DIENamedBase();
388 virtual const char* Name() const;
389 virtual const char* Description() const;
391 virtual status_t AddAttribute_name(uint16 attributeName,
392 const AttributeValue& value);
393 virtual status_t AddAttribute_description(uint16 attributeName,
394 const AttributeValue& value);
396 protected:
397 const char* fName;
398 const char* fDescription;
402 class DIEDeclaredBase : public DebugInfoEntry {
403 public:
404 DIEDeclaredBase();
406 protected:
407 virtual DeclarationLocation* GetDeclarationLocation();
409 protected:
410 DeclarationLocation fDeclarationLocation;
414 class DIEDeclaredNamedBase : public DIEDeclaredBase {
415 public:
416 DIEDeclaredNamedBase();
418 virtual const char* Name() const;
419 virtual const char* Description() const;
421 uint8 Accessibility() const { return fAccessibility; }
422 uint8 Visibility() const { return fVisibility; }
423 virtual bool IsDeclaration() const;
425 virtual status_t AddAttribute_name(uint16 attributeName,
426 const AttributeValue& value);
427 virtual status_t AddAttribute_description(uint16 attributeName,
428 const AttributeValue& value);
429 virtual status_t AddAttribute_accessibility(uint16 attributeName,
430 const AttributeValue& value);
431 virtual status_t AddAttribute_declaration(uint16 attributeName,
432 const AttributeValue& value);
434 protected:
435 const char* fName;
436 const char* fDescription;
437 uint8 fAccessibility;
438 uint8 fVisibility;
439 bool fDeclaration;
443 class DIEArrayIndexType : public DIEDerivedType {
444 public:
445 DIEArrayIndexType();
447 virtual const DynamicAttributeValue* ByteSize() const;
449 const DynamicAttributeValue* BitStride() const
450 { return &fBitStride; }
451 const DynamicAttributeValue* ByteStride() const
452 { return &fByteStride; }
454 virtual status_t AddAttribute_bit_stride(uint16 attributeName,
455 const AttributeValue& value);
456 virtual status_t AddAttribute_byte_size(uint16 attributeName,
457 const AttributeValue& value);
458 virtual status_t AddAttribute_byte_stride(uint16 attributeName,
459 const AttributeValue& value);
461 private:
462 DynamicAttributeValue fBitStride;
463 DynamicAttributeValue fByteSize;
464 DynamicAttributeValue fByteStride;
468 // #pragma mark -
471 class DIEArrayType : public DIEDerivedType {
472 public:
473 DIEArrayType();
475 virtual uint16 Tag() const;
477 virtual status_t InitAfterHierarchy(
478 DebugInfoEntryInitInfo& info);
480 virtual DebugInfoEntry* Specification() const;
482 virtual const DynamicAttributeValue* ByteSize() const;
484 const DynamicAttributeValue* BitStride() const
485 { return &fBitStride; }
487 const DebugInfoEntryList& Dimensions() const
488 { return fDimensions; }
490 virtual status_t AddChild(DebugInfoEntry* child);
492 virtual status_t AddAttribute_ordering(uint16 attributeName,
493 const AttributeValue& value);
494 virtual status_t AddAttribute_bit_stride(uint16 attributeName,
495 const AttributeValue& value);
496 virtual status_t AddAttribute_stride_size(uint16 attributeName,
497 const AttributeValue& value);
498 virtual status_t AddAttribute_byte_size(uint16 attributeName,
499 const AttributeValue& value);
500 virtual status_t AddAttribute_specification(uint16 attributeName,
501 const AttributeValue& value);
503 private:
504 DynamicAttributeValue fBitStride;
505 DynamicAttributeValue fByteSize;
506 DebugInfoEntryList fDimensions;
507 DIEArrayType* fSpecification;
508 uint8 fOrdering;
512 class DIEClassType : public DIEClassBaseType {
513 public:
514 DIEClassType();
516 virtual uint16 Tag() const;
520 class DIEEntryPoint : public DebugInfoEntry {
521 public:
522 // TODO: Maybe introduce a common base class for DIEEntryPoint and
523 // DIESubprogram.
524 DIEEntryPoint();
526 virtual uint16 Tag() const;
528 // TODO:
529 // DW_AT_address_class
530 // DW_AT_description
531 // DW_AT_frame_base
532 // DW_AT_low_pc
533 // DW_AT_name
534 // DW_AT_return_addr
535 // DW_AT_segment
536 // DW_AT_static_link
537 // DW_AT_type
541 class DIEEnumerationType : public DIEArrayIndexType {
542 public:
543 DIEEnumerationType();
545 virtual uint16 Tag() const;
547 virtual DebugInfoEntry* Specification() const;
549 const DebugInfoEntryList& Enumerators() const
550 { return fEnumerators; }
552 virtual status_t AddChild(DebugInfoEntry* child);
554 virtual status_t AddAttribute_specification(uint16 attributeName,
555 const AttributeValue& value);
557 private:
558 DIEEnumerationType* fSpecification;
559 DebugInfoEntryList fEnumerators;
563 class DIEFormalParameter : public DIEDeclaredNamedBase {
564 public:
565 DIEFormalParameter();
567 virtual uint16 Tag() const;
569 virtual DebugInfoEntry* AbstractOrigin() const;
570 virtual LocationDescription* GetLocationDescription();
572 DIEType* GetType() const { return fType; }
574 const ConstantAttributeValue* ConstValue() const
575 { return &fValue; }
577 bool IsArtificial() const { return fArtificial; }
579 virtual status_t AddAttribute_abstract_origin(
580 uint16 attributeName,
581 const AttributeValue& value);
582 virtual status_t AddAttribute_artificial(uint16 attributeName,
583 const AttributeValue& value);
584 virtual status_t AddAttribute_const_value(uint16 attributeName,
585 const AttributeValue& value);
586 virtual status_t AddAttribute_type(uint16 attributeName,
587 const AttributeValue& value);
589 // TODO:
590 // DW_AT_default_value
591 // DW_AT_endianity
592 // DW_AT_is_optional
593 // DW_AT_segment
594 // DW_AT_variable_parameter
596 private:
597 LocationDescription fLocationDescription;
598 DebugInfoEntry* fAbstractOrigin;
599 DIEType* fType;
600 ConstantAttributeValue fValue;
601 bool fArtificial;
605 class DIEImportedDeclaration : public DIEDeclaredNamedBase {
606 public:
607 DIEImportedDeclaration();
609 virtual uint16 Tag() const;
611 // TODO:
612 // DW_AT_import
613 // DW_AT_start_scope
617 class DIELabel : public DIEDeclaredNamedBase {
618 public:
619 DIELabel();
621 virtual uint16 Tag() const;
623 // TODO:
624 // DW_AT_abstract_origin
625 // DW_AT_low_pc
626 // DW_AT_segment
627 // DW_AT_start_scope
631 class DIELexicalBlock : public DIENamedBase {
632 public:
633 DIELexicalBlock();
635 virtual uint16 Tag() const;
637 virtual DebugInfoEntry* AbstractOrigin() const;
639 off_t AddressRangesOffset() const
640 { return fAddressRangesOffset; }
642 target_addr_t LowPC() const { return fLowPC; }
643 target_addr_t HighPC() const { return fHighPC; }
645 const DebugInfoEntryList& Variables() const { return fVariables; }
646 const DebugInfoEntryList& Blocks() const { return fBlocks; }
648 virtual status_t AddChild(DebugInfoEntry* child);
650 virtual status_t AddAttribute_low_pc(uint16 attributeName,
651 const AttributeValue& value);
652 virtual status_t AddAttribute_high_pc(uint16 attributeName,
653 const AttributeValue& value);
654 virtual status_t AddAttribute_ranges(uint16 attributeName,
655 const AttributeValue& value);
656 virtual status_t AddAttribute_abstract_origin(
657 uint16 attributeName,
658 const AttributeValue& value);
660 protected:
661 DebugInfoEntryList fVariables;
662 DebugInfoEntryList fBlocks;
663 target_addr_t fLowPC;
664 target_addr_t fHighPC;
665 off_t fAddressRangesOffset;
666 DIELexicalBlock* fAbstractOrigin;
668 // TODO:
669 // DW_AT_segment
673 class DIEMember : public DIEDeclaredNamedBase {
674 public:
675 DIEMember();
677 virtual uint16 Tag() const;
679 DIEType* GetType() const { return fType; }
680 const DynamicAttributeValue* ByteSize() const
681 { return &fByteSize; }
682 const DynamicAttributeValue* BitOffset() const
683 { return &fBitOffset; }
684 const DynamicAttributeValue* DataBitOffset() const
685 { return &fDataBitOffset; }
686 const DynamicAttributeValue* BitSize() const
687 { return &fBitSize; }
688 const MemberLocation* Location() const
689 { return &fLocation; }
691 virtual status_t AddAttribute_type(uint16 attributeName,
692 const AttributeValue& value);
693 virtual status_t AddAttribute_byte_size(uint16 attributeName,
694 const AttributeValue& value);
695 virtual status_t AddAttribute_bit_size(uint16 attributeName,
696 const AttributeValue& value);
697 virtual status_t AddAttribute_bit_offset(uint16 attributeName,
698 const AttributeValue& value);
699 virtual status_t AddAttribute_data_bit_offset(
700 uint16 attributeName,
701 const AttributeValue& value);
702 virtual status_t AddAttribute_data_member_location(
703 uint16 attributeName,
704 const AttributeValue& value);
706 // TODO:
707 // DW_AT_mutable
709 private:
710 DIEType* fType;
711 DynamicAttributeValue fByteSize;
712 DynamicAttributeValue fBitOffset;
713 DynamicAttributeValue fDataBitOffset;
714 DynamicAttributeValue fBitSize;
715 MemberLocation fLocation;
719 class DIEPointerType : public DIEAddressingType {
720 public:
721 DIEPointerType();
723 virtual uint16 Tag() const;
725 virtual DebugInfoEntry* Specification() const;
727 virtual status_t AddAttribute_specification(uint16 attributeName,
728 const AttributeValue& value);
730 private:
731 DIEPointerType* fSpecification;
735 class DIEReferenceType : public DIEAddressingType {
736 public:
737 DIEReferenceType();
739 virtual uint16 Tag() const;
743 class DIECompileUnit : public DIECompileUnitBase {
744 public:
745 DIECompileUnit();
747 virtual uint16 Tag() const;
751 class DIEStringType : public DIEDeclaredType {
752 public:
753 DIEStringType();
755 virtual uint16 Tag() const;
757 virtual const DynamicAttributeValue* ByteSize() const;
759 virtual status_t AddAttribute_byte_size(uint16 attributeName,
760 const AttributeValue& value);
762 private:
763 DynamicAttributeValue fByteSize;
764 // TODO:
765 // DW_AT_string_length
769 class DIEStructureType : public DIEClassBaseType {
770 public:
771 DIEStructureType();
773 virtual uint16 Tag() const;
777 class DIESubroutineType : public DIEDeclaredType {
778 public:
779 DIESubroutineType();
781 virtual uint16 Tag() const;
783 DIEType* ReturnType() const { return fReturnType; }
785 const DebugInfoEntryList& Parameters() const { return fParameters; }
787 virtual status_t AddChild(DebugInfoEntry* child);
789 virtual status_t AddAttribute_address_class(uint16 attributeName,
790 const AttributeValue& value);
791 virtual status_t AddAttribute_prototyped(uint16 attributeName,
792 const AttributeValue& value);
793 virtual status_t AddAttribute_type(uint16 attributeName,
794 const AttributeValue& value);
796 protected:
797 DebugInfoEntryList fParameters;
798 DIEType* fReturnType;
799 uint8 fAddressClass;
800 bool fPrototyped;
804 class DIETypedef : public DIEDerivedType {
805 public:
806 DIETypedef();
808 virtual uint16 Tag() const;
812 class DIEUnionType : public DIECompoundType {
813 public:
814 DIEUnionType();
816 virtual uint16 Tag() const;
820 class DIEUnspecifiedParameters : public DIEDeclaredBase {
821 public:
822 DIEUnspecifiedParameters();
824 virtual uint16 Tag() const;
826 // TODO:
827 // DW_AT_abstract_origin
828 // DW_AT_artificial
832 class DIEVariant : public DIEDeclaredBase {
833 public:
834 DIEVariant();
836 virtual uint16 Tag() const;
838 // TODO:
839 // DW_AT_accessibility
840 // DW_AT_abstract_origin
841 // DW_AT_declaration
842 // DW_AT_discr_list
843 // DW_AT_discr_value
847 class DIECommonBlock : public DIEDeclaredNamedBase {
848 public:
849 DIECommonBlock();
851 virtual uint16 Tag() const;
853 virtual LocationDescription* GetLocationDescription();
855 // TODO:
856 // DW_AT_segment
858 private:
859 LocationDescription fLocationDescription;
863 class DIECommonInclusion : public DIEDeclaredBase {
864 public:
865 DIECommonInclusion();
867 virtual uint16 Tag() const;
869 // TODO:
870 // DW_AT_common_reference
871 // DW_AT_declaration
872 // DW_AT_visibility
877 class DIEInheritance : public DIEDeclaredBase {
878 public:
879 DIEInheritance();
881 virtual uint16 Tag() const;
883 DIEType* GetType() const { return fType; }
884 const MemberLocation* Location() const
885 { return &fLocation; }
887 virtual status_t AddAttribute_type(uint16 attributeName,
888 const AttributeValue& value);
889 virtual status_t AddAttribute_data_member_location(
890 uint16 attributeName,
891 const AttributeValue& value);
893 // TODO:
894 // DW_AT_accessibility
895 // DW_AT_virtuality
897 private:
898 DIEType* fType;
899 MemberLocation fLocation;
903 class DIEInlinedSubroutine : public DebugInfoEntry {
904 public:
905 DIEInlinedSubroutine();
907 virtual uint16 Tag() const;
909 // TODO:
910 // DW_AT_abstract_origin
911 // DW_AT_call_column
912 // DW_AT_call_file
913 // DW_AT_call_line
914 // DW_AT_entry_pc
915 // DW_AT_high_pc
916 // DW_AT_low_pc
917 // DW_AT_ranges
918 // DW_AT_return_addr
919 // DW_AT_segment
920 // DW_AT_start_scope
921 // DW_AT_trampoline
925 class DIEModule : public DIEDeclaredNamedBase {
926 public:
927 DIEModule();
929 virtual uint16 Tag() const;
931 // TODO:
932 // DW_AT_entry_pc
933 // DW_AT_high_pc
934 // DW_AT_low_pc
935 // DW_AT_priority
936 // DW_AT_ranges
937 // DW_AT_segment
938 // DW_AT_specification
942 class DIEPointerToMemberType : public DIEDerivedType {
943 public:
944 DIEPointerToMemberType();
946 virtual uint16 Tag() const;
948 DIECompoundType* ContainingType() const
949 { return fContainingType; }
951 const LocationDescription& UseLocation() const
952 { return fUseLocation; }
954 virtual status_t AddAttribute_address_class(uint16 attributeName,
955 const AttributeValue& value);
956 virtual status_t AddAttribute_containing_type(
957 uint16 attributeName,
958 const AttributeValue& value);
959 virtual status_t AddAttribute_use_location(uint16 attributeName,
960 const AttributeValue& value);
962 protected:
963 DIECompoundType* fContainingType;
964 LocationDescription fUseLocation;
965 uint8 fAddressClass;
969 class DIESetType : public DIEDerivedType {
970 public:
971 DIESetType();
973 virtual uint16 Tag() const;
975 virtual const DynamicAttributeValue* ByteSize() const;
977 virtual status_t AddAttribute_byte_size(uint16 attributeName,
978 const AttributeValue& value);
980 private:
981 DynamicAttributeValue fByteSize;
985 class DIESubrangeType : public DIEArrayIndexType {
986 public:
987 DIESubrangeType();
989 virtual uint16 Tag() const;
991 const DynamicAttributeValue* LowerBound() const
992 { return &fLowerBound; }
993 const DynamicAttributeValue* UpperBound() const
994 { return &fUpperBound; }
995 const DynamicAttributeValue* Count() const
996 { return &fCount; }
998 virtual status_t AddAttribute_count(uint16 attributeName,
999 const AttributeValue& value);
1000 virtual status_t AddAttribute_lower_bound(uint16 attributeName,
1001 const AttributeValue& value);
1002 virtual status_t AddAttribute_upper_bound(uint16 attributeName,
1003 const AttributeValue& value);
1004 virtual status_t AddAttribute_threads_scaled(
1005 uint16 attributeName,
1006 const AttributeValue& value);
1008 private:
1009 DynamicAttributeValue fCount;
1010 DynamicAttributeValue fLowerBound;
1011 DynamicAttributeValue fUpperBound;
1012 bool fThreadsScaled;
1016 class DIEWithStatement : public DebugInfoEntry {
1017 public:
1018 DIEWithStatement();
1020 virtual uint16 Tag() const;
1022 DIEType* GetType() const { return fType; }
1024 virtual LocationDescription* GetLocationDescription();
1026 virtual status_t AddAttribute_type(uint16 attributeName,
1027 const AttributeValue& value);
1029 // TODO:
1030 // DW_AT_accessibility
1031 // DW_AT_address_class
1032 // DW_AT_declaration
1033 // DW_AT_high_pc
1034 // DW_AT_low_pc
1035 // DW_AT_ranges
1036 // DW_AT_segment
1037 // DW_AT_visibility
1039 private:
1040 DIEType* fType;
1041 LocationDescription fLocationDescription;
1045 class DIEAccessDeclaration : public DIEDeclaredNamedBase {
1046 public:
1047 DIEAccessDeclaration();
1049 virtual uint16 Tag() const;
1053 class DIEBaseType : public DIEType {
1054 public:
1055 DIEBaseType();
1057 virtual uint16 Tag() const;
1059 virtual const DynamicAttributeValue* ByteSize() const;
1060 const DynamicAttributeValue* BitOffset() const
1061 { return &fBitOffset; }
1062 const DynamicAttributeValue* DataBitOffset() const
1063 { return &fDataBitOffset; }
1064 const DynamicAttributeValue* BitSize() const
1065 { return &fBitSize; }
1066 uint8 Encoding() const { return fEncoding; }
1067 uint8 Endianity() const { return fEndianity; }
1069 virtual status_t AddAttribute_encoding(uint16 attributeName,
1070 const AttributeValue& value);
1071 virtual status_t AddAttribute_byte_size(uint16 attributeName,
1072 const AttributeValue& value);
1073 virtual status_t AddAttribute_bit_size(uint16 attributeName,
1074 const AttributeValue& value);
1075 virtual status_t AddAttribute_bit_offset(uint16 attributeName,
1076 const AttributeValue& value);
1077 virtual status_t AddAttribute_data_bit_offset(
1078 uint16 attributeName,
1079 const AttributeValue& value);
1080 virtual status_t AddAttribute_endianity(uint16 attributeName,
1081 const AttributeValue& value);
1083 // TODO:
1084 // DW_AT_binary_scale
1085 // DW_AT_decimal_scale
1086 // DW_AT_decimal_sign
1087 // DW_AT_description
1088 // DW_AT_digit_count
1089 // DW_AT_picture_string
1090 // DW_AT_small
1092 private:
1093 DynamicAttributeValue fByteSize;
1094 DynamicAttributeValue fBitOffset;
1095 DynamicAttributeValue fDataBitOffset;
1096 DynamicAttributeValue fBitSize;
1097 uint8 fEncoding;
1098 uint8 fEndianity;
1102 class DIECatchBlock : public DebugInfoEntry {
1103 public:
1104 DIECatchBlock();
1106 virtual uint16 Tag() const;
1108 // TODO:
1109 // DW_AT_abstract_origin
1110 // DW_AT_high_pc
1111 // DW_AT_low_pc
1112 // DW_AT_ranges
1113 // DW_AT_segment
1117 class DIEConstType : public DIEModifiedType {
1118 public:
1119 DIEConstType();
1121 virtual uint16 Tag() const;
1125 class DIEConstant : public DIEDeclaredNamedBase {
1126 public:
1127 DIEConstant();
1129 virtual uint16 Tag() const;
1131 DIEType* GetType() const { return fType; }
1133 const ConstantAttributeValue* ConstValue() const
1134 { return &fValue; }
1136 virtual status_t AddAttribute_const_value(uint16 attributeName,
1137 const AttributeValue& value);
1138 virtual status_t AddAttribute_type(uint16 attributeName,
1139 const AttributeValue& value);
1141 // TODO:
1142 // DW_AT_endianity
1143 // DW_AT_external
1144 // DW_AT_start_scope
1146 private:
1147 DIEType* fType;
1148 ConstantAttributeValue fValue;
1152 class DIEEnumerator : public DIEDeclaredNamedBase {
1153 public:
1154 DIEEnumerator();
1156 virtual uint16 Tag() const;
1158 const ConstantAttributeValue* ConstValue() const
1159 { return &fValue; }
1161 virtual status_t AddAttribute_const_value(uint16 attributeName,
1162 const AttributeValue& value);
1164 private:
1165 ConstantAttributeValue fValue;
1169 class DIEFileType : public DIEDerivedType {
1170 public:
1171 DIEFileType();
1173 virtual uint16 Tag() const;
1175 virtual const DynamicAttributeValue* ByteSize() const;
1177 virtual status_t AddAttribute_byte_size(uint16 attributeName,
1178 const AttributeValue& value);
1180 private:
1181 DynamicAttributeValue fByteSize;
1185 class DIEFriend : public DIEDeclaredBase {
1186 public:
1187 DIEFriend();
1189 virtual uint16 Tag() const;
1191 // TODO:
1192 // DW_AT_abstract_origin
1193 // DW_AT_friend
1197 class DIENameList : public DIEDeclaredNamedBase {
1198 public:
1199 DIENameList();
1201 virtual uint16 Tag() const;
1203 // TODO:
1204 // DW_AT_abstract_origin
1208 class DIENameListItem : public DIEDeclaredBase {
1209 public:
1210 DIENameListItem();
1212 virtual uint16 Tag() const;
1214 // TODO:
1215 // DW_AT_namelist_item
1219 class DIEPackedType : public DIEModifiedType {
1220 public:
1221 DIEPackedType();
1223 virtual uint16 Tag() const;
1227 class DIESubprogram : public DIEDeclaredNamedBase {
1228 public:
1229 DIESubprogram();
1230 ~DIESubprogram();
1232 virtual uint16 Tag() const;
1234 virtual DebugInfoEntry* Specification() const;
1235 virtual DebugInfoEntry* AbstractOrigin() const;
1237 off_t AddressRangesOffset() const
1238 { return fAddressRangesOffset; }
1240 target_addr_t LowPC() const { return fLowPC; }
1241 target_addr_t HighPC() const { return fHighPC; }
1243 const LocationDescription* FrameBase() const { return &fFrameBase; }
1245 const DebugInfoEntryList Parameters() const { return fParameters; }
1246 const DebugInfoEntryList Variables() const { return fVariables; }
1247 const DebugInfoEntryList Blocks() const { return fBlocks; }
1248 const DebugInfoEntryList TemplateTypeParameters() const
1249 { return fTemplateTypeParameters; }
1250 const DebugInfoEntryList TemplateValueParameters() const
1251 { return fTemplateValueParameters; }
1252 const DebugInfoEntryList CallSites() const
1253 { return fCallSites; }
1255 bool IsPrototyped() const { return fPrototyped; }
1256 uint8 Inline() const { return fInline; }
1257 bool IsArtificial() const { return fArtificial; }
1258 uint8 CallingConvention() const
1259 { return fCallingConvention; }
1260 bool IsMain() const { return fMain; }
1262 DIEType* ReturnType() const { return fReturnType; }
1264 virtual status_t AddChild(DebugInfoEntry* child);
1266 virtual status_t AddAttribute_low_pc(uint16 attributeName,
1267 const AttributeValue& value);
1268 virtual status_t AddAttribute_high_pc(uint16 attributeName,
1269 const AttributeValue& value);
1270 virtual status_t AddAttribute_ranges(uint16 attributeName,
1271 const AttributeValue& value);
1272 virtual status_t AddAttribute_specification(uint16 attributeName,
1273 const AttributeValue& value);
1274 virtual status_t AddAttribute_address_class(uint16 attributeName,
1275 const AttributeValue& value);
1276 virtual status_t AddAttribute_prototyped(uint16 attributeName,
1277 const AttributeValue& value);
1278 virtual status_t AddAttribute_type(uint16 attributeName,
1279 const AttributeValue& value);
1280 virtual status_t AddAttribute_inline(uint16 attributeName,
1281 const AttributeValue& value);
1282 virtual status_t AddAttribute_abstract_origin(
1283 uint16 attributeName,
1284 const AttributeValue& value);
1285 virtual status_t AddAttribute_frame_base(
1286 uint16 attributeName,
1287 const AttributeValue& value);
1288 virtual status_t AddAttribute_artificial(
1289 uint16 attributeName,
1290 const AttributeValue& value);
1291 virtual status_t AddAttribute_calling_convention(
1292 uint16 attributeName,
1293 const AttributeValue& value);
1294 virtual status_t AddAttribute_main_subprogram(
1295 uint16 attributeName,
1296 const AttributeValue& value);
1299 protected:
1300 DebugInfoEntryList fParameters;
1301 DebugInfoEntryList fVariables;
1302 DebugInfoEntryList fBlocks;
1303 DebugInfoEntryList fTemplateTypeParameters;
1304 DebugInfoEntryList fTemplateValueParameters;
1305 DebugInfoEntryList fCallSites;
1306 target_addr_t fLowPC;
1307 target_addr_t fHighPC;
1308 off_t fAddressRangesOffset;
1309 DIESubprogram* fSpecification;
1310 DIESubprogram* fAbstractOrigin;
1311 DIEType* fReturnType;
1312 LocationDescription fFrameBase;
1313 uint8 fAddressClass;
1314 bool fPrototyped;
1315 uint8 fInline;
1316 bool fMain;
1317 bool fArtificial;
1318 uint8 fCallingConvention;
1320 // TODO:
1321 // DW_AT_elemental
1322 // DW_AT_entry_pc
1323 // DW_AT_explicit
1324 // DW_AT_external
1325 // DW_AT_object_pointer
1326 // DW_AT_pure
1327 // DW_AT_recursive
1328 // DW_AT_return_addr
1329 // DW_AT_segment
1330 // DW_AT_start_scope
1331 // DW_AT_static_link
1332 // DW_AT_trampoline
1333 // DW_AT_virtuality
1334 // DW_AT_vtable_elem_location
1338 class DIETemplateTypeParameter : public DIEDeclaredNamedBase {
1339 public:
1340 DIETemplateTypeParameter();
1342 virtual uint16 Tag() const;
1344 DIEType* GetType() const { return fType; }
1346 virtual status_t AddAttribute_type(uint16 attributeName,
1347 const AttributeValue& value);
1349 private:
1350 DIEType* fType;
1354 class DIETemplateValueParameter : public DIEDeclaredNamedBase {
1355 public:
1356 DIETemplateValueParameter();
1358 virtual uint16 Tag() const;
1360 DIEType* GetType() const { return fType; }
1362 const ConstantAttributeValue* ConstValue() const
1363 { return &fValue; }
1365 virtual status_t AddAttribute_const_value(uint16 attributeName,
1366 const AttributeValue& value);
1367 virtual status_t AddAttribute_type(uint16 attributeName,
1368 const AttributeValue& value);
1370 private:
1371 DIEType* fType;
1372 ConstantAttributeValue fValue;
1376 class DIEThrownType : public DIEDeclaredBase {
1377 public:
1378 DIEThrownType();
1380 virtual uint16 Tag() const;
1382 DIEType* GetType() const { return fType; }
1384 virtual status_t AddAttribute_type(uint16 attributeName,
1385 const AttributeValue& value);
1387 // TODO:
1388 // DW_AT_allocated
1389 // DW_AT_associated
1390 // DW_AT_data_location
1392 private:
1393 DIEType* fType;
1397 class DIETryBlock : public DebugInfoEntry {
1398 public:
1399 DIETryBlock();
1401 virtual uint16 Tag() const;
1403 // TODO:
1404 // DW_AT_abstract_origin
1405 // DW_AT_high_pc
1406 // DW_AT_low_pc
1407 // DW_AT_ranges
1408 // DW_AT_segment
1412 class DIEVariantPart : public DIEDeclaredBase {
1413 public:
1414 DIEVariantPart();
1416 virtual uint16 Tag() const;
1418 DIEType* GetType() const { return fType; }
1420 virtual status_t AddAttribute_type(uint16 attributeName,
1421 const AttributeValue& value);
1423 // TODO:
1424 // DW_AT_abstract_origin
1425 // DW_AT_accessibility
1426 // DW_AT_declaration
1427 // DW_AT_discr
1429 private:
1430 DIEType* fType;
1434 class DIEVariable : public DIEDeclaredNamedBase {
1435 public:
1436 DIEVariable();
1438 virtual uint16 Tag() const;
1440 virtual DebugInfoEntry* Specification() const;
1441 virtual DebugInfoEntry* AbstractOrigin() const;
1443 virtual LocationDescription* GetLocationDescription();
1445 DIEType* GetType() const { return fType; }
1447 const ConstantAttributeValue* ConstValue() const
1448 { return &fValue; }
1450 uint64 StartScope() const { return fStartScope; }
1452 bool IsExternal() const { return fIsExternal; }
1454 virtual status_t AddAttribute_const_value(uint16 attributeName,
1455 const AttributeValue& value);
1456 virtual status_t AddAttribute_type(uint16 attributeName,
1457 const AttributeValue& value);
1458 virtual status_t AddAttribute_specification(uint16 attributeName,
1459 const AttributeValue& value);
1460 virtual status_t AddAttribute_abstract_origin(
1461 uint16 attributeName,
1462 const AttributeValue& value);
1463 virtual status_t AddAttribute_start_scope(
1464 uint16 attributeName,
1465 const AttributeValue& value);
1466 virtual status_t AddAttribute_external(
1467 uint16 attributeName,
1468 const AttributeValue& value);
1470 // TODO:
1471 // DW_AT_endianity
1472 // DW_AT_segment
1474 private:
1475 LocationDescription fLocationDescription;
1476 ConstantAttributeValue fValue;
1477 DIEType* fType;
1478 DebugInfoEntry* fSpecification;
1479 DIEVariable* fAbstractOrigin;
1480 uint64 fStartScope;
1481 bool fIsExternal;
1485 class DIEVolatileType : public DIEModifiedType {
1486 public:
1487 DIEVolatileType();
1489 virtual uint16 Tag() const;
1491 virtual status_t AddAttribute_decl_file(uint16 attributeName,
1492 const AttributeValue& value);
1493 virtual status_t AddAttribute_decl_line(uint16 attributeName,
1494 const AttributeValue& value);
1495 virtual status_t AddAttribute_decl_column(uint16 attributeName,
1496 const AttributeValue& value);
1498 private:
1499 DeclarationLocation fDeclarationLocation;
1503 class DIEDwarfProcedure : public DebugInfoEntry {
1504 public:
1505 DIEDwarfProcedure();
1507 virtual uint16 Tag() const;
1509 virtual LocationDescription* GetLocationDescription();
1511 private:
1512 LocationDescription fLocationDescription;
1516 class DIERestrictType : public DIEModifiedType {
1517 public:
1518 DIERestrictType();
1520 virtual uint16 Tag() const;
1524 class DIEInterfaceType : public DIEClassBaseType {
1525 public:
1526 DIEInterfaceType();
1528 virtual uint16 Tag() const;
1532 class DIENamespace : public DIEDeclaredNamedBase {
1533 public:
1534 DIENamespace();
1536 virtual uint16 Tag() const;
1538 virtual bool IsNamespace() const;
1540 const DebugInfoEntryList& Children() const
1541 { return fChildren; }
1543 virtual status_t AddChild(DebugInfoEntry* child);
1545 private:
1546 DebugInfoEntryList fChildren;
1548 // TODO:
1549 // DW_AT_extension
1550 // DW_AT_start_scope
1554 class DIEImportedModule : public DIEDeclaredBase {
1555 public:
1556 DIEImportedModule();
1558 virtual uint16 Tag() const;
1560 // TODO:
1561 // DW_AT_import
1562 // DW_AT_start_scope
1566 class DIEUnspecifiedType : public DIEType {
1567 public:
1568 DIEUnspecifiedType();
1570 virtual uint16 Tag() const;
1572 virtual status_t AddAttribute_decl_file(uint16 attributeName,
1573 const AttributeValue& value);
1574 virtual status_t AddAttribute_decl_line(uint16 attributeName,
1575 const AttributeValue& value);
1576 virtual status_t AddAttribute_decl_column(uint16 attributeName,
1577 const AttributeValue& value);
1579 // TODO:
1580 // DW_AT_description
1582 private:
1583 DeclarationLocation fDeclarationLocation;
1587 class DIEPartialUnit : public DIECompileUnitBase {
1588 public:
1589 DIEPartialUnit();
1591 virtual uint16 Tag() const;
1593 // TODO:
1594 // DW_AT_description
1598 class DIEImportedUnit : public DebugInfoEntry {
1599 public:
1600 DIEImportedUnit();
1602 virtual uint16 Tag() const;
1604 // TODO:
1605 // DW_AT_import
1609 class DIECondition : public DIEDeclaredNamedBase {
1610 public:
1611 DIECondition();
1613 virtual uint16 Tag() const;
1617 class DIESharedType : public DIEModifiedType {
1618 public:
1619 DIESharedType();
1621 virtual uint16 Tag() const;
1623 virtual status_t AddAttribute_count(uint16 attributeName,
1624 const AttributeValue& value);
1625 virtual status_t AddAttribute_decl_file(uint16 attributeName,
1626 const AttributeValue& value);
1627 virtual status_t AddAttribute_decl_line(uint16 attributeName,
1628 const AttributeValue& value);
1629 virtual status_t AddAttribute_decl_column(uint16 attributeName,
1630 const AttributeValue& value);
1632 private:
1633 DynamicAttributeValue fBlockSize;
1634 DeclarationLocation fDeclarationLocation;
1638 class DIETypeUnit : public DIECompileUnitBase {
1639 public:
1640 DIETypeUnit();
1642 virtual uint16 Tag() const;
1646 class DIERValueReferenceType : public DIEReferenceType {
1647 public:
1648 DIERValueReferenceType();
1650 virtual uint16 Tag() const;
1654 class DIETemplateTemplateParameter : public DIEDeclaredBase {
1655 public:
1656 DIETemplateTemplateParameter();
1658 virtual uint16 Tag() const;
1660 virtual const char* Name() const;
1662 virtual status_t AddAttribute_name(uint16 attributeName,
1663 const AttributeValue& value);
1665 private:
1666 const char* fName;
1670 class DIETemplateTypeParameterPack : public DIEDeclaredBase {
1671 public:
1672 DIETemplateTypeParameterPack();
1674 virtual uint16 Tag() const;
1676 virtual const char* Name() const;
1678 virtual status_t AddAttribute_name(uint16 attributeName,
1679 const AttributeValue& value);
1681 const DebugInfoEntryList& Children() const
1682 { return fChildren; }
1684 virtual status_t AddChild(DebugInfoEntry* child);
1686 private:
1687 const char* fName;
1688 DebugInfoEntryList fChildren;
1692 class DIETemplateValueParameterPack : public DIEDeclaredBase {
1693 public:
1694 DIETemplateValueParameterPack();
1696 virtual uint16 Tag() const;
1698 virtual const char* Name() const;
1700 virtual status_t AddAttribute_name(uint16 attributeName,
1701 const AttributeValue& value);
1703 const DebugInfoEntryList& Children() const
1704 { return fChildren; }
1706 virtual status_t AddChild(DebugInfoEntry* child);
1708 private:
1709 const char* fName;
1710 DebugInfoEntryList fChildren;
1714 class DIECallSite : public DIEDeclaredBase {
1715 public:
1716 DIECallSite();
1718 virtual uint16 Tag() const;
1720 virtual const char* Name() const;
1722 virtual status_t AddAttribute_name(uint16 attributeName,
1723 const AttributeValue& value);
1725 const DebugInfoEntryList& Children() const
1726 { return fChildren; }
1728 virtual status_t AddChild(DebugInfoEntry* child);
1730 private:
1731 const char* fName;
1732 DebugInfoEntryList fChildren;
1736 class DIECallSiteParameter : public DIEDeclaredBase {
1737 public:
1738 DIECallSiteParameter();
1740 virtual uint16 Tag() const;
1742 virtual const char* Name() const;
1744 virtual status_t AddAttribute_name(uint16 attributeName,
1745 const AttributeValue& value);
1747 const DebugInfoEntryList& Children() const
1748 { return fChildren; }
1750 virtual status_t AddChild(DebugInfoEntry* child);
1752 private:
1753 const char* fName;
1754 DebugInfoEntryList fChildren;
1758 // #pragma mark - DebugInfoEntryFactory
1761 class DebugInfoEntryFactory {
1762 public:
1763 DebugInfoEntryFactory();
1765 status_t CreateDebugInfoEntry(uint16 tag,
1766 DebugInfoEntry*& entry);
1770 #endif // DEBUG_INFO_ENTRIES_H