~ubuntu-branches/ubuntu/gutsy/virtualbox-ose/gutsy

« back to all changes in this revision

Viewing changes to src/VBox/Debugger/VBoxDbgBase.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-09-08 16:44:58 UTC
  • Revision ID: james.westby@ubuntu.com-20070908164458-wao29470vqtr8ksy
Tags: upstream-1.5.0-dfsg2
ImportĀ upstreamĀ versionĀ 1.5.0-dfsg2

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
18
 
 
19
/*******************************************************************************
 
20
*   Header Files                                                               *
 
21
*******************************************************************************/
 
22
#include <VBox/err.h>
 
23
#include <iprt/assert.h>
 
24
#include "VBoxDbgBase.h"
 
25
 
 
26
 
 
27
 
 
28
VBoxDbgBase::VBoxDbgBase(PVM pVM) : m_pVM(pVM)
 
29
{
 
30
    /*
 
31
     * Register
 
32
     */
 
33
    int rc = VMR3AtStateRegister(pVM, atStateChange, this);
 
34
    AssertRC(rc);
 
35
}
 
36
 
 
37
VBoxDbgBase::~VBoxDbgBase()
 
38
{
 
39
    /*
 
40
     * If the VM is still around.
 
41
     */
 
42
    if (m_pVM)
 
43
    {
 
44
        int rc = VMR3AtStateDeregister(m_pVM, atStateChange, this);
 
45
        AssertRC(rc);
 
46
        m_pVM = NULL;
 
47
    }
 
48
}
 
49
 
 
50
int VBoxDbgBase::stamReset(const char *pszPat)
 
51
{
 
52
    if (m_pVM)
 
53
        return STAMR3Reset(m_pVM, pszPat);
 
54
    return VERR_INVALID_HANDLE;
 
55
}
 
56
 
 
57
int VBoxDbgBase::stamEnum(const char *pszPat, PFNSTAMR3ENUM pfnEnum, void *pvUser)
 
58
{
 
59
    if (m_pVM)
 
60
        return STAMR3Enum(m_pVM, pszPat, pfnEnum, pvUser);
 
61
    return VERR_INVALID_HANDLE;
 
62
}
 
63
 
 
64
int VBoxDbgBase::dbgcCreate(PDBGCBACK pBack, unsigned fFlags)
 
65
{
 
66
    if (m_pVM)
 
67
        return DBGCCreate(m_pVM, pBack, fFlags);
 
68
    return VERR_INVALID_HANDLE;
 
69
}
 
70
 
 
71
/*static*/ DECLCALLBACK(void) VBoxDbgBase::atStateChange(PVM /*pVM*/, VMSTATE enmState, VMSTATE /*enmOldState*/, void *pvUser)
 
72
{
 
73
    VBoxDbgBase *pThis = (VBoxDbgBase *)pvUser;
 
74
    switch (enmState)
 
75
    {
 
76
        case VMSTATE_TERMINATED:
 
77
            pThis->sigTerminated();
 
78
            pThis->m_pVM = NULL;
 
79
            break;
 
80
 
 
81
        default:
 
82
            break;
 
83
    }
 
84
}
 
85
 
 
86
void VBoxDbgBase::sigTerminated()
 
87
{
 
88
}
 
89