public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Insight List <insight@sourceware.cygnus.com>
Subject: Patch: insight --args -vs- pwd
Date: Fri, 21 Dec 2001 14:42:00 -0000	[thread overview]
Message-ID: <87bsgsfaqq.fsf@creche.redhat.com> (raw)
Message-ID: <20011221144200.QYPij5aGoSKUuOAv8kBR97JiilDcdzDMnL-DwfLQ4fs@z> (raw)

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

             reply	other threads:[~2001-12-21 14:42 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-16 10:36 Tom Tromey [this message]
2001-12-21 14:42 ` Tom Tromey

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=87bsgsfaqq.fsf@creche.redhat.com \
    --to=tromey@redhat.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).