This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Use observers to report stop events.


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]