1 | /** @file
|
---|
2 | *
|
---|
3 | * VBox Debugger GUI - Base class.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | *
|
---|
17 | * If you received this file as part of a commercial VirtualBox
|
---|
18 | * distribution, then only the terms of your commercial VirtualBox
|
---|
19 | * license agreement apply instead of the previous paragraph.
|
---|
20 | */
|
---|
21 |
|
---|
22 |
|
---|
23 | #ifndef __VBoxDbgBase_h__
|
---|
24 | #define __VBoxDbgBase_h__
|
---|
25 |
|
---|
26 |
|
---|
27 | #include <VBox/stam.h>
|
---|
28 | #include <VBox/vmapi.h>
|
---|
29 | #include <VBox/dbg.h>
|
---|
30 |
|
---|
31 |
|
---|
32 | /**
|
---|
33 | * VBox Debugger GUI Base Class.
|
---|
34 | *
|
---|
35 | * The purpose of this class is to hide the VM handle, abstract VM
|
---|
36 | * operations, and finally to make sure the GUI won't crash when
|
---|
37 | * the VM dies.
|
---|
38 | */
|
---|
39 | class VBoxDbgBase
|
---|
40 | {
|
---|
41 | public:
|
---|
42 | /**
|
---|
43 | * Construct the object.
|
---|
44 | *
|
---|
45 | * @param pVM The VM handle.
|
---|
46 | */
|
---|
47 | VBoxDbgBase(PVM pVM);
|
---|
48 |
|
---|
49 | /**
|
---|
50 | * Destructor.
|
---|
51 | */
|
---|
52 | virtual ~VBoxDbgBase();
|
---|
53 |
|
---|
54 |
|
---|
55 | protected:
|
---|
56 | /**
|
---|
57 | * Checks if the VM is OK for normal operations.
|
---|
58 | * @returns true if ok, false if not.
|
---|
59 | */
|
---|
60 | bool isVMOk() const
|
---|
61 | {
|
---|
62 | return m_pVM != NULL;
|
---|
63 | }
|
---|
64 |
|
---|
65 | /** @name Operations
|
---|
66 | * @{ */
|
---|
67 | /**
|
---|
68 | * Wrapper for STAMR3Reset().
|
---|
69 | */
|
---|
70 | int stamReset(const char *pszPat);
|
---|
71 | /**
|
---|
72 | * Wrapper for STAMR3Enum().
|
---|
73 | */
|
---|
74 | int stamEnum(const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser);
|
---|
75 | /**
|
---|
76 | * Wrapper for DBGCCreate().
|
---|
77 | */
|
---|
78 | int dbgcCreate(PDBGCBACK pBack, unsigned fFlags);
|
---|
79 | /** @} */
|
---|
80 |
|
---|
81 |
|
---|
82 | protected:
|
---|
83 | /** @name Signals
|
---|
84 | * @{ */
|
---|
85 | /**
|
---|
86 | * Called when the VM has been terminated.
|
---|
87 | */
|
---|
88 | virtual void sigTerminated();
|
---|
89 | /** @} */
|
---|
90 |
|
---|
91 |
|
---|
92 | private:
|
---|
93 | /**
|
---|
94 | * VM state callback function.
|
---|
95 | *
|
---|
96 | * You are not allowed to call any function which changes the VM state from a
|
---|
97 | * state callback, except VMR3Destroy().
|
---|
98 | *
|
---|
99 | * @param pVM The VM handle.
|
---|
100 | * @param enmState The new state.
|
---|
101 | * @param enmOldState The old state.
|
---|
102 | * @param pvUser The user argument.
|
---|
103 | */
|
---|
104 | static DECLCALLBACK(void) atStateChange(PVM pVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
|
---|
105 |
|
---|
106 | private:
|
---|
107 | /** The VM handle. */
|
---|
108 | PVM m_pVM;
|
---|
109 | };
|
---|
110 |
|
---|
111 |
|
---|
112 | #endif
|
---|
113 |
|
---|