Changeset 55881 in vbox
- Timestamp:
- May 16, 2015 1:02:51 AM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 100338
- Location:
- trunk
- Files:
-
- 1 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/VBox/dbg.h
r44399 r55881 8 8 9 9 /* 10 * Copyright (C) 2006-201 3Oracle Corporation10 * Copyright (C) 2006-2015 Oracle Corporation 11 11 * 12 12 * This file is part of VirtualBox Open Source Edition (OSE), as … … 42 42 RT_C_DECLS_BEGIN 43 43 44 44 45 #ifdef IN_RING3 /* The debugger stuff is ring-3 only. */ 46 47 /** @defgroup grp_dbgc The Debugger Console API 48 * @{ 49 */ 45 50 46 51 /** @def VBOX_WITH_DEBUGGER … … 1096 1101 DBGDECL(int) DBGCTcpTerminate(PUVM pUVM, void *pvData); 1097 1102 1098 1099 /** @defgroup grp_dbgc_plug_in The DBGC Plug-in Interface 1100 * @{ 1101 */ 1102 1103 /** The plug-in module name prefix. */ 1104 #define DBGC_PLUG_IN_PREFIX "DBGCPlugIn" 1105 1106 /** The name of the plug-in entry point (FNDBGCPLUGIN) */ 1107 #define DBGC_PLUG_IN_ENTRYPOINT "DBGCPlugInEntry" 1108 1109 /** 1110 * DBGC plug-in operations. 1111 */ 1112 typedef enum DBGCPLUGINOP 1113 { 1114 /** The usual invalid first value. */ 1115 DBGCPLUGINOP_INVALID, 1116 /** Initialize the plug-in, register all the stuff. 1117 * The plug-in will be unloaded on failure. 1118 * uArg: The VirtualBox version (major+minor). */ 1119 DBGCPLUGINOP_INIT, 1120 /** Terminate the plug-ing, deregister all the stuff. 1121 * The plug-in will be unloaded after this call regardless of the return 1122 * code. */ 1123 DBGCPLUGINOP_TERM, 1124 /** The usual 32-bit hack. */ 1125 DBGCPLUGINOP_32BIT_HACK = 0x7fffffff 1126 } DBGCPLUGINOP; 1127 1128 /** 1129 * DBGC plug-in main entry point. 1130 * 1131 * @returns VBox status code. 1132 * 1133 * @param enmOperation The operation. 1134 * @param pUVM The user mode VM handle. This may be NULL. 1135 * @param uArg Extra argument. 1136 */ 1137 typedef DECLCALLBACK(int) FNDBGCPLUGIN(DBGCPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg); 1138 /** Pointer to a FNDBGCPLUGIN. */ 1139 typedef FNDBGCPLUGIN *PFNDBGCPLUGIN; 1140 1141 /** @copydoc FNDBGCPLUGIN */ 1142 DECLEXPORT(int) DBGCPlugInEntry(DBGCPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg); 1103 /** @} */ 1143 1104 1144 1105 #endif /* IN_RING3 */ 1145 1106 1146 /** @} */1147 1148 1149 1107 RT_C_DECLS_END 1150 1108 -
trunk/include/VBox/vmm/dbgf.h
r54218 r55881 1733 1733 VMMR3DECL(int) DBGFR3CoreWrite(PUVM pUVM, const char *pszFilename, bool fReplaceFile); 1734 1734 1735 1736 #ifdef IN_RING3 1737 /** @defgroup grp_dbgf_plug_in The DBGF Plug-in Interface 1738 * @{ 1739 */ 1740 1741 /** The plug-in module name prefix. */ 1742 #define DBGF_PLUG_IN_PREFIX "DbgPlugIn" 1743 1744 /** The name of the plug-in entry point (FNDBGFPLUGIN) */ 1745 #define DBGF_PLUG_IN_ENTRYPOINT "DbgPlugInEntry" 1746 1747 /** 1748 * DBGF plug-in operations. 1749 */ 1750 typedef enum DBGFPLUGINOP 1751 { 1752 /** The usual invalid first value. */ 1753 DBGFPLUGINOP_INVALID, 1754 /** Initialize the plug-in for a VM, register all the stuff. 1755 * The plug-in will be unloaded on failure. 1756 * uArg: The full VirtualBox version, see VBox/version.h. */ 1757 DBGFPLUGINOP_INIT, 1758 /** Terminate the plug-ing for a VM, deregister all the stuff. 1759 * The plug-in will be unloaded after this call regardless of the return 1760 * code. */ 1761 DBGFPLUGINOP_TERM, 1762 /** The usual 32-bit hack. */ 1763 DBGFPLUGINOP_32BIT_HACK = 0x7fffffff 1764 } DBGFPLUGINOP; 1765 1766 /** 1767 * DBGF plug-in main entry point. 1768 * 1769 * @returns VBox status code. 1770 * 1771 * @param enmOperation The operation. 1772 * @param pUVM The user mode VM handle. This may be NULL. 1773 * @param uArg Extra argument. 1774 */ 1775 typedef DECLCALLBACK(int) FNDBGFPLUGIN(DBGFPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg); 1776 /** Pointer to a FNDBGFPLUGIN. */ 1777 typedef FNDBGFPLUGIN *PFNDBGFPLUGIN; 1778 1779 /** @copydoc FNDBGFPLUGIN */ 1780 DECLEXPORT(int) DbgPlugInEntry(DBGFPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg); 1781 1782 VMMR3DECL(int) DBGFR3PlugInLoad(PUVM pUVM, const char *pszPlugIn, char *pszActual, size_t cbActual, PRTERRINFO pErrInfo); 1783 VMMR3DECL(int) DBGFR3PlugInUnload(PUVM pUVM, const char *pszName); 1784 VMMR3DECL(void) DBGFR3PlugInLoadAll(PUVM pUVM); 1785 VMMR3DECL(void) DBGFR3PlugInUnloadAll(PUVM pUVM); 1786 1735 1787 /** @} */ 1788 #endif /* IN_RING3 */ 1789 1790 1791 /** @} */ 1736 1792 1737 1793 -
trunk/src/VBox/Debugger/DBGCCommands.cpp
r55767 r55881 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 70 70 static FNDBGCCMD dbgcCmdLoadPlugIn; 71 71 static FNDBGCCMD dbgcCmdUnloadPlugIn; 72 static FNDBGCCMD dbgcCmdShowPlugIns;73 72 static FNDBGCCMD dbgcCmdHarakiri; 74 73 static FNDBGCCMD dbgcCmdEcho; … … 267 266 "(after removing blanks) are comment. blank lines are ignored. Stops on failure." }, 268 267 { "set", 2, 2, &g_aArgSet[0], RT_ELEMENTS(g_aArgSet), 0, dbgcCmdSet, "<var> <value>", "Sets a global variable." }, 269 { "showplugins",0, 0, NULL, 0, 0, dbgcCmdShowPlugIns,"", "List loaded plugins." },270 268 { "showvars", 0, 0, NULL, 0, 0, dbgcCmdShowVars, "", "List all the defined variables." }, 271 269 { "stop", 0, 0, NULL, 0, 0, dbgcCmdStop, "", "Stop execution." }, … … 1748 1746 1749 1747 /** 1750 * Extracts the plugin name from a plugin specifier that may or may not include 1751 * path and/or suffix. 1752 * 1753 * @returns VBox status code. 1754 * 1755 * @param pszDst Where to return the name. At least DBGCPLUGIN_MAX_NAME 1756 * worth of buffer space. 1757 * @param pszPlugIn The plugin specifier to parse. 1758 */ 1759 static int dbgcPlugInExtractName(char *pszDst, const char *pszPlugIn) 1760 { 1761 /* 1762 * Parse out the name stopping at the extension. 1763 */ 1764 const char *pszName = RTPathFilename(pszPlugIn); 1765 if (!pszName || !*pszName) 1766 return VERR_INVALID_NAME; 1767 if (!RTStrNICmp(pszName, DBGC_PLUG_IN_PREFIX, sizeof(DBGC_PLUG_IN_PREFIX) - 1)) 1768 { 1769 pszName += sizeof(DBGC_PLUG_IN_PREFIX) - 1; 1770 if (!*pszName) 1771 return VERR_INVALID_NAME; 1772 } 1773 1774 int ch; 1775 size_t cchName = 0; 1776 while ( (ch = pszName[cchName]) != '\0' 1777 && ch != '.') 1778 { 1779 if ( !RT_C_IS_ALPHA(ch) 1780 && ( !RT_C_IS_DIGIT(ch) 1781 || cchName == 0)) 1782 return VERR_INVALID_NAME; 1783 cchName++; 1784 } 1785 1786 if (cchName >= DBGCPLUGIN_MAX_NAME) 1787 return VERR_OUT_OF_RANGE; 1788 1789 /* 1790 * We're very picky about the extension if there is no path. 1791 */ 1792 if ( ch == '.' 1793 && !RTPathHavePath(pszPlugIn) 1794 && RTStrICmp(&pszName[cchName], RTLdrGetSuff())) 1795 return VERR_INVALID_NAME; 1796 1797 /* 1798 * Copy it. 1799 */ 1800 memcpy(pszDst, pszName, cchName); 1801 pszDst[cchName] = '\0'; 1748 * @interface_method_impl{FNDBCCMD, The 'loadplugin' command.} 1749 */ 1750 static DECLCALLBACK(int) dbgcCmdLoadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs) 1751 { 1752 PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp); 1753 1754 /* 1755 * Loop thru the plugin names. 1756 */ 1757 for (unsigned i = 0; i < cArgs; i++) 1758 { 1759 char szPlugIn[128]; 1760 RTERRINFOSTATIC ErrInfo; 1761 szPlugIn[0] = '\0'; 1762 int rc = DBGFR3PlugInLoad(pDbgc->pUVM, paArgs[i].u.pszString, szPlugIn, sizeof(szPlugIn), RTErrInfoInitStatic(&ErrInfo)); 1763 if (RT_SUCCESS(rc)) 1764 DBGCCmdHlpPrintf(pCmdHlp, "Loaded plug-in '%s' (%s)\n", szPlugIn, paArgs[i].u.pszString); 1765 else if (rc == VERR_ALREADY_EXISTS) 1766 DBGCCmdHlpPrintf(pCmdHlp, "A plug-in named '%s' is already loaded\n", szPlugIn); 1767 else if (szPlugIn[0]) 1768 return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGFR3PlugInLoad failed for '%s' ('%s'): %s", 1769 szPlugIn, paArgs[i].u.pszString, ErrInfo.szMsg); 1770 else 1771 return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGFR3PlugInLoad failed for '%s': %s", 1772 paArgs[i].u.pszString, ErrInfo.szMsg); 1773 } 1774 1802 1775 return VINF_SUCCESS; 1803 1776 } … … 1805 1778 1806 1779 /** 1807 * Locate a plug-in in list. 1808 * 1809 * @returns Pointer to the plug-in tracking structure. 1810 * @param pDbgc Pointer to the DBGC instance data. 1811 * @param pszName The name of the plug-in we're looking for. 1812 * @param ppPrev Where to optionally return the pointer to the 1813 * previous list member. 1814 */ 1815 static PDBGCPLUGIN dbgcPlugInLocate(PDBGC pDbgc, const char *pszName, PDBGCPLUGIN *ppPrev) 1816 { 1817 PDBGCPLUGIN pPrev = NULL; 1818 PDBGCPLUGIN pCur = pDbgc->pPlugInHead; 1819 while (pCur) 1820 { 1821 if (!RTStrICmp(pCur->szName, pszName)) 1822 { 1823 if (ppPrev) 1824 *ppPrev = pPrev; 1825 return pCur; 1826 } 1827 1828 /* advance */ 1829 pPrev = pCur; 1830 pCur = pCur->pNext; 1831 } 1832 return NULL; 1833 } 1834 1835 1836 /** 1837 * Try load the specified plug-in module. 1838 * 1839 * @returns VINF_SUCCESS on success, path error or loader error on failure. 1840 * 1841 * @param pPlugIn The plugin tracing record. 1842 * @param pszModule Module name. 1843 */ 1844 static int dbgcPlugInTryLoad(PDBGCPLUGIN pPlugIn, const char *pszModule) 1845 { 1846 /* 1847 * Load it and try resolve the entry point. 1848 */ 1849 int rc = RTLdrLoad(pszModule, &pPlugIn->hLdrMod); 1850 if (RT_SUCCESS(rc)) 1851 { 1852 rc = RTLdrGetSymbol(pPlugIn->hLdrMod, DBGC_PLUG_IN_ENTRYPOINT, (void **)&pPlugIn->pfnEntry); 1780 * @interface_method_impl{FNDBCCMD, The 'unload' command.} 1781 */ 1782 static DECLCALLBACK(int) dbgcCmdUnloadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs) 1783 { 1784 PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp); 1785 1786 /* 1787 * Loop thru the given plug-in names. 1788 */ 1789 for (unsigned i = 0; i < cArgs; i++) 1790 { 1791 int rc = DBGFR3PlugInUnload(pDbgc->pUVM, paArgs[i].u.pszString); 1853 1792 if (RT_SUCCESS(rc)) 1854 return VINF_SUCCESS; 1855 LogRel(("DBGC: RTLdrGetSymbol('%s', '%s',) -> %Rrc\n", pszModule, DBGC_PLUG_IN_ENTRYPOINT, rc)); 1856 1857 RTLdrClose(pPlugIn->hLdrMod); 1858 pPlugIn->hLdrMod = NIL_RTLDRMOD; 1859 } 1860 return rc; 1861 } 1862 1863 1864 /** 1865 * RTPathTraverseList callback. 1866 * 1867 * @returns See FNRTPATHTRAVERSER. 1868 * 1869 * @param pchPath See FNRTPATHTRAVERSER. 1870 * @param cchPath See FNRTPATHTRAVERSER. 1871 * @param pvUser1 The plug-in specifier. 1872 * @param pvUser2 The plug-in tracking record. 1873 */ 1874 static DECLCALLBACK(int) dbgcPlugInLoadCallback(const char *pchPath, size_t cchPath, void *pvUser1, void *pvUser2) 1875 { 1876 PDBGCPLUGIN pPlugIn = (PDBGCPLUGIN)pvUser2; 1877 const char *pszPlugIn = (const char *)pvUser1; 1878 1879 /* 1880 * Join the path and the specified plug-in module name, first with the 1881 * prefix and then without it. 1882 */ 1883 size_t cchModule = cchPath + 1 + strlen(pszPlugIn) + sizeof(DBGC_PLUG_IN_PREFIX) + 8; 1884 char *pszModule = (char *)alloca(cchModule); 1885 AssertReturn(pszModule, VERR_TRY_AGAIN); 1886 memcpy(pszModule, pchPath, cchPath); 1887 pszModule[cchPath] = '\0'; 1888 1889 int rc = RTPathAppend(pszModule, cchModule, DBGC_PLUG_IN_PREFIX); 1890 AssertRCReturn(rc, VERR_TRY_AGAIN); 1891 strcat(pszModule, pszPlugIn); 1892 rc = dbgcPlugInTryLoad(pPlugIn, pszModule); 1893 if (RT_SUCCESS(rc)) 1894 return VINF_SUCCESS; 1895 1896 pszModule[cchPath] = '\0'; 1897 rc = RTPathAppend(pszModule, cchModule, pszPlugIn); 1898 AssertRCReturn(rc, VERR_TRY_AGAIN); 1899 rc = dbgcPlugInTryLoad(pPlugIn, pszModule); 1900 if (RT_SUCCESS(rc)) 1901 return VINF_SUCCESS; 1902 1903 return VERR_TRY_AGAIN; 1904 } 1905 1906 1907 /** 1908 * Loads a plug-in. 1909 * 1910 * @returns VBox status code. If pCmd is specified, it's the return from 1911 * DBGCCmdHlpFail. 1912 * @param pDbgc The DBGC instance data. 1913 * @param pszName The plug-in name. 1914 * @param pszPlugIn The plug-in module name. 1915 * @param pCmd The command pointer if invoked by the user, NULL 1916 * if invoked from elsewhere. 1917 */ 1918 static int dbgcPlugInLoad(PDBGC pDbgc, const char *pszName, const char *pszPlugIn, PCDBGCCMD pCmd) 1919 { 1920 PDBGCCMDHLP pCmdHlp = &pDbgc->CmdHlp; 1921 1922 /* 1923 * Try load it. If specified with a path, we're assuming the user 1924 * wants to load a plug-in from some specific location. Otherwise 1925 * search for it. 1926 */ 1927 PDBGCPLUGIN pPlugIn = (PDBGCPLUGIN)RTMemAllocZ(sizeof(*pPlugIn)); 1928 if (!pPlugIn) 1929 return pCmd 1930 ? DBGCCmdHlpFail(pCmdHlp, pCmd, "out of memory\n") 1931 : VERR_NO_MEMORY; 1932 strcpy(pPlugIn->szName, pszName); 1933 1934 int rc; 1935 if (RTPathHavePath(pszPlugIn)) 1936 rc = dbgcPlugInTryLoad(pPlugIn, pszPlugIn); 1937 else 1938 { 1939 /* 1. The private architecture directory. */ 1940 char szPath[4*_1K]; 1941 rc = RTPathAppPrivateArch(szPath, sizeof(szPath)); 1942 if (RT_SUCCESS(rc)) 1943 rc = RTPathTraverseList(szPath, '\0', dbgcPlugInLoadCallback, (void *)pszPlugIn, pPlugIn); 1944 if (RT_FAILURE(rc)) 1945 { 1946 /* 2. The DBGC PLUGIN_PATH variable. */ 1947 DBGCVAR PathVar; 1948 int rc2 = DBGCCmdHlpEval(pCmdHlp, &PathVar, "$PLUGIN_PATH"); 1949 if ( RT_SUCCESS(rc2) 1950 && PathVar.enmType == DBGCVAR_TYPE_STRING) 1951 rc = RTPathTraverseList(PathVar.u.pszString, ';', dbgcPlugInLoadCallback, (void *)pszPlugIn, pPlugIn); 1952 if (RT_FAILURE_NP(rc)) 1953 { 1954 /* 3. The DBGC_PLUGIN_PATH environment variable. */ 1955 rc2 = RTEnvGetEx(RTENV_DEFAULT, "DBGC_PLUGIN_PATH", szPath, sizeof(szPath), NULL); 1956 if (RT_SUCCESS(rc2)) 1957 rc = RTPathTraverseList(szPath, ';', dbgcPlugInLoadCallback, (void *)pszPlugIn, pPlugIn); 1958 } 1959 } 1960 } 1961 if (RT_FAILURE(rc)) 1962 { 1963 RTMemFree(pPlugIn); 1964 return pCmd 1965 ? DBGCCmdHlpFail(pCmdHlp, pCmd, "could not find/load '%s'\n", pszPlugIn) 1966 : rc; 1967 } 1968 1969 /* 1970 * Try initialize it. 1971 */ 1972 rc = pPlugIn->pfnEntry(DBGCPLUGINOP_INIT, pDbgc->pUVM, VBOX_VERSION); 1973 if (RT_FAILURE(rc)) 1974 { 1975 RTLdrClose(pPlugIn->hLdrMod); 1976 RTMemFree(pPlugIn); 1977 return pCmd 1978 ? DBGCCmdHlpFail(pCmdHlp, pCmd, "initialization of plug-in '%s' failed with rc=%Rrc\n", pszPlugIn, rc) 1979 : rc; 1980 } 1981 1982 /* 1983 * Link it and we're good. 1984 */ 1985 pPlugIn->pNext = pDbgc->pPlugInHead; 1986 pDbgc->pPlugInHead = pPlugIn; 1987 DBGCCmdHlpPrintf(pCmdHlp, "Loaded plug-in '%s'.\n", pPlugIn->szName); 1793 DBGCCmdHlpPrintf(pCmdHlp, "Unloaded plug-in '%s'\n", paArgs[i].u.pszString); 1794 else if (rc == VERR_NOT_FOUND) 1795 return DBGCCmdHlpFail(pCmdHlp, pCmd, "'%s' was not found\n", paArgs[i].u.pszString); 1796 else 1797 return DBGCCmdHlpFailRc(pCmdHlp, pCmd, rc, "DBGFR3PlugInUnload failed for '%s'", paArgs[i].u.pszString); 1798 } 1799 1988 1800 return VINF_SUCCESS; 1989 1801 } 1990 1991 1992 1993 1994 /**1995 * Automatically load plug-ins from the architecture private directory of1996 * VirtualBox.1997 *1998 * This is called during console init.1999 *2000 * @param pDbgc The DBGC instance data.2001 */2002 void dbgcPlugInAutoLoad(PDBGC pDbgc)2003 {2004 /*2005 * Open the architecture specific directory with a filter on our prefix2006 * and names including a dot.2007 */2008 const char *pszSuff = RTLdrGetSuff();2009 size_t cchSuff = strlen(pszSuff);2010 2011 char szPath[RTPATH_MAX];2012 int rc = RTPathAppPrivateArch(szPath, sizeof(szPath) - cchSuff);2013 AssertRCReturnVoid(rc);2014 size_t offDir = strlen(szPath);2015 2016 rc = RTPathAppend(szPath, sizeof(szPath) - cchSuff, DBGC_PLUG_IN_PREFIX "*");2017 AssertRCReturnVoid(rc);2018 strcat(szPath, pszSuff);2019 2020 PRTDIR pDir;2021 rc = RTDirOpenFiltered(&pDir, szPath, RTDIRFILTER_WINNT, 0);2022 if (RT_SUCCESS(rc))2023 {2024 /*2025 * Now read it and try load each of the plug-in modules.2026 */2027 RTDIRENTRY DirEntry;2028 while (RT_SUCCESS(RTDirRead(pDir, &DirEntry, NULL)))2029 {2030 szPath[offDir] = '\0';2031 rc = RTPathAppend(szPath, sizeof(szPath), DirEntry.szName);2032 if (RT_SUCCESS(rc))2033 {2034 char szName[DBGCPLUGIN_MAX_NAME];2035 rc = dbgcPlugInExtractName(szName, DirEntry.szName);2036 if (RT_SUCCESS(rc))2037 dbgcPlugInLoad(pDbgc, szName, szPath, NULL /*pCmd*/);2038 }2039 }2040 2041 RTDirClose(pDir);2042 }2043 }2044 2045 2046 /**2047 * @interface_method_impl{FNDBCCMD, The 'loadplugin' command.}2048 */2049 static DECLCALLBACK(int) dbgcCmdLoadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)2050 {2051 PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);2052 2053 /*2054 * Loop thru the plugin names.2055 */2056 for (unsigned i = 0; i < cArgs; i++)2057 {2058 const char *pszPlugIn = paArgs[i].u.pszString;2059 2060 /* Extract the plug-in name. */2061 char szName[DBGCPLUGIN_MAX_NAME];2062 int rc = dbgcPlugInExtractName(szName, pszPlugIn);2063 if (RT_FAILURE(rc))2064 return DBGCCmdHlpFail(pCmdHlp, pCmd, "Malformed plug-in name: '%s'\n", pszPlugIn);2065 2066 /* Loaded? */2067 PDBGCPLUGIN pPlugIn = dbgcPlugInLocate(pDbgc, szName, NULL);2068 if (pPlugIn)2069 return DBGCCmdHlpFail(pCmdHlp, pCmd, "'%s' is already loaded\n", szName);2070 2071 /* Load it. */2072 rc = dbgcPlugInLoad(pDbgc, szName, pszPlugIn, pCmd);2073 if (RT_FAILURE(rc))2074 return rc;2075 }2076 2077 return VINF_SUCCESS;2078 }2079 2080 2081 /**2082 * Unload all plug-ins.2083 *2084 * @param pDbgc The DBGC instance data.2085 */2086 void dbgcPlugInUnloadAll(PDBGC pDbgc)2087 {2088 while (pDbgc->pPlugInHead)2089 {2090 PDBGCPLUGIN pPlugIn = pDbgc->pPlugInHead;2091 pDbgc->pPlugInHead = pPlugIn->pNext;2092 2093 if ( pDbgc->pVM /* prevents trouble during destruction. */2094 && pDbgc->pVM->enmVMState < VMSTATE_DESTROYING)2095 {2096 pPlugIn->pfnEntry(DBGCPLUGINOP_TERM, pDbgc->pUVM, 0);2097 RTLdrClose(pPlugIn->hLdrMod);2098 }2099 pPlugIn->hLdrMod = NIL_RTLDRMOD;2100 2101 RTMemFree(pPlugIn);2102 }2103 }2104 2105 2106 /**2107 * @interface_method_impl{FNDBCCMD, The 'unload' command.}2108 */2109 static DECLCALLBACK(int) dbgcCmdUnloadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)2110 {2111 PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);2112 2113 /*2114 * Loop thru the plugin names.2115 */2116 for (unsigned i = 0; i < cArgs; i++)2117 {2118 const char *pszPlugIn = paArgs[i].u.pszString;2119 2120 /* Extract the plug-in name. */2121 char szName[DBGCPLUGIN_MAX_NAME];2122 int rc = dbgcPlugInExtractName(szName, pszPlugIn);2123 if (RT_FAILURE(rc))2124 return DBGCCmdHlpFail(pCmdHlp, pCmd, "Malformed plug-in name: '%s'\n", pszPlugIn);2125 2126 /* Loaded? */2127 PDBGCPLUGIN pPrevPlugIn;2128 PDBGCPLUGIN pPlugIn = dbgcPlugInLocate(pDbgc, szName, &pPrevPlugIn);2129 if (!pPlugIn)2130 return DBGCCmdHlpFail(pCmdHlp, pCmd, "'%s' is not\n", szName);2131 2132 /*2133 * Terminate and unload it.2134 */2135 pPlugIn->pfnEntry(DBGCPLUGINOP_TERM, pDbgc->pUVM, 0);2136 RTLdrClose(pPlugIn->hLdrMod);2137 pPlugIn->hLdrMod = NIL_RTLDRMOD;2138 2139 if (pPrevPlugIn)2140 pPrevPlugIn->pNext = pPlugIn->pNext;2141 else2142 pDbgc->pPlugInHead = pPlugIn->pNext;2143 RTMemFree(pPlugIn->pNext);2144 DBGCCmdHlpPrintf(pCmdHlp, "Unloaded plug-in '%s'\n", szName);2145 }2146 2147 return VINF_SUCCESS;2148 }2149 2150 2151 /**2152 * @interface_method_impl{FNDBCCMD, The 'showplugins' command.}2153 */2154 static DECLCALLBACK(int) dbgcCmdShowPlugIns(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)2155 {2156 PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);2157 PDBGCPLUGIN pPlugIn = pDbgc->pPlugInHead;2158 if (!pPlugIn)2159 return DBGCCmdHlpPrintf(pCmdHlp, "No plug-ins loaded\n");2160 2161 DBGCCmdHlpPrintf(pCmdHlp, "Plug-ins: %s", pPlugIn->szName);2162 for (;;)2163 {2164 pPlugIn = pPlugIn->pNext;2165 if (!pPlugIn)2166 break;2167 DBGCCmdHlpPrintf(pCmdHlp, ", %s", pPlugIn->szName);2168 }2169 return DBGCCmdHlpPrintf(pCmdHlp, "\n");2170 }2171 2172 1802 2173 1803 -
trunk/src/VBox/Debugger/DBGCInternal.h
r47569 r55881 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 64 64 /** Pointer to named variable. */ 65 65 typedef DBGCNAMEDVAR *PDBGCNAMEDVAR; 66 67 68 /** The max length of a plug-in name, zero terminator included. */69 #define DBGCPLUGIN_MAX_NAME 3270 71 /**72 * Plug-in tracking record.73 */74 typedef struct DBGCPLUGIN75 {76 /** Pointer to the next plug-in. */77 struct DBGCPLUGIN *pNext;78 /** The loader handle. */79 RTLDRMOD hLdrMod;80 /** The plug-in entry point. */81 PFNDBGCPLUGIN pfnEntry;82 /** The plug-in name (variable length). */83 char szName[DBGCPLUGIN_MAX_NAME];84 } DBGCPLUGIN;85 /** Pointer to plug-in tracking record. */86 typedef DBGCPLUGIN *PDBGCPLUGIN;87 66 88 67 … … 158 137 * and unset using command with those names. */ 159 138 PDBGCNAMEDVAR *papVars; 160 161 /** The list of plug-in. (singly linked) */162 PDBGCPLUGIN pPlugInHead;163 139 164 140 /** The list of breakpoints. (singly linked) */ … … 398 374 void dbgcInitCmdHlp(PDBGC pDbgc); 399 375 400 void dbgcPlugInAutoLoad(PDBGC pDbgc);401 void dbgcPlugInUnloadAll(PDBGC pDbgc);402 403 376 /* For tstDBGCParser: */ 404 377 int dbgcCreate(PDBGC *ppDbgc, PDBGCBACK pBack, unsigned fFlags); -
trunk/src/VBox/Debugger/DBGConsole.cpp
r46156 r55881 968 968 } 969 969 970 /* Unload all plug-ins. */971 dbgcPlugInUnloadAll(pDbgc);972 973 970 /* Detach from the VM. */ 974 971 if (pDbgc->pUVM) … … 1050 1047 { 1051 1048 if (pVM) 1052 dbgcPlugInAutoLoad(pDbgc);1049 DBGFR3PlugInLoadAll(pDbgc->pUVM); 1053 1050 rc = pDbgc->CmdHlp.pfnPrintf(&pDbgc->CmdHlp, NULL, "VBoxDbg> "); 1054 1051 if (RT_SUCCESS(rc)) -
trunk/src/VBox/Debugger/DBGPlugInDiggers.cpp
r49044 r55881 1 1 /* $Id$ */ 2 2 /** @file 3 * D BGPlugInDiggers - Debugger and Guest OS Digger Plug-in.3 * DbfPlugInDiggers - Debugger and Guest OS Digger Plug-in. 4 4 */ 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 28 28 29 29 30 DECLEXPORT(int) D BGCPlugInEntry(DBGCPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg)30 DECLEXPORT(int) DbgPlugInEntry(DBGFPLUGINOP enmOperation, PUVM pUVM, uintptr_t uArg) 31 31 { 32 32 static PCDBGFOSREG s_aPlugIns[] = … … 42 42 switch (enmOperation) 43 43 { 44 case DBG CPLUGINOP_INIT:44 case DBGFPLUGINOP_INIT: 45 45 { 46 46 if (uArg != VBOX_VERSION) … … 61 61 } 62 62 63 case DBG CPLUGINOP_TERM:63 case DBGFPLUGINOP_TERM: 64 64 { 65 65 for (unsigned i = 0; i < RT_ELEMENTS(s_aPlugIns); i++) -
trunk/src/VBox/Debugger/Makefile.kmk
r55793 r55881 54 54 # The diggers plug-in. 55 55 # 56 DLLS += D BGCPlugInDiggers57 D BGCPlugInDiggers_TEMPLATE = VBOXR358 D BGCPlugInDiggers_SOURCES = \56 DLLS += DbgPlugInDiggers 57 DbgPlugInDiggers_TEMPLATE = VBOXR3 58 DbgPlugInDiggers_SOURCES = \ 59 59 DBGPlugInDiggers.cpp \ 60 60 DBGPlugInDarwin.cpp \ … … 64 64 DBGPlugInOS2.cpp \ 65 65 DBGPlugInCommonELF.cpp 66 D BGCPlugInDiggers_LIBS = \66 DbgPlugInDiggers_LIBS = \ 67 67 $(if-expr "$(LIB_VMM)" == "$(VBOX_LIB_VMM_LAZY)",$(LIB_REM),) \ 68 68 $(VBOX_LIB_VMM_LAZY) \ 69 69 $(LIB_RUNTIME) 70 $(call VBOX_SET_VER_INFO_DLL,D BGCPlugInDiggers,VirtualBox Debugger Guest OS Digger Plug-in)70 $(call VBOX_SET_VER_INFO_DLL,DbgPlugInDiggers,VirtualBox Debugger Guest OS Digger Plug-in) 71 71 72 72 -
trunk/src/VBox/Debugger/testcase/tstDBGCStubs.cpp
r54218 r55881 322 322 } 323 323 324 VMMR3DECL(int) DBGFR3PlugInLoad(PUVM pUVM, const char *pszPlugIn, char *pszActual, size_t cbActual, PRTERRINFO pErrInfo) 325 { 326 return VERR_INTERNAL_ERROR; 327 } 328 VMMR3DECL(int) DBGFR3PlugInUnload(PUVM pUVM, const char *pszName) 329 { 330 return VERR_INTERNAL_ERROR; 331 } 332 VMMR3DECL(void) DBGFR3PlugInLoadAll(PUVM pUVM) 333 { 334 } 335 324 336 325 337 ////////////////////////////////////////////////////////////////////////// -
trunk/src/VBox/VMM/Makefile.kmk
r55789 r55881 144 144 VMMR3/DBGFMem.cpp \ 145 145 VMMR3/DBGFOS.cpp \ 146 VMMR3/DBGFR3PlugIn.cpp \ 146 147 VMMR3/DBGFReg.cpp \ 147 148 VMMR3/DBGFStack.cpp \ -
trunk/src/VBox/VMM/VMMR3/DBGF.cpp
r54218 r55881 141 141 AssertCompile(sizeof(pUVM->aCpus[0].dbgf.s) <= sizeof(pUVM->aCpus[0].dbgf.padding)); 142 142 143 int rc = dbgfR3InfoInit(pUVM); 143 /* 144 * The usual sideways mountain climbing style of init: 145 */ 146 int rc = dbgfR3InfoInit(pUVM); /* (First, initalizes the shared critical section.) */ 144 147 if (RT_SUCCESS(rc)) 148 { 145 149 rc = dbgfR3TraceInit(pVM); 146 if (RT_SUCCESS(rc)) 147 rc = dbgfR3RegInit(pUVM); 148 if (RT_SUCCESS(rc)) 149 rc = dbgfR3AsInit(pUVM); 150 if (RT_SUCCESS(rc)) 151 rc = dbgfR3BpInit(pVM); 152 if (RT_SUCCESS(rc)) 153 rc = dbgfR3OSInit(pUVM); 150 if (RT_SUCCESS(rc)) 151 { 152 rc = dbgfR3RegInit(pUVM); 153 if (RT_SUCCESS(rc)) 154 { 155 rc = dbgfR3AsInit(pUVM); 156 if (RT_SUCCESS(rc)) 157 { 158 rc = dbgfR3BpInit(pVM); 159 if (RT_SUCCESS(rc)) 160 { 161 rc = dbgfR3OSInit(pUVM); 162 if (RT_SUCCESS(rc)) 163 { 164 rc = dbgfR3PlugInInit(pUVM); 165 if (RT_SUCCESS(rc)) 166 { 167 return VINF_SUCCESS; 168 } 169 dbgfR3OSTerm(pUVM); 170 } 171 } 172 dbgfR3AsTerm(pUVM); 173 } 174 dbgfR3RegTerm(pUVM); 175 } 176 dbgfR3TraceTerm(pVM); 177 } 178 dbgfR3InfoTerm(pUVM); 179 } 154 180 return rc; 155 181 } … … 166 192 PUVM pUVM = pVM->pUVM; 167 193 194 dbgfR3PlugInTerm(pUVM); 168 195 dbgfR3OSTerm(pUVM); 169 196 dbgfR3AsTerm(pUVM); -
trunk/src/VBox/VMM/VMMR3/DBGFInfo.cpp
r44399 r55881 5 5 6 6 /* 7 * Copyright (C) 2006-201 3Oracle Corporation7 * Copyright (C) 2006-2015 Oracle Corporation 8 8 * 9 9 * This file is part of VirtualBox Open Source Edition (OSE), as … … 79 79 * Initialize the info handlers. 80 80 * 81 * This is called first during the DBGF init process and thus does the shared 82 * critsect init. 83 * 81 84 * @returns VBox status code. 82 85 * @param pUVM The user mode VM handle. … … 87 90 * Make sure we already didn't initialized in the lazy manner. 88 91 */ 89 if (RTCritSect IsInitialized(&pUVM->dbgf.s.InfoCritSect))92 if (RTCritSectRwIsInitialized(&pUVM->dbgf.s.CritSect)) 90 93 return VINF_SUCCESS; 91 94 … … 93 96 * Initialize the crit sect. 94 97 */ 95 int rc = RTCritSect Init(&pUVM->dbgf.s.InfoCritSect);98 int rc = RTCritSectRwInit(&pUVM->dbgf.s.CritSect); 96 99 AssertRCReturn(rc, rc); 97 100 … … 117 120 * Delete the crit sect. 118 121 */ 119 int rc = RTCritSect Delete(&pUVM->dbgf.s.InfoCritSect);122 int rc = RTCritSectRwDelete(&pUVM->dbgf.s.CritSect); 120 123 AssertRC(rc); 121 124 return rc; … … 209 212 /** 210 213 * Handle registration worker. 214 * 211 215 * This allocates the structure, initializes the common fields and inserts into the list. 212 216 * Upon successful return the we're inside the crit sect and the caller must leave it. … … 245 249 /* lazy init */ 246 250 rc = VINF_SUCCESS; 247 if (!RTCritSect IsInitialized(&pUVM->dbgf.s.InfoCritSect))251 if (!RTCritSectRwIsInitialized(&pUVM->dbgf.s.CritSect)) 248 252 rc = dbgfR3InfoInit(pUVM); 249 253 if (RT_SUCCESS(rc)) … … 252 256 * Insert in alphabetical order. 253 257 */ 254 rc = RTCritSect Enter(&pUVM->dbgf.s.InfoCritSect);258 rc = RTCritSectRwEnterExcl(&pUVM->dbgf.s.CritSect); 255 259 AssertRC(rc); 256 260 PDBGFINFO pPrev = NULL; … … 308 312 pInfo->u.Dev.pfnHandler = pfnHandler; 309 313 pInfo->u.Dev.pDevIns = pDevIns; 310 RTCritSect Leave(&pVM->pUVM->dbgf.s.InfoCritSect);314 RTCritSectRwLeaveExcl(&pVM->pUVM->dbgf.s.CritSect); 311 315 } 312 316 … … 346 350 pInfo->u.Drv.pfnHandler = pfnHandler; 347 351 pInfo->u.Drv.pDrvIns = pDrvIns; 348 RTCritSect Leave(&pVM->pUVM->dbgf.s.InfoCritSect);352 RTCritSectRwLeaveExcl(&pVM->pUVM->dbgf.s.CritSect); 349 353 } 350 354 … … 398 402 pInfo->enmType = DBGFINFOTYPE_INT; 399 403 pInfo->u.Int.pfnHandler = pfnHandler; 400 RTCritSect Leave(&pVM->pUVM->dbgf.s.InfoCritSect);404 RTCritSectRwLeaveExcl(&pVM->pUVM->dbgf.s.CritSect); 401 405 } 402 406 … … 437 441 pInfo->u.Ext.pfnHandler = pfnHandler; 438 442 pInfo->u.Ext.pvUser = pvUser; 439 RTCritSect Leave(&pUVM->dbgf.s.InfoCritSect);443 RTCritSectRwLeaveExcl(&pUVM->dbgf.s.CritSect); 440 444 } 441 445 … … 467 471 * Enumerate the info handlers and free the requested entries. 468 472 */ 469 int rc = RTCritSect Enter(&pUVM->dbgf.s.InfoCritSect); AssertRC(rc);473 int rc = RTCritSectRwEnterExcl(&pUVM->dbgf.s.CritSect); AssertRC(rc); 470 474 rc = VERR_FILE_NOT_FOUND; 471 475 PDBGFINFO pPrev = NULL; … … 509 513 rc = VINF_SUCCESS; 510 514 } 511 int rc2 = RTCritSect Leave(&pUVM->dbgf.s.InfoCritSect);515 int rc2 = RTCritSectRwLeaveExcl(&pUVM->dbgf.s.CritSect); 512 516 AssertRC(rc2); 513 517 AssertRC(rc); … … 539 543 * Enumerate the info handlers and free the requested entries. 540 544 */ 541 int rc = RTCritSect Enter(&pUVM->dbgf.s.InfoCritSect); AssertRC(rc);545 int rc = RTCritSectRwEnterExcl(&pUVM->dbgf.s.CritSect); AssertRC(rc); 542 546 rc = VERR_FILE_NOT_FOUND; 543 547 PDBGFINFO pPrev = NULL; … … 581 585 rc = VINF_SUCCESS; 582 586 } 583 int rc2 = RTCritSect Leave(&pUVM->dbgf.s.InfoCritSect);587 int rc2 = RTCritSectRwLeaveExcl(&pUVM->dbgf.s.CritSect); 584 588 AssertRC(rc2); 585 589 AssertRC(rc); … … 608 612 */ 609 613 size_t cchName = strlen(pszName); 610 int rc = RTCritSect Enter(&pUVM->dbgf.s.InfoCritSect);614 int rc = RTCritSectRwEnterExcl(&pUVM->dbgf.s.CritSect); 611 615 AssertRC(rc); 612 616 rc = VERR_FILE_NOT_FOUND; … … 626 630 break; 627 631 } 628 int rc2 = RTCritSect Leave(&pUVM->dbgf.s.InfoCritSect);632 int rc2 = RTCritSectRwLeaveExcl(&pUVM->dbgf.s.CritSect); 629 633 AssertRC(rc2); 630 634 AssertRC(rc); … … 694 698 */ 695 699 size_t cchName = strlen(pszName); 696 int rc = RTCritSect Enter(&pUVM->dbgf.s.InfoCritSect);700 int rc = RTCritSectRwEnterShared(&pUVM->dbgf.s.CritSect); 697 701 AssertRC(rc); 698 702 PDBGFINFO pInfo = pUVM->dbgf.s.pInfoFirst; … … 705 709 /* 706 710 * Found it. 707 * Make a copy of it on the stack so we can leave the crit sect.708 * Switch on the type and invoke the handler.709 711 */ 710 DBGFINFO Info = *pInfo;711 rc = RTCritSectLeave(&pUVM->dbgf.s.InfoCritSect);712 AssertRC(rc);713 712 rc = VINF_SUCCESS; 714 switch ( Info.enmType)713 switch (pInfo->enmType) 715 714 { 716 715 case DBGFINFOTYPE_DEV: 717 if ( Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)718 rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT) Info.u.Dev.pfnHandler, 3, Info.u.Dev.pDevIns, pHlp, pszArgs);716 if (pInfo->fFlags & DBGFINFO_FLAGS_RUN_ON_EMT) 717 rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT)pInfo->u.Dev.pfnHandler, 3, pInfo->u.Dev.pDevIns, pHlp, pszArgs); 719 718 else 720 Info.u.Dev.pfnHandler(Info.u.Dev.pDevIns, pHlp, pszArgs);719 pInfo->u.Dev.pfnHandler(pInfo->u.Dev.pDevIns, pHlp, pszArgs); 721 720 break; 722 721 723 722 case DBGFINFOTYPE_DRV: 724 if ( Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)725 rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT) Info.u.Drv.pfnHandler, 3, Info.u.Drv.pDrvIns, pHlp, pszArgs);723 if (pInfo->fFlags & DBGFINFO_FLAGS_RUN_ON_EMT) 724 rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT)pInfo->u.Drv.pfnHandler, 3, pInfo->u.Drv.pDrvIns, pHlp, pszArgs); 726 725 else 727 Info.u.Drv.pfnHandler(Info.u.Drv.pDrvIns, pHlp, pszArgs);726 pInfo->u.Drv.pfnHandler(pInfo->u.Drv.pDrvIns, pHlp, pszArgs); 728 727 break; 729 728 … … 731 730 if (RT_VALID_PTR(pUVM->pVM)) 732 731 { 733 if ( Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)734 rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT) Info.u.Int.pfnHandler, 3, pUVM->pVM, pHlp, pszArgs);732 if (pInfo->fFlags & DBGFINFO_FLAGS_RUN_ON_EMT) 733 rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT)pInfo->u.Int.pfnHandler, 3, pUVM->pVM, pHlp, pszArgs); 735 734 else 736 Info.u.Int.pfnHandler(pUVM->pVM, pHlp, pszArgs);735 pInfo->u.Int.pfnHandler(pUVM->pVM, pHlp, pszArgs); 737 736 } 738 737 else … … 741 740 742 741 case DBGFINFOTYPE_EXT: 743 if ( Info.fFlags & DBGFINFO_FLAGS_RUN_ON_EMT)744 rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT) Info.u.Ext.pfnHandler, 3, Info.u.Ext.pvUser, pHlp, pszArgs);742 if (pInfo->fFlags & DBGFINFO_FLAGS_RUN_ON_EMT) 743 rc = VMR3ReqCallVoidWaitU(pUVM, idCpu, (PFNRT)pInfo->u.Ext.pfnHandler, 3, pInfo->u.Ext.pvUser, pHlp, pszArgs); 745 744 else 746 Info.u.Ext.pfnHandler(Info.u.Ext.pvUser, pHlp, pszArgs);745 pInfo->u.Ext.pfnHandler(pInfo->u.Ext.pvUser, pHlp, pszArgs); 747 746 break; 748 747 749 748 default: 750 AssertMsgFailedReturn(("Invalid info type enmType=%d\n", Info.enmType), VERR_IPE_NOT_REACHED_DEFAULT_CASE);749 AssertMsgFailedReturn(("Invalid info type enmType=%d\n", pInfo->enmType), VERR_IPE_NOT_REACHED_DEFAULT_CASE); 751 750 } 751 int rc2 = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect); 752 AssertRC(rc2); 752 753 } 753 754 else 754 755 { 755 rc = RTCritSect Leave(&pUVM->dbgf.s.InfoCritSect);756 rc = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect); 756 757 AssertRC(rc); 757 758 rc = VERR_FILE_NOT_FOUND; … … 867 868 * Note! We won't leave the critical section here... 868 869 */ 869 int rc = RTCritSect Enter(&pUVM->dbgf.s.InfoCritSect);870 int rc = RTCritSectRwEnterShared(&pUVM->dbgf.s.CritSect); 870 871 AssertRC(rc); 871 872 rc = VWRN_NOT_FOUND; … … 915 916 } 916 917 } 917 int rc2 = RTCritSect Leave(&pUVM->dbgf.s.InfoCritSect);918 int rc2 = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect); 918 919 AssertRC(rc2); 919 920 … … 947 948 * Enter and enumerate. 948 949 */ 949 int rc = RTCritSect Enter(&pUVM->dbgf.s.InfoCritSect);950 int rc = RTCritSectRwEnterShared(&pUVM->dbgf.s.CritSect); 950 951 AssertRC(rc); 951 952 … … 957 958 * Leave and exit. 958 959 */ 959 int rc2 = RTCritSect Leave(&pUVM->dbgf.s.InfoCritSect);960 int rc2 = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect); 960 961 AssertRC(rc2); 961 962 … … 980 981 */ 981 982 PUVM pUVM = pVM->pUVM; 982 int rc = RTCritSect Enter(&pUVM->dbgf.s.InfoCritSect);983 int rc = RTCritSectRwEnterShared(&pUVM->dbgf.s.CritSect); 983 984 AssertRC(rc); 984 985 … … 1007 1008 * Leave and exit. 1008 1009 */ 1009 rc = RTCritSect Leave(&pUVM->dbgf.s.InfoCritSect);1010 rc = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect); 1010 1011 AssertRC(rc); 1011 1012 } -
trunk/src/VBox/VMM/VMMR3/DBGFOS.cpp
r54218 r55881 38 38 39 39 #define DBGF_OS_READ_LOCK(pUVM) \ 40 do { int rcLock = RTCritSectRwEnterShared(&pUVM->dbgf.s. OSCritSect); AssertRC(rcLock); } while (0)40 do { int rcLock = RTCritSectRwEnterShared(&pUVM->dbgf.s.CritSect); AssertRC(rcLock); } while (0) 41 41 #define DBGF_OS_READ_UNLOCK(pUVM) \ 42 do { int rcLock = RTCritSectRwLeaveShared(&pUVM->dbgf.s. OSCritSect); AssertRC(rcLock); } while (0)42 do { int rcLock = RTCritSectRwLeaveShared(&pUVM->dbgf.s.CritSect); AssertRC(rcLock); } while (0) 43 43 44 44 #define DBGF_OS_WRITE_LOCK(pUVM) \ 45 do { int rcLock = RTCritSectRwEnterExcl(&pUVM->dbgf.s. OSCritSect); AssertRC(rcLock); } while (0)45 do { int rcLock = RTCritSectRwEnterExcl(&pUVM->dbgf.s.CritSect); AssertRC(rcLock); } while (0) 46 46 #define DBGF_OS_WRITE_UNLOCK(pUVM) \ 47 do { int rcLock = RTCritSectRwLeaveExcl(&pUVM->dbgf.s. OSCritSect); AssertRC(rcLock); } while (0)47 do { int rcLock = RTCritSectRwLeaveExcl(&pUVM->dbgf.s.CritSect); AssertRC(rcLock); } while (0) 48 48 49 49 … … 93 93 int dbgfR3OSInit(PUVM pUVM) 94 94 { 95 return RTCritSectRwInit(&pUVM->dbgf.s.OSCritSect);95 return VINF_SUCCESS; 96 96 } 97 97 … … 104 104 void dbgfR3OSTerm(PUVM pUVM) 105 105 { 106 RTCritSectRwDelete(&pUVM->dbgf.s.OSCritSect);106 DBGF_OS_WRITE_LOCK(pUVM); 107 107 108 108 /* … … 135 135 MMR3HeapFree(pOS); 136 136 } 137 138 DBGF_OS_WRITE_UNLOCK(pUVM); 137 139 } 138 140 -
trunk/src/VBox/VMM/VMMR3/VM.cpp
r54763 r55881 2490 2490 RTLogFlags(NULL, "nodisabled nobuffered"); 2491 2491 #endif 2492 #ifdef VBOX_WITH_STATISTICS2493 STAMR3Dump(pUVM, "*");2494 #else2492 //#ifdef VBOX_WITH_STATISTICS 2493 // STAMR3Dump(pUVM, "*"); 2494 //#else 2495 2495 LogRel(("************************* Statistics *************************\n")); 2496 2496 STAMR3DumpToReleaseLog(pUVM, "*"); 2497 2497 LogRel(("********************* End of statistics **********************\n")); 2498 #endif2498 //#endif 2499 2499 2500 2500 /* -
trunk/src/VBox/VMM/include/DBGFInternal.h
r54218 r55881 185 185 186 186 187 187 188 /** 188 189 * Converts a DBGF pointer into a VM pointer. … … 317 318 bool afAlignment2[3]; 318 319 320 /** Critical section protecting the Guest OS Digger data, the info handlers 321 * and the plugins. These share to give the best possible plugin unload 322 * race protection. */ 323 RTCRITSECTRW CritSect; 324 /** Head of the LIFO of loaded DBGF plugins. */ 325 R3PTRTYPE(struct DBGFPLUGIN *) pPlugInHead; 319 326 /** The current Guest OS digger. */ 320 327 R3PTRTYPE(PDBGFOS) pCurOS; 321 328 /** The head of the Guest OS digger instances. */ 322 329 R3PTRTYPE(PDBGFOS) pOSHead; 323 /** Critical section protecting the Guest OS Digger data. */324 RTCRITSECTRW OSCritSect;325 326 330 /** List of registered info handlers. */ 327 331 R3PTRTYPE(PDBGFINFO) pInfoFirst; 328 /** Critical section protecting the above list. */329 RTCRITSECT InfoCritSect;330 332 331 333 } DBGFUSERPERVM; 334 typedef DBGFUSERPERVM *PDBGFUSERPERVM; 335 typedef DBGFUSERPERVM const *PCDBGFUSERPERVM; 332 336 333 337 /** … … 356 360 void dbgfR3TraceRelocate(PVM pVM); 357 361 void dbgfR3TraceTerm(PVM pVM); 362 int dbgfR3PlugInInit(PUVM pUVM); 363 void dbgfR3PlugInTerm(PUVM pUVM); 358 364 359 365
Note:
See TracChangeset
for help on using the changeset viewer.