1 | /* $Id: DBGPlugInDiggers.cpp 96407 2022-08-22 17:43:14Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DbfPlugInDiggers - Debugger and Guest OS Digger Plug-in.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2022 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_DBGC
|
---|
33 | #include <VBox/dbg.h>
|
---|
34 | #include <VBox/vmm/vmmr3vtable.h>
|
---|
35 | #include "DBGPlugIns.h"
|
---|
36 | #include <VBox/version.h>
|
---|
37 | #include <iprt/errcore.h>
|
---|
38 |
|
---|
39 |
|
---|
40 | DECLEXPORT(int) DbgPlugInEntry(DBGFPLUGINOP enmOperation, PUVM pUVM, PCVMMR3VTABLE pVMM, uintptr_t uArg)
|
---|
41 | {
|
---|
42 | static PCDBGFOSREG s_aPlugIns[] =
|
---|
43 | {
|
---|
44 | &g_DBGDiggerDarwin,
|
---|
45 | &g_DBGDiggerFreeBsd,
|
---|
46 | &g_DBGDiggerLinux,
|
---|
47 | &g_DBGDiggerOS2,
|
---|
48 | &g_DBGDiggerSolaris,
|
---|
49 | &g_DBGDiggerWinNt
|
---|
50 | };
|
---|
51 |
|
---|
52 | switch (enmOperation)
|
---|
53 | {
|
---|
54 | case DBGFPLUGINOP_INIT:
|
---|
55 | {
|
---|
56 | if (uArg != VBOX_VERSION)
|
---|
57 | return VERR_VERSION_MISMATCH;
|
---|
58 |
|
---|
59 | for (unsigned i = 0; i < RT_ELEMENTS(s_aPlugIns); i++)
|
---|
60 | {
|
---|
61 | int rc = pVMM->pfnDBGFR3OSRegister(pUVM, s_aPlugIns[i]);
|
---|
62 | if (RT_FAILURE(rc))
|
---|
63 | {
|
---|
64 | AssertRC(rc);
|
---|
65 | while (i-- > 0)
|
---|
66 | pVMM->pfnDBGFR3OSDeregister(pUVM, s_aPlugIns[i]);
|
---|
67 | return rc;
|
---|
68 | }
|
---|
69 | }
|
---|
70 | return VINF_SUCCESS;
|
---|
71 | }
|
---|
72 |
|
---|
73 | case DBGFPLUGINOP_TERM:
|
---|
74 | {
|
---|
75 | for (unsigned i = 0; i < RT_ELEMENTS(s_aPlugIns); i++)
|
---|
76 | {
|
---|
77 | int rc = pVMM->pfnDBGFR3OSDeregister(pUVM, s_aPlugIns[i]);
|
---|
78 | AssertRC(rc);
|
---|
79 | }
|
---|
80 | return VINF_SUCCESS;
|
---|
81 | }
|
---|
82 |
|
---|
83 | default:
|
---|
84 | return VERR_NOT_SUPPORTED;
|
---|
85 | }
|
---|
86 | }
|
---|
87 |
|
---|