From mboxrd@z Thu Jan 1 00:00:00 1970 From: Elena Zannoni To: insight@sourceware.cygnus.com Subject: [PATCH] Attach to process shortcut Date: Fri, 10 Mar 2000 10:54:00 -0000 Message-id: <14537.17645.479215.914197@kwikemart.cygnus.com> X-SW-Source: 2000-q1/msg00134.html I have committed the following: This patch allows control-a (on native platforms) to start the attach dialog. Elena Index: ChangeLog =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/ChangeLog,v retrieving revision 1.5 diff -c -r1.5 ChangeLog *** ChangeLog 2000/03/09 16:02:27 1.5 --- ChangeLog 2000/03/10 16:45:53 *************** *** 1,3 **** --- 1,18 ---- + 2000-03-10 Elena Zannoni + + * srcbar.tcl (do_attach): Just call gdbtk_attach_native. + * interface.tcl (gdbtk_attach_native): Renamed from do_attach method + and moved from srcbar.tcl. + * srctextwin.itb: Add keyboard accelerator for Attach command. + + * interface.tcl (gdbtk_attach_remote): New proc. Renamed from + gdb_attach_target, to better distinguish from the native version. + (run_executable): Change gdbtk_attach_target call into + gdbtk_attach_remote. + * srcbar.tcl (do_connect): Replace gdbtk_attach_target call with + gdbtk_attach_remote call. + * tclIndex: Rebuild. + 2000-03-09 Elena Zannoni From: James Ingham : Index: interface.tcl =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v retrieving revision 1.2 diff -c -r1.2 interface.tcl *** interface.tcl 2000/03/02 01:42:32 1.2 --- interface.tcl 2000/03/10 16:45:53 *************** *** 985,991 **** # Attach if {$gdb_target_name == "" || [pref get gdb/src/run_attach]} { ! if {[gdbtk_attach_target] == "ATTACH_CANCELED"} { return } } --- 985,991 ---- # Attach if {$gdb_target_name == "" || [pref get gdb/src/run_attach]} { ! if {[gdbtk_attach_remote] == "ATTACH_CANCELED"} { return } } *************** *** 1103,1109 **** } # ------------------------------------------------------------------ ! # PROC: gdbtk_attach_target - attach to the target # This proc returns the following status messages: # # ATTACH_ERROR: An error occurred connecting to target. --- 1103,1109 ---- } # ------------------------------------------------------------------ ! # PROC: gdbtk_attach_remote - attach to the target # This proc returns the following status messages: # # ATTACH_ERROR: An error occurred connecting to target. *************** *** 1112,1118 **** # ATTACH_TARGET_UNCHANGED: Successfully attached, target unchanged. # UNKNOWN: An unknown error occurred. # ------------------------------------------------------------------ ! proc gdbtk_attach_target {} { global gdb_loaded debug "Attaching...." --- 1112,1118 ---- # ATTACH_TARGET_UNCHANGED: Successfully attached, target unchanged. # UNKNOWN: An unknown error occurred. # ------------------------------------------------------------------ ! proc gdbtk_attach_remote {} { global gdb_loaded debug "Attaching...." *************** *** 1305,1310 **** --- 1305,1335 ---- # ------------------------------------------------------------------ proc gdbtk_run {} { run_executable + } + + # ------------------------------------------------------------------ + # PROC: gdbtk_attach_native: attach to a running target + # ------------------------------------------------------------------ + proc gdbtk_attach_native {} { + ManagedWin::open_dlg AttachDlg ;#-transient + + debug "ManagedWin got [AttachDlg::last_button] [AttachDlg::pid]" + + if {[AttachDlg::last_button]} { + set pid [AttachDlg::pid] + set symbol_file [AttachDlg::symbol_file] + if {![_open_file $symbol_file]} { + ManagedWin::open WarningDlg -transient \ + -message "Could not load symbols from $symbol_file." + return + } + + if {[catch {gdb_cmd "attach $pid"} result]} { + ManagedWin::open WarningDlg -transient \ + -message [list "Could not attach to $pid:\n$result"] + return + } + } } # ------------------------------------------------------------------ Index: srcbar.tcl =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/srcbar.tcl,v retrieving revision 1.1.1.1 diff -c -r1.1.1.1 srcbar.tcl *** srcbar.tcl 2000/02/07 00:19:42 1.1.1.1 --- srcbar.tcl 2000/03/10 16:45:53 *************** *** 469,495 **** # METHOD: do_attach: attach to a running target # ------------------------------------------------------------------ method do_attach {menu} { ! ManagedWin::open_dlg AttachDlg ;#-transient ! ! debug "ManagedWin got [AttachDlg::last_button] [AttachDlg::pid]" ! ! if {[AttachDlg::last_button]} { ! set pid [AttachDlg::pid] ! set symbol_file [AttachDlg::symbol_file] ! if {![_open_file $symbol_file]} { ! ManagedWin::open WarningDlg -transient \ ! -message "Could not load symbols from $symbol_file." ! return ! } ! ! if {[catch {gdb_cmd "attach $pid"} result]} { ! ManagedWin::open WarningDlg -transient \ ! -message [list "Could not attach to $pid:\n$result"] ! return ! } ! ! } ! } # ------------------------------------------------------------------ --- 469,475 ---- # METHOD: do_attach: attach to a running target # ------------------------------------------------------------------ method do_attach {menu} { ! gdbtk_attach_native } # ------------------------------------------------------------------ *************** *** 519,525 **** gdbtk_busy ! set result [gdbtk_attach_target] switch $result { ATTACH_ERROR { set successful 0 --- 499,505 ---- gdbtk_busy ! set result [gdbtk_attach_remote] switch $result { ATTACH_ERROR { set successful 0 *************** *** 554,560 **** } default { ! dbug E "Unhandled response from gdbtk_attach_target: \"$result\"" set successful 0 } } --- 534,540 ---- } default { ! dbug E "Unhandled response from gdbtk_attach_remote: \"$result\"" set successful 0 } } Index: srctextwin.itb =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/srctextwin.itb,v retrieving revision 1.2 diff -c -r1.2 srctextwin.itb *** srctextwin.itb 2000/02/24 03:12:58 1.2 --- srctextwin.itb 2000/03/10 16:45:54 *************** *** 578,583 **** --- 578,584 ---- bind_plain_key $win Control-p "$this do_key print" bind_plain_key $win Control-u "$this do_key debug; break" bind_plain_key $win Control-o [list $this do_key open] + bind_plain_key $win Control-a [list $this do_key attach] if {!$Browsing && [pref get gdb/control_target]} { # Ctrl+F5 is another accelerator for Run *************** *** 1973,1978 **** --- 1974,1980 ---- thread_list { catch {ManagedWin::open ProcessWin} } debug { catch {ManagedWin::open DebugWin} } kod { catch {ManagedWin::open KodWin} } + attach { catch {gdbtk_attach_native} } default { dbug E "Unknown key binding: \"$key\"" } Index: tclIndex =================================================================== RCS file: /cvs/src/src/gdb/gdbtk/library/tclIndex,v retrieving revision 1.1.1.1 diff -c -r1.1.1.1 tclIndex *** tclIndex 2000/02/07 00:19:42 1.1.1.1 --- tclIndex 2000/03/10 16:45:54 *************** *** 50,56 **** set auto_index(set_target_name) [list source [file join $dir interface.tcl]] set auto_index(set_target) [list source [file join $dir interface.tcl]] set auto_index(run_executable) [list source [file join $dir interface.tcl]] ! set auto_index(gdbtk_attach_target) [list source [file join $dir interface.tcl]] set auto_index(gdbtk_step) [list source [file join $dir interface.tcl]] set auto_index(gdbtk_next) [list source [file join $dir interface.tcl]] set auto_index(gdbtk_finish) [list source [file join $dir interface.tcl]] --- 50,56 ---- set auto_index(set_target_name) [list source [file join $dir interface.tcl]] set auto_index(set_target) [list source [file join $dir interface.tcl]] set auto_index(run_executable) [list source [file join $dir interface.tcl]] ! set auto_index(gdbtk_attach_remote) [list source [file join $dir interface.tcl]] set auto_index(gdbtk_step) [list source [file join $dir interface.tcl]] set auto_index(gdbtk_next) [list source [file join $dir interface.tcl]] set auto_index(gdbtk_finish) [list source [file join $dir interface.tcl]] *************** *** 63,68 **** --- 63,69 ---- set auto_index(gdbtk_stop_idle_callback) [list source [file join $dir interface.tcl]] set auto_index(gdbtk_detach) [list source [file join $dir interface.tcl]] set auto_index(gdbtk_run) [list source [file join $dir interface.tcl]] + set auto_index(gdbtk_attach_native) [list source [file join $dir interface.tcl]] set auto_index(set_baud) [list source [file join $dir interface.tcl]] set auto_index(do_state_hook) [list source [file join $dir interface.tcl]] set auto_index(disconnect) [list source [file join $dir interface.tcl]]