OSDN Git Service

2000-10-13 Fernando Nasser <fnasser@cygnus.com>
authorfnasser <fnasser>
Mon, 23 Oct 2000 21:39:28 +0000 (21:39 +0000)
committerfnasser <fnasser>
Mon, 23 Oct 2000 21:39:28 +0000 (21:39 +0000)
        With Steven Johnson <sbjohnson@ozemail.com.au>
        This change fixes part of the possible scenarios where a race condition
        would cause core dumps if there were commands changing registers or
        other target resources in a startup script.
        The remaining scenarios are fixed by a patch to generic.gdbtk.c
        * interface.tcl (gdbtk_update_safe): New function. Like gdbtk_update
        but does nothing if target is running.
        (gdbtk_register_changed): Call the above safe version.
        (gdbtk_memory_changed): Likewise.

gdb/gdbtk/library/ChangeLog
gdb/gdbtk/library/interface.tcl

index 29d034a..4eb8ec0 100644 (file)
@@ -1,3 +1,15 @@
+2000-10-13  Fernando Nasser  <fnasser@cygnus.com>
+
+       With Steven Johnson <sbjohnson@ozemail.com.au>
+       This change fixes part of the possible scenarios where a race condition
+       would cause core dumps if there were commands changing registers or
+       other target resources in a startup script.
+       The remaining scenarios are fixed by a patch to generic.gdbtk.c
+       * interface.tcl (gdbtk_update_safe): New function. Like gdbtk_update
+       but does nothing if target is running.
+       (gdbtk_register_changed): Call the above safe version.
+       (gdbtk_memory_changed): Likewise.
+
 2000-10-11  Fernando Nasser  <fnasser@cygnus.com>
 
        * srctextwin.itb (build_popups): Fix typos that caused duplicate
index 248d1fe..1ab4b7f 100644 (file)
@@ -145,6 +145,27 @@ proc gdbtk_update {} {
 }
 
 # ------------------------------------------------------------------
+#   PROCEDURE:  gdbtk_update_safe - run all update hooks in a safe way
+#
+#          Use this procedure to force all widgets to update
+#          themselves. This hook is usually run after command
+#          that could change target state.
+#          Like gdbtk_update but safe to be used in "after idle"
+#          which is used in update hooks.
+# ------------------------------------------------------------------
+proc gdbtk_update_safe {} {
+  global gdb_running
+
+  # Fencepost: Do not update if we are running the target
+  # We get here because script commands may have changed memory or
+  # registers and "after idle" events registered as a consequence
+  # If we try to update while the target is running we are doomed.
+  if {!$gdb_running} {
+    gdbtk_update
+  }
+}
+
+# ------------------------------------------------------------------
 #   PROCEDURE: gdbtk_idle - run all idle hooks
 #
 #          Use this procedure to run all the gdb_idle_hook's,
@@ -548,7 +569,7 @@ proc gdbtk_tcl_display {action number {value {}}} {
 #         the user has changed the contents of a register.
 # ------------------------------------------------------------------
 proc gdbtk_register_changed {} {
-  after idle gdbtk_update
+  after idle gdbtk_update_safe
 }
 
 # ------------------------------------------------------------------
@@ -558,7 +579,7 @@ proc gdbtk_register_changed {} {
 #         the program's variables).
 # ------------------------------------------------------------------
 proc gdbtk_memory_changed {} {
-  after idle gdbtk_update
+  after idle gdbtk_update_safe
 }
 
 ####################################################################