diff options
author | Tom Tromey <tom@tromey.com> | 2017-09-23 15:34:30 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2017-09-25 19:54:07 -0600 |
commit | 9ac86b52da268147b2565e4920357432bb7a34c3 (patch) | |
tree | ecd744af89f932b6cad7bfcce62c28a91c33e85a /gdb/mi | |
parent | c0e383c63818baee1daf51b8fb1bae34d1e0597f (diff) | |
download | gdb-9ac86b52da268147b2565e4920357432bb7a34c3.zip gdb-9ac86b52da268147b2565e4920357432bb7a34c3.tar.gz gdb-9ac86b52da268147b2565e4920357432bb7a34c3.tar.bz2 |
Remove make_cleanup_regcache_xfree
This removes make_cleanup_regcache_xfree in favor of using
std::unique_ptr as the return type of frame_save_as_regcache.
gdb/ChangeLog
2017-09-25 Tom Tromey <tom@tromey.com>
* spu-tdep.c (spu2ppu_sniffer): Update.
* regcache.h (make_cleanup_regcache_xfree): Don't declare.
* regcache.c (do_regcache_xfree, make_cleanup_regcache_xfree):
Remove.
* ppc-linux-tdep.c (ppu2spu_sniffer): Update.
* mi/mi-main.c (mi_cmd_data_list_changed_registers): Update.
* frame.h (frame_save_as_regcache): Return std::unique_ptr.
* frame.c (frame_save_as_regcache): Return std::unique_ptr.
(frame_pop): Update.
Diffstat (limited to 'gdb/mi')
-rw-r--r-- | gdb/mi/mi-main.c | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/gdb/mi/mi-main.c b/gdb/mi/mi-main.c index c06ef18..5e71949 100644 --- a/gdb/mi/mi-main.c +++ b/gdb/mi/mi-main.c @@ -1031,22 +1031,20 @@ mi_cmd_data_list_register_names (const char *command, char **argv, int argc) void mi_cmd_data_list_changed_registers (const char *command, char **argv, int argc) { - static struct regcache *this_regs = NULL; + static std::unique_ptr<struct regcache> this_regs; struct ui_out *uiout = current_uiout; - struct regcache *prev_regs; + std::unique_ptr<struct regcache> prev_regs; struct gdbarch *gdbarch; int regnum, numregs, changed; int i; - struct cleanup *cleanup; /* The last time we visited this function, the current frame's register contents were saved in THIS_REGS. Move THIS_REGS over to PREV_REGS, and refresh THIS_REGS with the now-current register contents. */ - prev_regs = this_regs; + prev_regs = std::move (this_regs); this_regs = frame_save_as_regcache (get_selected_frame (NULL)); - cleanup = make_cleanup_regcache_xfree (prev_regs); /* Note that the test for a valid register must include checking the gdbarch_register_name because gdbarch_num_regs may be allocated @@ -1055,7 +1053,7 @@ mi_cmd_data_list_changed_registers (const char *command, char **argv, int argc) will change depending upon the particular processor being debugged. */ - gdbarch = get_regcache_arch (this_regs); + gdbarch = get_regcache_arch (this_regs.get ()); numregs = gdbarch_num_regs (gdbarch) + gdbarch_num_pseudo_regs (gdbarch); ui_out_emit_list list_emitter (uiout, "changed-registers"); @@ -1070,7 +1068,8 @@ mi_cmd_data_list_changed_registers (const char *command, char **argv, int argc) if (gdbarch_register_name (gdbarch, regnum) == NULL || *(gdbarch_register_name (gdbarch, regnum)) == '\0') continue; - changed = register_changed_p (regnum, prev_regs, this_regs); + changed = register_changed_p (regnum, prev_regs.get (), + this_regs.get ()); if (changed < 0) error (_("-data-list-changed-registers: " "Unable to read register contents.")); @@ -1089,7 +1088,8 @@ mi_cmd_data_list_changed_registers (const char *command, char **argv, int argc) && gdbarch_register_name (gdbarch, regnum) != NULL && *gdbarch_register_name (gdbarch, regnum) != '\000') { - changed = register_changed_p (regnum, prev_regs, this_regs); + changed = register_changed_p (regnum, prev_regs.get (), + this_regs.get ()); if (changed < 0) error (_("-data-list-changed-registers: " "Unable to read register contents.")); @@ -1099,7 +1099,6 @@ mi_cmd_data_list_changed_registers (const char *command, char **argv, int argc) else error (_("bad register number")); } - do_cleanups (cleanup); } static int |