From patchwork Mon Jul 6 01:17:12 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Patrick Palka X-Patchwork-Id: 7524 Received: (qmail 16891 invoked by alias); 6 Jul 2015 01:17:25 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 16881 invoked by uid 89); 6 Jul 2015 01:17:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 X-HELO: mail-qk0-f178.google.com Received: from mail-qk0-f178.google.com (HELO mail-qk0-f178.google.com) (209.85.220.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Mon, 06 Jul 2015 01:17:24 +0000 Received: by qkbp125 with SMTP id p125so108059643qkb.2 for ; Sun, 05 Jul 2015 18:17:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=0NhNpi0JGjvvZshAwYPyzlLolKdME3Sv8/3xkyEp4GM=; b=egT5z+89zxpoQFL9KVSnZ7pxlWb4kNJ91ANoztpaTkzEJr4W0M5Op0MdPQDIQ9cqxR jln/gDX1qSIDuX8Ynkv2rKaFmjHW3VfTZr49ZbuC2ZEKGWuy9Ezx2OTF14joliT8KeGh eYvZUVELdUnGVOFvW8HzzmafHvdnFwpu2gJfUk8r5UavHXig7/LAUVILabXvKAm/BNRe X8hh8TX+bAYdbEqWR+xma22Kzxf/t9q9PtPi6RtakNX3rIfCu3653F8mak3t1VyHodF5 WUxHw2PdaVM/ZSu5UuxzFmx/hGZRsU69Qv/rn7lPvutNnANstlUzd8j+tIekfmKXtsQ5 Mdcg== X-Gm-Message-State: ALoCoQk4WiK0fBhvCM0HbC5N/5A+WI7PJVmSxVzrYHNNq2Q1NPYFAjTetAKoC8aaXiKVCowG0gIq X-Received: by 10.140.135.80 with SMTP id 77mr73380504qhh.8.1436145441813; Sun, 05 Jul 2015 18:17:21 -0700 (PDT) Received: from localhost.localdomain (ool-4353acd8.dyn.optonline.net. [67.83.172.216]) by mx.google.com with ESMTPSA id p52sm8549889qge.25.2015.07.05.18.17.20 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sun, 05 Jul 2015 18:17:20 -0700 (PDT) From: Patrick Palka To: gdb-patches@sourceware.org Cc: Patrick Palka Subject: [PATCH] tui: replace deprecated_register_changed_hook with observer Date: Sun, 5 Jul 2015 21:17:12 -0400 Message-Id: <1436145432-6502-1-git-send-email-patrick@parcs.ath.cx> 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. [ I am not sure if the changes to the function tui_register_changed are correct. In particular, the inputted frame argument is now passed down to tui_check_data_values instead of the frame returned by get_selected_frame. The frame argument passed to each register_changed observer corresponds to the VALUE_FRAME_ID of the register being modified within a register assignment, e.g. the $rax in "print $rax = FOO". When would the frame corresponding to the VALUE_FRAME_ID of a register not be the currently selected frame? ] 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". Use it instead of calling get_selected_frame. (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. --- gdb/defs.h | 1 - gdb/interps.c | 1 - gdb/top.c | 5 ----- gdb/tui/tui-hooks.c | 16 +++++++--------- gdb/valops.c | 2 -- 5 files changed, 7 insertions(+), 18 deletions(-) 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..ccf0989 100644 --- a/gdb/tui/tui-hooks.c +++ b/gdb/tui/tui-hooks.c @@ -67,15 +67,12 @@ tui_new_objfile_hook (struct objfile* objfile) static int tui_refreshing_registers = 0; static void -tui_register_changed_hook (int regno) +tui_register_changed (struct frame_info *frame, int regno) { - struct frame_info *fi; - - fi = get_selected_frame (NULL); if (tui_refreshing_registers == 0) { tui_refreshing_registers = 1; - tui_check_data_values (fi); + tui_check_data_values (frame); tui_refreshing_registers = 0; } } @@ -226,6 +223,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 +251,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 +261,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 +276,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 66c63c1..c4ff032 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; }