This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Fix ada inferior-data cleanup
- From: Pedro Alves <palves at redhat dot com>
- To: Yao Qi <yao at codesourcery dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Mon, 28 Oct 2013 14:27:01 +0000
- Subject: Re: [PATCH] Fix ada inferior-data cleanup
- Authentication-results: sourceware.org; auth=none
- References: <1382759789-777-1-git-send-email-yao at codesourcery dot com> <526E4A3D dot 60503 at redhat dot com> <526E5702 dot 8070104 at codesourcery dot com>
On 10/28/2013 12:22 PM, Yao Qi wrote:
> On 10/28/2013 07:27 PM, Pedro Alves wrote:
>>> 'struct ada_inferior_data' is registered to per-inferior-data with
>>>> cleanup ada_inferior_data_cleanup, which means the data will be
>>>> destroyed when the inferior exits.
>> That's not correct. The registry data cleanups are only ran when
>> the inferior object is destroyed, IOW, when the inferior is
>> removed/deleted (e.g, with "remove-inferiors"), not when the program
>> exits.
>>
>
> Is it a good idea to call clear_inferior_data when inferior exists (in
> exit_inferior_1)?
IMO, it's not, for it confuses two different lifetimes. It's quite
plausible to have data associated with the inferior object that should
be preserved across runs.
> These inferior_exit observer functions are duplicated to
> inferior_data_cleanup functions. WDYT?
There's really no reason for the code to be duplicated. For each
case, a helper that does the real work can be called from
wherever necessary, for instance.
--
Pedro Alves