public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: "Andrew Burgess" <aburgess@broadcom.com>
To: insight@sourceware.org
Subject: [PATCH 2/2] Notice architecture changes even when the register window is not open.
Date: Thu, 05 Sep 2013 14:27:00 -0000	[thread overview]
Message-ID: <522894D1.3030209@broadcom.com> (raw)
In-Reply-To: <5228941F.8080601@broadcom.com>

The register cache can be accessed through the TCL proc "gdb_reginfo",
which can be called from anywhere, there's currently only one other
caller in "actiondlg.tcl", but more callers could easily be added.  I
believe that currently any caller to gdb_reginfo needs to (a) know if
they are accessing the reg-cache, and (b) if they are listen for arch
changed events and update the reg-cache.  I think this a bad situation
to be in as, the reg-cache would ideally be hidden from the user of
"gdb_reginfo", and secondly, we only really need to update the reg-cache
once per architecture change, not many times, which could happen if many
users are all trying to keep the reg-cache upto date.

Phew! So, the patch below moves the call to "gdb_reg_arch_changed" into
the top-level tcl event handler, we need to ensure that it gets called
before any of the event-handling windows see the architecture change
event as they might access the reg-cache.  I could in-theory have moved
the call to "gdb_reg_arch_changed" into the top-level window event
handler, I didn't do this for two reasons, (1) I didn't know if the top
level window always exists, though I suspect it does, but really (2) I
didn't know if there was any control on the order the windows receive
the events...

Anyway, let me know what you think, all feedback welcome.

Thanks,
Andrew

gdb/gdbtk/ChangeLog

2013-09-05  Andrew Burgess  <aburgess@broadcom.com>

	* library/interface.tcl (gdbtk_tcl_architecture_changed): Add call
	to gdb_reg_arch_changed.
	* library/regwin.itb (arch_changed): Remove call to
	gdb_reg_arch_changed.

Index: ./gdb/gdbtk/library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.60
diff -u -p -r1.60 interface.tcl
--- ./gdb/gdbtk/library/interface.tcl	9 Oct 2009 01:23:55 -0000	1.60
+++ ./gdb/gdbtk/library/interface.tcl	5 Sep 2013 14:19:53 -0000
@@ -1815,6 +1815,9 @@ proc initialize_gdbtk {} {
 # The architecture changed. Inform the UI.
 proc gdbtk_tcl_architecture_changed {} {
   set e [ArchChangedEvent \#auto]
+  # First perform global actions as a result of the architecture change.
+  gdb_reg_arch_changed $e 
+  # Now dispatch to all the other even handlers.
   GDBEventHandler::dispatch $e
   delete object $e
 }
Index: ./gdb/gdbtk/library/regwin.itb
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/regwin.itb,v
retrieving revision 1.30
diff -u -p -r1.30 regwin.itb
--- ./gdb/gdbtk/library/regwin.itb	25 May 2012 10:34:32 -0000	1.30
+++ ./gdb/gdbtk/library/regwin.itb	5 Sep 2013 14:19:53 -0000
@@ -932,9 +932,6 @@ itcl::body RegWin::_select_group {} {
 # ------------------------------------------------------------------
 itcl::body RegWin::arch_changed {event} {
 
-  # Update internal register caches
-  gdb_reg_arch_changed
-
   # Relayout the table
   _layout_table
 




  parent reply	other threads:[~2013-09-05 14:27 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-05 14:24 [PATCH 0/2] Memory corruption caused by failure to notice architecture change Andrew Burgess
2013-09-05 14:26 ` [PATCH 1/2] Add an assert that we're not overflowing the register cache Andrew Burgess
2013-09-05 18:55   ` Keith Seitz
2013-09-06  9:36     ` Andrew Burgess
2013-09-05 14:27 ` Andrew Burgess [this message]
2013-09-05 19:53   ` [PATCH 2/2] Notice architecture changes even when the register window is not open Keith Seitz
2013-09-06  9:21     ` Andrew Burgess
2013-09-06  9:40     ` Andrew Burgess

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=522894D1.3030209@broadcom.com \
    --to=aburgess@broadcom.com \
    --cc=insight@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).