vfs: check userland buffers before reading them.
[haiku.git] / headers / private / debugger / model / StackFrameValueInfos.h
blob3336078eff9e4526600a9857b6b8bd7f520b6045
1 /*
2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef STACK_FRAME_VALUE_INFOS_H
6 #define STACK_FRAME_VALUE_INFOS_H
9 #include <Referenceable.h>
10 #include <util/OpenHashTable.h>
11 #include <Variant.h>
14 class ObjectID;
15 class Type;
16 class TypeComponentPath;
17 class ValueLocation;
20 class StackFrameValueInfos : public BReferenceable {
21 public:
22 StackFrameValueInfos();
23 virtual ~StackFrameValueInfos();
25 status_t Init();
27 bool GetInfo(ObjectID* variable,
28 const TypeComponentPath* path,
29 Type** _type, ValueLocation** _location)
30 const;
31 // returns references
32 inline bool GetInfo(ObjectID* variable,
33 const TypeComponentPath& path,
34 Type** _type, ValueLocation** _location)
35 const;
36 // returns references
37 bool HasInfo(ObjectID* variable,
38 const TypeComponentPath* path) const;
39 inline bool HasInfo(ObjectID* variable,
40 const TypeComponentPath& path) const;
41 status_t SetInfo(ObjectID* variable,
42 TypeComponentPath* path, Type* type,
43 ValueLocation* location);
45 private:
46 struct Key;
47 struct InfoEntry;
48 struct InfoEntryHashDefinition;
50 typedef BOpenHashTable<InfoEntryHashDefinition> ValueTable;
52 private:
53 StackFrameValueInfos& operator=(const StackFrameValueInfos& other);
55 void _Cleanup();
57 private:
58 ValueTable* fValues;
62 bool
63 StackFrameValueInfos::GetInfo(ObjectID* variable, const TypeComponentPath& path,
64 Type** _type, ValueLocation** _location) const
66 return GetInfo(variable, &path, _type, _location);
70 bool
71 StackFrameValueInfos::HasInfo(ObjectID* variable, const TypeComponentPath& path)
72 const
74 return HasInfo(variable, &path);
78 #endif // STACK_FRAME_VALUE_INFOS_H