This is the mail archive of the
mailing list for the GDB project.
Re: [patch 2/2] Assert leftover cleanups in TRY_CATCH
- From: Tom Tromey <tromey at redhat dot com>
- To: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 06 May 2013 11:56:56 -0600
- Subject: Re: [patch 2/2] Assert leftover cleanups in TRY_CATCH
- References: <20130501165750 dot GA453 at host2 dot jankratochvil dot net>
>>>>> "Jan" == Jan Kratochvil <email@example.com> writes:
Jan> 2013-05-01 Jan Kratochvil <firstname.lastname@example.org>
Jan> * cleanups.c (restore_my_cleanups): New gdb_assert for SENTINEL_CLEANUP.
Thanks for doing this. I think it is a nice addition.
We could do this for all cleanup-creating functions, at least when using
GCC, if we didn't mind putting a declaration at the start of each such
#if ... gcc ..
#define CHECK_CLEANUP \
struct cleanup *__dummy ## __LINE__ \
__attribute__ ((cleanup (check_cleanup))) \
= get_checking_cleanup_pointer ();
This would call check_cleanup when the function exited normally, so we
could verify that the cleanup chain was properly reset.
I think it would be possible to automate adding this declaration in all
needed spots. I'm curious what you think about it.