public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Insight session regression (?)
@ 2001-08-21 14:14 Tom Tromey
  2001-09-24 13:12 ` Fernando Nasser
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2001-08-21 14:14 UTC (permalink / raw)
  To: Insight List

I started Insight like this:

    gdb /my/executable

Then I set things up and did some debugging.
Finally I exited.

Then I re-ran the same gdb command line.
Of course it just comes up in the default mode.
If I then select /my/executable from the File menu, I expect it to use
my old session.  However, it doesn't -- my old session is wiped out.

I think this might be a regression, but I am not certain.
In any case I found this surprising.
FWIW I think "gdb /my/executable" should really reload my session by
default.

Tom

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Insight session regression (?)
  2001-08-21 14:14 Insight session regression (?) Tom Tromey
@ 2001-09-24 13:12 ` Fernando Nasser
  2001-09-28 13:30   ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Fernando Nasser @ 2001-09-24 13:12 UTC (permalink / raw)
  To: tromey; +Cc: Insight List

Tom Tromey wrote:
> 
> I started Insight like this:
> 
>     gdb /my/executable
> 
> Then I set things up and did some debugging.
> Finally I exited.
> 
> Then I re-ran the same gdb command line.
> Of course it just comes up in the default mode.
> If I then select /my/executable from the File menu, I expect it to use
> my old session.  However, it doesn't -- my old session is wiped out.
> 
> I think this might be a regression, but I am not certain.
> In any case I found this surprising.

I noticed that one has to explicitly select one of the sections
from the File menu (at the bottom).

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


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

I agree.

-- 
Fernando Nasser
Red Hat - Toronto                       E-Mail:  fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario   M4P 2C9

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Insight session regression (?)
  2001-09-24 13:12 ` Fernando Nasser
@ 2001-09-28 13:30   ` Tom Tromey
  0 siblings, 0 replies; 3+ messages in thread
From: Tom Tromey @ 2001-09-28 13:30 UTC (permalink / raw)
  To: Fernando Nasser; +Cc: Insight List

>>>>> "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
-

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2001-09-28 13:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-08-21 14:14 Insight session regression (?) Tom Tromey
2001-09-24 13:12 ` Fernando Nasser
2001-09-28 13:30   ` Tom Tromey

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).