This is the mail archive of the gdb@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: Thread bound variable objects [was: Re: MI non-stop mode spec]


On Monday 24 March 2008 07:02:48 Nick Roberts wrote:
>  > > + ? do_cleanups (old_cleanups);
>  > > + 
>  > > ? ? return NULL;
>  > > ? }
>  > 
>  > I think the use of cleanups above is wrong. You basically have:
>  > 
>  > 	struct cleanups *old_cleanups = NULL;
>  > 	if (whatever)
>  > 		old_cleanups = ...
>  > 	do_cleanups (old_cleanups);
>  > 
>  > so, if 'whatever' evaluates to false, all cleanups, including those set
>  > in parent, will be executed.
> 
> OK, it should be:
> 
>   +  if (old_cleanups != NULL)
>   +    do_cleanups (old_cleanups);

I think that's also wrong. In the event that no cleanups were installed
before calling this function, this code will fail to run the
cleanups installed by this function. In the event that a cleanup
should be really installed conditionally, the right code is:

	struct cleanups *back_to  = make_cleanup (null_cleanup, NULL);

	if (...)
		make_cleanup ();

	do_cleanups (back_to);

>  > That's what we get for using a language that does not have exceptions
>  > and proper destructors. I'll fix this too.
> 
> I see now from the ChangeLog that you've committed your own change without
> posting to the list first or explaining what it does.

Sorry, no:
1. I've checked in two changes, not one.
2. Both are posted to gdb-patches.
3. Both are general cleanups, and don't implement anything that your patch
tries to implement.

> My patch does two things:
> 
> 1) It stops a variable object from being considered automatically out of
>    scope when the selected thread changes.
> 2) It associates a thread-id field with the variable object so that the
>    front end can organise the display of watch expressions accordingly.
> 
> AFAICS your patch does neither of these.  Could you please say what it
> does do?

Please see my gdb-patches posts.

- Volodya


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