What does winopen(3G) do?

Dave Ciemiewicz ciemo at bananapc.wpd.sgi.com
Thu May 31 08:58:33 AEST 1990


In article <May.29.20.11.19.1990.700 at genesis.rutgers.edu>,
broderic at genesis.rutgers.edu (Alfred J. Broderick) writes:
> 
> It seems that all programs that use winopen(3G) (including `wsh`)
> run in the background but do not show up in the when you type `jobs`.  
> How does this work?  Is there any way to debug programs that use
> winopen with `edge`?  Whenever I try to use `edge` to debug a program
> that uses winopen, my program runs to completion before edge is able
> to do a "stop at".
> 
> Any help and explainations will be appreciated.
> 
> Alfred Broderick
> broderic at topaz.rutgers.edu
> -- 
> Alfred++

winopen() forks a copy of the program in such a way that program is
backgrounded.  By default, dbx/edge do not stop on the fork system
call.

Solution 1
----------
There is a mode in dbx/edge to force this adding the forked
child process to your process pool,

	set $promptonfork=2

You can then click on the newly created child process in the edge
window and hit debug to select the child process for debugging.

Solution 2
----------
Another approach is to force a GL program.  To do this, use the
foreground(3G) call.  You might #ifdef DEBUG your code so the
foreground call is called when you are debugging.  This will prevent
the fork and make it easier to debug your app.

Solution 3
----------
A trick for debugging GL apps while in dbx/edge, do the following sequence
of steps in dbx or the edge command (dbx) window:

	stop in main
	run
	ccall foreground()
	cont

This manual sequence is equivalent ot hardcoding the foreground(3G) call in
your code.  If you run your code more than once in the the same debugging
session, doing "stop in main" is unnecessary.

I have used all three of these techniques and find the second one the easiest
to deal with though the third solution is useful in a pinch compared the 
first solution I offer.

						--- Ciemo



More information about the Comp.sys.sgi mailing list