Attaching to a remote running process

Note: When you are debugging a WebSphere Application Server Enterprise Edition Series or OS/390 program, the Load Program dialog and the Attach menu item are not applicable.

ngjava.gif (225 bytes)Important: For interpreted Java programs, you must attach to a running Java Virtual Machine (JVM). See the related topic below on how to attach to a running JVM.

You can attach the debugger to a process running on a remote system either by using the Attach dialog or from a command line by using the -a option of the idebug command. See the related topic below on when to attach to a running process.

To attach the debugger to a running process from a command line:

  1. On the remote system, start the debug engine using the irmtdbgc command. If you specify the -qport option, take note of it. You will need it later. The default port is 8000.
  2. On the local system, enter the following command:
    idebug -qhost=<remote_host> [-qport=<host_port>][-qlang=<dominant language>] -a<process_id>

where <remote_host> is the the TCP/IP name or address of the remote system, and <process_id> is a valid process id on the remote system.

Important: Do not attach to operating system processes or to the debugger's own processes. Attaching to such processes can cause unpredictable results.

To attach the debugger to a running process on a remote system with the Attach dialog:

  1. Select File > Attach or issue idebug -a to invoke the Attach dialog.
  2. Select the Compiled tab.
  3. Select the Remote radio button. Make sure you have already started the engine. Enter the host name and port number where the engine is listening.
  4. Select the dominant language of the program.
  5. Optionally, enter the full path name to the executable associated with the process you want to attach, in the Process Path field.
  6. If you do not know the Process ID of the process you want to attach to, click Get Process List. The Process List dialog provides a list of the processes running on the machine entered in the Process Path field. Select a process from the list and click OK to close the Process List dialog.
    or
    If you know the Process ID, click the Enter Process ID radio button and enter the Process ID in the Process ID field.
  7. Click Use program profile if you want to use this feature.
  8. Click Attach to attach to the process and close the Attach dialog.

ngaix.gif (1051 bytes) The debugger detaches from the process on debugger exit. The Terminate button can be used to terminate an attached process. To detach without exiting the debugger, use the Detach button or select Debug> Detach from the menu bar.
ngwin.gif (1069 bytes) When you exit the debugger, any attached process is also terminated.

You cannot restart a program that you have attached to.

ngrelc.gif (533 bytes)
When to attach

ngrelt.gif (466 bytes)
ngaix.gif (1051 bytes)ngwin.gif (1069 bytes)Attaching to a local running process
ngjava.gif (225 bytes) Attaching to a running Java Virtual Machine

ngrelr.gif (548 bytes)
idebug command
ngaix.gif (1051 bytes)ngwin.gif (1069 bytes) irmtdbgc command