Debugger: Add dedicated functions for global {un}init.
[haiku.git] / src / apps / debugger / debug_managers / TeamMemoryBlockManager.h
blob2405454f688fc44022a0548665a717b16ea11fc4
1 /*
2 * Copyright 2011, Rene Gollent, rene@gollent.com.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef TEAM_MEMORY_BLOCK_MANAGER_H
6 #define TEAM_MEMORY_BLOCK_MANAGER_H
9 #include <Locker.h>
10 #include <Referenceable.h>
11 #include <util/DoublyLinkedList.h>
12 #include <util/OpenHashTable.h>
14 #include "Types.h"
17 struct MemoryBlockHashDefinition;
18 class TeamMemoryBlock;
21 class TeamMemoryBlockManager
23 public:
24 TeamMemoryBlockManager();
25 ~TeamMemoryBlockManager();
27 status_t Init();
29 TeamMemoryBlock* GetMemoryBlock(target_addr_t address);
31 private:
32 struct Key;
33 struct MemoryBlockEntry;
34 struct MemoryBlockHashDefinition;
35 typedef BOpenHashTable<MemoryBlockHashDefinition> MemoryBlockTable;
36 typedef DoublyLinkedList<TeamMemoryBlock> DeadBlockTable;
38 private:
39 void _Cleanup();
40 void _MarkDeadBlock(target_addr_t address);
41 void _RemoveBlock(target_addr_t address);
43 private:
44 friend class TeamMemoryBlockOwner;
46 private:
47 BLocker fLock;
48 MemoryBlockTable* fActiveBlocks;
49 DeadBlockTable* fDeadBlocks;
53 class TeamMemoryBlockOwner
55 public:
56 TeamMemoryBlockOwner(
57 TeamMemoryBlockManager* manager);
58 ~TeamMemoryBlockOwner();
60 void RemoveBlock(TeamMemoryBlock* block);
62 private:
63 TeamMemoryBlockManager* fBlockManager;
67 #endif // TEAM_MEMORY_BLOCK_MANAGER_H