1 | /* $Id: DBGFR0.cpp 106061 2024-09-16 14:03:52Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DBGF - Debugger Facility, R0 part.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2020-2024 Oracle and/or its affiliates.
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox base platform packages, as
|
---|
10 | * available from https://www.virtualbox.org.
|
---|
11 | *
|
---|
12 | * This program is free software; you can redistribute it and/or
|
---|
13 | * modify it under the terms of the GNU General Public License
|
---|
14 | * as published by the Free Software Foundation, in version 3 of the
|
---|
15 | * License.
|
---|
16 | *
|
---|
17 | * This program is distributed in the hope that it will be useful, but
|
---|
18 | * WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
19 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
---|
20 | * General Public License for more details.
|
---|
21 | *
|
---|
22 | * You should have received a copy of the GNU General Public License
|
---|
23 | * along with this program; if not, see <https://www.gnu.org/licenses>.
|
---|
24 | *
|
---|
25 | * SPDX-License-Identifier: GPL-3.0-only
|
---|
26 | */
|
---|
27 |
|
---|
28 |
|
---|
29 | /*********************************************************************************************************************************
|
---|
30 | * Header Files *
|
---|
31 | *********************************************************************************************************************************/
|
---|
32 | #define LOG_GROUP LOG_GROUP_DBGF
|
---|
33 | #include "DBGFInternal.h"
|
---|
34 | #include <VBox/vmm/gvm.h>
|
---|
35 | #include <VBox/vmm/gvmm.h>
|
---|
36 | #include <VBox/vmm/vmm.h>
|
---|
37 |
|
---|
38 | #include <VBox/log.h>
|
---|
39 | #include <VBox/sup.h>
|
---|
40 | #include <iprt/asm.h>
|
---|
41 | #include <iprt/assert.h>
|
---|
42 | #include <iprt/errcore.h>
|
---|
43 | #include <iprt/ctype.h>
|
---|
44 | #include <iprt/mem.h>
|
---|
45 | #include <iprt/memobj.h>
|
---|
46 | #include <iprt/process.h>
|
---|
47 | #include <iprt/string.h>
|
---|
48 |
|
---|
49 | #include "dtrace/VBoxVMM.h"
|
---|
50 |
|
---|
51 |
|
---|
52 |
|
---|
53 | /**
|
---|
54 | * Initializes the per-VM data for the DBGF.
|
---|
55 | *
|
---|
56 | * This is called from under the GVMM lock, so it only need to initialize the
|
---|
57 | * data so DBGFR0CleanupVM and others will work smoothly.
|
---|
58 | *
|
---|
59 | * @param pGVM Pointer to the global VM structure.
|
---|
60 | */
|
---|
61 | VMMR0_INT_DECL(void) DBGFR0InitPerVMData(PGVM pGVM)
|
---|
62 | {
|
---|
63 | AssertCompile(sizeof(pGVM->dbgfr0.s) <= sizeof(pGVM->dbgfr0.padding));
|
---|
64 | pGVM->dbgfr0.s.pTracerR0 = NULL;
|
---|
65 |
|
---|
66 | dbgfR0BpInit(pGVM);
|
---|
67 | }
|
---|
68 |
|
---|
69 |
|
---|
70 | /**
|
---|
71 | * Cleans up any loose ends before the GVM structure is destroyed.
|
---|
72 | */
|
---|
73 | VMMR0_INT_DECL(void) DBGFR0CleanupVM(PGVM pGVM)
|
---|
74 | {
|
---|
75 | #ifdef VBOX_WITH_DBGF_TRACING
|
---|
76 | if (pGVM->dbgfr0.s.pTracerR0)
|
---|
77 | dbgfR0TracerDestroy(pGVM, pGVM->dbgfr0.s.pTracerR0);
|
---|
78 | pGVM->dbgfr0.s.pTracerR0 = NULL;
|
---|
79 | #endif
|
---|
80 |
|
---|
81 | dbgfR0BpDestroy(pGVM);
|
---|
82 | }
|
---|
83 |
|
---|