1 /* 2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de. 3 * Copyright 2013, Rene Gollent, rene@gollent.com. 4 * Distributed under the terms of the MIT License. 5 */ 6 #ifndef COMPILATION_UNIT_H 7 #define COMPILATION_UNIT_H 8 9 #include <ObjectList.h> 10 #include <String.h> 11 12 #include "BaseUnit.h" 13 #include "LineNumberProgram.h" 14 #include "Types.h" 15 16 17 class DIECompileUnitBase; 18 class TargetAddressRangeList; 19 20 21 class CompilationUnit : public BaseUnit { 22 public: 23 CompilationUnit(off_t headerOffset, 24 off_t contentOffset, 25 off_t totalSize, 26 off_t abbreviationOffset, 27 uint8 addressSize, bool isDwarf64); 28 virtual ~CompilationUnit(); 29 30 inline target_addr_t MaxAddress() const; 31 32 DIECompileUnitBase* UnitEntry() const { return fUnitEntry; } 33 void SetUnitEntry(DIECompileUnitBase* entry); 34 35 TargetAddressRangeList* AddressRanges() const 36 { return fAddressRanges; } 37 void SetAddressRanges( 38 TargetAddressRangeList* ranges); 39 40 target_addr_t AddressRangeBase() const; 41 42 LineNumberProgram& GetLineNumberProgram() 43 { return fLineNumberProgram; } 44 45 bool AddDirectory(const char* directory); 46 int32 CountDirectories() const; 47 const char* DirectoryAt(int32 index) const; 48 49 bool AddFile(const char* fileName, int32 dirIndex); 50 int32 CountFiles() const; 51 const char* FileAt(int32 index, 52 const char** _directory = NULL) const; 53 54 virtual dwarf_unit_kind Kind() const; 55 56 private: 57 struct File; 58 typedef BObjectList<BString> DirectoryList; 59 typedef BObjectList<File> FileList; 60 61 private: 62 DIECompileUnitBase* fUnitEntry; 63 TargetAddressRangeList* fAddressRanges; 64 DirectoryList fDirectories; 65 FileList fFiles; 66 LineNumberProgram fLineNumberProgram; 67 }; 68 69 70 target_addr_t 71 CompilationUnit::MaxAddress() const 72 { 73 return AddressSize() == 4 ? 0xffffffffULL : 0xffffffffffffffffULL; 74 } 75 76 77 #endif // COMPILATION_UNIT_H 78