Replace tui_restore_gdbout with scoped_restore
This patch replaces tui_restore_gdbout (a cleaup function) with a use of scoped_restore. This one is broken out into its own patch because it might slightly change the behavior of gdb: it saves and restores pagination_enabled, whereas the tui_restore_gdbout unconditionally set pagination_enabled to 1; and I think this warrants closer review. ChangeLog 2017-08-03 Tom Tromey <tom@tromey.com> * tui/tui-regs.c (tui_restore_gdbout): Remove. (tui_register_format): Use scoped_restore.
This commit is contained in:
parent
2ec845e758
commit
31b68d4ad7
|
@ -1,3 +1,8 @@
|
||||||
|
2017-08-03 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* tui/tui-regs.c (tui_restore_gdbout): Remove.
|
||||||
|
(tui_register_format): Use scoped_restore.
|
||||||
|
|
||||||
2017-08-03 Tom Tromey <tom@tromey.com>
|
2017-08-03 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* reverse.c (exec_direction_default): Remove.
|
* reverse.c (exec_direction_default): Remove.
|
||||||
|
|
|
@ -707,13 +707,6 @@ TUI command to control the register window."), tuicmd);
|
||||||
** STATIC LOCAL FUNCTIONS **
|
** STATIC LOCAL FUNCTIONS **
|
||||||
******************************************/
|
******************************************/
|
||||||
|
|
||||||
static void
|
|
||||||
tui_restore_gdbout (void *ui)
|
|
||||||
{
|
|
||||||
gdb_stdout = (struct ui_file*) ui;
|
|
||||||
pagination_enabled = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Get the register from the frame and return a printable
|
/* Get the register from the frame and return a printable
|
||||||
representation of it. */
|
representation of it. */
|
||||||
|
|
||||||
|
@ -721,17 +714,14 @@ static char *
|
||||||
tui_register_format (struct frame_info *frame, int regnum)
|
tui_register_format (struct frame_info *frame, int regnum)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (frame);
|
struct gdbarch *gdbarch = get_frame_arch (frame);
|
||||||
struct ui_file *old_stdout;
|
|
||||||
struct cleanup *cleanups;
|
|
||||||
char *p, *s;
|
|
||||||
char *ret;
|
|
||||||
|
|
||||||
string_file stream;
|
string_file stream;
|
||||||
|
|
||||||
pagination_enabled = 0;
|
scoped_restore save_pagination
|
||||||
old_stdout = gdb_stdout;
|
= make_scoped_restore (&pagination_enabled, 0);
|
||||||
gdb_stdout = &stream;
|
scoped_restore save_stdout
|
||||||
cleanups = make_cleanup (tui_restore_gdbout, (void*) old_stdout);
|
= make_scoped_restore (&gdb_stdout, &stream);
|
||||||
|
|
||||||
gdbarch_print_registers_info (gdbarch, &stream, frame, regnum, 1);
|
gdbarch_print_registers_info (gdbarch, &stream, frame, regnum, 1);
|
||||||
|
|
||||||
/* Remove the possible \n. */
|
/* Remove the possible \n. */
|
||||||
|
@ -740,11 +730,7 @@ tui_register_format (struct frame_info *frame, int regnum)
|
||||||
str.resize (str.size () - 1);
|
str.resize (str.size () - 1);
|
||||||
|
|
||||||
/* Expand tabs into spaces, since ncurses on MS-Windows doesn't. */
|
/* Expand tabs into spaces, since ncurses on MS-Windows doesn't. */
|
||||||
ret = tui_expand_tabs (str.c_str (), 0);
|
return tui_expand_tabs (str.c_str (), 0);
|
||||||
|
|
||||||
do_cleanups (cleanups);
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the register value from the given frame and format it for the
|
/* Get the register value from the given frame and format it for the
|
||||||
|
|
Loading…
Reference in New Issue