How to get atexit hooks to run in the presence of execv?

R. Bernstein rocky at panix.com
Wed Jan 28 21:54:14 EST 2009


As a hobby I've been (re)writing a debugger. One of the commands,
"restart", works by calling an execv(). You may need to do this when
the program you are debugging is threaded or when one needs to ensure
that all program state is reinitialized.

Recently, I added remote debugging via TCP sockets. (Well, also FIFO's
as well but closing sockets before restarting is what's of concern.)

I noticed that execv in Python 2.5.2 doesn't arrange exit hooks to get
called. Should it?  Furthermore, I don't seen any atexit routine that
would let me initiate such finalization. Should there be one?

Or perhaps I'm missing something. Is there a way to arrange atexit
hooks to get run before issuing an execv-like call? 

Thanks.




More information about the Python-list mailing list