vfs: check userland buffers before reading them.
[haiku.git] / src / kits / debugger / dwarf / CompilationUnit.h
blobdd8c837a71235134f825b2133142cd2271f47e2c
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
9 #include <ObjectList.h>
10 #include <String.h>
12 #include "BaseUnit.h"
13 #include "LineNumberProgram.h"
14 #include "Types.h"
17 class DIECompileUnitBase;
18 class TargetAddressRangeList;
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();
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;
56 private:
57 struct File;
58 typedef BObjectList<BString> DirectoryList;
59 typedef BObjectList<File> FileList;
61 private:
62 DIECompileUnitBase* fUnitEntry;
63 TargetAddressRangeList* fAddressRanges;
64 DirectoryList fDirectories;
65 FileList fFiles;
66 LineNumberProgram fLineNumberProgram;
70 target_addr_t
71 CompilationUnit::MaxAddress() const
73 return AddressSize() == 4 ? 0xffffffffULL : 0xffffffffffffffffULL;
77 #endif // COMPILATION_UNIT_H