vfs: check userland buffers before reading them.
[haiku.git] / src / apps / debugger / user_interface / gui / inspector_window / InspectorWindow.h
blob0dafddbd7072d5ea6a6974b69ffac2988d780030
1 /*
2 * Copyright 2011-2015, Rene Gollent, rene@gollent.com. All rights reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef INSPECTOR_WINDOW_H
6 #define INSPECTOR_WINDOW_H
9 #include <Window.h>
11 #include "ExpressionInfo.h"
12 #include "MemoryView.h"
13 #include "Team.h"
14 #include "TeamMemoryBlock.h"
15 #include "Types.h"
18 class BButton;
19 class BMenuField;
20 class BMessenger;
21 class BStringView;
22 class BTextControl;
23 class GuiTeamUiSettings;
24 class SourceLanguage;
25 class UserInterfaceListener;
28 class InspectorWindow : public BWindow, private Team::Listener,
29 private TeamMemoryBlock::Listener, private MemoryView::Listener,
30 private ExpressionInfo::Listener {
31 public:
32 InspectorWindow(::Team* team,
33 UserInterfaceListener* listener,
34 BHandler* target);
35 virtual ~InspectorWindow();
37 static InspectorWindow* Create(::Team* team,
38 UserInterfaceListener* listener,
39 BHandler* target);
40 // throws
42 virtual void MessageReceived(BMessage* message);
43 virtual bool QuitRequested();
45 // Team::Listener
46 virtual void ThreadStateChanged(
47 const Team::ThreadEvent& event);
49 virtual void MemoryChanged(
50 const Team::MemoryChangedEvent& event);
52 // TeamMemoryBlock::Listener
53 virtual void MemoryBlockRetrieved(TeamMemoryBlock* block);
54 virtual void MemoryBlockRetrievalFailed(
55 TeamMemoryBlock* block, status_t result);
57 // MemoryView::Listener
58 virtual void TargetAddressChanged(target_addr_t address);
59 virtual void HexModeChanged(int32 newMode);
60 virtual void EndianModeChanged(int32 newMode);
61 virtual void TextModeChanged(int32 newMode);
63 // ExpressionInfo::Listener
64 virtual void ExpressionEvaluated(ExpressionInfo* info,
65 status_t result, ExpressionResult* value);
67 status_t LoadSettings(
68 const GuiTeamUiSettings& settings);
69 status_t SaveSettings(
70 BMessage& settings);
72 private:
73 void _Init();
75 void _LoadMenuFieldMode(BMenuField* field,
76 const char* name,
77 const BMessage& settings);
78 status_t _SaveMenuFieldMode(BMenuField* field,
79 const char* name,
80 BMessage& settings);
82 void _SetToAddress(target_addr_t address);
83 void _SetCurrentBlock(TeamMemoryBlock* block);
85 void _SetEditMode(bool enabled);
87 bool _GetWritableState() const;
89 void _UpdateWritableOptions();
91 void _UpdateWritableIndicator();
92 const char* _GetCurrentWritableIndicator() const;
94 private:
95 UserInterfaceListener* fListener;
96 BTextControl* fAddressInput;
97 BMenuField* fHexMode;
98 BMenuField* fEndianMode;
99 BMenuField* fTextMode;
100 BStringView* fWritableBlockIndicator;
101 MemoryView* fMemoryView;
102 BButton* fPreviousBlockButton;
103 BButton* fNextBlockButton;
104 BButton* fEditBlockButton;
105 BButton* fCommitBlockButton;
106 BButton* fRevertBlockButton;
107 TeamMemoryBlock* fCurrentBlock;
108 target_addr_t fCurrentAddress;
109 ::Team* fTeam;
110 SourceLanguage* fLanguage;
111 ExpressionInfo* fExpressionInfo;
112 BHandler* fTarget;
115 #endif // INSPECTOR_WINDOW_H