From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Tromey To: Insight List Subject: Patch: insight --args -vs- pwd Date: Fri, 21 Dec 2001 14:42:00 -0000 Message-ID: <87bsgsfaqq.fsf@creche.redhat.com> X-SW-Source: 2001-q4/msg00433.html Message-ID: <20011221144200.QYPij5aGoSKUuOAv8kBR97JiilDcdzDMnL-DwfLQ4fs@z> 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 * library/interface.tcl (gdbtk_tcl_preloop): Use current directory when `--args' given. 2001-12-21 Tom Tromey 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" } }