HPE Community read-only access December 15, 2018
This is a maintenance upgrade. You will be able to read articles and posts, but not post or reply.
Hours:
Dec 15, 4:00 am to 10:00 am UTC
Dec 14, 10:00 pm CST to Dec 15, 4:00 am CST
Dec 14, 8:00 pm PST to Dec 15, 2:00 am PST
Operating System - OpenVMS
cancel
Showing results for 
Search instead for 
Did you mean: 

Debugging a child process created using vfork() and execv()

 
Shreesha Hebbar
Occasional Contributor

Debugging a child process created using vfork() and execv()

Can a child process created using calls to vfork() and execv() be debugged via VMS debugger? I have tried depositing the debug image in execv call.
1 REPLY
John Gillings
Honored Contributor

Re: Debugging a child process created using vfork() and execv()

Shreesha,

Yes, it should be possible. You need to make sure DBG$INPUT and DBG$OUTPUT point somewhere sensible.

If you have an X-Server you should be able to direct DBG$DECW$DISPLAY to a valid display, which should then fire up the DECwindows debugger on your X-server when the image is activated. Probably the easiest mechanism is to define a group logical name. For example:

$ SET DISPLAY/CREATE/NODE=xserver/TRANSPORT=tcpip
$ DEFINE/GROUP DBG$DECW$DISPLAY 'F$TRNLNM("DECW$DISPLAY")'
$ RUN yourprogram

If you don't have an X server, get yourself two terminal windows. Find the name of one terminal (assume TNA123:) and issue a "WAIT 10" command to make the owner process dormant for a while. Now from the other terminal:

$ DEFINE/GROUP DBG$INPUT TNA123:
$ DEFINE/GROUP DBG$OUTPUT TNA123:
$ SET PROCESS/PRIV=SHARE
$ RUN your-program

When the subprocess starts an image linked /DEBUG, it should talk to the dormant terminal. Note you need SHARE privilege, and you need to be careful if you have multiple subprocesses as they will all try to use the same terminal for debugger input and output.

Don't forget to DEASSIGN the group logical names.

yet another possibility... use the "kept" debugger and CONNECT to your child process.

Run your program and let the subprocess start.

From another terminal:

$ DEBUG/KEEP
DBG> CONNECT childprocess

This may need some code to make the child wait to be debugged. See debugger manual for more detail.

A crucible of informative mistakes