aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorPatrick Palka <patrick@parcs.ath.cx>2015-07-02 12:27:50 -0400
committerPatrick Palka <patrick@parcs.ath.cx>2015-07-08 14:44:30 -0400
commita9bd710f8777b5f4d6cbb9f5f14d6eb16f60c690 (patch)
treea3c9fb1dc7e9594ba8c834e94baf7e88e1cf0fb7 /gdb
parent328e7bfdde7267f5e4b971bc6dca7b82aef77661 (diff)
downloadbinutils-a9bd710f8777b5f4d6cbb9f5f14d6eb16f60c690.zip
binutils-a9bd710f8777b5f4d6cbb9f5f14d6eb16f60c690.tar.gz
binutils-a9bd710f8777b5f4d6cbb9f5f14d6eb16f60c690.tar.bz2
tui: replace deprecated_register_changed_hook with observer
This is a straightforward replacement of the TUI's use of the aforementioned hook with the register_changed observer. Since this was the only user of the hook, this patch also removes the hook. gdb/ChangeLog: * defs.h (deprecated_register_changed_hook): Remove prototype. * interps.c (clear_iterpreter_hooks): Remove reference to deprecated_register_changed_hook. * top.c (deprecated_register_changed_hook): Remove prototype. * valops.c (value_assign): Remove reference to deprecated_register_changed_hook. * tui/tui-hooks.c (tui_register_changed): Add parameter "frame". Add comment documenting the function. (tui_register_changed_observer): Define. (tui_install_hooks): Remove reference to deprecated_register_changed_hook. Set tui_register_changed_observer. (tui_remove_hooks): Remove reference to deprecated_register_changed_hook. Unset tui_register_changed_observer.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog18
-rw-r--r--gdb/defs.h1
-rw-r--r--gdb/interps.c1
-rw-r--r--gdb/top.c5
-rw-r--r--gdb/tui/tui-hooks.c18
-rw-r--r--gdb/valops.c2
6 files changed, 31 insertions, 14 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index b565dde..3bdb099 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,21 @@
+2015-07-08 Patrick Palka <patrick@parcs.ath.cx>
+
+ * defs.h (deprecated_register_changed_hook): Remove prototype.
+ * interps.c (clear_iterpreter_hooks): Remove reference to
+ deprecated_register_changed_hook.
+ * top.c (deprecated_register_changed_hook): Remove prototype.
+ * valops.c (value_assign): Remove reference to
+ deprecated_register_changed_hook.
+ * tui/tui-hooks.c (tui_register_changed): Add parameter "frame".
+ Add comment documenting the function.
+ (tui_register_changed_observer): Define.
+ (tui_install_hooks): Remove reference to
+ deprecated_register_changed_hook. Set
+ tui_register_changed_observer.
+ (tui_remove_hooks): Remove reference to
+ deprecated_register_changed_hook. Unset
+ tui_register_changed_observer.
+
2015-07-08 Jan Kratochvil <jan.kratochvil@redhat.com>
PR compile/18484
diff --git a/gdb/defs.h b/gdb/defs.h
index 32b08bb..a555da1 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -649,7 +649,6 @@ extern void (*deprecated_readline_begin_hook) (char *, ...)
ATTRIBUTE_FPTR_PRINTF_1;
extern char *(*deprecated_readline_hook) (const char *);
extern void (*deprecated_readline_end_hook) (void);
-extern void (*deprecated_register_changed_hook) (int regno);
extern void (*deprecated_context_hook) (int);
extern ptid_t (*deprecated_target_wait_hook) (ptid_t ptid,
struct target_waitstatus *status,
diff --git a/gdb/interps.c b/gdb/interps.c
index 4c1e6cc..d825e14 100644
--- a/gdb/interps.c
+++ b/gdb/interps.c
@@ -370,7 +370,6 @@ clear_interpreter_hooks (void)
deprecated_readline_begin_hook = 0;
deprecated_readline_hook = 0;
deprecated_readline_end_hook = 0;
- deprecated_register_changed_hook = 0;
deprecated_context_hook = 0;
deprecated_target_wait_hook = 0;
deprecated_call_command_hook = 0;
diff --git a/gdb/top.c b/gdb/top.c
index 01fddd2..1e30b1c 100644
--- a/gdb/top.c
+++ b/gdb/top.c
@@ -221,11 +221,6 @@ void (*deprecated_detach_hook) (void);
void (*deprecated_interactive_hook) (void);
-/* Tell the GUI someone changed the register REGNO. -1 means
- that the caller does not know which register changed or
- that several registers have changed (see value_assign). */
-void (*deprecated_register_changed_hook) (int regno);
-
/* Called when going to wait for the target. Usually allows the GUI
to run while waiting for target events. */
diff --git a/gdb/tui/tui-hooks.c b/gdb/tui/tui-hooks.c
index 0eb2f07..c885108 100644
--- a/gdb/tui/tui-hooks.c
+++ b/gdb/tui/tui-hooks.c
@@ -66,11 +66,18 @@ tui_new_objfile_hook (struct objfile* objfile)
/* Prevent recursion of deprecated_register_changed_hook(). */
static int tui_refreshing_registers = 0;
+/* Observer for the register_changed notification. */
+
static void
-tui_register_changed_hook (int regno)
+tui_register_changed (struct frame_info *frame, int regno)
{
struct frame_info *fi;
+ /* 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
+ up in the other. So we always use the selected frame here, and ignore
+ FRAME. */
fi = get_selected_frame (NULL);
if (tui_refreshing_registers == 0)
{
@@ -226,6 +233,7 @@ static struct observer *tui_inferior_exit_observer;
static struct observer *tui_about_to_proceed_observer;
static struct observer *tui_before_prompt_observer;
static struct observer *tui_normal_stop_observer;
+static struct observer *tui_register_changed_observer;
/* Install the TUI specific hooks. */
void
@@ -253,8 +261,8 @@ tui_install_hooks (void)
= observer_attach_before_prompt (tui_before_prompt);
tui_normal_stop_observer
= observer_attach_normal_stop (tui_normal_stop);
-
- deprecated_register_changed_hook = tui_register_changed_hook;
+ tui_register_changed_observer
+ = observer_attach_register_changed (tui_register_changed);
}
/* Remove the TUI specific hooks. */
@@ -263,8 +271,6 @@ tui_remove_hooks (void)
{
deprecated_print_frame_info_listing_hook = 0;
deprecated_query_hook = 0;
- deprecated_register_changed_hook = 0;
-
/* Remove our observers. */
observer_detach_breakpoint_created (tui_bp_created_observer);
tui_bp_created_observer = NULL;
@@ -280,6 +286,8 @@ tui_remove_hooks (void)
tui_before_prompt_observer = NULL;
observer_detach_normal_stop (tui_normal_stop_observer);
tui_normal_stop_observer = NULL;
+ observer_detach_register_changed (tui_register_changed_observer);
+ tui_register_changed_observer = NULL;
}
void _initialize_tui_hooks (void);
diff --git a/gdb/valops.c b/gdb/valops.c
index 50082c9..403e088 100644
--- a/gdb/valops.c
+++ b/gdb/valops.c
@@ -1170,8 +1170,6 @@ value_assign (struct value *toval, struct value *fromval)
}
observer_notify_register_changed (frame, value_reg);
- if (deprecated_register_changed_hook)
- deprecated_register_changed_hook (-1);
break;
}