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