This is the mail archive of the insight@sources.redhat.com mailing list for the Insight project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch: insight --args -vs- pwd


I've been using `gdb --args' for quite a while now.
Lately I've come to realize that if I run gdb in this mode, I really
want Insight to ignore the session's notion of pwd and instead use the
directory where I launched gdb.
This makes sense because in `--args' mode you are expecting the
inferior to be run in the "current environment".  Several times now
I've been confused by the current behavior of overriding the pwd with
the session's pwd.

This patch implements what I'd prefer.
Ok to commit?

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* library/interface.tcl (gdbtk_tcl_preloop): Use current directory
	when `--args' given.

2001-12-21  Tom Tromey  <tromey@redhat.com>

Index: library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.35
diff -u -r1.35 interface.tcl
--- library/interface.tcl 2001/12/11 08:55:52 1.35
+++ library/interface.tcl 2001/12/21 22:34:54
@@ -100,7 +100,7 @@
 # ------------------------------------------------------------------
 
 proc gdbtk_tcl_preloop { } {
-  global gdb_exe_name
+  global gdb_exe_name gdb_current_directory
 
   set_baud
 
@@ -115,11 +115,13 @@
     # At startup, file_changed_hook is called too late for us, so we
     # must notice the initial session by hand.  If the arguments exist
     # -- if the user used `gdb --args' -- then we want the new
-    # arguments to override the session's arguments.
+    # arguments and pwd to override what is set in the session.
     set current_args [gdb_get_inferior_args]
+    set current_dir $gdb_current_directory
     session_notice_file_change
     if {[string length $current_args] > 0} {
       gdb_set_inferior_args $current_args
+      gdb_cmd "cd $current_dir"
     }
   }
   


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]