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
+ * library/srcmenubar.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.
# METHOD: do_detach: detach from a running target
# ------------------------------------------------------------------
method do_detach {menu} {
- ::disconnect
+ gdbtk_disconnect
gdbtk_idle
}
# in asynch mode if async is 1
# ------------------------------------------------------------------
method do_connect {menu {async 0}} {
- global file_done
- debug "do_connect: menu=$menu 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
+ set successful [gdbtk_connect $async]
if {$successful} {
$menu entryconfigure "Connect to target" -state disabled
$menu entryconfigure "Disconnect" -state disabled
}
- # Whenever we attach, we need to do an update
- gdbtk_update
+ # Make the menu reflect this change
+ ::update idletasks
}
# ------------------------------------------------------------------
# For now, these are the same, but they might be different...
#
- disconnect $async
+ gdbtk_disconnect $async
$menu entryconfigure "Connect to target" -state normal
$menu entryconfigure "Disconnect" -state disabled
}
}
- debug "Enable list is: $enable_list"
- foreach {type state} $enable_list {
- set members [menubar_menu_class_find $type]
- if {[llength $members]} {
- menubar_change_menu_state $state $members
- }
- }
+ set_class_state $enable_list
}
\f
####################################################################