VirtualBox

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

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

Debugger GUI: Having a go at the statistics view and hitting a extremely inefficient tree view. So, later.

  • 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 12183 2008-09-07 02:35:53Z 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 __VBoxDbgBase_h__
24#define __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
61protected:
62 /**
63 * Checks if the VM is OK for normal operations.
64 * @returns true if ok, false if not.
65 */
66 bool isVMOk() const
67 {
68 return m_pVM != NULL;
69 }
70
71 /**
72 * Checks if the current thread is the GUI thread or not.
73 * @return true/false accordingly.
74 */
75 bool isGUIThread() const
76 {
77 return m_hGUIThread == RTThreadNativeSelf();
78 }
79
80 /** @name Operations
81 * @{ */
82 /**
83 * Wrapper for STAMR3Reset().
84 */
85 int stamReset(const QString &rPat);
86 /**
87 * Wrapper for STAMR3Enum().
88 */
89 int stamEnum(const QString &rPat, PFNSTAMR3ENUM pfnEnum, void *pvUser);
90 /**
91 * Wrapper for DBGCCreate().
92 */
93 int dbgcCreate(PDBGCBACK pBack, unsigned fFlags);
94 /** @} */
95
96
97protected:
98 /** @name Signals
99 * @{ */
100 /**
101 * Called when the VM has been terminated.
102 */
103 virtual void sigTerminated();
104 /** @} */
105
106
107private:
108 /**
109 * VM state callback function.
110 *
111 * You are not allowed to call any function which changes the VM state from a
112 * state callback, except VMR3Destroy().
113 *
114 * @param pVM The VM handle.
115 * @param enmState The new state.
116 * @param enmOldState The old state.
117 * @param pvUser The user argument.
118 */
119 static DECLCALLBACK(void) atStateChange(PVM pVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
120
121private:
122 /** The VM handle. */
123 PVM m_pVM;
124 /** The handle of the GUI thread. */
125 RTNATIVETHREAD m_hGUIThread;
126};
127
128
129#endif
130
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