This section provides some example command lines. For each example we'll break it down, argument by argument so that you can see how the command line works.
In all these examples the executable to run is vmValidator.exe. You will need to provide the full path to vmValidator.exe, or add the path to vmValidator install directory to your $PATH.
32 bit application monitoring: vmValidator.exe
64 bit application monitoring: vmValidator_x64.exe
vmValidator.exe /exe e:\om\c\test\release\test.exe /dir e:\om\c\test\release /args "-add 3 4"
/program e:\om\c\test\release\test.exe
Start application e:\om\c\test\release\test.exe
/dir e:\om\c\test\release
Start the application in e:\om\c\test\release
/args "-add 3 4"
Pass the arguments -add 3 4 to the application being launched
vmValidator.exe /process 1344
/process 1344
Attach to process 1344 and monitor that process.
Launching VM Validator from your own code to monitor a process you've just started. The arguments are the same as for Example 2.
int attachVMValidatorToRunningProcess(DWORD processId, // process id to monitor
const TCHAR *dir) // startup dir, can be NULL
{
CString vmValidator;
int bRet;
vmValidator = getVMValidatorPath(dir);
if (GetFileAttributes(vmValidator) != INVALID_FILE_ATTRIBUTES)
{
// only try to launch if exception tracer is a valid filename
TCHAR commandLine[1000];
STARTUPINFO stStartInfo;
PROCESS_INFORMATION stProcessInfo;
memset(&stStartInfo, 0, sizeof(STARTUPINFO));
memset(&stProcessInfo, 0, sizeof(PROCESS_INFORMATION));
stStartInfo.cb = sizeof(STARTUPINFO);
_stprintf_s(commandLine, sizeof(commandLine) / sizeof(commandLine[0]), _T("%s /process %u"), (const TCHAR *)vmValidator, processId);
bRet = CreateProcess(NULL,
commandLine,
NULL,
NULL,
FALSE,
0,
NULL,
dir,
&stStartInfo,
&stProcessInfo);
if (bRet)
{
WaitForInputIdle(stProcessInfo.hProcess, 10 * 1000); // 10 seconds
CloseHandle(stProcessInfo.hProcess);
CloseHandle(stProcessInfo.hThread);
}
}
else
bRet = FALSE;
return bRet;
}
vmValidator.exe /session e:\crashes\2022_10_05\osc1.vvm
/session e:\crashes\2022_10_05\osc1.vvm
Load session file e:\crashes\2022_10_05\osc1.vvm
vmValidator.exe /minidump e:\crashes\2022_10_05\crash34.dmp
/minidump e:\crashes\2022_10_05\crash34.dmp
Load minidump e:\crashes\2022_10_05\crash34.dmp