Please enable JavaScript to view this site.

Exception Tracer Help

Navigation: Command Line Interface

Command Line Examples

Scroll Prev Top Next More

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 exceptionTracer.exe. You will need to provide the full path to exceptionTracer.exe, or add the path to exceptionTracer install directory to your $PATH.

 

32 bit application monitoring: exceptionTracer.exe

64 bit application monitoring: exceptionTracer_x64.exe

 

 

Example 1

 

exceptionTracer.exe /exe e:\om\c\test\release\test.exe /dir e:\om\c\test\release /args "-add 3 4"

 

 /exe 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

 

 

Example 2

 

exceptionTracer.exe /process 1344

 

 /process 1344

 

 Attach to process 1344 and monitor that process.

 

 

Example 3

 

exceptionTracer.exe /processName myprocess.exe

 

 /processName myprocess.exe

 

 Attach to process myprocess.exe and monitor that process.

 

 Caution: If there are multiple processes name myprocess.exe the first one found when enumerating the process list is the one that is used. For situations like this we recommend using /process instead.

 

 

Example 4

 

Launching ExceptionTracer from your own code to monitor a process you've just started. The arguments are the same as for Example 2.

 

int attachExceptionTracerToRunningProcess(DWORD         processId,          // process id to monitor
                                          const TCHAR   *dir)               // startup dir, can be NULL
{
   CString      exceptionTracer;
   int          bRet;
 
   exceptionTracer = getExceptionTracerPath(dir);
   if (GetFileAttributes(exceptionTracer) != 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 *)exceptionTracer, 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;
}

 

 

Example 5

 

exceptionTracer.exe /waitForProcess myprocess.exe

 

 /waitForProcess myprocess.exe

 

 Wait for myprocess.exe to start then attach to myprocess.exe and monitor that process.

 

 Caution: If a process called myprocess.exe is already running exceptionTracer will monitor that process.