Cleanups and Exception handlers

Jan Kratochvil jan.kratochvil@redhat.com
Wed May 1 19:44:00 GMT 2013


On Wed, 01 May 2013 20:46:10 +0200, Phil Muldoon wrote:
> In the first example, where did the previously registered cleanup
> outside of the TRY_CATCH go? Was it discarded (or leaked?)

Right, leaked, forgotten in memory, a bug.  The new patch will assert those:
	[patch 2/2] Assert leftover cleanups in TRY_CATCH
	http://sourceware.org/ml/gdb-patches/2013-05/msg00008.html


> On 01/05/13 16:21, Jan Kratochvil wrote:
> > In such case cleanups are executed already inside the TRY_CATCH block at the
> > time the exception was thrown.  throw_exception contains:
> > 	do_cleanups (all_cleanups ());
> 
> Ok thanks, so in the case of cleanups entirely encapsulated in the
> TRY_CATCH block there is no need to do anything in the later exception
> handling block (the "if", after).

Right.


> > It seemed to me that there were too many TRY_CATCH blocks even in cases where
> > nothing can throw an exception.
> 
> This is because most (though I have no audited all of them) calls to
> ui_out_* use *_filtered function calls (at least when the output is
> directed to the CLI).  These can be interrupted from GDB and Python
> has to handle the resulting GDB generated keyboard interruption
> exception.  It's a massive pain in the neck. ;)

Oops, OK.


Jan



More information about the Gdb mailing list