OSDN Git Service

2001-01-04 Fernando Nasser <fnasser@totem.toronto.redhat.com>
authorfnasser <fnasser>
Thu, 4 Jan 2001 16:36:47 +0000 (16:36 +0000)
committerfnasser <fnasser>
Thu, 4 Jan 2001 16:36:47 +0000 (16:36 +0000)
* library/interface.tcl (gdbtk_connect): New proc. Connects to ai
 remote target (code previously at library/gdbmenubar.itcl).
(disconnect): Rename to...
(gdbtk_disconnect): New name for proc disconnect.
* library/gdbmenubar.itcl (do_connect): Remove the code mentioned
above and call the new interface proc gdbtk_connect.
Also, call ::update idletasks after changing the state of the
menu entries.
(do_detach): Call gdbtk_disconnect, not ::disconnect (old name).
(do_disconnect): Call gdbtk_disconnect, not disconnect (old name).

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

index 1bca48b..a509b1d 100644 (file)
@@ -1,3 +1,16 @@
+2001-01-04  Fernando Nasser  <fnasser@totem.toronto.redhat.com>
+
+       * library/interface.tcl (gdbtk_connect): New proc. Connects to ai
+        remote target (code previously at library/gdbmenubar.itcl).
+       (disconnect): Rename to...
+       (gdbtk_disconnect): New name for proc disconnect.
+       * library/gdbmenubar.itcl (do_connect): Remove the code mentioned
+       above and call the new interface proc gdbtk_connect.
+       Also, call ::update idletasks after changing the state of the
+       menu entries.
+       (do_detach): Call gdbtk_disconnect, not ::disconnect (old name).
+       (do_disconnect): Call gdbtk_disconnect, not disconnect (old name).
+
 2001-01-03  Fernando Nasser  <fnasser@totem.toronto.redhat.com>
 
        * library/prefs.tcl (pref_set_defaults): Define gdb/src/top_control
index c00aea3..3323014 100644 (file)
@@ -1209,6 +1209,66 @@ proc gdbtk_attach_remote {} {
 }
 
 # ------------------------------------------------------------------
+# PROC:  gdbtk_connect: connect to a remote target 
+#                      in asynch mode if async is 1
+# ------------------------------------------------------------------
+proc gdbtk_connect {{async 0}} {
+  global file_done
+
+  debug "async=$async"
+
+  gdbtk_busy
+
+  set result [gdbtk_attach_remote]
+  switch $result {
+    ATTACH_ERROR {
+      set successful 0
+    }
+
+    ATTACH_TARGET_CHANGED {
+       if {[pref get gdb/load/check] && $file_done} {
+         set err [catch {gdb_cmd "compare-sections"} errTxt]
+         if {$err} {
+           set successful 0
+           tk_messageBox -title "Error" -message $errTxt \
+             -icon error -type ok
+           break
+         }
+       }
+
+       tk_messageBox -title "GDB" -message "Successfully connected" \
+         -icon info -type ok
+       set successful 1
+    }
+
+    ATTACH_CANCELED {
+       tk_messageBox -title "GDB" -message "Connection Canceled" -icon info \
+         -type ok
+       set successful 0
+    }
+
+    ATTACH_TARGET_UNCHANGED {
+       tk_messageBox -title "GDB" -message "Successfully connected" \
+         -icon info -type ok
+       set successful 1
+    }
+
+    default {
+       dbug E "Unhandled response from gdbtk_attach_remote: \"$result\""
+       set successful 0
+    }
+  }
+
+  gdbtk_idle
+
+  # Whenever we attach, we need to do an update
+  if {$successful} {
+    gdbtk_attached
+  }
+  return $successful
+}
+
+# ------------------------------------------------------------------
 #  PROC: gdbtk_step - step the target
 # ------------------------------------------------------------------
 proc gdbtk_step {} {
@@ -1407,9 +1467,9 @@ proc do_state_hook {varname ind op} {
 }
 
 # ------------------------------------------------------------------
-# PROC: disconnect -
+# PROC: gdbtk_disconnect -
 # ------------------------------------------------------------------
-proc disconnect {{async 0}} {
+proc gdbtk_disconnect {{async 0}} {
    global gdb_loaded gdb_target_changed
    catch {gdb_cmd "detach"}
    # force a new target command to do something