From mboxrd@z Thu Jan 1 00:00:00 1970 From: Andrew Cagney To: gdb-patches@sources.redhat.com Subject: [rfc] Return old cleanup when doing a restore_cleanups() Date: Mon, 13 Aug 2001 12:28:00 -0000 Message-id: <3B782A6A.2050207@cygnus.com> X-SW-Source: 2001-08/msg00143.html Hello, The attached patch tweeks the restore_cleanups() family of functions so that the old cleanup is returned. In theory, that returned cleanup should be NULL (since the cleanup chain will have been drained just prior to the restore_cleanups() call). In reality, I'm not too sure. I'd like to find out what the old chain was so I can add an assert to certain callers (e.g. catch_errors()). I guess the alternative is to just stick the assert in restore_cleanups() and see what breaks. Thoughts? Preference? Andrew Ref: top.c:catch_errors() /* FIXME: cagney/1999-11-05: A correct FUNC implementation will clean things up (restoring the cleanup chain) to the state they were just prior to the call. Unfortunately, many FUNC's are not that well behaved. This could be fixed by adding either a do_cleanups call (to cover the problem) or an assertion check to detect bad FUNCs code. */ /* Restore the cleanup chain and error/quit messages to their original states. */ restore_cleanups (saved_cleanup_chain);