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.
6 #ifndef COMPILATION_UNIT_H
7 #define COMPILATION_UNIT_H
9 #include <ObjectList.h>
13 #include "LineNumberProgram.h"
17 class DIECompileUnitBase
;
18 class TargetAddressRangeList
;
21 class CompilationUnit
: public BaseUnit
{
23 CompilationUnit(off_t headerOffset
,
26 off_t abbreviationOffset
,
27 uint8 addressSize
, bool isDwarf64
);
28 virtual ~CompilationUnit();
30 inline target_addr_t
MaxAddress() const;
32 DIECompileUnitBase
* UnitEntry() const { return fUnitEntry
; }
33 void SetUnitEntry(DIECompileUnitBase
* entry
);
35 TargetAddressRangeList
* AddressRanges() const
36 { return fAddressRanges
; }
37 void SetAddressRanges(
38 TargetAddressRangeList
* ranges
);
40 target_addr_t
AddressRangeBase() const;
42 LineNumberProgram
& GetLineNumberProgram()
43 { return fLineNumberProgram
; }
45 bool AddDirectory(const char* directory
);
46 int32
CountDirectories() const;
47 const char* DirectoryAt(int32 index
) const;
49 bool AddFile(const char* fileName
, int32 dirIndex
);
50 int32
CountFiles() const;
51 const char* FileAt(int32 index
,
52 const char** _directory
= NULL
) const;
54 virtual dwarf_unit_kind
Kind() const;
58 typedef BObjectList
<BString
> DirectoryList
;
59 typedef BObjectList
<File
> FileList
;
62 DIECompileUnitBase
* fUnitEntry
;
63 TargetAddressRangeList
* fAddressRanges
;
64 DirectoryList fDirectories
;
66 LineNumberProgram fLineNumberProgram
;
71 CompilationUnit::MaxAddress() const
73 return AddressSize() == 4 ? 0xffffffffULL
: 0xffffffffffffffffULL
;
77 #endif // COMPILATION_UNIT_H