Consultor Eletrônico



Kbase P27476: How to attach to a process using DBX
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   5/11/2009
Status: Verified

GOAL:

How to attach to a process using AIX's DBX tool?

GOAL:

How to debug a running process on AIX?

FACT(s) (Environment):

UNIX
Progress/OpenEdge Product Family

FIX:

In some situations a process will not generate a core file appropriately on exit.
In situations where a specific series of actions is known to trigger errors which will lead to a process termination it may be possible to use dbx to get stack information from the point when the process died.

If the dbx debug executable exists on the system it may be possible to connect to the process in memory to gather the same information that might be outputted from a crash.

To connect DBX to a process perform the following:

1. Log into the system as root.

2. Launch the dbx command:


dbx -a PID# <path upto and including Progress executable> | tee dbx.out

PID# is the PID of the process to connect to.
<path upto and including Progress executable> is the full path to the Progress executable to connect to.

For example if researching a problem and the below was in the process list:

username 38744 1 2 17:02:55 - 0:00 /usr1/aix/dlc/bin/_mprosrv ibm91c

38744 is the PID and /usr1/aix/dlc/bin/_mprosrv is the full path to and including the executable

The following command would be issued:

dbx -a 38744 /usr1/aix/dlc/bin/_mprosrv | tee dbx.out

At this point repeat the sequence of actions which causes the abnormal termination.
When the termination occurs go to the session where dbx was started.

DBX will typically modify the prompt and will look similar to this:
Waiting to attach to process 38744 ...
Successfully attached to _progres.
Type 'help' for help.
reading symbolic information ...warning: no source compiled with -g
stopped in wait.wait at 0xd034b914 ($t1)
0xd034b914 (wait+0xe8) 80410014 lwz r2,0x14(r1)
(dbx)

At this point issue the where command:
(dbx) where

The output should appear on the screen and in the file designated by the tee command to the dbx.out file.
There are several ways to exit DBX

1) To exit DBX with a process termination issue the command:
q

2) To exit without a process termination issue the command:
detach

NOTE: If the process was already in the process of termination the detach will not alter that chain of events.