This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[patch] [patch 2/2] Assert leftover cleanups in TRY_CATCH
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Joel Brobecker <brobecker at adacore dot com>
- Cc: Tom Tromey <tromey at redhat dot com>, gdb-patches at sourceware dot org
- Date: Tue, 7 May 2013 16:19:57 +0200
- Subject: [patch] [patch 2/2] Assert leftover cleanups in TRY_CATCH
- References: <20130501165750 dot GA453 at host2 dot jankratochvil dot net> <87obcoyot3 dot fsf at fleche dot redhat dot com> <20130507062305 dot GH5278 at adacore dot com>
On Tue, 07 May 2013 08:23:05 +0200, Joel Brobecker wrote:
> I agree. My only additional comment, after having hit this assertion,
> is that it seems a bit harsh to be doing an abort in this case.
> The problem showed up during a testsuite run, and so I would
> investigate it regardless. But I can imagine the same issue
> occurring during a real debugging session trying to chase a bug -
> I'd be pretty upset to see my session ended like that.
>
> Should we consider changing it into an internal_warning?
I forgot the direction GDB should not crash on recoverable issues.
Jan
gdb/
2013-05-07 Jan Kratochvil <jan.kratochvil@redhat.com>
* cleanups.c (restore_my_cleanups): Replace gdb_assert by
internal_warning.
diff --git a/gdb/cleanups.c b/gdb/cleanups.c
index 02db9f5..1b5d973 100644
--- a/gdb/cleanups.c
+++ b/gdb/cleanups.c
@@ -261,7 +261,10 @@ save_final_cleanups (void)
static void
restore_my_cleanups (struct cleanup **pmy_chain, struct cleanup *chain)
{
- gdb_assert (*pmy_chain == SENTINEL_CLEANUP);
+ if (*pmy_chain != SENTINEL_CLEANUP)
+ internal_warning (__FILE__, __LINE__,
+ _("restore_my_cleanups has found a stale cleanup"));
+
*pmy_chain = chain;
}