1 | /* $Id: DBGPlugInDiggers.cpp 64371 2016-10-23 00:53:17Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * DbfPlugInDiggers - Debugger and Guest OS Digger Plug-in.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2016 Oracle Corporation
|
---|
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 (GPL) as published by the Free Software
|
---|
13 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
14 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
15 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 |
|
---|
19 | /*********************************************************************************************************************************
|
---|
20 | * Header Files *
|
---|
21 | *********************************************************************************************************************************/
|
---|
22 | #define LOG_GROUP LOG_GROUP_DBGC
|
---|
23 | #include <VBox/dbg.h>
|
---|
24 | #include <VBox/vmm/dbgf.h>
|
---|
25 | #include "DBGPlugIns.h"
|
---|
26 | #include <VBox/version.h>
|
---|
27 | #include <VBox/err.h>
|
---|
28 |
|
---|
29 |
|
---|
30 | DECLEXPORT(int) DbgPlugInEntry(DBGFPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg)
|
---|
31 | {
|
---|
32 | static PCDBGFOSREG s_aPlugIns[] =
|
---|
33 | {
|
---|
34 | &g_DBGDiggerDarwin,
|
---|
35 | &g_DBGDiggerFreeBsd,
|
---|
36 | &g_DBGDiggerLinux,
|
---|
37 | &g_DBGDiggerOS2,
|
---|
38 | &g_DBGDiggerSolaris,
|
---|
39 | &g_DBGDiggerWinNt
|
---|
40 | };
|
---|
41 |
|
---|
42 | switch (enmOperation)
|
---|
43 | {
|
---|
44 | case DBGFPLUGINOP_INIT:
|
---|
45 | {
|
---|
46 | if (uArg != VBOX_VERSION)
|
---|
47 | return VERR_VERSION_MISMATCH;
|
---|
48 |
|
---|
49 | for (unsigned i = 0; i < RT_ELEMENTS(s_aPlugIns); i++)
|
---|
50 | {
|
---|
51 | int rc = DBGFR3OSRegister(pUVM, s_aPlugIns[i]);
|
---|
52 | if (RT_FAILURE(rc))
|
---|
53 | {
|
---|
54 | AssertRC(rc);
|
---|
55 | while (i-- > 0)
|
---|
56 | DBGFR3OSDeregister(pUVM, s_aPlugIns[i]);
|
---|
57 | return rc;
|
---|
58 | }
|
---|
59 | }
|
---|
60 | return VINF_SUCCESS;
|
---|
61 | }
|
---|
62 |
|
---|
63 | case DBGFPLUGINOP_TERM:
|
---|
64 | {
|
---|
65 | for (unsigned i = 0; i < RT_ELEMENTS(s_aPlugIns); i++)
|
---|
66 | {
|
---|
67 | int rc = DBGFR3OSDeregister(pUVM, s_aPlugIns[i]);
|
---|
68 | AssertRC(rc);
|
---|
69 | }
|
---|
70 | return VINF_SUCCESS;
|
---|
71 | }
|
---|
72 |
|
---|
73 | default:
|
---|
74 | return VERR_NOT_SUPPORTED;
|
---|
75 | }
|
---|
76 | }
|
---|
77 |
|
---|