exit signal

Jim Barton jmb at patton.wpd.sgi.com
Wed Dec 19 02:39:42 AEST 1990


In article <9012160645.AA10200 at karron.med.nyu.edu>, Dan
Karron at UCBVAX.BERKELEY.EDU writes:
 
> How can I set a signal handler for a software exit() call ? I am
> looking to catch programs that exit via an exit(value) call, or fall
> off the end of the main procedure. I do not have control of the user code.

Your description is a little unclear of what you want - I don't know
what you mean by not having control of the user code. Guessing, the
easiest way to do this is to use dbx. Ask dbx to stop on a call to exit,
or even trap the exit system call. dbx will also catch any signals
posted to the program, so you can always catch the program when it is
going south.

> I want to save the window state of the application program. I have
> a macro to edit "exit(value)" to "Exit(value)", but that does not catch
> mains falling off the end, or exit() with no args.

I'm still a little confused about what you're looking for, but one thing
to try here might be a call to 'pause()'. This basically hangs the
program out into limbo until you kill it, so it should leave your window
up on the screen. Again, perhaps dbx is the best thing to use for this task.

By the way, you CAN use dbx to grab a running process and debug it - use
the -p option (and, as always, LATFM).

> 
> I tried SIGTERM, but that does not do what I want. What does it do ?
> 

The signal(2) man page can give you some help here. But playing with
signals won't help you debug your program - dbx is still the best bet.

-- Jim Barton
   Silicon Graphics Computer Systems
   jmb at sgi.com



More information about the Comp.sys.sgi mailing list