VirtualBox

source: vbox/trunk/src/VBox/Debugger/VBoxDbgBase.h@ 12478

Last change on this file since 12478 was 12478, checked in by vboxsync, 16 years ago

Debugger: kind of getting somewhere...

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.9 KB
Line 
1/* $Id: VBoxDbgBase.h 12478 2008-09-16 03:12:57Z vboxsync $ */
2/** @file
3 * VBox Debugger GUI - Base class.
4 */
5
6/*
7 * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
18 * Clara, CA 95054 USA or visit http://www.sun.com if you need
19 * additional information or have any questions.
20 */
21
22
23#ifndef ___Debugger_VBoxDbgBase_h
24#define ___Debugger_VBoxDbgBase_h
25
26
27#include <VBox/stam.h>
28#include <VBox/vmapi.h>
29#include <VBox/dbg.h>
30#include <iprt/thread.h>
31#ifdef VBOXDBG_USE_QT4
32# include <QString>
33#else
34# include <qstring.h>
35#endif
36
37
38/**
39 * VBox Debugger GUI Base Class.
40 *
41 * The purpose of this class is to hide the VM handle, abstract VM
42 * operations, and finally to make sure the GUI won't crash when
43 * the VM dies.
44 */
45class VBoxDbgBase
46{
47public:
48 /**
49 * Construct the object.
50 *
51 * @param pVM The VM handle.
52 */
53 VBoxDbgBase(PVM pVM);
54
55 /**
56 * Destructor.
57 */
58 virtual ~VBoxDbgBase();
59
60
61 /**
62 * Checks if the VM is OK for normal operations.
63 * @returns true if ok, false if not.
64 */
65 bool isVMOk() const
66 {
67 return m_pVM != NULL;
68 }
69
70 /**
71 * Checks if the current thread is the GUI thread or not.
72 * @return true/false accordingly.
73 */
74 bool isGUIThread() const
75 {
76 return m_hGUIThread == RTThreadNativeSelf();
77 }
78
79 /** @name Operations
80 * @{ */
81 /**
82 * Wrapper for STAMR3Reset().
83 */
84 int stamReset(const QString &rPat);
85 /**
86 * Wrapper for STAMR3Enum().
87 */
88 int stamEnum(const QString &rPat, PFNSTAMR3ENUM pfnEnum, void *pvUser);
89 /**
90 * Wrapper for DBGCCreate().
91 */
92 int dbgcCreate(PDBGCBACK pBack, unsigned fFlags);
93 /** @} */
94
95
96protected:
97 /** @name Signals
98 * @{ */
99 /**
100 * Called when the VM has been terminated.
101 */
102 virtual void sigTerminated();
103 /** @} */
104
105
106private:
107 /**
108 * VM state callback function.
109 *
110 * You are not allowed to call any function which changes the VM state from a
111 * state callback, except VMR3Destroy().
112 *
113 * @param pVM The VM handle.
114 * @param enmState The new state.
115 * @param enmOldState The old state.
116 * @param pvUser The user argument.
117 */
118 static DECLCALLBACK(void) atStateChange(PVM pVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
119
120private:
121 /** The VM handle. */
122 PVM m_pVM;
123 /** The handle of the GUI thread. */
124 RTNATIVETHREAD m_hGUIThread;
125};
126
127
128#endif
129
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette