From: "Martin M. Hunt" <hunt@redhat.com>
To: insight@sources.redhat.com
Subject: [patch] Run button fixes
Date: Thu, 10 Oct 2002 12:47:00 -0000 [thread overview]
Message-ID: <200210101246.02183.hunt@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 1380 bytes --]
I've checked in the attached patch that fixes some long-standing Run button
problems.
- Previously, Insight remembered the target name last used when debugging an
executable. It would then attempt to attach to that target the next time it
was run with the same executable. Unfortunately it did not remember the
target options (port number, etc) or set the baud rate. Those were saved as
global preferences, so often Insight failed to connect. This patch should fix
all these issues.
- With this patch the Run button is made busy (changes to stop sign) when
target command is issued. This makes it possible to cancel.
- When debugging a program, if you hit the Run button, it restarts
immediately. This patch instead puts up a dialog allowing you to confirm or
cancel restarting. This is consistent with the command line behavior.
--
Martin Hunt
GDB Engineer
Red Hat, Inc.
2002-10-10 Martin M. Hunt <hunt@redhat.com>
* library/session.tcl (save): Save target_cmd,
attach, load, run, and cont as session prefs.
(notice_file_change): Load in above session
prefs.
* library/interface.tcl (set_target): Set icons busy
before attempting target command and set back to idle after.
(run_executable): Return on ATTACH_ERROR.
(gdbtk_run): If run button is hit when a program
is currently being debugged, put up a dialog allowing
user to continue or cancel.
[-- Attachment #2: p --]
[-- Type: text/x-diff, Size: 3938 bytes --]
Index: gdbtk/library/session.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/session.tcl,v
retrieving revision 1.12
diff -u -r1.12 session.tcl
--- gdbtk/library/session.tcl 7 May 2002 05:11:09 -0000 1.12
+++ gdbtk/library/session.tcl 10 Oct 2002 03:52:14 -0000
@@ -171,7 +171,14 @@
set values(dirs) $gdb_source_path
set values(pwd) $gdb_current_directory
set values(target) $gdb_target_name
+ set values(target_cmd) $::gdb_target_cmd
+ # these prefs need to be made session-dependent
+ set values(run_attach) [pref get gdb/src/run_attach]
+ set values(run_load) [pref get gdb/src/run_load]
+ set values(run_run) [pref get gdb/src/run_run]
+ set values(run_cont) [pref get gdb/src/run_cont]
+
# Breakpoints.
set values(breakpoints) [_serialize_bps]
@@ -194,8 +201,6 @@
# the session, as returned by Session::list_names.
#
proc load {name} {
- global gdb_target_name
-
# gdb sessions are named after the executable.
set key gdb/session/$name
@@ -230,6 +235,12 @@
set values($k) [pref getd $key/$k]
}
+ # reset these back to their defaults
+ pref set gdb/src/run_attach 0
+ pref set gdb/src/run_load 0
+ pref set gdb/src/run_run 1
+ pref set gdb/src/run_cont 0
+
if {! [info exists values(executable)] || $values(executable) != $name} {
# No such session.
return
@@ -258,7 +269,17 @@
if {[info exists values(target)]} {
debug "Restoring Target: $values(target)"
set gdb_target_name $values(target)
- }
+ debug "Restoring Target_Cmd: $values(target_cmd)"
+ set ::gdb_target_cmd $values(target_cmd)
+ set_baud
+ }
+
+ if {[info exists values(run_attach)]} {
+ pref set gdb/src/run_attach $values(run_attach)
+ pref set gdb/src/run_load $values(run_load)
+ pref set gdb/src/run_run $values(run_run)
+ pref set gdb/src/run_cont $values(run_cont)
+ }
}
#
Index: gdbtk/library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.44
diff -u -r1.44 interface.tcl
--- gdbtk/library/interface.tcl 1 Aug 2002 01:19:02 -0000 1.44
+++ gdbtk/library/interface.tcl 10 Oct 2002 03:52:15 -0000
@@ -1075,8 +1075,8 @@
# ------------------------------------------------------------------
proc set_target {} {
global gdb_target_cmd gdb_target_changed gdb_pretty_name gdb_target_name
-# debug "gdb_target_changed=$gdb_target_changed gdb_target_cmd=\"$gdb_target_cmd\""
-# debug "gdb_target_name=$gdb_target_name"
+ #debug "gdb_target_changed=$gdb_target_changed gdb_target_cmd=\"$gdb_target_cmd\""
+ #debug "gdb_target_name=$gdb_target_name"
if {$gdb_target_cmd == "" && ![TargetSelection::native_debugging]} {
if {$gdb_target_name == ""} {
set prompt 1
@@ -1099,8 +1099,10 @@
update
catch {gdb_cmd "detach"}
debug "CONNECTING TO TARGET: $gdb_target_cmd"
+ gdbtk_busy
set err [catch {gdb_immediate "target $gdb_target_cmd"} msg ]
$srcWin set_status
+ gdbtk_idle
if {$err} {
if {[string first "Program not killed" $msg] != -1} {
@@ -1161,7 +1163,8 @@
# Attach
if {$gdb_target_name == "" || [pref get gdb/src/run_attach]} {
- if {[gdbtk_attach_remote] == "ATTACH_CANCELED"} {
+ set r [gdbtk_attach_remote]
+ if {$r == "ATTACH_CANCELED" || $r == "ATTACH_ERROR"} {
return
}
}
@@ -1548,6 +1551,14 @@
# PROC: gdbtk_run
# ------------------------------------------------------------------
proc gdbtk_run {} {
+ if {$::gdb_running == 1} {
+ set msg "A program is currently being debugged.\n"
+ append msg "Do you want to restart?"
+ if {![gdbtk_tcl_query $msg no]} {
+ # NO
+ return
+ }
+ }
run_executable
}
reply other threads:[~2002-10-10 19:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=200210101246.02183.hunt@redhat.com \
--to=hunt@redhat.com \
--cc=insight@sources.redhat.com \
/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).