[patch 2/2] Assert leftover cleanups in TRY_CATCH

Jan Kratochvil
2013-05-01T16:57:57Z

Hi,

as discussed in:
Re: Cleanups and Exception handlers
http://sourceware.org/ml/gdb/2013-05/msg00007.html
Message-ID: <20130501152116.GA7529@host2.jankratochvil.net>

this gdb_assert can be useful. Unfortunately there may be leftover
"regressions" due to it not caught by the testsuite.

Thanks,
Jan

gdb/
2013-05-01 Jan Kratochvil <jan.kratochvil@redhat.com>

* cleanups.c (restore_my_cleanups): New gdb_assert for SENTINEL_CLEANUP.

diff --git a/gdb/cleanups.c b/gdb/cleanups.c
index c403db7..02db9f5 100644
--- a/gdb/cleanups.c
+++ b/gdb/cleanups.c
@@ -261,6 +261,7 @@ save_final_cleanups (void)
static void
restore_my_cleanups (struct cleanup **pmy_chain, struct cleanup *chain)
{
+ gdb_assert (*pmy_chain == SENTINEL_CLEANUP);
*pmy_chain = chain;
}