From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Tromey To: Fernando Nasser Cc: Insight List Subject: Re: Insight session regression (?) Date: Fri, 28 Sep 2001 13:30:00 -0000 Message-id: <87vgi3giak.fsf@creche.redhat.com> References: <87u1z1jd8u.fsf@creche.redhat.com> <3BAF92CB.498BADA0@cygnus.com> X-SW-Source: 2001-q3/msg00305.html >>>>> "Fernando" == Fernando Nasser 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 * 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 -