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, 5 Jun 2008 11:41:11 -0400
- Subject: Re: [RFA] Use observers to report stop events.
- References: <200804112145.58456.vladimir@codesourcery.com> <200804292210.31614.vladimir@codesourcery.com> <20080501195758.GL22218@caradoc.them.org> <200805041225.54416.vladimir@codesourcery.com>
On Sun, May 04, 2008 at 12:25:54PM +0400, Vladimir Prus wrote:
> Are those two new patches, together with the previously posted one
> (changing stop_observer not to always fire) OK?
For this patch, if an error occurs during proceed (i.e. if the
cleanup restoring suppress_normal_stop_observer is run), will the
normal_stop observer ever be called? Is that a problem?
> + If the argument is pointer to allocated memory, then you need to
is a pointer
> struct cleanup *
> -make_my_cleanup (struct cleanup **pmy_chain, make_cleanup_ftype *function,
> - void *arg)
> +make_cleanup_restore_integer (int *variable, int value)
> +{
> + struct restore_integer_closure *c =
> + xmalloc (sizeof (struct restore_integer_closure));
> + struct cleanup *cleanup = make_cleanup (restore_integer, (void *) c);
> + c->variable = variable;
> + c->value = *variable;
> + *variable = value;
> + cleanup_chain->free_arg = xfree;
> + return cleanup;
> +}
Could you use make_my_cleanup2 here to avoid poking around in
cleanup_chain, please?
Also, the only thing value is used for is to set *variable. I
suggest not setting the variable in a function named
"make_cleanup_restore_integer", which doesn't say anything about
setting. So I would prefer this:
old_cleanup = make_cleanup_restore_integer (some_var);
some_var = 0;
> * infrun.c (finish_command): Don't pass cleanup
> to continuation.
> (finish_command_continuation): Don't grab cleanup from
> the passed data, as we don't use, and cannot, use it anyway.
OK.
--
Daniel Jacobowitz
CodeSourcery