VirtualBox

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

Last change on this file since 10596 was 9269, checked in by vboxsync, 17 years ago

Fixed the file headers.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.8 KB
Line 
1/* $Id: VBoxDbgBase.h 9269 2008-05-31 14:53:24Z 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
32
33/**
34 * VBox Debugger GUI Base Class.
35 *
36 * The purpose of this class is to hide the VM handle, abstract VM
37 * operations, and finally to make sure the GUI won't crash when
38 * the VM dies.
39 */
40class VBoxDbgBase
41{
42public:
43 /**
44 * Construct the object.
45 *
46 * @param pVM The VM handle.
47 */
48 VBoxDbgBase(PVM pVM);
49
50 /**
51 * Destructor.
52 */
53 virtual ~VBoxDbgBase();
54
55
56protected:
57 /**
58 * Checks if the VM is OK for normal operations.
59 * @returns true if ok, false if not.
60 */
61 bool isVMOk() const
62 {
63 return m_pVM != NULL;
64 }
65
66 /**
67 * Checks if the current thread is the GUI thread or not.
68 * @return true/false accordingly.
69 */
70 bool isGUIThread() const
71 {
72 return m_hGUIThread == RTThreadNativeSelf();
73 }
74
75 /** @name Operations
76 * @{ */
77 /**
78 * Wrapper for STAMR3Reset().
79 */
80 int stamReset(const char *pszPat);
81 /**
82 * Wrapper for STAMR3Enum().
83 */
84 int stamEnum(const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser);
85 /**
86 * Wrapper for DBGCCreate().
87 */
88 int dbgcCreate(PDBGCBACK pBack, unsigned fFlags);
89 /** @} */
90
91
92protected:
93 /** @name Signals
94 * @{ */
95 /**
96 * Called when the VM has been terminated.
97 */
98 virtual void sigTerminated();
99 /** @} */
100
101
102private:
103 /**
104 * VM state callback function.
105 *
106 * You are not allowed to call any function which changes the VM state from a
107 * state callback, except VMR3Destroy().
108 *
109 * @param pVM The VM handle.
110 * @param enmState The new state.
111 * @param enmOldState The old state.
112 * @param pvUser The user argument.
113 */
114 static DECLCALLBACK(void) atStateChange(PVM pVM, VMSTATE enmState, VMSTATE enmOldState, void *pvUser);
115
116private:
117 /** The VM handle. */
118 PVM m_pVM;
119 /** The handle of the GUI thread. */
120 RTNATIVETHREAD m_hGUIThread;
121};
122
123
124#endif
125
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