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: [PATCH v2] RAII-fy make_cleanup_restore_current_thread & friends


On Wednesday, April 19 2017, Pedro Alves wrote:

> New in v2:
>   - v1 had missed deleting save_current_program_space / restore_program_space.
>
> After all the make_cleanup_restore_current_thread fixing, I thought
> I'd convert that and its relatives (which are all cleanups) to RAII
> classes.
>
> scoped_restore_current_pspace_and_thread was put in a separate file to
> avoid a circular dependency.
>
> Tested on x86-64 Fedora 23, native and gdbserver.

Nice cleanup, thanks for that.  I just have one comment.

>[...]
> diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
> index 4940ec2..09d5d5c 100644
> --- a/gdb/breakpoint.c
> +++ b/gdb/breakpoint.c
> @@ -80,6 +80,7 @@
>  #include "mi/mi-common.h"
>  #include "extension.h"
>  #include <algorithm>
> +#include "progspace-and-thread.h"
>  
>  /* Enums for exception-handling support.  */
>  enum exception_event_kind
> @@ -3066,7 +3067,7 @@ update_inserted_breakpoint_locations (void)
>       there was an error.  */
>    tmp_error_stream.puts ("Warning:\n");
>  
> -  struct cleanup *cleanups = save_current_space_and_thread ();
> +  scoped_restore_current_pspace_and_thread restore;

"restore" doesn't seem like a very good name; I think it's too generic.
How about naming the variable "restore_pspace_thread" or something like
that, like you did with other variables?

> [...]

Otherwise, LGTM.

Thanks,

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


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