public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Fernando Nasser <fnasser@cygnus.com>
Cc: Insight List <insight@sourceware.cygnus.com>
Subject: Re: Insight session regression (?)
Date: Fri, 28 Sep 2001 13:30:00 -0000	[thread overview]
Message-ID: <87vgi3giak.fsf@creche.redhat.com> (raw)
In-Reply-To: <3BAF92CB.498BADA0@cygnus.com>

>>>>> "Fernando" == Fernando Nasser <fnasser@cygnus.com> writes:

Fernando> We need to check if the selected file matches one of the
Fernando> saved sections and use it.

>> FWIW I think "gdb /my/executable" should really reload my session
>> by default.

Fernando> I agree.

I wrote a patch to do this.  It is appended.

It is a bit ugly.  I added a new global :-(.  Without this,
gdbtk_tcl_exec_file_display will be run before the preloop proc is run,
and it will try to save the session.  This will overwrite whatever
session might have existed under that name.

My patch circumvents saving the session in this case, and then changes
the preloop to load a session if one exists.  I removed some code from
the preloop which seemed redundant (and which caused the source window
to flash from source, to nothing, to source again on startup).

Is this ok?  Or is there a better way to do it?

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* library/interface.tcl (gdbtk_tcl_preloop): Set
	gdb_after_preloop.  Load session if user specified executable
	name.  Don't set executable name or try to find main.
	(gdbtk_tcl_exec_file_display): Only save session after preloop has
	run.
	* library/main.tcl (gdb_after_preloop): Set to zero.

Index: library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.29
diff -u -r1.29 interface.tcl
--- library/interface.tcl 2001/08/13 18:30:36 1.29
+++ library/interface.tcl 2001/09/28 20:26:18
@@ -101,25 +101,23 @@
 
 proc gdbtk_tcl_preloop { } {
   global gdb_exe_name
+  global gdb_after_preloop
 
   set_baud
 
   tk appname gdbtk
+
+  if {$gdb_exe_name != ""} {
+    session_load $gdb_exe_name
+  }
+
   # If there was an error loading an executible specified on the command line
   # then we will have called pre_add_symbol, which would set us to busy,
   # but not the corresponding post_add_symbol.  Do this here just in case...
   after idle gdbtk_idle 
   ManagedWin::startup
 
-  SrcWin::point_to_main
-  set msg ""
-  catch {gdb_cmd "info files"} msg
-  set line1 [string range $msg 0 [string first \n $msg]]  
-  if {[regexp {Symbols from "(.*)"\.} $line1 dummy name]} {
-    set gdb_exe_name $name
-  }
-
-  
+  set gdb_after_preloop 1
   gdbtk_update
 }
 
@@ -735,6 +733,7 @@
 # ------------------------------------------------------------------
 proc gdbtk_tcl_exec_file_display {filename} {
   global gdb_exe_changed
+  global gdb_after_preloop
 
   # DO NOT CALL set_exe here! 
 
@@ -757,8 +756,12 @@
   set_exe_name $filename
   set gdb_exe_changed 0
 
-  # Add this new session to the session list
-  session_save
+  # Add this new session to the session list.  Before preloop is run,
+  # we're still initializing -- if we save the session now we'll
+  # overwrite whatever might be there.
+  if {$gdb_after_preloop} {
+    session_save
+  }
 
   SrcWin::point_to_main
 }
Index: library/main.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/main.tcl,v
retrieving revision 1.5
diff -u -r1.5 main.tcl
--- library/main.tcl 2001/09/19 18:10:37 1.5
+++ library/main.tcl 2001/09/28 20:26:18
@@ -32,6 +32,7 @@
 # Also, add the plugins directory if it exists.
 # Note: GDBTK_LIBRARY will be set in tcl_findLibrary before main.tcl is called.
 
+set gdb_after_preloop 0
 set gdb_plugins ""
 
 if {[info exists auto_path]} {
@@ -172,4 +173,3 @@
 # ManagedWin::open About -transient -expire 5000
 
 gdbtk_idle
-

      reply	other threads:[~2001-09-28 13:30 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-21 14:14 Tom Tromey
2001-09-24 13:12 ` Fernando Nasser
2001-09-28 13:30   ` Tom Tromey [this message]

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=87vgi3giak.fsf@creche.redhat.com \
    --to=tromey@redhat.com \
    --cc=fnasser@cygnus.com \
    --cc=insight@sourceware.cygnus.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).