Use RAII to save and restore scalars
authorTom Tromey <tom@tromey.com>
Fri, 23 Sep 2016 02:29:11 +0000 (20:29 -0600)
committerTom Tromey <tom@tromey.com>
Fri, 21 Oct 2016 20:17:31 +0000 (14:17 -0600)
commitb7b633e9b13fc5697af035f4504c9790c612a8c7
tree0da81b5f31738da5c2aa84819d709a66ef9d4583
parent9a1e3f003122c97d6e1822c472bcd37f59fb1a74
Use RAII to save and restore scalars

This patch replaces many (but not all) uses of
make_cleanup_restore_integer with a simple RAII-based template class.
It also removes the similar restore_execution_direction cleanup in
favor of this new class.  Subsequent patches will replace other
similar cleanups with this class.

The class is typically instantiated using make_scoped_restore.  This
allows for template argument deduction.

2016-10-21  Tom Tromey  <tom@tromey.com>

* common/scoped_restore.h: New file.
* utils.h: Include scoped_restore.h.
* top.c (execute_command_to_string): Use scoped_restore.
* python/python.c (python_interactive_command): Use
scoped_restore.
(python_command, execute_gdb_command): Likewise.
* printcmd.c (do_one_display): Use scoped_restore.
* mi/mi-main.c (exec_continue): Use scoped_restore.
* mi/mi-cmd-var.c (mi_cmd_var_assign): Use scoped_restore.
* linux-fork.c (checkpoint_command): Use scoped_restore.
* infrun.c (restore_execution_direction): Remove.
(fetch_inferior_event): Use scoped_restore.
* compile/compile.c (compile_file_command): Use
scoped_restore.
(compile_code_command, compile_print_command): Likewise.
* cli/cli-script.c (execute_user_command): Use
scoped_restore.
(while_command, if_command, script_from_file): Likewise.
* arm-tdep.c (arm_insert_single_step_breakpoint): Use
scoped_restore.
13 files changed:
gdb/ChangeLog
gdb/arm-tdep.c
gdb/cli/cli-script.c
gdb/common/scoped_restore.h [new file with mode: 0644]
gdb/compile/compile.c
gdb/infrun.c
gdb/linux-fork.c
gdb/mi/mi-cmd-var.c
gdb/mi/mi-main.c
gdb/printcmd.c
gdb/python/python.c
gdb/top.c
gdb/utils.h
This page took 0.035059 seconds and 4 git commands to generate.