1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Copyright 2011-2014, Rene Gollent, rene@gollent.com.
4 * Distributed under the terms of the MIT License.
5 */
6
7 #include "DebugInfoEntries.h"
8
9 #include <new>
10
11 #include "AttributeValue.h"
12 #include "Dwarf.h"
13 #include "SourceLanguageInfo.h"
14
15
16 // #pragma mark - DIECompileUnitBase
17
18
DIECompileUnitBase()19 DIECompileUnitBase::DIECompileUnitBase()
20 :
21 fName(NULL),
22 fCompilationDir(NULL),
23 fLowPC(0),
24 fHighPC(0),
25 fStatementListOffset(-1),
26 fMacroInfoOffset(-1),
27 fAddressRangesOffset(-1),
28 fBaseTypesUnit(NULL),
29 fLanguage(0),
30 fIdentifierCase(0),
31 fUseUTF8(true),
32 fContainsMainSubprogram(false)
33 {
34 }
35
36
~DIECompileUnitBase()37 DIECompileUnitBase::~DIECompileUnitBase()
38 {
39 }
40
41
42 status_t
InitAfterAttributes(DebugInfoEntryInitInfo & info)43 DIECompileUnitBase::InitAfterAttributes(DebugInfoEntryInitInfo& info)
44 {
45 switch (fLanguage) {
46 case 0:
47 info.languageInfo = &kUnknownLanguageInfo;
48 return B_OK;
49 case DW_LANG_C89:
50 info.languageInfo = &kC89LanguageInfo;
51 return B_OK;
52 case DW_LANG_C:
53 info.languageInfo = &kCLanguageInfo;
54 return B_OK;
55 case DW_LANG_C_plus_plus:
56 info.languageInfo = &kCPlusPlusLanguageInfo;
57 return B_OK;
58 case DW_LANG_C99:
59 info.languageInfo = &kC99LanguageInfo;
60 return B_OK;
61 default:
62 info.languageInfo = &kUnsupportedLanguageInfo;
63 return B_OK;
64 }
65 }
66
67
68 const char*
Name() const69 DIECompileUnitBase::Name() const
70 {
71 return fName;
72 }
73
74
75 status_t
AddChild(DebugInfoEntry * child)76 DIECompileUnitBase::AddChild(DebugInfoEntry* child)
77 {
78 if (child->IsType())
79 fTypes.Add(child);
80 else
81 fOtherChildren.Add(child);
82 return B_OK;
83 }
84
85
86 status_t
AddAttribute_name(uint16 attributeName,const AttributeValue & value)87 DIECompileUnitBase::AddAttribute_name(uint16 attributeName,
88 const AttributeValue& value)
89 {
90 fName = value.string;
91 return B_OK;
92 }
93
94
95 status_t
AddAttribute_comp_dir(uint16 attributeName,const AttributeValue & value)96 DIECompileUnitBase::AddAttribute_comp_dir(uint16 attributeName,
97 const AttributeValue& value)
98 {
99 fCompilationDir = value.string;
100 return B_OK;
101 }
102
103
104 status_t
AddAttribute_low_pc(uint16 attributeName,const AttributeValue & value)105 DIECompileUnitBase::AddAttribute_low_pc(uint16 attributeName,
106 const AttributeValue& value)
107 {
108 fLowPC = value.address;
109 return B_OK;
110 }
111
112
113 status_t
AddAttribute_high_pc(uint16 attributeName,const AttributeValue & value)114 DIECompileUnitBase::AddAttribute_high_pc(uint16 attributeName,
115 const AttributeValue& value)
116 {
117 fHighPC = value.address;
118 if (fLowPC != 0 && fHighPC < fLowPC)
119 fHighPC += fLowPC;
120
121 return B_OK;
122 }
123
124
125 status_t
AddAttribute_producer(uint16 attributeName,const AttributeValue & value)126 DIECompileUnitBase::AddAttribute_producer(uint16 attributeName,
127 const AttributeValue& value)
128 {
129 // not interesting
130 return B_OK;
131 }
132
133
134 status_t
AddAttribute_stmt_list(uint16 attributeName,const AttributeValue & value)135 DIECompileUnitBase::AddAttribute_stmt_list(uint16 attributeName,
136 const AttributeValue& value)
137 {
138 fStatementListOffset = value.pointer;
139 return B_OK;
140 }
141
142
143 status_t
AddAttribute_macro_info(uint16 attributeName,const AttributeValue & value)144 DIECompileUnitBase::AddAttribute_macro_info(uint16 attributeName,
145 const AttributeValue& value)
146 {
147 fMacroInfoOffset = value.pointer;
148 return B_OK;
149 }
150
151
152 status_t
AddAttribute_base_types(uint16 attributeName,const AttributeValue & value)153 DIECompileUnitBase::AddAttribute_base_types(uint16 attributeName,
154 const AttributeValue& value)
155 {
156 fBaseTypesUnit = dynamic_cast<DIECompileUnitBase*>(value.reference);
157 return fBaseTypesUnit != NULL ? B_OK : B_BAD_DATA;
158 }
159
160
161 status_t
AddAttribute_language(uint16 attributeName,const AttributeValue & value)162 DIECompileUnitBase::AddAttribute_language(uint16 attributeName,
163 const AttributeValue& value)
164 {
165 fLanguage = value.constant;
166 return B_OK;
167 }
168
169
170 status_t
AddAttribute_identifier_case(uint16 attributeName,const AttributeValue & value)171 DIECompileUnitBase::AddAttribute_identifier_case(uint16 attributeName,
172 const AttributeValue& value)
173 {
174 fIdentifierCase = value.constant;
175 return B_OK;
176 }
177
178
179 status_t
AddAttribute_use_UTF8(uint16 attributeName,const AttributeValue & value)180 DIECompileUnitBase::AddAttribute_use_UTF8(uint16 attributeName,
181 const AttributeValue& value)
182 {
183 fUseUTF8 = value.flag;
184 return B_OK;
185 }
186
187
188 status_t
AddAttribute_ranges(uint16 attributeName,const AttributeValue & value)189 DIECompileUnitBase::AddAttribute_ranges(uint16 attributeName,
190 const AttributeValue& value)
191 {
192 fAddressRangesOffset = value.pointer;
193 return B_OK;
194 }
195
196
197 status_t
AddAttribute_main_subprogram(uint16 attributeName,const AttributeValue & value)198 DIECompileUnitBase::AddAttribute_main_subprogram(uint16 attributeName,
199 const AttributeValue& value)
200 {
201 fContainsMainSubprogram = true;
202 return B_OK;
203 }
204
205
206 // #pragma mark - DIEType
207
208
DIEType()209 DIEType::DIEType()
210 :
211 fName(NULL)
212 {
213 fAllocated.SetTo((uint64)0);
214 fAssociated.SetTo((uint64)0);
215 }
216
217
218 bool
IsType() const219 DIEType::IsType() const
220 {
221 return true;
222 }
223
224
225 const char*
Name() const226 DIEType::Name() const
227 {
228 return fName;
229 }
230
231
232 bool
IsDeclaration() const233 DIEType::IsDeclaration() const
234 {
235 return false;
236 }
237
238
239 const DynamicAttributeValue*
ByteSize() const240 DIEType::ByteSize() const
241 {
242 return NULL;
243 }
244
245
246 status_t
AddAttribute_name(uint16 attributeName,const AttributeValue & value)247 DIEType::AddAttribute_name(uint16 attributeName,
248 const AttributeValue& value)
249 {
250 fName = value.string;
251 return B_OK;
252 }
253
254
255 status_t
AddAttribute_allocated(uint16 attributeName,const AttributeValue & value)256 DIEType::AddAttribute_allocated(uint16 attributeName,
257 const AttributeValue& value)
258 {
259 return SetDynamicAttributeValue(fAllocated, value);
260 }
261
262
263 status_t
AddAttribute_associated(uint16 attributeName,const AttributeValue & value)264 DIEType::AddAttribute_associated(uint16 attributeName,
265 const AttributeValue& value)
266 {
267 return SetDynamicAttributeValue(fAssociated, value);
268 }
269
270
271 // #pragma mark - DIEModifiedType
272
273
DIEModifiedType()274 DIEModifiedType::DIEModifiedType()
275 :
276 fType(NULL)
277 {
278 }
279
280
281 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)282 DIEModifiedType::AddAttribute_type(uint16 attributeName,
283 const AttributeValue& value)
284 {
285 fType = dynamic_cast<DIEType*>(value.reference);
286 return fType != NULL ? B_OK : B_BAD_DATA;
287 }
288
289
290 // #pragma mark - DIEAddressingType
291
292
DIEAddressingType()293 DIEAddressingType::DIEAddressingType()
294 :
295 fAddressClass(0)
296 {
297 }
298
299
300 status_t
AddAttribute_address_class(uint16 attributeName,const AttributeValue & value)301 DIEAddressingType::AddAttribute_address_class(uint16 attributeName,
302 const AttributeValue& value)
303 {
304 // TODO: How is the address class handled?
305 fAddressClass = value.constant;
306 return B_OK;
307 }
308
309
310 // #pragma mark - DIEDeclaredType
311
312
DIEDeclaredType()313 DIEDeclaredType::DIEDeclaredType()
314 :
315 fDescription(NULL),
316 fAbstractOrigin(NULL),
317 fSignatureType(NULL),
318 fAccessibility(0),
319 fDeclaration(false)
320 {
321 }
322
323
324 const char*
Description() const325 DIEDeclaredType::Description() const
326 {
327 return fDescription;
328 }
329
330
331 DebugInfoEntry*
AbstractOrigin() const332 DIEDeclaredType::AbstractOrigin() const
333 {
334 return fAbstractOrigin;
335 }
336
337
338 DebugInfoEntry*
SignatureType() const339 DIEDeclaredType::SignatureType() const
340 {
341 return fSignatureType;
342 }
343
344
345 bool
IsDeclaration() const346 DIEDeclaredType::IsDeclaration() const
347 {
348 return fDeclaration;
349 }
350
351
352 status_t
AddAttribute_accessibility(uint16 attributeName,const AttributeValue & value)353 DIEDeclaredType::AddAttribute_accessibility(uint16 attributeName,
354 const AttributeValue& value)
355 {
356 fAccessibility = value.constant;
357 return B_OK;
358 }
359
360
361 status_t
AddAttribute_declaration(uint16 attributeName,const AttributeValue & value)362 DIEDeclaredType::AddAttribute_declaration(uint16 attributeName,
363 const AttributeValue& value)
364 {
365 fDeclaration = value.flag;
366 return B_OK;
367 }
368
369
370 status_t
AddAttribute_description(uint16 attributeName,const AttributeValue & value)371 DIEDeclaredType::AddAttribute_description(uint16 attributeName,
372 const AttributeValue& value)
373 {
374 fDescription = value.string;
375 return B_OK;
376 }
377
378
379 status_t
AddAttribute_abstract_origin(uint16 attributeName,const AttributeValue & value)380 DIEDeclaredType::AddAttribute_abstract_origin(uint16 attributeName,
381 const AttributeValue& value)
382 {
383 fAbstractOrigin = value.reference;
384 return B_OK;
385 }
386
387
388 status_t
AddAttribute_signature(uint16 attributeName,const AttributeValue & value)389 DIEDeclaredType::AddAttribute_signature(uint16 attributeName,
390 const AttributeValue& value)
391 {
392 fSignatureType = value.reference;
393 return B_OK;
394 }
395
396
397 DeclarationLocation*
GetDeclarationLocation()398 DIEDeclaredType::GetDeclarationLocation()
399 {
400 return &fDeclarationLocation;
401 }
402
403
404 // #pragma mark - DIEDerivedType
405
406
DIEDerivedType()407 DIEDerivedType::DIEDerivedType()
408 :
409 fType(NULL)
410 {
411 }
412
413
414 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)415 DIEDerivedType::AddAttribute_type(uint16 attributeName,
416 const AttributeValue& value)
417 {
418 fType = dynamic_cast<DIEType*>(value.reference);
419 return fType != NULL ? B_OK : B_BAD_DATA;
420 }
421
422
423
424
425 // #pragma mark - DIECompoundType
426
427
DIECompoundType()428 DIECompoundType::DIECompoundType()
429 :
430 fSpecification(NULL)
431 {
432 }
433
434
435 bool
IsNamespace() const436 DIECompoundType::IsNamespace() const
437 {
438 return true;
439 }
440
441
442 DebugInfoEntry*
Specification() const443 DIECompoundType::Specification() const
444 {
445 return fSpecification;
446 }
447
448
449 const DynamicAttributeValue*
ByteSize() const450 DIECompoundType::ByteSize() const
451 {
452 return &fByteSize;
453 }
454
455
456 status_t
AddChild(DebugInfoEntry * child)457 DIECompoundType::AddChild(DebugInfoEntry* child)
458 {
459 if (child->Tag() == DW_TAG_member) {
460 // TODO: Not for interfaces!
461 fDataMembers.Add(child);
462 return B_OK;
463 }
464
465 return DIEDeclaredType::AddChild(child);
466 }
467
468
469 status_t
AddAttribute_byte_size(uint16 attributeName,const AttributeValue & value)470 DIECompoundType::AddAttribute_byte_size(uint16 attributeName,
471 const AttributeValue& value)
472 {
473 return SetDynamicAttributeValue(fByteSize, value);
474 }
475
476
477 status_t
AddAttribute_specification(uint16 attributeName,const AttributeValue & value)478 DIECompoundType::AddAttribute_specification(uint16 attributeName,
479 const AttributeValue& value)
480 {
481 fSpecification = dynamic_cast<DIECompoundType*>(value.reference);
482 return fSpecification != NULL ? B_OK : B_BAD_DATA;
483 }
484
485
486 // #pragma mark - DIEClassBaseType
487
488
DIEClassBaseType()489 DIEClassBaseType::DIEClassBaseType()
490 {
491 }
492
493
494 status_t
AddChild(DebugInfoEntry * child)495 DIEClassBaseType::AddChild(DebugInfoEntry* child)
496 {
497 switch (child->Tag()) {
498 case DW_TAG_inheritance:
499 fBaseTypes.Add(child);
500 return B_OK;
501 case DW_TAG_friend:
502 fFriends.Add(child);
503 return B_OK;
504 case DW_TAG_access_declaration:
505 fAccessDeclarations.Add(child);
506 return B_OK;
507 case DW_TAG_subprogram:
508 fMemberFunctions.Add(child);
509 return B_OK;
510 case DW_TAG_template_type_parameter:
511 case DW_TAG_template_value_parameter:
512 fTemplateParameters.Add(child);
513 return B_OK;
514 // TODO: Variants!
515 default:
516 {
517 if (child->IsType()) {
518 fInnerTypes.Add(child);
519 return B_OK;
520 }
521
522 return DIECompoundType::AddChild(child);
523 }
524 }
525 }
526
527
528 // #pragma mark - DIENamedBase
529
530
DIENamedBase()531 DIENamedBase::DIENamedBase()
532 :
533 fName(NULL),
534 fDescription(NULL)
535 {
536 }
537
538
539 const char*
Name() const540 DIENamedBase::Name() const
541 {
542 return fName;
543 }
544
545
546 const char*
Description() const547 DIENamedBase::Description() const
548 {
549 return fDescription;
550 }
551
552
553 status_t
AddAttribute_name(uint16 attributeName,const AttributeValue & value)554 DIENamedBase::AddAttribute_name(uint16 attributeName,
555 const AttributeValue& value)
556 {
557 fName = value.string;
558 return B_OK;
559 }
560
561
562 status_t
AddAttribute_description(uint16 attributeName,const AttributeValue & value)563 DIENamedBase::AddAttribute_description(uint16 attributeName,
564 const AttributeValue& value)
565 {
566 fDescription = value.string;
567 return B_OK;
568 }
569
570
571 // #pragma mark - DIEDeclaredBase
572
573
DIEDeclaredBase()574 DIEDeclaredBase::DIEDeclaredBase()
575 {
576 }
577
578
579 DeclarationLocation*
GetDeclarationLocation()580 DIEDeclaredBase::GetDeclarationLocation()
581 {
582 return &fDeclarationLocation;
583 }
584
585
586 // #pragma mark - DIEDeclaredNamedBase
587
588
DIEDeclaredNamedBase()589 DIEDeclaredNamedBase::DIEDeclaredNamedBase()
590 :
591 fName(NULL),
592 fDescription(NULL),
593 fAccessibility(0),
594 fVisibility(0),
595 fDeclaration(false)
596 {
597 }
598
599
600 const char*
Name() const601 DIEDeclaredNamedBase::Name() const
602 {
603 return fName;
604 }
605
606
607 const char*
Description() const608 DIEDeclaredNamedBase::Description() const
609 {
610 return fDescription;
611 }
612
613
614 bool
IsDeclaration() const615 DIEDeclaredNamedBase::IsDeclaration() const
616 {
617 return fDeclaration;
618 }
619
620
621 status_t
AddAttribute_name(uint16 attributeName,const AttributeValue & value)622 DIEDeclaredNamedBase::AddAttribute_name(uint16 attributeName,
623 const AttributeValue& value)
624 {
625 fName = value.string;
626 return B_OK;
627 }
628
629
630 status_t
AddAttribute_description(uint16 attributeName,const AttributeValue & value)631 DIEDeclaredNamedBase::AddAttribute_description(uint16 attributeName,
632 const AttributeValue& value)
633 {
634 fDescription = value.string;
635 return B_OK;
636 }
637
638
639 status_t
AddAttribute_accessibility(uint16 attributeName,const AttributeValue & value)640 DIEDeclaredNamedBase::AddAttribute_accessibility(uint16 attributeName,
641 const AttributeValue& value)
642 {
643 fAccessibility = value.constant;
644 return B_OK;
645 }
646
647
648 status_t
AddAttribute_declaration(uint16 attributeName,const AttributeValue & value)649 DIEDeclaredNamedBase::AddAttribute_declaration(uint16 attributeName,
650 const AttributeValue& value)
651 {
652 fDeclaration = value.flag;
653 return B_OK;
654 }
655
656
657 // #pragma mark - DIEArrayIndexType
658
659
DIEArrayIndexType()660 DIEArrayIndexType::DIEArrayIndexType()
661 {
662 }
663
664
665 const DynamicAttributeValue*
ByteSize() const666 DIEArrayIndexType::ByteSize() const
667 {
668 return &fByteSize;
669 }
670
671
672 status_t
AddAttribute_bit_stride(uint16 attributeName,const AttributeValue & value)673 DIEArrayIndexType::AddAttribute_bit_stride(uint16 attributeName,
674 const AttributeValue& value)
675 {
676 return SetDynamicAttributeValue(fBitStride, value);
677 }
678
679
680 status_t
AddAttribute_byte_size(uint16 attributeName,const AttributeValue & value)681 DIEArrayIndexType::AddAttribute_byte_size(uint16 attributeName,
682 const AttributeValue& value)
683 {
684 return SetDynamicAttributeValue(fByteSize, value);
685 }
686
687
688 status_t
AddAttribute_byte_stride(uint16 attributeName,const AttributeValue & value)689 DIEArrayIndexType::AddAttribute_byte_stride(uint16 attributeName,
690 const AttributeValue& value)
691 {
692 return SetDynamicAttributeValue(fByteStride, value);
693 }
694
695
696 // #pragma mark - DIEArrayType
697
698
DIEArrayType()699 DIEArrayType::DIEArrayType()
700 :
701 fSpecification(NULL),
702 fOrdering(DW_ORD_row_major)
703 {
704 }
705
706
707 uint16
Tag() const708 DIEArrayType::Tag() const
709 {
710 return DW_TAG_array_type;
711 }
712
713
714 status_t
InitAfterHierarchy(DebugInfoEntryInitInfo & info)715 DIEArrayType::InitAfterHierarchy(DebugInfoEntryInitInfo& info)
716 {
717 fOrdering = info.languageInfo->arrayOrdering;
718 return B_OK;
719 }
720
721
722 DebugInfoEntry*
Specification() const723 DIEArrayType::Specification() const
724 {
725 return fSpecification;
726 }
727
728
729 const DynamicAttributeValue*
ByteSize() const730 DIEArrayType::ByteSize() const
731 {
732 return &fByteSize;
733 }
734
735
736 status_t
AddChild(DebugInfoEntry * child)737 DIEArrayType::AddChild(DebugInfoEntry* child)
738 {
739 // a dimension child must be of subrange or enumeration type
740 uint16 tag = child->Tag();
741 if (tag == DW_TAG_subrange_type || tag == DW_TAG_enumeration_type) {
742 fDimensions.Add(child);
743 return B_OK;
744 }
745
746 return DIEDerivedType::AddChild(child);
747 }
748
749
750 status_t
AddAttribute_ordering(uint16 attributeName,const AttributeValue & value)751 DIEArrayType::AddAttribute_ordering(uint16 attributeName,
752 const AttributeValue& value)
753 {
754 fOrdering = value.constant;
755 return B_OK;
756 }
757
758
759 status_t
AddAttribute_bit_stride(uint16 attributeName,const AttributeValue & value)760 DIEArrayType::AddAttribute_bit_stride(uint16 attributeName,
761 const AttributeValue& value)
762 {
763 return SetDynamicAttributeValue(fBitStride, value);
764 }
765
766
767 status_t
AddAttribute_stride_size(uint16 attributeName,const AttributeValue & value)768 DIEArrayType::AddAttribute_stride_size(uint16 attributeName,
769 const AttributeValue& value)
770 {
771 return SetDynamicAttributeValue(fBitStride, value);
772 }
773
774
775 status_t
AddAttribute_byte_size(uint16 attributeName,const AttributeValue & value)776 DIEArrayType::AddAttribute_byte_size(uint16 attributeName,
777 const AttributeValue& value)
778 {
779 return SetDynamicAttributeValue(fByteSize, value);
780 }
781
782
783 status_t
AddAttribute_specification(uint16 attributeName,const AttributeValue & value)784 DIEArrayType::AddAttribute_specification(uint16 attributeName,
785 const AttributeValue& value)
786 {
787 fSpecification = dynamic_cast<DIEArrayType*>(value.reference);
788 return fSpecification != NULL ? B_OK : B_BAD_DATA;
789 }
790
791
792 // #pragma mark - DIEClassType
793
794
DIEClassType()795 DIEClassType::DIEClassType()
796 {
797 }
798
799
800 uint16
Tag() const801 DIEClassType::Tag() const
802 {
803 return DW_TAG_class_type;
804 }
805
806
807 // #pragma mark - DIEEntryPoint
808
809
DIEEntryPoint()810 DIEEntryPoint::DIEEntryPoint()
811 {
812 }
813
814
815 uint16
Tag() const816 DIEEntryPoint::Tag() const
817 {
818 return DW_TAG_entry_point;
819 }
820
821
822 // #pragma mark - DIEEnumerationType
823
824
DIEEnumerationType()825 DIEEnumerationType::DIEEnumerationType()
826 :
827 fSpecification(NULL)
828 {
829 }
830
831
832 uint16
Tag() const833 DIEEnumerationType::Tag() const
834 {
835 return DW_TAG_enumeration_type;
836 }
837
838
839 DebugInfoEntry*
Specification() const840 DIEEnumerationType::Specification() const
841 {
842 return fSpecification;
843 }
844
845
846 status_t
AddChild(DebugInfoEntry * child)847 DIEEnumerationType::AddChild(DebugInfoEntry* child)
848 {
849 if (child->Tag() == DW_TAG_enumerator) {
850 fEnumerators.Add(child);
851 return B_OK;
852 }
853
854 return DIEDerivedType::AddChild(child);
855 }
856
857
858 status_t
AddAttribute_specification(uint16 attributeName,const AttributeValue & value)859 DIEEnumerationType::AddAttribute_specification(uint16 attributeName,
860 const AttributeValue& value)
861 {
862 fSpecification = dynamic_cast<DIEEnumerationType*>(value.reference);
863 return fSpecification != NULL ? B_OK : B_BAD_DATA;
864 }
865
866
867 // #pragma mark - DIEFormalParameter
868
869
DIEFormalParameter()870 DIEFormalParameter::DIEFormalParameter()
871 :
872 fAbstractOrigin(NULL),
873 fType(NULL),
874 fArtificial(false)
875 {
876 }
877
878
879 uint16
Tag() const880 DIEFormalParameter::Tag() const
881 {
882 return DW_TAG_formal_parameter;
883 }
884
885
886 DebugInfoEntry*
AbstractOrigin() const887 DIEFormalParameter::AbstractOrigin() const
888 {
889 return fAbstractOrigin;
890 }
891
892
893 LocationDescription*
GetLocationDescription()894 DIEFormalParameter::GetLocationDescription()
895 {
896 return &fLocationDescription;
897 }
898
899
900 status_t
AddAttribute_abstract_origin(uint16 attributeName,const AttributeValue & value)901 DIEFormalParameter::AddAttribute_abstract_origin(uint16 attributeName,
902 const AttributeValue& value)
903 {
904 fAbstractOrigin = value.reference;
905 return B_OK;
906 }
907
908
909 status_t
AddAttribute_artificial(uint16 attributeName,const AttributeValue & value)910 DIEFormalParameter::AddAttribute_artificial(uint16 attributeName,
911 const AttributeValue& value)
912 {
913 fArtificial = value.flag;
914 return B_OK;
915 }
916
917
918 status_t
AddAttribute_const_value(uint16 attributeName,const AttributeValue & value)919 DIEFormalParameter::AddAttribute_const_value(uint16 attributeName,
920 const AttributeValue& value)
921 {
922 return SetConstantAttributeValue(fValue, value);
923 }
924
925
926 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)927 DIEFormalParameter::AddAttribute_type(uint16 attributeName,
928 const AttributeValue& value)
929 {
930 fType = dynamic_cast<DIEType*>(value.reference);
931 return fType != NULL ? B_OK : B_BAD_DATA;
932 }
933
934
935 // #pragma mark - DIEImportedDeclaration
936
937
DIEImportedDeclaration()938 DIEImportedDeclaration::DIEImportedDeclaration()
939 {
940 }
941
942
943 uint16
Tag() const944 DIEImportedDeclaration::Tag() const
945 {
946 return DW_TAG_imported_declaration;
947 }
948
949
950 // #pragma mark - DIELabel
951
952
DIELabel()953 DIELabel::DIELabel()
954 {
955 }
956
957
958 uint16
Tag() const959 DIELabel::Tag() const
960 {
961 return DW_TAG_label;
962 }
963
964
965 // #pragma mark - DIELexicalBlock
966
967
DIELexicalBlock()968 DIELexicalBlock::DIELexicalBlock()
969 :
970 fLowPC(0),
971 fHighPC(0),
972 fAddressRangesOffset(-1),
973 fAbstractOrigin(NULL)
974 {
975 }
976
977
978 uint16
Tag() const979 DIELexicalBlock::Tag() const
980 {
981 return DW_TAG_lexical_block;
982 }
983
984
985 DebugInfoEntry*
AbstractOrigin() const986 DIELexicalBlock::AbstractOrigin() const
987 {
988 return fAbstractOrigin;
989 }
990
991
992 status_t
AddChild(DebugInfoEntry * child)993 DIELexicalBlock::AddChild(DebugInfoEntry* child)
994 {
995 switch (child->Tag()) {
996 case DW_TAG_variable:
997 fVariables.Add(child);
998 return B_OK;
999 case DW_TAG_lexical_block:
1000 fBlocks.Add(child);
1001 return B_OK;
1002 default:
1003 return DIENamedBase::AddChild(child);
1004 }
1005 }
1006
1007
1008 status_t
AddAttribute_low_pc(uint16 attributeName,const AttributeValue & value)1009 DIELexicalBlock::AddAttribute_low_pc(uint16 attributeName,
1010 const AttributeValue& value)
1011 {
1012 fLowPC = value.address;
1013 return B_OK;
1014 }
1015
1016
1017 status_t
AddAttribute_high_pc(uint16 attributeName,const AttributeValue & value)1018 DIELexicalBlock::AddAttribute_high_pc(uint16 attributeName,
1019 const AttributeValue& value)
1020 {
1021 fHighPC = value.address;
1022 if (fLowPC != 0 && fHighPC < fLowPC)
1023 fHighPC += fLowPC;
1024
1025 return B_OK;
1026 }
1027
1028
1029 status_t
AddAttribute_ranges(uint16 attributeName,const AttributeValue & value)1030 DIELexicalBlock::AddAttribute_ranges(uint16 attributeName,
1031 const AttributeValue& value)
1032 {
1033 fAddressRangesOffset = value.pointer;
1034 return B_OK;
1035 }
1036
1037
1038 status_t
AddAttribute_abstract_origin(uint16 attributeName,const AttributeValue & value)1039 DIELexicalBlock::AddAttribute_abstract_origin(uint16 attributeName,
1040 const AttributeValue& value)
1041 {
1042 fAbstractOrigin = dynamic_cast<DIELexicalBlock*>(value.reference);
1043 return fAbstractOrigin != NULL ? B_OK : B_BAD_DATA;
1044 }
1045
1046
1047 // #pragma mark - DIEMember
1048
1049
DIEMember()1050 DIEMember::DIEMember()
1051 :
1052 fType(NULL)
1053 {
1054 }
1055
1056
1057 uint16
Tag() const1058 DIEMember::Tag() const
1059 {
1060 return DW_TAG_member;
1061 }
1062
1063
1064 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)1065 DIEMember::AddAttribute_type(uint16 attributeName,
1066 const AttributeValue& value)
1067 {
1068 fType = dynamic_cast<DIEType*>(value.reference);
1069 return fType != NULL ? B_OK : B_BAD_DATA;
1070 }
1071
1072
1073 status_t
AddAttribute_byte_size(uint16 attributeName,const AttributeValue & value)1074 DIEMember::AddAttribute_byte_size(uint16 attributeName,
1075 const AttributeValue& value)
1076 {
1077 return SetDynamicAttributeValue(fByteSize, value);
1078 }
1079
1080
1081 status_t
AddAttribute_bit_size(uint16 attributeName,const AttributeValue & value)1082 DIEMember::AddAttribute_bit_size(uint16 attributeName,
1083 const AttributeValue& value)
1084 {
1085 return SetDynamicAttributeValue(fBitSize, value);
1086 }
1087
1088
1089 status_t
AddAttribute_data_member_location(uint16 attributeName,const AttributeValue & value)1090 DIEMember::AddAttribute_data_member_location(uint16 attributeName,
1091 const AttributeValue& value)
1092 {
1093 return SetMemberLocation(fLocation, value);
1094 }
1095
1096
1097 status_t
AddAttribute_bit_offset(uint16 attributeName,const AttributeValue & value)1098 DIEMember::AddAttribute_bit_offset(uint16 attributeName,
1099 const AttributeValue& value)
1100 {
1101 return SetDynamicAttributeValue(fBitOffset, value);
1102 }
1103
1104
1105 status_t
AddAttribute_data_bit_offset(uint16 attributeName,const AttributeValue & value)1106 DIEMember::AddAttribute_data_bit_offset(uint16 attributeName,
1107 const AttributeValue& value)
1108 {
1109 return SetDynamicAttributeValue(fDataBitOffset, value);
1110 }
1111
1112
1113 // #pragma mark - DIEPointerType
1114
1115
DIEPointerType()1116 DIEPointerType::DIEPointerType()
1117 :
1118 fSpecification(NULL)
1119 {
1120 }
1121
1122
1123 uint16
Tag() const1124 DIEPointerType::Tag() const
1125 {
1126 return DW_TAG_pointer_type;
1127 }
1128
1129
1130 DebugInfoEntry*
Specification() const1131 DIEPointerType::Specification() const
1132 {
1133 return fSpecification;
1134 }
1135
1136
1137 status_t
AddAttribute_specification(uint16 attributeName,const AttributeValue & value)1138 DIEPointerType::AddAttribute_specification(uint16 attributeName,
1139 const AttributeValue& value)
1140 {
1141 fSpecification = dynamic_cast<DIEPointerType*>(value.reference);
1142 return fSpecification != NULL ? B_OK : B_BAD_DATA;
1143 }
1144
1145
1146 // #pragma mark - DIEReferenceType
1147
1148
DIEReferenceType()1149 DIEReferenceType::DIEReferenceType()
1150 {
1151 }
1152
1153
1154 uint16
Tag() const1155 DIEReferenceType::Tag() const
1156 {
1157 return DW_TAG_reference_type;
1158 }
1159
1160
1161 // #pragma mark - DIECompileUnit
1162
1163
DIECompileUnit()1164 DIECompileUnit::DIECompileUnit()
1165 {
1166 }
1167
1168
1169 uint16
Tag() const1170 DIECompileUnit::Tag() const
1171 {
1172 return DW_TAG_compile_unit;
1173 }
1174
1175
1176 // #pragma mark - DIEStringType
1177
1178
DIEStringType()1179 DIEStringType::DIEStringType()
1180 {
1181 }
1182
1183
1184 uint16
Tag() const1185 DIEStringType::Tag() const
1186 {
1187 return DW_TAG_string_type;
1188 }
1189
1190
1191 const DynamicAttributeValue*
ByteSize() const1192 DIEStringType::ByteSize() const
1193 {
1194 return &fByteSize;
1195 }
1196
1197
1198 status_t
AddAttribute_byte_size(uint16 attributeName,const AttributeValue & value)1199 DIEStringType::AddAttribute_byte_size(uint16 attributeName,
1200 const AttributeValue& value)
1201 {
1202 return SetDynamicAttributeValue(fByteSize, value);
1203 }
1204
1205
1206 // #pragma mark - DIEStructureType
1207
1208
DIEStructureType()1209 DIEStructureType::DIEStructureType()
1210 {
1211 }
1212
1213
1214 uint16
Tag() const1215 DIEStructureType::Tag() const
1216 {
1217 return DW_TAG_structure_type;
1218 }
1219
1220
1221 // #pragma mark - DIESubroutineType
1222
1223
DIESubroutineType()1224 DIESubroutineType::DIESubroutineType()
1225 :
1226 fReturnType(NULL),
1227 fAddressClass(0),
1228 fPrototyped(false)
1229 {
1230 }
1231
1232
1233 uint16
Tag() const1234 DIESubroutineType::Tag() const
1235 {
1236 return DW_TAG_subroutine_type;
1237 }
1238
1239
1240 status_t
AddChild(DebugInfoEntry * child)1241 DIESubroutineType::AddChild(DebugInfoEntry* child)
1242 {
1243 switch (child->Tag()) {
1244 case DW_TAG_formal_parameter:
1245 case DW_TAG_unspecified_parameters:
1246 fParameters.Add(child);
1247 return B_OK;
1248 default:
1249 return DIEDeclaredType::AddChild(child);
1250 }
1251 }
1252
1253
1254 status_t
AddAttribute_address_class(uint16 attributeName,const AttributeValue & value)1255 DIESubroutineType::AddAttribute_address_class(uint16 attributeName,
1256 const AttributeValue& value)
1257 {
1258 // TODO: How is the address class handled?
1259 fAddressClass = value.constant;
1260 return B_OK;
1261 }
1262
1263
1264 status_t
AddAttribute_prototyped(uint16 attributeName,const AttributeValue & value)1265 DIESubroutineType::AddAttribute_prototyped(uint16 attributeName,
1266 const AttributeValue& value)
1267 {
1268 fPrototyped = value.flag;
1269 return B_OK;
1270 }
1271
1272
1273 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)1274 DIESubroutineType::AddAttribute_type(uint16 attributeName,
1275 const AttributeValue& value)
1276 {
1277 fReturnType = dynamic_cast<DIEType*>(value.reference);
1278 return fReturnType != NULL ? B_OK : B_BAD_DATA;
1279 }
1280
1281
1282 // #pragma mark - DIETypedef
1283
1284
DIETypedef()1285 DIETypedef::DIETypedef()
1286 {
1287 }
1288
1289
1290 uint16
Tag() const1291 DIETypedef::Tag() const
1292 {
1293 return DW_TAG_typedef;
1294 }
1295
1296
1297 // #pragma mark - DIEUnionType
1298
1299
DIEUnionType()1300 DIEUnionType::DIEUnionType()
1301 {
1302 }
1303
1304
1305 uint16
Tag() const1306 DIEUnionType::Tag() const
1307 {
1308 return DW_TAG_union_type;
1309 }
1310
1311
1312 // #pragma mark - DIEUnspecifiedParameters
1313
1314
DIEUnspecifiedParameters()1315 DIEUnspecifiedParameters::DIEUnspecifiedParameters()
1316 {
1317 }
1318
1319
1320 uint16
Tag() const1321 DIEUnspecifiedParameters::Tag() const
1322 {
1323 return DW_TAG_unspecified_parameters;
1324 }
1325
1326
1327 // #pragma mark - DIEVariant
1328
1329
DIEVariant()1330 DIEVariant::DIEVariant()
1331 {
1332 }
1333
1334
1335 uint16
Tag() const1336 DIEVariant::Tag() const
1337 {
1338 return DW_TAG_variant;
1339 }
1340
1341
1342 // #pragma mark - DIECommonBlock
1343
1344
DIECommonBlock()1345 DIECommonBlock::DIECommonBlock()
1346 {
1347 }
1348
1349
1350 uint16
Tag() const1351 DIECommonBlock::Tag() const
1352 {
1353 return DW_TAG_common_block;
1354 }
1355
1356
1357 LocationDescription*
GetLocationDescription()1358 DIECommonBlock::GetLocationDescription()
1359 {
1360 return &fLocationDescription;
1361 }
1362
1363
1364 // #pragma mark - DIECommonInclusion
1365
1366
DIECommonInclusion()1367 DIECommonInclusion::DIECommonInclusion()
1368 {
1369 }
1370
1371
1372 uint16
Tag() const1373 DIECommonInclusion::Tag() const
1374 {
1375 return DW_TAG_common_inclusion;
1376 }
1377
1378
1379 // #pragma mark - DIEInheritance
1380
1381
DIEInheritance()1382 DIEInheritance::DIEInheritance()
1383 :
1384 fType(NULL)
1385 {
1386 }
1387
1388
1389 uint16
Tag() const1390 DIEInheritance::Tag() const
1391 {
1392 return DW_TAG_inheritance;
1393 }
1394
1395
1396 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)1397 DIEInheritance::AddAttribute_type(uint16 attributeName,
1398 const AttributeValue& value)
1399 {
1400 fType = dynamic_cast<DIEType*>(value.reference);
1401 return fType != NULL ? B_OK : B_BAD_DATA;
1402 }
1403
1404
1405 status_t
AddAttribute_data_member_location(uint16 attributeName,const AttributeValue & value)1406 DIEInheritance::AddAttribute_data_member_location(uint16 attributeName,
1407 const AttributeValue& value)
1408 {
1409 return SetMemberLocation(fLocation, value);
1410 }
1411
1412
1413 // #pragma mark - DIEInlinedSubroutine
1414
1415
DIEInlinedSubroutine()1416 DIEInlinedSubroutine::DIEInlinedSubroutine()
1417 {
1418 }
1419
1420
1421 uint16
Tag() const1422 DIEInlinedSubroutine::Tag() const
1423 {
1424 return DW_TAG_inlined_subroutine;
1425 }
1426
1427
1428 // #pragma mark - DIEModule
1429
1430
DIEModule()1431 DIEModule::DIEModule()
1432 {
1433 }
1434
1435
1436 uint16
Tag() const1437 DIEModule::Tag() const
1438 {
1439 return DW_TAG_module;
1440 }
1441
1442
1443 // #pragma mark - DIEPointerToMemberType
1444
1445
DIEPointerToMemberType()1446 DIEPointerToMemberType::DIEPointerToMemberType()
1447 :
1448 fContainingType(NULL),
1449 fAddressClass(0)
1450 {
1451 }
1452
1453
1454 uint16
Tag() const1455 DIEPointerToMemberType::Tag() const
1456 {
1457 return DW_TAG_ptr_to_member_type;
1458 }
1459
1460
1461 status_t
AddAttribute_address_class(uint16 attributeName,const AttributeValue & value)1462 DIEPointerToMemberType::AddAttribute_address_class(uint16 attributeName,
1463 const AttributeValue& value)
1464 {
1465 // TODO: How is the address class handled?
1466 fAddressClass = value.constant;
1467 return B_OK;
1468 }
1469
1470
1471 status_t
AddAttribute_containing_type(uint16 attributeName,const AttributeValue & value)1472 DIEPointerToMemberType::AddAttribute_containing_type(uint16 attributeName,
1473 const AttributeValue& value)
1474 {
1475 DebugInfoEntry* type = value.reference;
1476 DIEModifiedType* modifiedType;
1477 while ((modifiedType = dynamic_cast<DIEModifiedType*>(type)) != NULL)
1478 type = modifiedType->GetType();
1479
1480 fContainingType = dynamic_cast<DIECompoundType*>(type);
1481 return fContainingType != NULL ? B_OK : B_BAD_DATA;
1482 }
1483
1484
1485 status_t
AddAttribute_use_location(uint16 attributeName,const AttributeValue & value)1486 DIEPointerToMemberType::AddAttribute_use_location(uint16 attributeName,
1487 const AttributeValue& value)
1488 {
1489 if (value.attributeClass == ATTRIBUTE_CLASS_LOCLIST) {
1490 fUseLocation.SetToLocationList(value.pointer);
1491 return B_OK;
1492 }
1493
1494 if (value.attributeClass == ATTRIBUTE_CLASS_BLOCK) {
1495 fUseLocation.SetToExpression(value.block.data, value.block.length);
1496 return B_OK;
1497 }
1498
1499 return B_BAD_DATA;
1500 }
1501
1502
1503 // #pragma mark - DIESetType
1504
1505
DIESetType()1506 DIESetType::DIESetType()
1507 {
1508 }
1509
1510
1511 uint16
Tag() const1512 DIESetType::Tag() const
1513 {
1514 return DW_TAG_set_type;
1515 }
1516
1517
1518 const DynamicAttributeValue*
ByteSize() const1519 DIESetType::ByteSize() const
1520 {
1521 return &fByteSize;
1522 }
1523
1524
1525 status_t
AddAttribute_byte_size(uint16 attributeName,const AttributeValue & value)1526 DIESetType::AddAttribute_byte_size(uint16 attributeName,
1527 const AttributeValue& value)
1528 {
1529 return SetDynamicAttributeValue(fByteSize, value);
1530 }
1531
1532
1533 // #pragma mark - DIESubrangeType
1534
1535
DIESubrangeType()1536 DIESubrangeType::DIESubrangeType()
1537 :
1538 fThreadsScaled(false)
1539 {
1540 }
1541
1542
1543 uint16
Tag() const1544 DIESubrangeType::Tag() const
1545 {
1546 return DW_TAG_subrange_type;
1547 }
1548
1549
1550 status_t
AddAttribute_count(uint16 attributeName,const AttributeValue & value)1551 DIESubrangeType::AddAttribute_count(uint16 attributeName,
1552 const AttributeValue& value)
1553 {
1554 return SetDynamicAttributeValue(fCount, value);
1555 }
1556
1557
1558 status_t
AddAttribute_lower_bound(uint16 attributeName,const AttributeValue & value)1559 DIESubrangeType::AddAttribute_lower_bound(uint16 attributeName,
1560 const AttributeValue& value)
1561 {
1562 return SetDynamicAttributeValue(fLowerBound, value);
1563 }
1564
1565
1566 status_t
AddAttribute_upper_bound(uint16 attributeName,const AttributeValue & value)1567 DIESubrangeType::AddAttribute_upper_bound(uint16 attributeName,
1568 const AttributeValue& value)
1569 {
1570 return SetDynamicAttributeValue(fUpperBound, value);
1571 }
1572
1573
1574 status_t
AddAttribute_threads_scaled(uint16 attributeName,const AttributeValue & value)1575 DIESubrangeType::AddAttribute_threads_scaled(uint16 attributeName,
1576 const AttributeValue& value)
1577 {
1578 fThreadsScaled = value.flag;
1579 return B_OK;
1580 }
1581
1582
1583 // #pragma mark - DIEWithStatement
1584
1585
DIEWithStatement()1586 DIEWithStatement::DIEWithStatement()
1587 :
1588 fType(NULL)
1589 {
1590 }
1591
1592
1593 uint16
Tag() const1594 DIEWithStatement::Tag() const
1595 {
1596 return DW_TAG_with_stmt;
1597 }
1598
1599
1600 LocationDescription*
GetLocationDescription()1601 DIEWithStatement::GetLocationDescription()
1602 {
1603 return &fLocationDescription;
1604 }
1605
1606
1607 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)1608 DIEWithStatement::AddAttribute_type(uint16 attributeName,
1609 const AttributeValue& value)
1610 {
1611 fType = dynamic_cast<DIEType*>(value.reference);
1612 return fType != NULL ? B_OK : B_BAD_DATA;
1613 }
1614
1615
1616 // #pragma mark - DIEAccessDeclaration
1617
1618
DIEAccessDeclaration()1619 DIEAccessDeclaration::DIEAccessDeclaration()
1620 {
1621 }
1622
1623
1624 uint16
Tag() const1625 DIEAccessDeclaration::Tag() const
1626 {
1627 return DW_TAG_access_declaration;
1628 }
1629
1630
1631 // #pragma mark - DIEBaseType
1632
1633
DIEBaseType()1634 DIEBaseType::DIEBaseType()
1635 :
1636 fEncoding(0),
1637 fEndianity(0)
1638 {
1639 }
1640
1641
1642 uint16
Tag() const1643 DIEBaseType::Tag() const
1644 {
1645 return DW_TAG_base_type;
1646 }
1647
1648
1649 const DynamicAttributeValue*
ByteSize() const1650 DIEBaseType::ByteSize() const
1651 {
1652 return &fByteSize;
1653 }
1654
1655
1656 status_t
AddAttribute_encoding(uint16 attributeName,const AttributeValue & value)1657 DIEBaseType::AddAttribute_encoding(uint16 attributeName,
1658 const AttributeValue& value)
1659 {
1660 fEncoding = value.constant;
1661 return B_OK;
1662 }
1663
1664
1665 status_t
AddAttribute_byte_size(uint16 attributeName,const AttributeValue & value)1666 DIEBaseType::AddAttribute_byte_size(uint16 attributeName,
1667 const AttributeValue& value)
1668 {
1669 return SetDynamicAttributeValue(fByteSize, value);
1670 }
1671
1672
1673 status_t
AddAttribute_bit_size(uint16 attributeName,const AttributeValue & value)1674 DIEBaseType::AddAttribute_bit_size(uint16 attributeName,
1675 const AttributeValue& value)
1676 {
1677 return SetDynamicAttributeValue(fBitSize, value);
1678 }
1679
1680
1681 status_t
AddAttribute_bit_offset(uint16 attributeName,const AttributeValue & value)1682 DIEBaseType::AddAttribute_bit_offset(uint16 attributeName,
1683 const AttributeValue& value)
1684 {
1685 return SetDynamicAttributeValue(fBitOffset, value);
1686 }
1687
1688
1689 status_t
AddAttribute_data_bit_offset(uint16 attributeName,const AttributeValue & value)1690 DIEBaseType::AddAttribute_data_bit_offset(uint16 attributeName,
1691 const AttributeValue& value)
1692 {
1693 return SetDynamicAttributeValue(fDataBitOffset, value);
1694 }
1695
1696
1697 status_t
AddAttribute_endianity(uint16 attributeName,const AttributeValue & value)1698 DIEBaseType::AddAttribute_endianity(uint16 attributeName,
1699 const AttributeValue& value)
1700 {
1701 fEndianity = value.constant;
1702 return B_OK;
1703 }
1704
1705
1706 // #pragma mark - DIECatchBlock
1707
1708
DIECatchBlock()1709 DIECatchBlock::DIECatchBlock()
1710 {
1711 }
1712
1713
1714 uint16
Tag() const1715 DIECatchBlock::Tag() const
1716 {
1717 return DW_TAG_catch_block;
1718 }
1719
1720
1721 // #pragma mark - DIEConstType
1722
1723
DIEConstType()1724 DIEConstType::DIEConstType()
1725 {
1726 }
1727
1728
1729 uint16
Tag() const1730 DIEConstType::Tag() const
1731 {
1732 return DW_TAG_const_type;
1733 }
1734
1735
1736 // #pragma mark - DIEConstant
1737
1738
DIEConstant()1739 DIEConstant::DIEConstant()
1740 :
1741 fType(NULL)
1742 {
1743 }
1744
1745
1746 uint16
Tag() const1747 DIEConstant::Tag() const
1748 {
1749 return DW_TAG_constant;
1750 }
1751
1752
1753 status_t
AddAttribute_const_value(uint16 attributeName,const AttributeValue & value)1754 DIEConstant::AddAttribute_const_value(uint16 attributeName,
1755 const AttributeValue& value)
1756 {
1757 return SetConstantAttributeValue(fValue, value);
1758 }
1759
1760
1761 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)1762 DIEConstant::AddAttribute_type(uint16 attributeName,
1763 const AttributeValue& value)
1764 {
1765 fType = dynamic_cast<DIEType*>(value.reference);
1766 return fType != NULL ? B_OK : B_BAD_DATA;
1767 }
1768
1769
1770 // #pragma mark - DIEEnumerator
1771
1772
DIEEnumerator()1773 DIEEnumerator::DIEEnumerator()
1774 {
1775 }
1776
1777
1778 uint16
Tag() const1779 DIEEnumerator::Tag() const
1780 {
1781 return DW_TAG_enumerator;
1782 }
1783
1784
1785 status_t
AddAttribute_const_value(uint16 attributeName,const AttributeValue & value)1786 DIEEnumerator::AddAttribute_const_value(uint16 attributeName,
1787 const AttributeValue& value)
1788 {
1789 return SetConstantAttributeValue(fValue, value);
1790 }
1791
1792
1793 // #pragma mark - DIEFileType
1794
1795
DIEFileType()1796 DIEFileType::DIEFileType()
1797 {
1798 }
1799
1800
1801 uint16
Tag() const1802 DIEFileType::Tag() const
1803 {
1804 return DW_TAG_file_type;
1805 }
1806
1807
1808 const DynamicAttributeValue*
ByteSize() const1809 DIEFileType::ByteSize() const
1810 {
1811 return &fByteSize;
1812 }
1813
1814
1815 status_t
AddAttribute_byte_size(uint16 attributeName,const AttributeValue & value)1816 DIEFileType::AddAttribute_byte_size(uint16 attributeName,
1817 const AttributeValue& value)
1818 {
1819 return SetDynamicAttributeValue(fByteSize, value);
1820 }
1821
1822
1823 // #pragma mark - DIEFriend
1824
1825
DIEFriend()1826 DIEFriend::DIEFriend()
1827 {
1828 }
1829
1830
1831 uint16
Tag() const1832 DIEFriend::Tag() const
1833 {
1834 return DW_TAG_friend;
1835 }
1836
1837
1838 // #pragma mark - DIENameList
1839
1840
DIENameList()1841 DIENameList::DIENameList()
1842 {
1843 }
1844
1845
1846 uint16
Tag() const1847 DIENameList::Tag() const
1848 {
1849 return DW_TAG_namelist;
1850 }
1851
1852
1853 // #pragma mark - DIENameListItem
1854
1855
DIENameListItem()1856 DIENameListItem::DIENameListItem()
1857 {
1858 }
1859
1860
1861 uint16
Tag() const1862 DIENameListItem::Tag() const
1863 {
1864 return DW_TAG_namelist_item;
1865 }
1866
1867
1868 // #pragma mark - DIENamespace
1869
1870
DIENamespace()1871 DIENamespace::DIENamespace()
1872 {
1873 }
1874
1875
1876 uint16
Tag() const1877 DIENamespace::Tag() const
1878 {
1879 return DW_TAG_namespace;
1880 }
1881
1882
1883 bool
IsNamespace() const1884 DIENamespace::IsNamespace() const
1885 {
1886 return true;
1887 }
1888
1889
1890 status_t
AddChild(DebugInfoEntry * child)1891 DIENamespace::AddChild(DebugInfoEntry* child)
1892 {
1893 fChildren.Add(child);
1894 return B_OK;
1895 }
1896
1897
1898 // #pragma mark - DIEPackedType
1899
1900
DIEPackedType()1901 DIEPackedType::DIEPackedType()
1902 {
1903 }
1904
1905
1906 uint16
Tag() const1907 DIEPackedType::Tag() const
1908 {
1909 return DW_TAG_packed_type;
1910 }
1911
1912
1913 // #pragma mark - DIESubprogram
1914
1915
DIESubprogram()1916 DIESubprogram::DIESubprogram()
1917 :
1918 fLowPC(0),
1919 fHighPC(0),
1920 fAddressRangesOffset(-1),
1921 fSpecification(NULL),
1922 fAbstractOrigin(NULL),
1923 fReturnType(NULL),
1924 fAddressClass(0),
1925 fPrototyped(false),
1926 fInline(DW_INL_not_inlined),
1927 fMain(false),
1928 fArtificial(false),
1929 fCallingConvention(DW_CC_normal)
1930 {
1931 }
1932
1933
~DIESubprogram()1934 DIESubprogram::~DIESubprogram()
1935 {
1936 }
1937
1938
1939 uint16
Tag() const1940 DIESubprogram::Tag() const
1941 {
1942 return DW_TAG_subprogram;
1943 }
1944
1945
1946 DebugInfoEntry*
Specification() const1947 DIESubprogram::Specification() const
1948 {
1949 return fSpecification;
1950 }
1951
1952
1953
1954 DebugInfoEntry*
AbstractOrigin() const1955 DIESubprogram::AbstractOrigin() const
1956 {
1957 return fAbstractOrigin;
1958 }
1959
1960
1961 status_t
AddChild(DebugInfoEntry * child)1962 DIESubprogram::AddChild(DebugInfoEntry* child)
1963 {
1964 switch (child->Tag()) {
1965 case DW_TAG_formal_parameter:
1966 case DW_TAG_unspecified_parameters:
1967 fParameters.Add(child);
1968 return B_OK;
1969 case DW_TAG_variable:
1970 fVariables.Add(child);
1971 return B_OK;
1972 case DW_TAG_lexical_block:
1973 fBlocks.Add(child);
1974 return B_OK;
1975 case DW_TAG_template_type_parameter:
1976 fTemplateTypeParameters.Add(child);
1977 return B_OK;
1978 case DW_TAG_template_value_parameter:
1979 fTemplateValueParameters.Add(child);
1980 return B_OK;
1981 case DW_TAG_call_site:
1982 case DW_TAG_GNU_call_site:
1983 fCallSites.Add(child);
1984 return B_OK;
1985 default:
1986 return DIENamespace::AddChild(child);
1987 }
1988 }
1989
1990
1991
1992 status_t
AddAttribute_low_pc(uint16 attributeName,const AttributeValue & value)1993 DIESubprogram::AddAttribute_low_pc(uint16 attributeName,
1994 const AttributeValue& value)
1995 {
1996 fLowPC = value.address;
1997 return B_OK;
1998 }
1999
2000
2001 status_t
AddAttribute_high_pc(uint16 attributeName,const AttributeValue & value)2002 DIESubprogram::AddAttribute_high_pc(uint16 attributeName,
2003 const AttributeValue& value)
2004 {
2005 fHighPC = value.address;
2006 if (fLowPC != 0 && fHighPC < fLowPC)
2007 fHighPC += fLowPC;
2008
2009 return B_OK;
2010 }
2011
2012
2013 status_t
AddAttribute_ranges(uint16 attributeName,const AttributeValue & value)2014 DIESubprogram::AddAttribute_ranges(uint16 attributeName,
2015 const AttributeValue& value)
2016 {
2017 fAddressRangesOffset = value.pointer;
2018 return B_OK;
2019 }
2020
2021
2022 status_t
AddAttribute_specification(uint16 attributeName,const AttributeValue & value)2023 DIESubprogram::AddAttribute_specification(uint16 attributeName,
2024 const AttributeValue& value)
2025 {
2026 fSpecification = dynamic_cast<DIESubprogram*>(value.reference);
2027 return fSpecification != NULL ? B_OK : B_BAD_DATA;
2028 }
2029
2030
2031 status_t
AddAttribute_address_class(uint16 attributeName,const AttributeValue & value)2032 DIESubprogram::AddAttribute_address_class(uint16 attributeName,
2033 const AttributeValue& value)
2034 {
2035 // TODO: How is the address class handled?
2036 fAddressClass = value.constant;
2037 return B_OK;
2038 }
2039
2040
2041 status_t
AddAttribute_prototyped(uint16 attributeName,const AttributeValue & value)2042 DIESubprogram::AddAttribute_prototyped(uint16 attributeName,
2043 const AttributeValue& value)
2044 {
2045 fPrototyped = value.flag;
2046 return B_OK;
2047 }
2048
2049
2050 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)2051 DIESubprogram::AddAttribute_type(uint16 attributeName,
2052 const AttributeValue& value)
2053 {
2054 fReturnType = dynamic_cast<DIEType*>(value.reference);
2055 return fReturnType != NULL ? B_OK : B_BAD_DATA;
2056 }
2057
2058
2059 status_t
AddAttribute_inline(uint16 attributeName,const AttributeValue & value)2060 DIESubprogram::AddAttribute_inline(uint16 attributeName,
2061 const AttributeValue& value)
2062 {
2063 // TODO: How is the address class handled?
2064 fInline = value.constant;
2065 return B_OK;
2066 }
2067
2068
2069 status_t
AddAttribute_abstract_origin(uint16 attributeName,const AttributeValue & value)2070 DIESubprogram::AddAttribute_abstract_origin(uint16 attributeName,
2071 const AttributeValue& value)
2072 {
2073 fAbstractOrigin = dynamic_cast<DIESubprogram*>(value.reference);
2074 return fAbstractOrigin != NULL ? B_OK : B_BAD_DATA;
2075 }
2076
2077
2078 status_t
AddAttribute_frame_base(uint16 attributeName,const AttributeValue & value)2079 DIESubprogram::AddAttribute_frame_base(uint16 attributeName,
2080 const AttributeValue& value)
2081 {
2082 if (value.attributeClass == ATTRIBUTE_CLASS_LOCLIST) {
2083 fFrameBase.SetToLocationList(value.pointer);
2084 return B_OK;
2085 }
2086
2087 if (value.attributeClass == ATTRIBUTE_CLASS_BLOCK) {
2088 fFrameBase.SetToExpression(value.block.data, value.block.length);
2089 return B_OK;
2090 }
2091
2092 return B_BAD_DATA;
2093 }
2094
2095
2096 status_t
AddAttribute_artificial(uint16 attributeName,const AttributeValue & value)2097 DIESubprogram::AddAttribute_artificial(uint16 attributeName,
2098 const AttributeValue& value)
2099 {
2100 fArtificial = value.flag;
2101 return B_OK;
2102 }
2103
2104
2105 status_t
AddAttribute_calling_convention(uint16 attributeName,const AttributeValue & value)2106 DIESubprogram::AddAttribute_calling_convention(uint16 attributeName,
2107 const AttributeValue& value)
2108 {
2109 fCallingConvention = value.constant;
2110 return B_OK;
2111 }
2112
2113
2114 status_t
AddAttribute_main_subprogram(uint16 attributeName,const AttributeValue & value)2115 DIESubprogram::AddAttribute_main_subprogram(uint16 attributeName,
2116 const AttributeValue& value)
2117 {
2118 fMain = true;
2119 return B_OK;
2120 }
2121
2122
2123 // #pragma mark - DIETemplateTypeParameter
2124
2125
DIETemplateTypeParameter()2126 DIETemplateTypeParameter::DIETemplateTypeParameter()
2127 :
2128 fType(NULL)
2129 {
2130 }
2131
2132
2133 uint16
Tag() const2134 DIETemplateTypeParameter::Tag() const
2135 {
2136 return DW_TAG_template_type_parameter;
2137 }
2138
2139
2140 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)2141 DIETemplateTypeParameter::AddAttribute_type(uint16 attributeName,
2142 const AttributeValue& value)
2143 {
2144 fType = dynamic_cast<DIEType*>(value.reference);
2145 return fType != NULL ? B_OK : B_BAD_DATA;
2146 }
2147
2148
2149 // #pragma mark - DIETemplateValueParameter
2150
2151
DIETemplateValueParameter()2152 DIETemplateValueParameter::DIETemplateValueParameter()
2153 :
2154 fType(NULL)
2155 {
2156 }
2157
2158
2159 uint16
Tag() const2160 DIETemplateValueParameter::Tag() const
2161 {
2162 return DW_TAG_template_value_parameter;
2163 }
2164
2165
2166 status_t
AddAttribute_const_value(uint16 attributeName,const AttributeValue & value)2167 DIETemplateValueParameter::AddAttribute_const_value(uint16 attributeName,
2168 const AttributeValue& value)
2169 {
2170 return SetConstantAttributeValue(fValue, value);
2171 }
2172
2173
2174 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)2175 DIETemplateValueParameter::AddAttribute_type(uint16 attributeName,
2176 const AttributeValue& value)
2177 {
2178 fType = dynamic_cast<DIEType*>(value.reference);
2179 return fType != NULL ? B_OK : B_BAD_DATA;
2180 }
2181
2182
2183 // #pragma mark - DIEThrownType
2184
2185
DIEThrownType()2186 DIEThrownType::DIEThrownType()
2187 :
2188 fType(NULL)
2189 {
2190 }
2191
2192
2193 uint16
Tag() const2194 DIEThrownType::Tag() const
2195 {
2196 return DW_TAG_thrown_type;
2197 }
2198
2199
2200 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)2201 DIEThrownType::AddAttribute_type(uint16 attributeName,
2202 const AttributeValue& value)
2203 {
2204 fType = dynamic_cast<DIEType*>(value.reference);
2205 return fType != NULL ? B_OK : B_BAD_DATA;
2206 }
2207
2208
2209 // #pragma mark - DIETryBlock
2210
2211
DIETryBlock()2212 DIETryBlock::DIETryBlock()
2213 {
2214 }
2215
2216
2217 uint16
Tag() const2218 DIETryBlock::Tag() const
2219 {
2220 return DW_TAG_try_block;
2221 }
2222
2223
2224 // #pragma mark - DIEVariantPart
2225
2226
DIEVariantPart()2227 DIEVariantPart::DIEVariantPart()
2228 :
2229 fType(NULL)
2230 {
2231 }
2232
2233
2234 uint16
Tag() const2235 DIEVariantPart::Tag() const
2236 {
2237 return DW_TAG_variant_part;
2238 }
2239
2240
2241 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)2242 DIEVariantPart::AddAttribute_type(uint16 attributeName,
2243 const AttributeValue& value)
2244 {
2245 fType = dynamic_cast<DIEType*>(value.reference);
2246 return fType != NULL ? B_OK : B_BAD_DATA;
2247 }
2248
2249
2250 // #pragma mark - DIEVariable
2251
2252
DIEVariable()2253 DIEVariable::DIEVariable()
2254 :
2255 fType(NULL),
2256 fSpecification(NULL),
2257 fAbstractOrigin(NULL),
2258 fStartScope(0)
2259 {
2260 }
2261
2262
2263 uint16
Tag() const2264 DIEVariable::Tag() const
2265 {
2266 return DW_TAG_variable;
2267 }
2268
2269
2270 DebugInfoEntry*
Specification() const2271 DIEVariable::Specification() const
2272 {
2273 return fSpecification;
2274 }
2275
2276
2277
2278 DebugInfoEntry*
AbstractOrigin() const2279 DIEVariable::AbstractOrigin() const
2280 {
2281 return fAbstractOrigin;
2282 }
2283
2284
2285 LocationDescription*
GetLocationDescription()2286 DIEVariable::GetLocationDescription()
2287 {
2288 return &fLocationDescription;
2289 }
2290
2291
2292 status_t
AddAttribute_const_value(uint16 attributeName,const AttributeValue & value)2293 DIEVariable::AddAttribute_const_value(uint16 attributeName,
2294 const AttributeValue& value)
2295 {
2296 return SetConstantAttributeValue(fValue, value);
2297 }
2298
2299
2300 status_t
AddAttribute_type(uint16 attributeName,const AttributeValue & value)2301 DIEVariable::AddAttribute_type(uint16 attributeName,
2302 const AttributeValue& value)
2303 {
2304 fType = dynamic_cast<DIEType*>(value.reference);
2305 return fType != NULL ? B_OK : B_BAD_DATA;
2306 }
2307
2308
2309 status_t
AddAttribute_specification(uint16 attributeName,const AttributeValue & value)2310 DIEVariable::AddAttribute_specification(uint16 attributeName,
2311 const AttributeValue& value)
2312 {
2313 fSpecification = dynamic_cast<DIEVariable*>(value.reference);
2314 // in the case of static variables declared within a compound type,
2315 // the specification may point to a member entry rather than
2316 // a variable entry
2317 if (fSpecification == NULL)
2318 fSpecification = dynamic_cast<DIEMember*>(value.reference);
2319
2320 return fSpecification != NULL ? B_OK : B_BAD_DATA;
2321 }
2322
2323
2324 status_t
AddAttribute_abstract_origin(uint16 attributeName,const AttributeValue & value)2325 DIEVariable::AddAttribute_abstract_origin(uint16 attributeName,
2326 const AttributeValue& value)
2327 {
2328 fAbstractOrigin = dynamic_cast<DIEVariable*>(value.reference);
2329 return fAbstractOrigin != NULL ? B_OK : B_BAD_DATA;
2330 }
2331
2332
2333 status_t
AddAttribute_start_scope(uint16 attributeName,const AttributeValue & value)2334 DIEVariable::AddAttribute_start_scope(uint16 attributeName,
2335 const AttributeValue& value)
2336 {
2337 fStartScope = value.constant;
2338 return B_OK;
2339 }
2340
2341
2342 status_t
AddAttribute_external(uint16 attributeName,const AttributeValue & value)2343 DIEVariable::AddAttribute_external(uint16 attributeName,
2344 const AttributeValue& value)
2345 {
2346 fIsExternal = value.flag;
2347 return B_OK;
2348 }
2349
2350
2351 // #pragma mark - DIEVolatileType
2352
2353
DIEVolatileType()2354 DIEVolatileType::DIEVolatileType()
2355 {
2356 }
2357
2358
2359 uint16
Tag() const2360 DIEVolatileType::Tag() const
2361 {
2362 return DW_TAG_volatile_type;
2363 }
2364
2365
2366 status_t
AddAttribute_decl_file(uint16 attributeName,const AttributeValue & value)2367 DIEVolatileType::AddAttribute_decl_file(uint16 attributeName,
2368 const AttributeValue& value)
2369 {
2370 fDeclarationLocation.SetFile(value.constant);
2371 return B_OK;
2372 }
2373
2374
2375 status_t
AddAttribute_decl_line(uint16 attributeName,const AttributeValue & value)2376 DIEVolatileType::AddAttribute_decl_line(uint16 attributeName,
2377 const AttributeValue& value)
2378 {
2379 fDeclarationLocation.SetLine(value.constant);
2380 return B_OK;
2381 }
2382
2383
2384 status_t
AddAttribute_decl_column(uint16 attributeName,const AttributeValue & value)2385 DIEVolatileType::AddAttribute_decl_column(uint16 attributeName,
2386 const AttributeValue& value)
2387 {
2388 fDeclarationLocation.SetColumn(value.constant);
2389 return B_OK;
2390 }
2391
2392
2393 // #pragma mark - DIEDwarfProcedure
2394
2395
DIEDwarfProcedure()2396 DIEDwarfProcedure::DIEDwarfProcedure()
2397 {
2398 }
2399
2400
2401 uint16
Tag() const2402 DIEDwarfProcedure::Tag() const
2403 {
2404 return DW_TAG_dwarf_procedure;
2405 }
2406
2407
2408 LocationDescription*
GetLocationDescription()2409 DIEDwarfProcedure::GetLocationDescription()
2410 {
2411 return &fLocationDescription;
2412 }
2413
2414
2415 // #pragma mark - DIERestrictType
2416
2417
DIERestrictType()2418 DIERestrictType::DIERestrictType()
2419 {
2420 }
2421
2422
2423 uint16
Tag() const2424 DIERestrictType::Tag() const
2425 {
2426 return DW_TAG_restrict_type;
2427 }
2428
2429
2430 // #pragma mark - DIEInterfaceType
2431
2432
DIEInterfaceType()2433 DIEInterfaceType::DIEInterfaceType()
2434 {
2435 }
2436
2437
2438 uint16
Tag() const2439 DIEInterfaceType::Tag() const
2440 {
2441 return DW_TAG_interface_type;
2442 }
2443
2444
2445 // #pragma mark - DIEImportedModule
2446
2447
DIEImportedModule()2448 DIEImportedModule::DIEImportedModule()
2449 {
2450 }
2451
2452
2453 uint16
Tag() const2454 DIEImportedModule::Tag() const
2455 {
2456 return DW_TAG_imported_module;
2457 }
2458
2459
2460 // #pragma mark - DIEUnspecifiedType
2461
2462
DIEUnspecifiedType()2463 DIEUnspecifiedType::DIEUnspecifiedType()
2464 {
2465 }
2466
2467
2468 uint16
Tag() const2469 DIEUnspecifiedType::Tag() const
2470 {
2471 return DW_TAG_unspecified_type;
2472 }
2473
2474
2475 status_t
AddAttribute_decl_file(uint16 attributeName,const AttributeValue & value)2476 DIEUnspecifiedType::AddAttribute_decl_file(uint16 attributeName,
2477 const AttributeValue& value)
2478 {
2479 fDeclarationLocation.SetFile(value.constant);
2480 return B_OK;
2481 }
2482
2483
2484 status_t
AddAttribute_decl_line(uint16 attributeName,const AttributeValue & value)2485 DIEUnspecifiedType::AddAttribute_decl_line(uint16 attributeName,
2486 const AttributeValue& value)
2487 {
2488 fDeclarationLocation.SetLine(value.constant);
2489 return B_OK;
2490 }
2491
2492
2493 status_t
AddAttribute_decl_column(uint16 attributeName,const AttributeValue & value)2494 DIEUnspecifiedType::AddAttribute_decl_column(uint16 attributeName,
2495 const AttributeValue& value)
2496 {
2497 fDeclarationLocation.SetColumn(value.constant);
2498 return B_OK;
2499 }
2500
2501
2502 // #pragma mark - DIEPartialUnit
2503
2504
DIEPartialUnit()2505 DIEPartialUnit::DIEPartialUnit()
2506 {
2507 }
2508
2509
2510 uint16
Tag() const2511 DIEPartialUnit::Tag() const
2512 {
2513 return DW_TAG_partial_unit;
2514 }
2515
2516
2517 // #pragma mark - DIEImportedUnit
2518
2519
DIEImportedUnit()2520 DIEImportedUnit::DIEImportedUnit()
2521 {
2522 }
2523
2524
2525 uint16
Tag() const2526 DIEImportedUnit::Tag() const
2527 {
2528 return DW_TAG_imported_unit;
2529 }
2530
2531
2532 // #pragma mark - DIECondition
2533
2534
DIECondition()2535 DIECondition::DIECondition()
2536 {
2537 }
2538
2539
2540 uint16
Tag() const2541 DIECondition::Tag() const
2542 {
2543 return DW_TAG_condition;
2544 }
2545
2546
2547 // #pragma mark - DIESharedType
2548
2549
DIESharedType()2550 DIESharedType::DIESharedType()
2551 {
2552 fBlockSize.SetTo(~(uint64)0);
2553 }
2554
2555
2556 uint16
Tag() const2557 DIESharedType::Tag() const
2558 {
2559 return DW_TAG_shared_type;
2560 }
2561
2562
2563 status_t
AddAttribute_count(uint16 attributeName,const AttributeValue & value)2564 DIESharedType::AddAttribute_count(uint16 attributeName,
2565 const AttributeValue& value)
2566 {
2567 return SetDynamicAttributeValue(fBlockSize, value);
2568 }
2569
2570
2571 status_t
AddAttribute_decl_file(uint16 attributeName,const AttributeValue & value)2572 DIESharedType::AddAttribute_decl_file(uint16 attributeName,
2573 const AttributeValue& value)
2574 {
2575 fDeclarationLocation.SetFile(value.constant);
2576 return B_OK;
2577 }
2578
2579
2580 status_t
AddAttribute_decl_line(uint16 attributeName,const AttributeValue & value)2581 DIESharedType::AddAttribute_decl_line(uint16 attributeName,
2582 const AttributeValue& value)
2583 {
2584 fDeclarationLocation.SetLine(value.constant);
2585 return B_OK;
2586 }
2587
2588
2589 status_t
AddAttribute_decl_column(uint16 attributeName,const AttributeValue & value)2590 DIESharedType::AddAttribute_decl_column(uint16 attributeName,
2591 const AttributeValue& value)
2592 {
2593 fDeclarationLocation.SetColumn(value.constant);
2594 return B_OK;
2595 }
2596
2597
2598 // #pragma mark - DIETypeUnit
2599
2600
DIETypeUnit()2601 DIETypeUnit::DIETypeUnit()
2602 {
2603 }
2604
2605
2606 uint16
Tag() const2607 DIETypeUnit::Tag() const
2608 {
2609 return DW_TAG_type_unit;
2610 }
2611
2612
2613 // #pragma mark - DIERValueReferenceType
2614
2615
DIERValueReferenceType()2616 DIERValueReferenceType::DIERValueReferenceType()
2617 {
2618 }
2619
2620
2621 uint16
Tag() const2622 DIERValueReferenceType::Tag() const
2623 {
2624 return DW_TAG_rvalue_reference_type;
2625 }
2626
2627
2628 // #pragma mark - DIETemplateTemplateParameter
2629
2630
DIETemplateTemplateParameter()2631 DIETemplateTemplateParameter::DIETemplateTemplateParameter()
2632 :
2633 fName(NULL)
2634 {
2635 }
2636
2637
2638 uint16
Tag() const2639 DIETemplateTemplateParameter::Tag() const
2640 {
2641 return DW_TAG_GNU_template_template_param;
2642 }
2643
2644
2645 const char*
Name() const2646 DIETemplateTemplateParameter::Name() const
2647 {
2648 return fName;
2649 }
2650
2651
2652 status_t
AddAttribute_name(uint16 attributeName,const AttributeValue & value)2653 DIETemplateTemplateParameter::AddAttribute_name(uint16 attributeName,
2654 const AttributeValue& value)
2655 {
2656 fName = value.string;
2657 return B_OK;
2658 }
2659
2660
2661 // #pragma mark - DIETemplateTypeParameterPack
2662
2663
DIETemplateTypeParameterPack()2664 DIETemplateTypeParameterPack::DIETemplateTypeParameterPack()
2665 :
2666 fName(NULL)
2667 {
2668 }
2669
2670
2671 uint16
Tag() const2672 DIETemplateTypeParameterPack::Tag() const
2673 {
2674 return DW_TAG_GNU_template_parameter_pack;
2675 }
2676
2677
2678 const char*
Name() const2679 DIETemplateTypeParameterPack::Name() const
2680 {
2681 return fName;
2682 }
2683
2684
2685 status_t
AddAttribute_name(uint16 attributeName,const AttributeValue & value)2686 DIETemplateTypeParameterPack::AddAttribute_name(uint16 attributeName,
2687 const AttributeValue& value)
2688 {
2689 fName = value.string;
2690 return B_OK;
2691 }
2692
2693
2694 status_t
AddChild(DebugInfoEntry * child)2695 DIETemplateTypeParameterPack::AddChild(DebugInfoEntry* child)
2696 {
2697 if (child->Tag() == DW_TAG_template_type_parameter) {
2698 fChildren.Add(child);
2699 return B_OK;
2700 }
2701
2702 return DIEDeclaredBase::AddChild(child);
2703 }
2704
2705
2706 // #pragma mark - DIETemplateValueParameterPack
2707
2708
DIETemplateValueParameterPack()2709 DIETemplateValueParameterPack::DIETemplateValueParameterPack()
2710 :
2711 fName(NULL)
2712 {
2713 }
2714
2715
2716 uint16
Tag() const2717 DIETemplateValueParameterPack::Tag() const
2718 {
2719 return DW_TAG_GNU_formal_parameter_pack;
2720 }
2721
2722
2723 const char*
Name() const2724 DIETemplateValueParameterPack::Name() const
2725 {
2726 return fName;
2727 }
2728
2729
2730 status_t
AddAttribute_name(uint16 attributeName,const AttributeValue & value)2731 DIETemplateValueParameterPack::AddAttribute_name(uint16 attributeName,
2732 const AttributeValue& value)
2733 {
2734 fName = value.string;
2735 return B_OK;
2736 }
2737
2738
2739 status_t
AddChild(DebugInfoEntry * child)2740 DIETemplateValueParameterPack::AddChild(DebugInfoEntry* child)
2741 {
2742 if (child->Tag() == DW_TAG_formal_parameter) {
2743 fChildren.Add(child);
2744 return B_OK;
2745 }
2746
2747 return DIEDeclaredBase::AddChild(child);
2748 }
2749
2750
2751 // #pragma mark - DIECallSite
2752
2753
DIECallSite()2754 DIECallSite::DIECallSite()
2755 :
2756 fName(NULL)
2757 {
2758 }
2759
2760
2761 uint16
Tag() const2762 DIECallSite::Tag() const
2763 {
2764 return DW_TAG_GNU_call_site;
2765 }
2766
2767
2768 const char*
Name() const2769 DIECallSite::Name() const
2770 {
2771 return fName;
2772 }
2773
2774
2775 status_t
AddAttribute_name(uint16 attributeName,const AttributeValue & value)2776 DIECallSite::AddAttribute_name(uint16 attributeName,
2777 const AttributeValue& value)
2778 {
2779 fName = value.string;
2780 return B_OK;
2781 }
2782
2783
2784 status_t
AddChild(DebugInfoEntry * child)2785 DIECallSite::AddChild(DebugInfoEntry* child)
2786 {
2787 if (child->Tag() == DW_TAG_GNU_call_site_parameter
2788 || child->Tag() == DW_TAG_call_site_parameter) {
2789 fChildren.Add(child);
2790 return B_OK;
2791 }
2792
2793 return DIEDeclaredBase::AddChild(child);
2794 }
2795
2796
2797 // #pragma mark - DIECallSiteParameter
2798
2799
DIECallSiteParameter()2800 DIECallSiteParameter::DIECallSiteParameter()
2801 :
2802 fName(NULL)
2803 {
2804 }
2805
2806
2807 uint16
Tag() const2808 DIECallSiteParameter::Tag() const
2809 {
2810 return DW_TAG_GNU_call_site_parameter;
2811 }
2812
2813
2814 const char*
Name() const2815 DIECallSiteParameter::Name() const
2816 {
2817 return fName;
2818 }
2819
2820
2821 status_t
AddAttribute_name(uint16 attributeName,const AttributeValue & value)2822 DIECallSiteParameter::AddAttribute_name(uint16 attributeName,
2823 const AttributeValue& value)
2824 {
2825 fName = value.string;
2826 return B_OK;
2827 }
2828
2829
2830 status_t
AddChild(DebugInfoEntry * child)2831 DIECallSiteParameter::AddChild(DebugInfoEntry* child)
2832 {
2833 return DIEDeclaredBase::AddChild(child);
2834 }
2835
2836
2837 // #pragma mark - DebugInfoEntryFactory
2838
2839
DebugInfoEntryFactory()2840 DebugInfoEntryFactory::DebugInfoEntryFactory()
2841 {
2842 }
2843
2844
2845 status_t
CreateDebugInfoEntry(uint16 tag,DebugInfoEntry * & _entry)2846 DebugInfoEntryFactory::CreateDebugInfoEntry(uint16 tag, DebugInfoEntry*& _entry)
2847 {
2848 DebugInfoEntry* entry = NULL;
2849
2850 switch (tag) {
2851 case DW_TAG_array_type:
2852 entry = new(std::nothrow) DIEArrayType;
2853 break;
2854 case DW_TAG_class_type:
2855 entry = new(std::nothrow) DIEClassType;
2856 break;
2857 case DW_TAG_entry_point:
2858 entry = new(std::nothrow) DIEEntryPoint;
2859 break;
2860 case DW_TAG_enumeration_type:
2861 entry = new(std::nothrow) DIEEnumerationType;
2862 break;
2863 case DW_TAG_formal_parameter:
2864 entry = new(std::nothrow) DIEFormalParameter;
2865 break;
2866 case DW_TAG_imported_declaration:
2867 entry = new(std::nothrow) DIEImportedDeclaration;
2868 break;
2869 case DW_TAG_label:
2870 entry = new(std::nothrow) DIELabel;
2871 break;
2872 case DW_TAG_lexical_block:
2873 entry = new(std::nothrow) DIELexicalBlock;
2874 break;
2875 case DW_TAG_member:
2876 entry = new(std::nothrow) DIEMember;
2877 break;
2878 case DW_TAG_pointer_type:
2879 entry = new(std::nothrow) DIEPointerType;
2880 break;
2881 case DW_TAG_reference_type:
2882 entry = new(std::nothrow) DIEReferenceType;
2883 break;
2884 case DW_TAG_compile_unit:
2885 entry = new(std::nothrow) DIECompileUnit;
2886 break;
2887 case DW_TAG_string_type:
2888 entry = new(std::nothrow) DIEStringType;
2889 break;
2890 case DW_TAG_structure_type:
2891 entry = new(std::nothrow) DIEStructureType;
2892 break;
2893 case DW_TAG_subroutine_type:
2894 entry = new(std::nothrow) DIESubroutineType;
2895 break;
2896 case DW_TAG_typedef:
2897 entry = new(std::nothrow) DIETypedef;
2898 break;
2899 case DW_TAG_union_type:
2900 entry = new(std::nothrow) DIEUnionType;
2901 break;
2902 case DW_TAG_unspecified_parameters:
2903 entry = new(std::nothrow) DIEUnspecifiedParameters;
2904 break;
2905 case DW_TAG_variant:
2906 entry = new(std::nothrow) DIEVariant;
2907 break;
2908 case DW_TAG_common_block:
2909 entry = new(std::nothrow) DIECommonBlock;
2910 break;
2911 case DW_TAG_common_inclusion:
2912 entry = new(std::nothrow) DIECommonInclusion;
2913 break;
2914 case DW_TAG_inheritance:
2915 entry = new(std::nothrow) DIEInheritance;
2916 break;
2917 case DW_TAG_inlined_subroutine:
2918 entry = new(std::nothrow) DIEInlinedSubroutine;
2919 break;
2920 case DW_TAG_module:
2921 entry = new(std::nothrow) DIEModule;
2922 break;
2923 case DW_TAG_ptr_to_member_type:
2924 entry = new(std::nothrow) DIEPointerToMemberType;
2925 break;
2926 case DW_TAG_set_type:
2927 entry = new(std::nothrow) DIESetType;
2928 break;
2929 case DW_TAG_subrange_type:
2930 entry = new(std::nothrow) DIESubrangeType;
2931 break;
2932 case DW_TAG_with_stmt:
2933 entry = new(std::nothrow) DIEWithStatement;
2934 break;
2935 case DW_TAG_access_declaration:
2936 entry = new(std::nothrow) DIEAccessDeclaration;
2937 break;
2938 case DW_TAG_base_type:
2939 entry = new(std::nothrow) DIEBaseType;
2940 break;
2941 case DW_TAG_catch_block:
2942 entry = new(std::nothrow) DIECatchBlock;
2943 break;
2944 case DW_TAG_const_type:
2945 entry = new(std::nothrow) DIEConstType;
2946 break;
2947 case DW_TAG_constant:
2948 entry = new(std::nothrow) DIEConstant;
2949 break;
2950 case DW_TAG_enumerator:
2951 entry = new(std::nothrow) DIEEnumerator;
2952 break;
2953 case DW_TAG_file_type:
2954 entry = new(std::nothrow) DIEFileType;
2955 break;
2956 case DW_TAG_friend:
2957 entry = new(std::nothrow) DIEFriend;
2958 break;
2959 case DW_TAG_namelist:
2960 entry = new(std::nothrow) DIENameList;
2961 break;
2962 case DW_TAG_namelist_item:
2963 entry = new(std::nothrow) DIENameListItem;
2964 break;
2965 case DW_TAG_packed_type:
2966 entry = new(std::nothrow) DIEPackedType;
2967 break;
2968 case DW_TAG_subprogram:
2969 entry = new(std::nothrow) DIESubprogram;
2970 break;
2971 case DW_TAG_template_type_parameter:
2972 entry = new(std::nothrow) DIETemplateTypeParameter;
2973 break;
2974 case DW_TAG_template_value_parameter:
2975 entry = new(std::nothrow) DIETemplateValueParameter;
2976 break;
2977 case DW_TAG_thrown_type:
2978 entry = new(std::nothrow) DIEThrownType;
2979 break;
2980 case DW_TAG_try_block:
2981 entry = new(std::nothrow) DIETryBlock;
2982 break;
2983 case DW_TAG_variant_part:
2984 entry = new(std::nothrow) DIEVariantPart;
2985 break;
2986 case DW_TAG_variable:
2987 entry = new(std::nothrow) DIEVariable;
2988 break;
2989 case DW_TAG_volatile_type:
2990 entry = new(std::nothrow) DIEVolatileType;
2991 break;
2992 case DW_TAG_dwarf_procedure:
2993 entry = new(std::nothrow) DIEDwarfProcedure;
2994 break;
2995 case DW_TAG_restrict_type:
2996 entry = new(std::nothrow) DIERestrictType;
2997 break;
2998 case DW_TAG_interface_type:
2999 entry = new(std::nothrow) DIEInterfaceType;
3000 break;
3001 case DW_TAG_namespace:
3002 entry = new(std::nothrow) DIENamespace;
3003 break;
3004 case DW_TAG_imported_module:
3005 entry = new(std::nothrow) DIEImportedModule;
3006 break;
3007 case DW_TAG_unspecified_type:
3008 entry = new(std::nothrow) DIEUnspecifiedType;
3009 break;
3010 case DW_TAG_partial_unit:
3011 entry = new(std::nothrow) DIEPartialUnit;
3012 break;
3013 case DW_TAG_imported_unit:
3014 entry = new(std::nothrow) DIEImportedUnit;
3015 break;
3016 case DW_TAG_condition:
3017 entry = new(std::nothrow) DIECondition;
3018 break;
3019 case DW_TAG_shared_type:
3020 entry = new(std::nothrow) DIESharedType;
3021 break;
3022 case DW_TAG_type_unit:
3023 entry = new(std::nothrow) DIETypeUnit;
3024 break;
3025 case DW_TAG_rvalue_reference_type:
3026 entry = new(std::nothrow) DIERValueReferenceType;
3027 break;
3028 case DW_TAG_GNU_template_template_param:
3029 entry = new(std::nothrow) DIETemplateTemplateParameter;
3030 break;
3031 case DW_TAG_GNU_template_parameter_pack:
3032 entry = new(std::nothrow) DIETemplateTypeParameterPack;
3033 break;
3034 case DW_TAG_GNU_formal_parameter_pack:
3035 entry = new(std::nothrow) DIETemplateValueParameterPack;
3036 break;
3037 case DW_TAG_call_site:
3038 case DW_TAG_GNU_call_site:
3039 entry = new(std::nothrow) DIECallSite;
3040 break;
3041 case DW_TAG_call_site_parameter:
3042 case DW_TAG_GNU_call_site_parameter:
3043 entry = new(std::nothrow) DIECallSiteParameter;
3044 break;
3045 default:
3046 return B_ENTRY_NOT_FOUND;
3047 break;
3048 }
3049
3050 _entry = entry;
3051 return B_OK;
3052 }
3053