From: Tom Tromey Date: Sat, 13 Jul 2019 22:15:30 +0000 (-0600) Subject: Change tui_check_register_values to be a method X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=63356bfda1603f67db865dceff5a3a4d028c9d5a;p=binutils-gdb.git Change tui_check_register_values to be a method This changes tui_check_register_values to be a method on tui_data_window. An additional check in tui_register_changed is needed, because TUI_DATA_WIN could be NULL at this point. 2019-08-20 Tom Tromey * tui/tui-regs.h (struct tui_data_window) : Declare. (tui_check_register_values): Don't declare. * tui/tui-regs.c (tui_data_window::check_register_values): Rename from tui_check_register_values. * tui/tui-hooks.c (tui_register_changed): Update. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 27fcb35a557..1e93dd0868a 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,12 @@ +2019-08-20 Tom Tromey + + * tui/tui-regs.h (struct tui_data_window) : + Declare. + (tui_check_register_values): Don't declare. + * tui/tui-regs.c (tui_data_window::check_register_values): Rename + from tui_check_register_values. + * tui/tui-hooks.c (tui_register_changed): Update. + 2019-08-20 Tom Tromey * tui/tui-regs.c (tui_reg_layout): Move later. diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c index 5cc90dd3b6c..2555da7f1ae 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -71,6 +71,9 @@ tui_register_changed (struct frame_info *frame, int regno) { struct frame_info *fi; + if (!tui_is_window_visible (DATA_WIN)) + return; + /* The frame of the register that was changed may differ from the selected frame, but we only want to show the register values of the selected frame. And even if the frames differ a register change made in one can still show @@ -80,7 +83,7 @@ tui_register_changed (struct frame_info *frame, int regno) if (tui_refreshing_registers == 0) { tui_refreshing_registers = 1; - tui_check_register_values (fi); + TUI_DATA_WIN->check_register_values (fi); tui_refreshing_registers = 0; } } @@ -152,7 +155,7 @@ tui_refresh_frame_and_register_information (int registers_too_p) && (frame_info_changed_p || registers_too_p)) { tui_refreshing_registers = 1; - tui_check_register_values (fi); + TUI_DATA_WIN->check_register_values (fi); tui_refreshing_registers = 0; } } diff --git a/gdb/tui/tui-regs.c b/gdb/tui/tui-regs.c index 147f57a13a2..cd343edc314 100644 --- a/gdb/tui/tui-regs.c +++ b/gdb/tui/tui-regs.c @@ -555,29 +555,24 @@ tui_data_window::refresh_window () given a particular frame. If the values have changed, they are updated with the new value and highlighted. */ void -tui_check_register_values (struct frame_info *frame) +tui_data_window::check_register_values (struct frame_info *frame) { - if (TUI_DATA_WIN != NULL - && TUI_DATA_WIN->is_visible ()) + if (regs_content.empty () && display_regs) + tui_show_registers (current_group); + else { - if (TUI_DATA_WIN->regs_content.empty () - && TUI_DATA_WIN->display_regs) - tui_show_registers (TUI_DATA_WIN->current_group); - else + for (auto &&data_item_win_ptr : regs_content) { - for (auto &&data_item_win_ptr : TUI_DATA_WIN->regs_content) - { - int was_hilighted; + int was_hilighted; - was_hilighted = data_item_win_ptr->highlight; + was_hilighted = data_item_win_ptr->highlight; - tui_get_register (frame, data_item_win_ptr.get (), - data_item_win_ptr->item_no, - &data_item_win_ptr->highlight); + tui_get_register (frame, data_item_win_ptr.get (), + data_item_win_ptr->item_no, + &data_item_win_ptr->highlight); - if (data_item_win_ptr->highlight || was_hilighted) - tui_display_register (data_item_win_ptr.get ()); - } + if (data_item_win_ptr->highlight || was_hilighted) + tui_display_register (data_item_win_ptr.get ()); } } } diff --git a/gdb/tui/tui-regs.h b/gdb/tui/tui-regs.h index b70d8df3620..01c2ea6dad4 100644 --- a/gdb/tui/tui-regs.h +++ b/gdb/tui/tui-regs.h @@ -100,6 +100,8 @@ struct tui_data_window : public tui_win_info started from. If nothing is displayed (-1) is returned. */ int display_registers_from_line (int line_no); + void check_register_values (struct frame_info *frame); + protected: void do_scroll_vertical (int num_to_scroll) override; @@ -120,7 +122,6 @@ protected: void rerender () override; }; -extern void tui_check_register_values (struct frame_info *); extern void tui_show_registers (struct reggroup *group); #endif /* TUI_TUI_REGS_H */