This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] Use observers to report stop events.
- From: Daniel Jacobowitz <drow at false dot org>
- To: Vladimir Prus <vladimir at codesourcery dot com>
- Cc: Joel Brobecker <brobecker at adacore dot com>, gdb-patches at sources dot redhat dot com
- Date: Thu, 1 May 2008 15:57:58 -0400
- Subject: Re: [RFA] Use observers to report stop events.
- References: <200804112145.58456.vladimir@codesourcery.com> <20080429031411.GB28505@adacore.com> <200804292210.31614.vladimir@codesourcery.com>
On Tue, Apr 29, 2008 at 10:10:30PM +0400, Vladimir Prus wrote:
> Here are 3 independent bits.
>
> 1. Introduce the make_cleanup_restore_integer function. You're right
> that it can lead to bad results if one discards this cleanup, but then
> one should be careful with discarding cleanups anyway.
This patch looks fine except that ...
> 2. Modify the normal_stop observer not to fire in some cases. One
> case is when doing function call -- we don't announce the stop in CLI
> and for similar reason we don't have observer to be called. Also,
> for the benefit of next patch, we want the call to observer to
> be delayed until we print function return value, if we're doing finish.
... unless I'm mistaken you have exactly the memory leak Joel warned
about, since finish_command discards continuations.
Am I correct that the cleanup for finish_command is never supposed to
survive the function returning? It's run on error and discarded on
normal return. So you could put the closure in a local variable,
maybe.
struct foo_closure my_closure = { &my_global, my_global };
make_cleanup (restore_integer, &my_closure);
--
Daniel Jacobowitz
CodeSourcery