VirtualBox

source: vbox/trunk/src/VBox/Debugger/VBoxDbg.cpp@ 4337

Last change on this file since 4337 was 4071, checked in by vboxsync, 17 years ago

Biggest check-in ever. New source code headers for all (C) innotek files.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/** @file
2 *
3 * VBox Debugger GUI.
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#define VBOX_COM_NO_ATL
20#include <VBox/dbggui.h>
21#include <VBox/vm.h>
22#include <VBox/err.h>
23#include <iprt/assert.h>
24#include <iprt/alloc.h>
25
26#include "VBoxDbgGui.h"
27
28
29/**
30 * Debugger GUI instance data.
31 */
32typedef struct DBGGUI
33{
34 /** Magic number (DBGGUI_MAGIC). */
35 uint32_t u32Magic;
36 /** Pointer to the Debugger GUI manager object. */
37 VBoxDbgGui *pVBoxDbgGui;
38} DBGGUI;
39
40/** DBGGUI magic value (Elizabeth Kostova). */
41#define DBGGUI_MAGIC 0x19640804
42
43
44/**
45 * Creates the debugger GUI.
46 *
47 * @returns VBox status code.
48 * @param pSession The Virtual Box session.
49 * @param ppGui Where to store the pointer to the debugger instance.
50 */
51DBGDECL(int) DBGGuiCreate(ISession *pSession, PDBGGUI *ppGui)
52{
53 PDBGGUI pGui = (PDBGGUI)RTMemAlloc(sizeof(*pGui));
54 if (!pGui)
55 return VERR_NO_MEMORY;
56 pGui->u32Magic = DBGGUI_MAGIC;
57 pGui->pVBoxDbgGui = new VBoxDbgGui();
58
59 int rc = pGui->pVBoxDbgGui->init(pSession);
60 if (VBOX_SUCCESS(rc))
61 {
62 *ppGui = pGui;
63 return rc;
64 }
65
66 delete pGui->pVBoxDbgGui;
67 RTMemFree(pGui);
68 *ppGui = NULL;
69 return rc;
70}
71
72
73/**
74 * Destroys the debugger GUI.
75 *
76 * @returns VBox status code.
77 * @param pGui The instance returned by DBGGuiCreate().
78 */
79DBGDECL(int) DBGGuiDestroy(PDBGGUI pGui)
80{
81 /*
82 * Validate.
83 */
84 if (!pGui)
85 return VERR_INVALID_PARAMETER;
86 AssertMsgReturn(pGui->u32Magic == DBGGUI_MAGIC, ("u32Magic=%#x\n", pGui->u32Magic), VERR_INVALID_PARAMETER);
87
88 /*
89 * Do the job.
90 */
91 pGui->u32Magic++;
92 delete pGui->pVBoxDbgGui;
93 RTMemFree(pGui);
94
95 return VINF_SUCCESS;
96}
97
98
99/**
100 * Notifies the debugger GUI that the console window (or whatever) has changed
101 * size or position.
102 *
103 * @param pGui The instance returned by DBGGuiCreate().
104 * @param x The x-coordinate of the window the debugger is relative to.
105 * @param y The y-coordinate of the window the debugger is relative to.
106 * @param cx The width of the window the debugger is relative to.
107 * @param cy The height of the window the debugger is relative to.
108 */
109DBGDECL(void) DBGGuiAdjustRelativePos(PDBGGUI pGui, int x, int y, unsigned cx, unsigned cy)
110{
111 AssertReturn(pGui, (void)VERR_INVALID_PARAMETER);
112 AssertMsgReturn(pGui->u32Magic == DBGGUI_MAGIC, ("u32Magic=%#x\n", pGui->u32Magic), (void)VERR_INVALID_PARAMETER);
113 pGui->pVBoxDbgGui->adjustRelativePos(x, y, cx, cy);
114}
115
116
117/**
118 * Shows the default statistics window.
119 *
120 * @returns VBox status code.
121 * @param pGui The instance returned by DBGGuiCreate().
122 */
123DBGDECL(int) DBGGuiShowStatistics(PDBGGUI pGui)
124{
125 AssertReturn(pGui, VERR_INVALID_PARAMETER);
126 AssertMsgReturn(pGui->u32Magic == DBGGUI_MAGIC, ("u32Magic=%#x\n", pGui->u32Magic), VERR_INVALID_PARAMETER);
127 return pGui->pVBoxDbgGui->showStatistics();
128}
129
130
131/**
132 * Shows the default command line window.
133 *
134 * @returns VBox status code.
135 * @param pGui The instance returned by DBGGuiCreate().
136 */
137DBGDECL(int) DBGGuiShowCommandLine(PDBGGUI pGui)
138{
139 AssertReturn(pGui, VERR_INVALID_PARAMETER);
140 AssertMsgReturn(pGui->u32Magic == DBGGUI_MAGIC, ("u32Magic=%#x\n", pGui->u32Magic), VERR_INVALID_PARAMETER);
141 return pGui->pVBoxDbgGui->showConsole();
142}
143
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