summaryrefslogtreecommitdiff
path: root/src/VBox/Debugger/DBGCCommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/VBox/Debugger/DBGCCommands.cpp')
-rw-r--r--src/VBox/Debugger/DBGCCommands.cpp701
1 files changed, 266 insertions, 435 deletions
diff --git a/src/VBox/Debugger/DBGCCommands.cpp b/src/VBox/Debugger/DBGCCommands.cpp
index a47b4114..6992c548 100644
--- a/src/VBox/Debugger/DBGCCommands.cpp
+++ b/src/VBox/Debugger/DBGCCommands.cpp
@@ -4,7 +4,7 @@
*/
/*
- * Copyright (C) 2006-2012 Oracle Corporation
+ * Copyright (C) 2006-2013 Oracle Corporation
*
* This file is part of VirtualBox Open Source Edition (OSE), as
* available from http://www.virtualbox.org. This file is free software;
@@ -47,31 +47,32 @@
/*******************************************************************************
* Internal Functions *
*******************************************************************************/
-static DECLCALLBACK(int) dbgcCmdHelp(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdQuit(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdStop(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdDetect(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdCpu(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdInfo(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdLog(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdLogDest(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdLogFlags(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdFormat(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdLoadImage(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdLoadMap(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdLoadSeg(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdLoadSyms(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdSet(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdUnset(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdLoadVars(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdShowVars(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdLoadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdUnloadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdShowPlugIns(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdHarakiri(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdEcho(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdRunScript(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
-static DECLCALLBACK(int) dbgcCmdWriteCore(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs);
+static FNDBGCCMD dbgcCmdHelp;
+static FNDBGCCMD dbgcCmdQuit;
+static FNDBGCCMD dbgcCmdStop;
+static FNDBGCCMD dbgcCmdDetect;
+static FNDBGCCMD dbgcCmdCpu;
+static FNDBGCCMD dbgcCmdInfo;
+static FNDBGCCMD dbgcCmdLog;
+static FNDBGCCMD dbgcCmdLogDest;
+static FNDBGCCMD dbgcCmdLogFlags;
+static FNDBGCCMD dbgcCmdLogFlush;
+static FNDBGCCMD dbgcCmdFormat;
+static FNDBGCCMD dbgcCmdLoadImage;
+static FNDBGCCMD dbgcCmdLoadMap;
+static FNDBGCCMD dbgcCmdLoadSeg;
+static FNDBGCCMD dbgcCmdUnload;
+static FNDBGCCMD dbgcCmdSet;
+static FNDBGCCMD dbgcCmdUnset;
+static FNDBGCCMD dbgcCmdLoadVars;
+static FNDBGCCMD dbgcCmdShowVars;
+static FNDBGCCMD dbgcCmdLoadPlugIn;
+static FNDBGCCMD dbgcCmdUnloadPlugIn;
+static FNDBGCCMD dbgcCmdShowPlugIns;
+static FNDBGCCMD dbgcCmdHarakiri;
+static FNDBGCCMD dbgcCmdEcho;
+static FNDBGCCMD dbgcCmdRunScript;
+static FNDBGCCMD dbgcCmdWriteCore;
/*******************************************************************************
@@ -157,23 +158,11 @@ static const DBGCVARDESC g_aArgLoadSeg[] =
};
-/** loadsyms arguments. */
-static const DBGCVARDESC g_aArgLoadSyms[] =
-{
- /* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */
- { 1, 1, DBGCVAR_CAT_STRING, 0, "path", "Filename string." },
- { 0, 1, DBGCVAR_CAT_NUMBER, 0, "delta", "Delta to add to the loaded symbols. (optional)" },
- { 0, 1, DBGCVAR_CAT_STRING, 0, "module name", "Module name. (optional)" },
- { 0, 1, DBGCVAR_CAT_POINTER, DBGCVD_FLAGS_DEP_PREV, "module address", "Module address. (optional)" },
- { 0, 1, DBGCVAR_CAT_NUMBER, 0, "module size", "The module size. (optional)" },
-};
-
-
/** log arguments. */
static const DBGCVARDESC g_aArgLog[] =
{
/* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */
- { 1, 1, DBGCVAR_CAT_STRING, 0, "groups", "Group modifier string (quote it!)." }
+ { 0, 1, DBGCVAR_CAT_STRING, 0, "groups", "Group modifier string (quote it!)." }
};
@@ -181,7 +170,7 @@ static const DBGCVARDESC g_aArgLog[] =
static const DBGCVARDESC g_aArgLogDest[] =
{
/* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */
- { 1, 1, DBGCVAR_CAT_STRING, 0, "dests", "Destination modifier string (quote it!)." }
+ { 0, 1, DBGCVAR_CAT_STRING, 0, "dests", "Destination modifier string (quote it!)." }
};
@@ -189,7 +178,7 @@ static const DBGCVARDESC g_aArgLogDest[] =
static const DBGCVARDESC g_aArgLogFlags[] =
{
/* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */
- { 1, 1, DBGCVAR_CAT_STRING, 0, "flags", "Flag modifier string (quote it!)." }
+ { 0, 1, DBGCVAR_CAT_STRING, 0, "flags", "Flag modifier string (quote it!)." }
};
@@ -209,6 +198,13 @@ static const DBGCVARDESC g_aArgSet[] =
{ 1, 1, DBGCVAR_CAT_ANY, 0, "value", "Value to assign to the variable." },
};
+/** loadplugin, unloadplugin. */
+static const DBGCVARDESC g_aArgUnload[] =
+{
+ /* cTimesMin, cTimesMax, enmCategory, fFlags, pszName, pszDescription */
+ { 1, ~0U, DBGCVAR_CAT_STRING, 0, "modname", "Unloads all mappings of the given modules in the active address space." },
+};
+
/** 'unset' arguments */
static const DBGCVARDESC g_aArgUnset[] =
{
@@ -241,6 +237,8 @@ const DBGCCMD g_aDbgcCmds[] =
{ "loadimage", 2, 3, &g_aArgLoadImage[0], RT_ELEMENTS(g_aArgLoadImage), 0, dbgcCmdLoadImage, "<filename> <address> [name]",
"Loads the symbols of an executable image at the specified address. "
/*"Optionally giving the module a name other than the file name stem."*/ }, /** @todo implement line breaks */
+ { "loadimage32",2, 3, &g_aArgLoadImage[0], RT_ELEMENTS(g_aArgLoadImage), 0, dbgcCmdLoadImage, "<filename> <address> [name]", "loadimage variant for selecting 32-bit images (mach-o)." },
+ { "loadimage64",2, 3, &g_aArgLoadImage[0], RT_ELEMENTS(g_aArgLoadImage), 0, dbgcCmdLoadImage, "<filename> <address> [name]", "loadimage variant for selecting 64-bit images (mach-o)." },
{ "loadmap", 2, 5, &g_aArgLoadMap[0], RT_ELEMENTS(g_aArgLoadMap), 0, dbgcCmdLoadMap, "<filename> <address> [name] [subtrahend] [seg]",
"Loads the symbols from a map file, usually at a specified address. "
/*"Optionally giving the module a name other than the file name stem "
@@ -249,11 +247,11 @@ const DBGCCMD g_aDbgcCmds[] =
{ "loadseg", 3, 4, &g_aArgLoadSeg[0], RT_ELEMENTS(g_aArgLoadSeg), 0, dbgcCmdLoadSeg, "<filename> <address> <seg> [name]",
"Loads the symbols of a segment in the executable image at the specified address. "
/*"Optionally giving the module a name other than the file name stem."*/ },
- { "loadsyms", 1, 5, &g_aArgLoadSyms[0], RT_ELEMENTS(g_aArgLoadSyms), 0, dbgcCmdLoadSyms, "<filename> [delta] [module] [module address]", "Loads symbols from a text file. Optionally giving a delta and a module." },
{ "loadvars", 1, 1, &g_aArgFilename[0], RT_ELEMENTS(g_aArgFilename), 0, dbgcCmdLoadVars, "<filename>", "Load variables from file. One per line, same as the args to the set command." },
- { "log", 1, 1, &g_aArgLog[0], RT_ELEMENTS(g_aArgLog), 0, dbgcCmdLog, "<group string>", "Modifies the logging group settings (VBOX_LOG)" },
- { "logdest", 1, 1, &g_aArgLogDest[0], RT_ELEMENTS(g_aArgLogDest), 0, dbgcCmdLogDest, "<dest string>", "Modifies the logging destination (VBOX_LOG_DEST)." },
- { "logflags", 1, 1, &g_aArgLogFlags[0], RT_ELEMENTS(g_aArgLogFlags), 0, dbgcCmdLogFlags, "<flags string>", "Modifies the logging flags (VBOX_LOG_FLAGS)." },
+ { "log", 0, 1, &g_aArgLog[0], RT_ELEMENTS(g_aArgLog), 0, dbgcCmdLog, "[group string]", "Displays or modifies the logging group settings (VBOX_LOG)" },
+ { "logdest", 0, 1, &g_aArgLogDest[0], RT_ELEMENTS(g_aArgLogDest), 0, dbgcCmdLogDest, "[dest string]", "Displays or modifies the logging destination (VBOX_LOG_DEST)." },
+ { "logflags", 0, 1, &g_aArgLogFlags[0], RT_ELEMENTS(g_aArgLogFlags), 0, dbgcCmdLogFlags, "[flags string]", "Displays or modifies the logging flags (VBOX_LOG_FLAGS)." },
+ { "logflush", 0, 0, NULL, 0, 0, dbgcCmdLogFlush, "", "Flushes the log buffers." },
{ "quit", 0, 0, NULL, 0, 0, dbgcCmdQuit, "", "Exits the debugger." },
{ "runscript", 1, 1, &g_aArgFilename[0], RT_ELEMENTS(g_aArgFilename), 0, dbgcCmdRunScript, "<filename>", "Runs the command listed in the script. Lines starting with '#' "
"(after removing blanks) are comment. blank lines are ignored. Stops on failure." },
@@ -261,6 +259,7 @@ const DBGCCMD g_aDbgcCmds[] =
{ "showplugins",0, 0, NULL, 0, 0, dbgcCmdShowPlugIns,"", "List loaded plugins." },
{ "showvars", 0, 0, NULL, 0, 0, dbgcCmdShowVars, "", "List all the defined variables." },
{ "stop", 0, 0, NULL, 0, 0, dbgcCmdStop, "", "Stop execution." },
+ { "unload", 1, ~0U, &g_aArgUnload[0], RT_ELEMENTS(g_aArgUnload), 0, dbgcCmdUnload, "<modname1> [modname2..N]", "Unloads one or more modules in the current address space." },
{ "unloadplugin", 1, ~0U, &g_aArgPlugIn[0], RT_ELEMENTS(g_aArgPlugIn), 0, dbgcCmdUnloadPlugIn, "<plugin1> [plugin2..N]", "Unloads one or more plugins." },
{ "unset", 1, ~0U, &g_aArgUnset[0], RT_ELEMENTS(g_aArgUnset), 0, dbgcCmdUnset, "<var1> [var1..[varN]]", "Unsets (delete) one or more global variables." },
{ "writecore", 1, 1, &g_aArgWriteCore[0], RT_ELEMENTS(g_aArgWriteCore), 0, dbgcCmdWriteCore, "<filename>", "Write core to file." },
@@ -717,16 +716,9 @@ static void dbgcCmdHelpSummary(PDBGC pDbgc, PDBGCCMDHLP pCmdHlp, uint32_t *pcHit
/**
- * The 'help' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'help' command.}
*/
-static DECLCALLBACK(int) dbgcCmdHelp(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdHelp(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
int rc = VINF_SUCCESS;
@@ -832,26 +824,19 @@ static DECLCALLBACK(int) dbgcCmdHelp(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pV
}
NOREF(pCmd);
- NOREF(pVM);
+ NOREF(pUVM);
return rc;
}
/**
- * The 'quit', 'exit' and 'bye' commands.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'quit', 'exit' and 'bye' commands. }
*/
-static DECLCALLBACK(int) dbgcCmdQuit(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdQuit(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
- pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Quitting console...\n");
+ DBGCCmdHlpPrintf(pCmdHlp, "Quitting console...\n");
NOREF(pCmd);
- NOREF(pVM);
+ NOREF(pUVM);
NOREF(paArgs);
NOREF(cArgs);
return VERR_DBGC_QUIT;
@@ -859,30 +844,23 @@ static DECLCALLBACK(int) dbgcCmdQuit(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pV
/**
- * The 'stop' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'stop' command.}
*/
-static DECLCALLBACK(int) dbgcCmdStop(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdStop(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
/*
* Check if the VM is halted or not before trying to halt it.
*/
int rc;
- if (DBGFR3IsHalted(pVM))
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "warning: The VM is already halted...\n");
+ if (DBGFR3IsHalted(pUVM))
+ rc = DBGCCmdHlpPrintf(pCmdHlp, "warning: The VM is already halted...\n");
else
{
- rc = DBGFR3Halt(pVM);
+ rc = DBGFR3Halt(pUVM);
if (RT_SUCCESS(rc))
rc = VWRN_DBGC_CMD_PENDING;
else
- rc = pCmdHlp->pfnVBoxError(pCmdHlp, rc, "Executing DBGFR3Halt().");
+ rc = DBGCCmdHlpVBoxError(pCmdHlp, rc, "Executing DBGFR3Halt().");
}
NOREF(pCmd); NOREF(paArgs); NOREF(cArgs);
@@ -891,16 +869,9 @@ static DECLCALLBACK(int) dbgcCmdStop(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pV
/**
- * The 'echo' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'echo' command.}
*/
-static DECLCALLBACK(int) dbgcCmdEcho(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdEcho(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
/*
* Loop thru the arguments and print them with one space between.
@@ -909,31 +880,24 @@ static DECLCALLBACK(int) dbgcCmdEcho(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pV
for (unsigned i = 0; i < cArgs; i++)
{
AssertReturn(paArgs[i].enmType == DBGCVAR_TYPE_STRING, VERR_DBGC_PARSE_BUG);
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, i ? " %s" : "%s", paArgs[i].u.pszString);
+ rc = DBGCCmdHlpPrintf(pCmdHlp, i ? " %s" : "%s", paArgs[i].u.pszString);
if (RT_FAILURE(rc))
return rc;
}
- NOREF(pCmd); NOREF(pVM);
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "\n");
+ NOREF(pCmd); NOREF(pUVM);
+ return DBGCCmdHlpPrintf(pCmdHlp, "\n");
}
/**
- * The 'runscript' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'runscript' command.}
*/
-static DECLCALLBACK(int) dbgcCmdRunScript(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdRunScript(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
/* check that the parser did what it's supposed to do. */
if ( cArgs != 1
|| paArgs[0].enmType != DBGCVAR_TYPE_STRING)
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "parser error\n");
+ return DBGCCmdHlpPrintf(pCmdHlp, "parser error\n");
/** @todo Load the script here, but someone else should do the actual
* evaluation and execution of it. */
@@ -944,7 +908,7 @@ static DECLCALLBACK(int) dbgcCmdRunScript(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, P
const char *pszFilename = paArgs[0].u.pszString;
FILE *pFile = fopen(pszFilename, "r");
if (!pFile)
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Failed to open '%s'.\n", pszFilename);
+ return DBGCCmdHlpPrintf(pCmdHlp, "Failed to open '%s'.\n", pszFilename);
/*
* Execute it line by line.
@@ -958,7 +922,7 @@ static DECLCALLBACK(int) dbgcCmdRunScript(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, P
char *pszEnd = strchr(szLine, '\0');
if (pszEnd == &szLine[sizeof(szLine) - 1])
{
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "runscript error: Line #%u is too long\n", iLine);
+ rc = DBGCCmdHlpPrintf(pCmdHlp, "runscript error: Line #%u is too long\n", iLine);
break;
}
iLine++;
@@ -989,72 +953,58 @@ static DECLCALLBACK(int) dbgcCmdRunScript(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, P
if (RT_FAILURE(rc))
{
if (rc == VERR_BUFFER_OVERFLOW)
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "runscript error: Line #%u is too long (exec overflowed)\n", iLine);
+ rc = DBGCCmdHlpPrintf(pCmdHlp, "runscript error: Line #%u is too long (exec overflowed)\n", iLine);
break;
}
if (rc == VWRN_DBGC_CMD_PENDING)
{
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "runscript error: VWRN_DBGC_CMD_PENDING on line #%u, script terminated\n", iLine);
+ rc = DBGCCmdHlpPrintf(pCmdHlp, "runscript error: VWRN_DBGC_CMD_PENDING on line #%u, script terminated\n", iLine);
break;
}
}
fclose(pFile);
- NOREF(pCmd); NOREF(pVM);
+ NOREF(pCmd); NOREF(pUVM);
return rc;
}
/**
- * The 'detect' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'detect' command.}
*/
-static DECLCALLBACK(int) dbgcCmdDetect(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdDetect(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
/* check that the parser did what it's supposed to do. */
if (cArgs != 0)
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "parser error\n");
+ return DBGCCmdHlpPrintf(pCmdHlp, "parser error\n");
/*
* Perform the detection.
*/
char szName[64];
- int rc = DBGFR3OSDetect(pVM, szName, sizeof(szName));
+ int rc = DBGFR3OSDetect(pUVM, szName, sizeof(szName));
if (RT_FAILURE(rc))
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "Executing DBGFR3OSDetect().");
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "Executing DBGFR3OSDetect().\n");
if (rc == VINF_SUCCESS)
{
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Guest OS: %s\n", szName);
+ rc = DBGCCmdHlpPrintf(pCmdHlp, "Guest OS: %s\n", szName);
char szVersion[512];
- int rc2 = DBGFR3OSQueryNameAndVersion(pVM, NULL, 0, szVersion, sizeof(szVersion));
+ int rc2 = DBGFR3OSQueryNameAndVersion(pUVM, NULL, 0, szVersion, sizeof(szVersion));
if (RT_SUCCESS(rc2))
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Version : %s\n", szVersion);
+ rc = DBGCCmdHlpPrintf(pCmdHlp, "Version : %s\n", szVersion);
}
else
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Unable to figure out which guest OS it is, sorry.\n");
+ rc = DBGCCmdHlpPrintf(pCmdHlp, "Unable to figure out which guest OS it is, sorry.\n");
NOREF(pCmd); NOREF(paArgs);
return rc;
}
/**
- * The 'cpu' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'cpu' command.}
*/
-static DECLCALLBACK(int) dbgcCmdCpu(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdCpu(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
@@ -1062,22 +1012,21 @@ static DECLCALLBACK(int) dbgcCmdCpu(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM
if ( cArgs != 0
&& ( cArgs != 1
|| paArgs[0].enmType != DBGCVAR_TYPE_NUMBER))
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "parser error\n");
- if (!pVM)
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: No VM.\n");
+ return DBGCCmdHlpPrintf(pCmdHlp, "parser error\n");
+ DBGC_CMDHLP_REQ_UVM_RET(pCmdHlp, pCmd, pUVM);
int rc;
if (!cArgs)
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Current CPU ID: %u\n", pDbgc->idCpu);
+ rc = DBGCCmdHlpPrintf(pCmdHlp, "Current CPU ID: %u\n", pDbgc->idCpu);
else
{
-/** @todo add a DBGF getter for this. */
- if (paArgs[0].u.u64Number >= pVM->cCpus)
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: idCpu %u is out of range! Highest ID is %u.\n",
- paArgs[0].u.u64Number, pVM->cCpus);
+ VMCPUID cCpus = DBGFR3CpuGetCount(pUVM);
+ if (paArgs[0].u.u64Number >= cCpus)
+ rc = DBGCCmdHlpPrintf(pCmdHlp, "error: idCpu %u is out of range! Highest ID is %u.\n",
+ paArgs[0].u.u64Number, cCpus);
else
{
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Changed CPU from %u to %u.\n",
+ rc = DBGCCmdHlpPrintf(pCmdHlp, "Changed CPU from %u to %u.\n",
pDbgc->idCpu, (VMCPUID)paArgs[0].u.u64Number);
pDbgc->idCpu = (VMCPUID)paArgs[0].u.u64Number;
}
@@ -1087,16 +1036,9 @@ static DECLCALLBACK(int) dbgcCmdCpu(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM
/**
- * The 'info' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'info' command.}
*/
-static DECLCALLBACK(int) dbgcCmdInfo(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdInfo(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
@@ -1107,19 +1049,18 @@ static DECLCALLBACK(int) dbgcCmdInfo(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pV
|| cArgs > 2
|| paArgs[0].enmType != DBGCVAR_TYPE_STRING
|| paArgs[cArgs - 1].enmType != DBGCVAR_TYPE_STRING)
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "internal error: The parser doesn't do its job properly yet.. quote the string.\n");
- if (!pVM)
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "error: No VM.\n");
+ return DBGCCmdHlpPrintf(pCmdHlp, "internal error: The parser doesn't do its job properly yet.. quote the string.\n");
+ DBGC_CMDHLP_REQ_UVM_RET(pCmdHlp, pCmd, pUVM);
/*
* Dump it.
*/
- int rc = DBGFR3InfoEx(pVM, pDbgc->idCpu,
+ int rc = DBGFR3InfoEx(pUVM, pDbgc->idCpu,
paArgs[0].u.pszString,
cArgs == 2 ? paArgs[1].u.pszString : NULL,
DBGCCmdHlpGetDbgfOutputHlp(pCmdHlp));
if (RT_FAILURE(rc))
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "DBGFR3InfoEx()\n");
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "DBGFR3InfoEx()\n");
NOREF(pCmd);
return 0;
@@ -1127,76 +1068,100 @@ static DECLCALLBACK(int) dbgcCmdInfo(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pV
/**
- * The 'log' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'log' command.}
*/
-static DECLCALLBACK(int) dbgcCmdLog(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdLog(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
- int rc = DBGFR3LogModifyGroups(pVM, paArgs[0].u.pszString);
- if (RT_SUCCESS(rc))
- return VINF_SUCCESS;
- NOREF(pCmd); NOREF(cArgs);
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "DBGFR3LogModifyGroups(%p,'%s')\n", pVM, paArgs[0].u.pszString);
+ int rc;
+ if (cArgs == 0)
+ {
+ char szBuf[_64K];
+ rc = RTLogGetGroupSettings(NULL, szBuf, sizeof(szBuf));
+ if (RT_FAILURE(rc))
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "RTLogGetDestinations(NULL,,%#zx)\n", sizeof(szBuf));
+ DBGCCmdHlpPrintf(pCmdHlp, "VBOX_LOG=%s\n", szBuf);
+ }
+ else
+ {
+ rc = DBGFR3LogModifyGroups(pUVM, paArgs[0].u.pszString);
+ if (RT_FAILURE(rc))
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "DBGFR3LogModifyGroups(%p,'%s')\n", pUVM, paArgs[0].u.pszString);
+ }
+ NOREF(pCmd);
+ return VINF_SUCCESS;
}
/**
- * The 'logdest' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'logdest' command.}
*/
-static DECLCALLBACK(int) dbgcCmdLogDest(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdLogDest(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
- int rc = DBGFR3LogModifyDestinations(pVM, paArgs[0].u.pszString);
- if (RT_SUCCESS(rc))
- return VINF_SUCCESS;
- NOREF(pCmd); NOREF(cArgs);
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "DBGFR3LogModifyDestinations(%p,'%s')\n", pVM, paArgs[0].u.pszString);
+ int rc;
+ if (cArgs == 0)
+ {
+ char szBuf[_16K];
+ rc = RTLogGetDestinations(NULL, szBuf, sizeof(szBuf));
+ if (RT_FAILURE(rc))
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "RTLogGetDestinations(NULL,,%#zx)\n", sizeof(szBuf));
+ DBGCCmdHlpPrintf(pCmdHlp, "VBOX_LOG_DEST=%s\n", szBuf);
+ }
+ else
+ {
+ rc = DBGFR3LogModifyDestinations(pUVM, paArgs[0].u.pszString);
+ if (RT_FAILURE(rc))
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "DBGFR3LogModifyDestinations(%p,'%s')\n", pUVM, paArgs[0].u.pszString);
+ }
+ NOREF(pCmd);
+ return VINF_SUCCESS;
}
/**
- * The 'logflags' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'logflags' command.}
*/
-static DECLCALLBACK(int) dbgcCmdLogFlags(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdLogFlags(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
- int rc = DBGFR3LogModifyFlags(pVM, paArgs[0].u.pszString);
- if (RT_SUCCESS(rc))
- return VINF_SUCCESS;
+ int rc;
+ if (cArgs == 0)
+ {
+ char szBuf[_16K];
+ rc = RTLogGetFlags(NULL, szBuf, sizeof(szBuf));
+ if (RT_FAILURE(rc))
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "RTLogGetFlags(NULL,,%#zx)\n", sizeof(szBuf));
+ DBGCCmdHlpPrintf(pCmdHlp, "VBOX_LOG_FLAGS=%s\n", szBuf);
+ }
+ else
+ {
+ rc = DBGFR3LogModifyFlags(pUVM, paArgs[0].u.pszString);
+ if (RT_FAILURE(rc))
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "DBGFR3LogModifyFlags(%p,'%s')\n", pUVM, paArgs[0].u.pszString);
+ }
+
+ NOREF(pCmd);
+ return rc;
+}
+
+
+/**
+ * @interface_method_impl{FNDBCCMD, The 'logflush' command.}
+ */
+static DECLCALLBACK(int) dbgcCmdLogFlush(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
+{
+ RTLogFlush(NULL);
+ PRTLOGGER pLogRel = RTLogRelDefaultInstance();
+ if (pLogRel)
+ RTLogFlush(pLogRel);
+
NOREF(pCmd); NOREF(cArgs);
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "DBGFR3LogModifyFlags(%p,'%s')\n", pVM, paArgs[0].u.pszString);
+ return VINF_SUCCESS;
}
/**
- * The 'format' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'format' command.}
*/
-static DECLCALLBACK(int) dbgcCmdFormat(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdFormat(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
LogFlow(("dbgcCmdFormat\n"));
static const char *apszRangeDesc[] =
@@ -1210,81 +1175,81 @@ static DECLCALLBACK(int) dbgcCmdFormat(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM
switch (paArgs[iArg].enmType)
{
case DBGCVAR_TYPE_UNKNOWN:
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Unknown variable type!\n");
break;
case DBGCVAR_TYPE_GC_FLAT:
if (paArgs[iArg].enmRangeType != DBGCVAR_RANGE_NONE)
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Guest flat address: %%%08x range %lld %s\n",
paArgs[iArg].u.GCFlat,
paArgs[iArg].u64Range,
apszRangeDesc[paArgs[iArg].enmRangeType]);
else
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Guest flat address: %%%08x\n",
paArgs[iArg].u.GCFlat);
break;
case DBGCVAR_TYPE_GC_FAR:
if (paArgs[iArg].enmRangeType != DBGCVAR_RANGE_NONE)
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Guest far address: %04x:%08x range %lld %s\n",
paArgs[iArg].u.GCFar.sel,
paArgs[iArg].u.GCFar.off,
paArgs[iArg].u64Range,
apszRangeDesc[paArgs[iArg].enmRangeType]);
else
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Guest far address: %04x:%08x\n",
paArgs[iArg].u.GCFar.sel,
paArgs[iArg].u.GCFar.off);
break;
case DBGCVAR_TYPE_GC_PHYS:
if (paArgs[iArg].enmRangeType != DBGCVAR_RANGE_NONE)
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Guest physical address: %%%%%08x range %lld %s\n",
paArgs[iArg].u.GCPhys,
paArgs[iArg].u64Range,
apszRangeDesc[paArgs[iArg].enmRangeType]);
else
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Guest physical address: %%%%%08x\n",
paArgs[iArg].u.GCPhys);
break;
case DBGCVAR_TYPE_HC_FLAT:
if (paArgs[iArg].enmRangeType != DBGCVAR_RANGE_NONE)
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Host flat address: %%%08x range %lld %s\n",
paArgs[iArg].u.pvHCFlat,
paArgs[iArg].u64Range,
apszRangeDesc[paArgs[iArg].enmRangeType]);
else
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Host flat address: %%%08x\n",
paArgs[iArg].u.pvHCFlat);
break;
case DBGCVAR_TYPE_HC_PHYS:
if (paArgs[iArg].enmRangeType != DBGCVAR_RANGE_NONE)
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Host physical address: %RHp range %lld %s\n",
paArgs[iArg].u.HCPhys,
paArgs[iArg].u64Range,
apszRangeDesc[paArgs[iArg].enmRangeType]);
else
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Host physical address: %RHp\n",
paArgs[iArg].u.HCPhys);
break;
case DBGCVAR_TYPE_STRING:
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"String, %lld bytes long: %s\n",
paArgs[iArg].u64Range,
paArgs[iArg].u.pszString);
break;
case DBGCVAR_TYPE_SYMBOL:
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Symbol, %lld bytes long: %s\n",
paArgs[iArg].u64Range,
paArgs[iArg].u.pszString);
@@ -1292,7 +1257,7 @@ static DECLCALLBACK(int) dbgcCmdFormat(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM
case DBGCVAR_TYPE_NUMBER:
if (paArgs[iArg].enmRangeType != DBGCVAR_RANGE_NONE)
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Number: hex %llx dec 0i%lld oct 0t%llo range %lld %s\n",
paArgs[iArg].u.u64Number,
paArgs[iArg].u.u64Number,
@@ -1300,7 +1265,7 @@ static DECLCALLBACK(int) dbgcCmdFormat(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM
paArgs[iArg].u64Range,
apszRangeDesc[paArgs[iArg].enmRangeType]);
else
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Number: hex %llx dec 0i%lld oct 0t%llo\n",
paArgs[iArg].u.u64Number,
paArgs[iArg].u.u64Number,
@@ -1308,29 +1273,22 @@ static DECLCALLBACK(int) dbgcCmdFormat(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM
break;
default:
- rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL,
+ rc = DBGCCmdHlpPrintf(pCmdHlp,
"Invalid argument type %d\n",
paArgs[iArg].enmType);
break;
}
} /* arg loop */
- NOREF(pCmd); NOREF(pVM);
+ NOREF(pCmd); NOREF(pUVM);
return 0;
}
/**
- * The 'loadimage' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'loadimage' command.}
*/
-static DECLCALLBACK(int) dbgcCmdLoadImage(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdLoadImage(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
/*
* Validate the parsing and make sense of the input.
@@ -1347,7 +1305,7 @@ static DECLCALLBACK(int) dbgcCmdLoadImage(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, P
DBGFADDRESS ModAddress;
int rc = pCmdHlp->pfnVarToDbgfAddr(pCmdHlp, &paArgs[1], &ModAddress);
if (RT_FAILURE(rc))
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "pfnVarToDbgfAddr: %Dv\n", &paArgs[1]);
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "pfnVarToDbgfAddr: %Dv\n", &paArgs[1]);
const char *pszModName = NULL;
if (cArgs >= 3)
@@ -1357,30 +1315,31 @@ static DECLCALLBACK(int) dbgcCmdLoadImage(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, P
}
/*
+ * Determine the desired image arch from the load command used.
+ */
+ RTLDRARCH enmArch = RTLDRARCH_WHATEVER;
+ if (pCmd->pszCmd[sizeof("loadimage") - 1] == '3')
+ enmArch = RTLDRARCH_X86_32;
+ else if (pCmd->pszCmd[sizeof("loadimage") - 1] == '6')
+ enmArch = RTLDRARCH_AMD64;
+
+ /*
* Try create a module for it.
*/
PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
- rc = DBGFR3AsLoadImage(pVM, pDbgc->hDbgAs, pszFilename, pszModName, &ModAddress, NIL_RTDBGSEGIDX, 0 /*fFlags*/);
+ rc = DBGFR3AsLoadImage(pUVM, pDbgc->hDbgAs, pszFilename, pszModName, enmArch, &ModAddress, NIL_RTDBGSEGIDX, 0 /*fFlags*/);
if (RT_FAILURE(rc))
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "DBGFR3ModuleLoadImage(,,'%s','%s',%Dv,)\n",
- pszFilename, pszModName, &paArgs[1]);
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "DBGFR3ModuleLoadImage(,,'%s','%s',%Dv,)\n",
+ pszFilename, pszModName, &paArgs[1]);
- NOREF(pCmd);
return VINF_SUCCESS;
}
/**
- * The 'loadmap' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'loadmap' command.}
*/
-static DECLCALLBACK(int) dbgcCmdLoadMap(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdLoadMap(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
/*
* Validate the parsing and make sense of the input.
@@ -1397,7 +1356,7 @@ static DECLCALLBACK(int) dbgcCmdLoadMap(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM
DBGFADDRESS ModAddress;
int rc = pCmdHlp->pfnVarToDbgfAddr(pCmdHlp, &paArgs[1], &ModAddress);
if (RT_FAILURE(rc))
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "pfnVarToDbgfAddr: %Dv\n", &paArgs[1]);
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "pfnVarToDbgfAddr: %Dv\n", &paArgs[1]);
const char *pszModName = NULL;
if (cArgs >= 3)
@@ -1420,17 +1379,17 @@ static DECLCALLBACK(int) dbgcCmdLoadMap(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM
iModSeg = (RTDBGSEGIDX)paArgs[4].u.u64Number;
if ( iModSeg != paArgs[4].u.u64Number
|| iModSeg > RTDBGSEGIDX_LAST)
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Segment index out of range: %Dv; range={0..%#x}\n", &paArgs[1], RTDBGSEGIDX_LAST);
+ return DBGCCmdHlpPrintf(pCmdHlp, "Segment index out of range: %Dv; range={0..%#x}\n", &paArgs[1], RTDBGSEGIDX_LAST);
}
/*
* Try create a module for it.
*/
PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
- rc = DBGFR3AsLoadMap(pVM, pDbgc->hDbgAs, pszFilename, pszModName, &ModAddress, NIL_RTDBGSEGIDX, uSubtrahend, 0 /*fFlags*/);
+ rc = DBGFR3AsLoadMap(pUVM, pDbgc->hDbgAs, pszFilename, pszModName, &ModAddress, NIL_RTDBGSEGIDX, uSubtrahend, 0 /*fFlags*/);
if (RT_FAILURE(rc))
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "DBGFR3AsLoadMap(,,'%s','%s',%Dv,)\n",
- pszFilename, pszModName, &paArgs[1]);
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "DBGFR3AsLoadMap(,,'%s','%s',%Dv,)\n",
+ pszFilename, pszModName, &paArgs[1]);
NOREF(pCmd);
return VINF_SUCCESS;
@@ -1438,16 +1397,9 @@ static DECLCALLBACK(int) dbgcCmdLoadMap(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM
/**
- * The 'loadseg' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'loadseg' command.}
*/
-static DECLCALLBACK(int) dbgcCmdLoadSeg(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdLoadSeg(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
/*
* Validate the parsing and make sense of the input.
@@ -1465,12 +1417,12 @@ static DECLCALLBACK(int) dbgcCmdLoadSeg(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM
DBGFADDRESS ModAddress;
int rc = pCmdHlp->pfnVarToDbgfAddr(pCmdHlp, &paArgs[1], &ModAddress);
if (RT_FAILURE(rc))
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "pfnVarToDbgfAddr: %Dv\n", &paArgs[1]);
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "pfnVarToDbgfAddr: %Dv\n", &paArgs[1]);
RTDBGSEGIDX iModSeg = (RTDBGSEGIDX)paArgs[1].u.u64Number;
if ( iModSeg != paArgs[2].u.u64Number
|| iModSeg > RTDBGSEGIDX_LAST)
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Segment index out of range: %Dv; range={0..%#x}\n", &paArgs[1], RTDBGSEGIDX_LAST);
+ return DBGCCmdHlpPrintf(pCmdHlp, "Segment index out of range: %Dv; range={0..%#x}\n", &paArgs[1], RTDBGSEGIDX_LAST);
const char *pszModName = NULL;
if (cArgs >= 4)
@@ -1483,10 +1435,10 @@ static DECLCALLBACK(int) dbgcCmdLoadSeg(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM
* Call the debug info manager about this loading.
*/
PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
- rc = DBGFR3AsLoadImage(pVM, pDbgc->hDbgAs, pszFilename, pszModName, &ModAddress, iModSeg, 0 /*fFlags*/);
+ rc = DBGFR3AsLoadImage(pUVM, pDbgc->hDbgAs, pszFilename, pszModName, RTLDRARCH_WHATEVER, &ModAddress, iModSeg, 0 /*fFlags*/);
if (RT_FAILURE(rc))
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "DBGFR3ModuleLoadImage(,,'%s','%s',%Dv,)\n",
- pszFilename, pszModName, &paArgs[1]);
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "DBGFR3ModuleLoadImage(,,'%s','%s',%Dv,)\n",
+ pszFilename, pszModName, &paArgs[1]);
NOREF(pCmd);
return VINF_SUCCESS;
@@ -1494,87 +1446,27 @@ static DECLCALLBACK(int) dbgcCmdLoadSeg(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM
/**
- * The 'loadsyms' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'unload' command.}
*/
-static DECLCALLBACK(int) dbgcCmdLoadSyms(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdUnload(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
+ PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
+
/*
* Validate the parsing and make sense of the input.
* This is a mess as usual because we don't trust the parser yet.
*/
- if ( cArgs < 1
- || paArgs[0].enmType != DBGCVAR_TYPE_STRING)
- {
- AssertMsgFailed(("Parse error, first argument required to be string!\n"));
- return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE;
- }
- DBGCVAR AddrVar;
- RTGCUINTPTR Delta = 0;
- const char *pszModule = NULL;
- RTGCUINTPTR ModuleAddress = 0;
- unsigned cbModule = 0;
- if (cArgs > 1)
+ AssertReturn( cArgs >= 1
+ && paArgs[0].enmType == DBGCVAR_TYPE_STRING,
+ VERR_DBGC_PARSE_INCORRECT_ARG_TYPE);
+ for (unsigned i = 0; i < cArgs; i++)
{
- unsigned iArg = 1;
- if (paArgs[iArg].enmType == DBGCVAR_TYPE_NUMBER)
- {
- Delta = (RTGCUINTPTR)paArgs[iArg].u.u64Number;
- iArg++;
- }
- if (iArg < cArgs)
- {
- if (paArgs[iArg].enmType != DBGCVAR_TYPE_STRING)
- {
- AssertMsgFailed(("Parse error, module argument required to be string!\n"));
- return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE;
- }
- pszModule = paArgs[iArg].u.pszString;
- iArg++;
- if (iArg < cArgs)
- {
- if (!DBGCVAR_ISPOINTER(paArgs[iArg].enmType))
- {
- AssertMsgFailed(("Parse error, module argument required to be GC pointer!\n"));
- return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE;
- }
- int rc = DBGCCmdHlpEval(pCmdHlp, &AddrVar, "%%(%Dv)", &paArgs[iArg]);
- if (RT_FAILURE(rc))
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "Module address cast %%(%Dv) failed.", &paArgs[iArg]);
- ModuleAddress = paArgs[iArg].u.GCFlat;
- iArg++;
- if (iArg < cArgs)
- {
- if (paArgs[iArg].enmType != DBGCVAR_TYPE_NUMBER)
- {
- AssertMsgFailed(("Parse error, module argument required to be an integer!\n"));
- return VERR_DBGC_PARSE_INCORRECT_ARG_TYPE;
- }
- cbModule = (unsigned)paArgs[iArg].u.u64Number;
- iArg++;
- if (iArg < cArgs)
- {
- AssertMsgFailed(("Parse error, too many arguments!\n"));
- return VERR_DBGC_PARSE_TOO_MANY_ARGUMENTS;
- }
- }
- }
- }
- }
+ AssertReturn(paArgs[i].enmType == DBGCVAR_TYPE_STRING, VERR_DBGC_PARSE_INCORRECT_ARG_TYPE);
- /*
- * Call the debug info manager about this loading...
- */
- int rc = DBGFR3ModuleLoad(pVM, paArgs[0].u.pszString, Delta, pszModule, ModuleAddress, cbModule);
- if (RT_FAILURE(rc))
- return pCmdHlp->pfnVBoxError(pCmdHlp, rc, "DBGInfoSymbolLoad(, '%s', %RGv, '%s', %RGv, 0)\n",
- paArgs[0].u.pszString, Delta, pszModule, ModuleAddress);
+ int rc = DBGFR3AsUnlinkModuleByName(pUVM, pDbgc->hDbgAs, paArgs[i].u.pszString);
+ if (RT_FAILURE(rc))
+ return DBGCCmdHlpVBoxError(pCmdHlp, rc, "DBGFR3AsUnlinkModuleByName(,,'%s')\n", paArgs[i].u.pszString);
+ }
NOREF(pCmd);
return VINF_SUCCESS;
@@ -1582,16 +1474,9 @@ static DECLCALLBACK(int) dbgcCmdLoadSyms(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PV
/**
- * The 'set' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'set' command.}
*/
-static DECLCALLBACK(int) dbgcCmdSet(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdSet(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
@@ -1606,14 +1491,16 @@ static DECLCALLBACK(int) dbgcCmdSet(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM
*/
const char *pszVar = paArgs[0].u.pszString;
if (!RT_C_IS_ALPHA(*pszVar) || *pszVar == '_')
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL,
- "syntax error: Invalid variable name '%s'. Variable names must match regex '[_a-zA-Z][_a-zA-Z0-9*'!", paArgs[0].u.pszString);
+ return DBGCCmdHlpPrintf(pCmdHlp,
+ "syntax error: Invalid variable name '%s'. Variable names must match regex '[_a-zA-Z][_a-zA-Z0-9*'!",
+ paArgs[0].u.pszString);
while (RT_C_IS_ALNUM(*pszVar) || *pszVar == '_')
*pszVar++;
if (*pszVar)
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL,
- "syntax error: Invalid variable name '%s'. Variable names must match regex '[_a-zA-Z][_a-zA-Z0-9*]'!", paArgs[0].u.pszString);
+ return DBGCCmdHlpPrintf(pCmdHlp,
+ "syntax error: Invalid variable name '%s'. Variable names must match regex '[_a-zA-Z][_a-zA-Z0-9*]'!",
+ paArgs[0].u.pszString);
/*
@@ -1670,22 +1557,15 @@ static DECLCALLBACK(int) dbgcCmdSet(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM
}
pDbgc->papVars[pDbgc->cVars++] = pVar;
- NOREF(pCmd); NOREF(pVM); NOREF(cArgs);
+ NOREF(pCmd); NOREF(pUVM); NOREF(cArgs);
return 0;
}
/**
- * The 'unset' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'unset' command.}
*/
-static DECLCALLBACK(int) dbgcCmdUnset(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdUnset(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
for (unsigned i = 0; i < cArgs; i++)
@@ -1720,22 +1600,15 @@ static DECLCALLBACK(int) dbgcCmdUnset(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM p
} /* lookup */
} /* arg loop */
- NOREF(pCmd); NOREF(pVM);
+ NOREF(pCmd); NOREF(pUVM);
return 0;
}
/**
- * The 'loadvars' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'loadvars' command.}
*/
-static DECLCALLBACK(int) dbgcCmdLoadVars(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdLoadVars(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
/*
* Don't trust the parser.
@@ -1768,39 +1641,32 @@ static DECLCALLBACK(int) dbgcCmdLoadVars(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PV
&& *psz != '#'
&& *psz != ';')
{
- pCmdHlp->pfnPrintf(pCmdHlp, NULL, "dbg: set %s", psz);
+ DBGCCmdHlpPrintf(pCmdHlp, "dbg: set %s", psz);
pCmdHlp->pfnExec(pCmdHlp, "set %s", psz);
}
}
fclose(pFile);
}
else
- return pCmdHlp->pfnPrintf(pCmdHlp, NULL, "Failed to open file '%s'.\n", paArgs[0].u.pszString);
+ return DBGCCmdHlpPrintf(pCmdHlp, "Failed to open file '%s'.\n", paArgs[0].u.pszString);
- NOREF(pCmd); NOREF(pVM);
+ NOREF(pCmd); NOREF(pUVM);
return 0;
}
/**
- * The 'showvars' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'showvars' command.}
*/
-static DECLCALLBACK(int) dbgcCmdShowVars(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdShowVars(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
for (unsigned iVar = 0; iVar < pDbgc->cVars; iVar++)
{
- int rc = pCmdHlp->pfnPrintf(pCmdHlp, NULL, "%-20s ", &pDbgc->papVars[iVar]->szName);
+ int rc = DBGCCmdHlpPrintf(pCmdHlp, "%-20s ", &pDbgc->papVars[iVar]->szName);
if (!rc)
- rc = dbgcCmdFormat(pCmd, pCmdHlp, pVM, &pDbgc->papVars[iVar]->Var, 1);
+ rc = dbgcCmdFormat(pCmd, pCmdHlp, pUVM, &pDbgc->papVars[iVar]->Var, 1);
if (rc)
return rc;
}
@@ -2033,7 +1899,7 @@ static int dbgcPlugInLoad(PDBGC pDbgc, const char *pszName, const char *pszPlugI
/*
* Try initialize it.
*/
- rc = pPlugIn->pfnEntry(DBGCPLUGINOP_INIT, pDbgc->pVM, VBOX_VERSION);
+ rc = pPlugIn->pfnEntry(DBGCPLUGINOP_INIT, pDbgc->pUVM, VBOX_VERSION);
if (RT_FAILURE(rc))
{
RTLdrClose(pPlugIn->hLdrMod);
@@ -2108,16 +1974,9 @@ void dbgcPlugInAutoLoad(PDBGC pDbgc)
/**
- * The 'loadplugin' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'loadplugin' command.}
*/
-static DECLCALLBACK(int) dbgcCmdLoadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdLoadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
@@ -2164,7 +2023,7 @@ void dbgcPlugInUnloadAll(PDBGC pDbgc)
if ( pDbgc->pVM /* prevents trouble during destruction. */
&& pDbgc->pVM->enmVMState < VMSTATE_DESTROYING)
{
- pPlugIn->pfnEntry(DBGCPLUGINOP_TERM, pDbgc->pVM, 0);
+ pPlugIn->pfnEntry(DBGCPLUGINOP_TERM, pDbgc->pUVM, 0);
RTLdrClose(pPlugIn->hLdrMod);
}
pPlugIn->hLdrMod = NIL_RTLDRMOD;
@@ -2175,16 +2034,9 @@ void dbgcPlugInUnloadAll(PDBGC pDbgc)
/**
- * The 'unload' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'unload' command.}
*/
-static DECLCALLBACK(int) dbgcCmdUnloadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdUnloadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
@@ -2210,7 +2062,7 @@ static DECLCALLBACK(int) dbgcCmdUnloadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp
/*
* Terminate and unload it.
*/
- pPlugIn->pfnEntry(DBGCPLUGINOP_TERM, pDbgc->pVM, 0);
+ pPlugIn->pfnEntry(DBGCPLUGINOP_TERM, pDbgc->pUVM, 0);
RTLdrClose(pPlugIn->hLdrMod);
pPlugIn->hLdrMod = NIL_RTLDRMOD;
@@ -2227,16 +2079,9 @@ static DECLCALLBACK(int) dbgcCmdUnloadPlugIn(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp
/**
- * The 'showplugins' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'showplugins' command.}
*/
-static DECLCALLBACK(int) dbgcCmdShowPlugIns(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdShowPlugIns(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
PDBGC pDbgc = DBGC_CMDHLP2DBGC(pCmdHlp);
PDBGCPLUGIN pPlugIn = pDbgc->pPlugInHead;
@@ -2257,35 +2102,21 @@ static DECLCALLBACK(int) dbgcCmdShowPlugIns(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp,
/**
- * The 'harakiri' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'harakiri' command.}
*/
-static DECLCALLBACK(int) dbgcCmdHarakiri(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdHarakiri(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
Log(("dbgcCmdHarakiri\n"));
for (;;)
exit(126);
- NOREF(pCmd); NOREF(pCmdHlp); NOREF(pVM); NOREF(paArgs); NOREF(cArgs);
+ NOREF(pCmd); NOREF(pCmdHlp); NOREF(pUVM); NOREF(paArgs); NOREF(cArgs);
}
/**
- * The 'writecore' command.
- *
- * @returns VBox status.
- * @param pCmd Pointer to the command descriptor (as registered).
- * @param pCmdHlp Pointer to command helper functions.
- * @param pVM Pointer to the current VM (if any).
- * @param paArgs Pointer to (readonly) array of arguments.
- * @param cArgs Number of arguments in the array.
+ * @interface_method_impl{FNDBCCMD, The 'writecore' command.}
*/
-static DECLCALLBACK(int) dbgcCmdWriteCore(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, unsigned cArgs)
+static DECLCALLBACK(int) dbgcCmdWriteCore(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, PUVM pUVM, PCDBGCVAR paArgs, unsigned cArgs)
{
Log(("dbgcCmdWriteCore\n"));
@@ -2303,7 +2134,7 @@ static DECLCALLBACK(int) dbgcCmdWriteCore(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, P
if (!pszDumpPath)
return DBGCCmdHlpFail(pCmdHlp, pCmd, "Missing file path.\n");
- int rc = DBGFR3CoreWrite(pVM, pszDumpPath, true /*fReplaceFile*/);
+ int rc = DBGFR3CoreWrite(pUVM, pszDumpPath, true /*fReplaceFile*/);
if (RT_FAILURE(rc))
return DBGCCmdHlpFail(pCmdHlp, pCmd, "DBGFR3WriteCore failed. rc=%Rrc\n", rc);
@@ -2315,13 +2146,13 @@ static DECLCALLBACK(int) dbgcCmdWriteCore(PCDBGCCMD pCmd, PDBGCCMDHLP pCmdHlp, P
/**
* @callback_method_impl{The randu32() function implementation.}
*/
-static DECLCALLBACK(int) dbgcFuncRandU32(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pVM, PCDBGCVAR paArgs, uint32_t cArgs,
+static DECLCALLBACK(int) dbgcFuncRandU32(PCDBGCFUNC pFunc, PDBGCCMDHLP pCmdHlp, PVM pUVM, PCDBGCVAR paArgs, uint32_t cArgs,
PDBGCVAR pResult)
{
AssertReturn(cArgs == 0, VERR_DBGC_PARSE_BUG);
uint32_t u32 = RTRandU32();
DBGCVAR_INIT_NUMBER(pResult, u32);
- NOREF(pFunc); NOREF(pCmdHlp); NOREF(pVM); NOREF(paArgs);
+ NOREF(pFunc); NOREF(pCmdHlp); NOREF(pUVM); NOREF(paArgs);
return VINF_SUCCESS;
}