## Attaching to a Process

Use a Symbian OS Attach to Process launch configuration to attach the debugger to an already running Symbian OS process or thread on a target device. This is useful for debugging DLLs where the main process is unknown or for servers running in RAM in a client-server relationship where the client relies on the presence of the server process to operate.

One common debugging DLL use case is when the developer doesn't know which process calls the DLL. This makes it difficult to debug the DLL because you doesn't know which process to attach to nor start. Carbide enables DLL debugging by simply attaching the DLL to any running process as long as the DLL is included in the Executables view.

You can also attach to a process in the Symbian OS Data view when debugging.

NOTE You cannot attach to a process running on the emulator. It must be a target device running the Symbian OS and the TRK debug agent.

When attempting to find a process the debugger uses the UID3 to locate the process.

#### Attaching to any Running Process

1. In the Executables view, click the Import an executable file icon () to add an executable to the Executables view for debugging.

   The executable added appears in the Project Explorer view under an Executables project. This group includes all executables listed in the Executables view that are not linked to any project in the workspace.

   Figure 1 - Executables list in Project Explorer view

   NOTE The executable must include symbolics in order for debugging to work.

2. Click Debug () to launch the New Configuration Launch Wizard.

Select the Symbian OS Attach to Process launch configuration option and fill in the requested information.

Figure 2 - Attach to Process launch configuration

3. Click Debug.

The Attach to Process dialog appears. Click a column title to sort the processes in ascending or descending order to help you locate a specific process or use the filter text box to show specific processes.

Figure 3 - Attach to Process window

4. Select a process, click OK.

In this example we've linked the prefs.dll program to the process BlackFlag.exe on the device. The Attach to Process dialog closes. Open the Symbian OS Data view to show the process and thread information.

NOTE Terminating an Attach to Process session actually kills the process on the device. This means you must restart the process on the device in order to attach to it again.

##### Related references

- Debug View
- Debug Window
- Symbian OS View
- Debugging DLLs with any Process