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

 

Launch an application with a specific startup directory and pass two arguments to the program at startup.

 

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

 

Attach to a specific process, specified by process id.

 

exceptionTracer.exe /process 1344

 

 /process 1344

 

 Attach to process 1344 and monitor that process.

 

 

Example 3

 

Attach to a specific process, specified by application name.

 

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

 

Attach to a specific process when it starts, specified by application name. The application will be started outside of Exception Tracer.

 

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.

 

 

Example 6

 

Create a minidump of a process when it throws an exception.

 

exceptionTracer.exe /process 1344 /miniDumpOnException /flagMiniDumpNormal /flagMiniDumpWithFullMemory /flagMiniDumpWithFullMemoryInfo /miniDumpDir e:\my-minidumps

 

 /process 1344

 

 Attach to process 1344.

 

 /miniDumpOnException

 

 Create a minidump when an exception is thrown (according to the exception filters in the settings).

 

 /flagMiniDumpNormal /flagMiniDumpWithFullMemory /flagMiniDumpWithFullMemoryInfo

 

 Flags specifying what information the minidump contains.

 

 /miniDumpDir e:\my-minidumps

 

 Save the minidump in e:\my-minidumps

 

 

Example 7

 

Create a minidump of a process without attaching Exception Tracer to the target process.

 

exceptionTracer.exe /createMinidumpProcess 1344 /createMiniDumpFileName "e:\my-minidumps\UnitTest48.dmp"

 

 /createMinidumpProcess 1344

 

 Create a minidump for process 1344

 

 /createMiniDumpFileName "e:\my-minidumps\UnitTest48.dmp"

 

 Save the minidump in the file e:\my-minidumps\UnitTest48.dmp