This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: RFC: lazily call save_current_space_and_thread
- From: Jan Kratochvil <jan dot kratochvil at redhat dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Sat, 5 Mar 2011 13:52:39 +0100
- Subject: Re: RFC: lazily call save_current_space_and_thread
- References: <m3k4geslx2.fsf@fleche.redhat.com>
On Fri, 04 Mar 2011 20:52:41 +0100, Tom Tromey wrote:
> + /* We lazily save the current program space. Saving the current
> + program space is reasonably expensive in the multi-inferior case,
> + and in many situations we don't need to do it. Comparing a
> + cleanup against NULL is usually forbidden, but in this case we
> + have already made a cleanup, so we know it is safe. */
> + struct cleanup *current_space_cleanup = NULL;
> +
[...]
> + if (current_space_cleanup == NULL)
> + current_space_cleanup = save_current_space_and_thread ();
save_current_space_and_thread - like any make_cleanup derivation - may return
NULL even for successfully pushed cleanup function. For example inside
TRY_CATCH, due to its save_cleanups.
GDB does need more C++.
Thanks,
Jan