- Main Page
- Modules
- Classes

- Search for |

# Pin Process API

## Functions

BOOL | LEVEL_PINCLIENT::PIN_IsProcessExiting ()
VOID | LEVEL_PINCLIENT::PIN_ExitProcess (INT32 exitCode)
INT | LEVEL_PINCLIENT::PIN_GetPid ()
VOID | LEVEL_PINCLIENT::PIN_ExitApplication (INT32 status)

## Detailed Description

These APIs provide information about the instrumented process. They are available in any thread, including any internal thread spawned by the tool.

## Function Documentation

VOID LEVEL_PINCLIENT::PIN_ExitApplication | ( | INT32 | status | ) |

| Terminate the current process after calling the relevant thread and process exit callbacks. This call behaves "as if" the application process itself had executed a process termination system call. It therefore does perform all the finalization actions Pin normally takes on application process exit, including calling registered thread and process fini-functions, unlike PIN_ExitProcess, which exits immediately.

This API may be called from an instrumentation callback function or an analysis routine. However, it should not be called from any FINI_CALLBACK or THREAD_FINI_CALLBACK routines. It may be called by an application thread or a tool internal thread (that was created via PIN_SpawnInternalThread).

Be aware, that when called from an internal thread, the calling thread will not exit until after the tool's fini callback returns. Therefore, to avoid deadlock, your fini callback should not wait for that internal thread to exit.

Parameters:

  `[in]` | status | The result argument to exit

Returns:
  This function does not return.

Note:
  The vm and pin client locks are obtained during the call of this API.

Availability:
  Mode: JIT
  O/S: Linux,Windows,BSD
  CPU: All

VOID LEVEL_PINCLIENT::PIN_ExitProcess | ( | INT32 | exitCode | ) |

| Terminate the current process immediately, without calling any thread or process fini callbacks that may be registered. (See PIN_ExitApplication, if you want fini callbacks to be called). This function should be used only for abnormal termination of the instrumented process. Normally, the process is terminated when Pin executes a process termination system call on behalf of the application.

Parameters:

  `[in]` | exitCode | exit code of the process to be reported to the operating system.

Returns:
  the function never returns.

Availability:
  Mode: JIT & Probe
  O/S: Linux, Windows & MacOS
  CPU: All

INT LEVEL_PINCLIENT::PIN_GetPid | ( |  | ) |

| Returns current process id

Availability:
  Mode: JIT & Probe
  O/S: Linux, Windows & MacOS
  CPU: All

BOOL LEVEL_PINCLIENT::PIN_IsProcessExiting | ( |  | ) |

| Check to see if the current process is about to exit. This function is useful when a tool creates its own threads via the PIN_SpawnInternalThread() function. In such a case, the tool's threads can periodically call PIN_IsProcessExiting() to see if the application is exiting. If so, the thread should either return or call the PIN_ExitThread() function as soon as possible.

Returns:
  TRUE, if the current process is exiting.

Availability:
  Mode: JIT
  O/S: All
  CPU: All