headers/bsd: Add sys/queue.h.
[haiku.git] / src / kits / debugger / dwarf / TypeUnit.h
blobee3d594f2b672367b5d105f0adc401856fe6429d
1 /*
2 * Copyright 2013, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef TYPE_UNIT_H
6 #define TYPE_UNIT_H
9 #include <ObjectList.h>
10 #include <String.h>
12 #include "BaseUnit.h"
15 class DIETypeUnit;
18 class TypeUnit : public BaseUnit {
19 public:
20 TypeUnit(off_t headerOffset,
21 off_t contentOffset,
22 off_t totalSize,
23 off_t abbreviationOffset,
24 off_t typeOffset,
25 uint8 addressSize,
26 uint64 typeSignature,
27 bool isDwarf64);
28 ~TypeUnit();
30 uint64 Signature() const { return fSignature; }
32 off_t TypeOffset() const { return fTypeOffset; }
35 DIETypeUnit* UnitEntry() const { return fUnitEntry; }
36 void SetUnitEntry(DIETypeUnit* entry);
38 DebugInfoEntry* TypeEntry() const;
39 void SetTypeEntry(DebugInfoEntry* entry);
41 virtual dwarf_unit_kind Kind() const;
43 private:
44 DIETypeUnit* fUnitEntry;
45 DebugInfoEntry* fTypeEntry;
46 uint64 fSignature;
47 off_t fTypeOffset;
51 struct TypeUnitTableEntry {
52 uint64 signature;
53 TypeUnit* unit;
54 TypeUnitTableEntry* next;
56 TypeUnitTableEntry(uint64 signature, TypeUnit* unit)
58 signature(signature),
59 unit(unit)
65 struct TypeUnitTableHashDefinition {
66 typedef uint64 KeyType;
67 typedef TypeUnitTableEntry ValueType;
69 size_t HashKey(uint64 key) const
71 return (size_t)key;
74 size_t Hash(TypeUnitTableEntry* value) const
76 return HashKey(value->signature);
79 bool Compare(uint64 key, TypeUnitTableEntry* value) const
81 return value->signature == key;
84 TypeUnitTableEntry*& GetLink(TypeUnitTableEntry* value) const
86 return value->next;
91 #endif // TYPE_UNIT_H