public inbox for insight@sourceware.org
 help / color / mirror / Atom feed
* Re: Startup with --args
@ 2001-10-04 19:42 Tom Tromey
  2001-11-21 23:18 ` Tom Tromey
  0 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2001-10-04 19:42 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Insight List





>>>>> "Keith" == Keith Seitz <keiths@cygnus.com> writes:

>> I've been running with my --args patch installed for a while now.
>> Hopefully it will get its final approval soon.

Keith> Are you waiting on me for something?

Nope.  I think (but I still have to check) that I got the last
approval for that patch from Elena today.

Keith> Is there a way to do this without modifying
Keith> session_notice_file_change? I don't know. It seems to me that
Keith> if we want to override the session's arguments, we should just
Keith> do that.

It never occurred to me.  Unbelievable.  How about the appended?  It
is much simpler.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

     * library/interface.tcl (gdbtk_tcl_preloop): Override session's
     command-line arguments if required.

Index: library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.32
diff -u -r1.32 interface.tcl
--- library/interface.tcl 2001/11/19 18:43:19 1.32
+++ library/interface.tcl 2001/11/21 22:36:53
@@ -113,8 +113,14 @@

   if {$gdb_exe_name != ""} {
     # At startup, file_changed_hook is called too late for us, so we
-    # must notice the initial session by hand.
+    # 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.
+    set current_args [gdb_get_inferior_args]
     session_notice_file_change
+    if {[string length $current_args] > 0} {
+      gdb_set_inferior_args $current_args
+    }
   }

   gdbtk_update


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

* Re: Startup with --args
  2001-10-04 19:42 Startup with --args Tom Tromey
@ 2001-11-21 23:18 ` Tom Tromey
  0 siblings, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2001-11-21 23:18 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Insight List

>>>>> "Keith" == Keith Seitz <keiths@cygnus.com> writes:

>> I've been running with my --args patch installed for a while now.
>> Hopefully it will get its final approval soon.

Keith> Are you waiting on me for something?

Nope.  I think (but I still have to check) that I got the last
approval for that patch from Elena today.

Keith> Is there a way to do this without modifying
Keith> session_notice_file_change? I don't know. It seems to me that
Keith> if we want to override the session's arguments, we should just
Keith> do that.

It never occurred to me.  Unbelievable.  How about the appended?  It
is much simpler.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

     * library/interface.tcl (gdbtk_tcl_preloop): Override session's
     command-line arguments if required.

Index: library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.32
diff -u -r1.32 interface.tcl
--- library/interface.tcl 2001/11/19 18:43:19 1.32
+++ library/interface.tcl 2001/11/21 22:36:53
@@ -113,8 +113,14 @@

   if {$gdb_exe_name != ""} {
     # At startup, file_changed_hook is called too late for us, so we
-    # must notice the initial session by hand.
+    # 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.
+    set current_args [gdb_get_inferior_args]
     session_notice_file_change
+    if {[string length $current_args] > 0} {
+      gdb_set_inferior_args $current_args
+    }
   }

   gdbtk_update


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

* Re: Startup with --args
  2001-10-04 19:35 Tom Tromey
@ 2001-11-21 23:14 ` Tom Tromey
  0 siblings, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2001-11-21 23:14 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Insight List

>>>>> "Keith" == Keith Seitz <keiths@cygnus.com> writes:

>> It never occurred to me.  Unbelievable.  How about the appended?  It
>> is much simpler.

Keith> YES! Love that isolation!

I'm checking this in.

Tom


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

* Re: Startup with --args
  2001-10-04 19:28 Keith Seitz
@ 2001-11-21 23:13 ` Keith Seitz
  0 siblings, 0 replies; 16+ messages in thread
From: Keith Seitz @ 2001-11-21 23:13 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Insight List

On 21 Nov 2001, Tom Tromey wrote:

> It never occurred to me.  Unbelievable.  How about the appended?  It
> is much simpler.

YES! Love that isolation! Of course, late last night I convinced myself
that maybe your original patch is correct, too. :-(

Time will tell.
Keith

> Index: ChangeLog
> from  Tom Tromey  <tromey@redhat.com>
>
>    * library/interface.tcl (gdbtk_tcl_preloop): Override session's
>    command-line arguments if required.
>
> Index: library/interface.tcl
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
> retrieving revision 1.32
> diff -u -r1.32 interface.tcl
> --- library/interface.tcl 2001/11/19 18:43:19 1.32
> +++ library/interface.tcl 2001/11/21 22:36:53
> @@ -113,8 +113,14 @@
>
>    if {$gdb_exe_name != ""} {
>      # At startup, file_changed_hook is called too late for us, so we
> -    # must notice the initial session by hand.
> +    # 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.
> +    set current_args [gdb_get_inferior_args]
>      session_notice_file_change
> +    if {[string length $current_args] > 0} {
> +      gdb_set_inferior_args $current_args
> +    }
>    }
>
>    gdbtk_update
>


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

* Re: Startup with --args
  2001-10-04 19:13       ` Tom Tromey
@ 2001-11-21 16:26         ` Tom Tromey
  0 siblings, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2001-11-21 16:26 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Insight List

>>>>> "Keith" == Keith Seitz <keiths@cygnus.com> writes:

>> It never occurred to me.  Unbelievable.  How about the appended?  It
>> is much simpler.

Keith> YES! Love that isolation!

I'm checking this in.

Tom

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

* Re: Startup with --args
  2001-10-04 18:44     ` Keith Seitz
  2001-10-04 19:13       ` Tom Tromey
@ 2001-11-21 14:45       ` Keith Seitz
  1 sibling, 0 replies; 16+ messages in thread
From: Keith Seitz @ 2001-11-21 14:45 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Insight List

On 21 Nov 2001, Tom Tromey wrote:

> It never occurred to me.  Unbelievable.  How about the appended?  It
> is much simpler.

YES! Love that isolation! Of course, late last night I convinced myself
that maybe your original patch is correct, too. :-(

Time will tell.
Keith

> Index: ChangeLog
> from  Tom Tromey  <tromey@redhat.com>
>
> 	* library/interface.tcl (gdbtk_tcl_preloop): Override session's
> 	command-line arguments if required.
>
> Index: library/interface.tcl
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
> retrieving revision 1.32
> diff -u -r1.32 interface.tcl
> --- library/interface.tcl 2001/11/19 18:43:19 1.32
> +++ library/interface.tcl 2001/11/21 22:36:53
> @@ -113,8 +113,14 @@
>
>    if {$gdb_exe_name != ""} {
>      # At startup, file_changed_hook is called too late for us, so we
> -    # must notice the initial session by hand.
> +    # 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.
> +    set current_args [gdb_get_inferior_args]
>      session_notice_file_change
> +    if {[string length $current_args] > 0} {
> +      gdb_set_inferior_args $current_args
> +    }
>    }
>
>    gdbtk_update
>

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

* Re: Startup with --args
  2001-10-04 18:08   ` Tom Tromey
  2001-10-04 18:44     ` Keith Seitz
@ 2001-11-21 14:38     ` Tom Tromey
  1 sibling, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2001-11-21 14:38 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Insight List

>>>>> "Keith" == Keith Seitz <keiths@cygnus.com> writes:

>> I've been running with my --args patch installed for a while now.
>> Hopefully it will get its final approval soon.

Keith> Are you waiting on me for something?

Nope.  I think (but I still have to check) that I got the last
approval for that patch from Elena today.

Keith> Is there a way to do this without modifying
Keith> session_notice_file_change? I don't know. It seems to me that
Keith> if we want to override the session's arguments, we should just
Keith> do that.

It never occurred to me.  Unbelievable.  How about the appended?  It
is much simpler.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* library/interface.tcl (gdbtk_tcl_preloop): Override session's
	command-line arguments if required.

Index: library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.32
diff -u -r1.32 interface.tcl
--- library/interface.tcl 2001/11/19 18:43:19 1.32
+++ library/interface.tcl 2001/11/21 22:36:53
@@ -113,8 +113,14 @@
 
   if {$gdb_exe_name != ""} {
     # At startup, file_changed_hook is called too late for us, so we
-    # must notice the initial session by hand.
+    # 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.
+    set current_args [gdb_get_inferior_args]
     session_notice_file_change
+    if {[string length $current_args] > 0} {
+      gdb_set_inferior_args $current_args
+    }
   }
   
   gdbtk_update

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

* Re: Startup with --args
  2001-10-04 15:09 ` Keith Seitz
  2001-10-04 18:08   ` Tom Tromey
@ 2001-11-20 16:53   ` Keith Seitz
  1 sibling, 0 replies; 16+ messages in thread
From: Keith Seitz @ 2001-11-20 16:53 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Insight List

On 20 Nov 2001, Tom Tromey wrote:

> I've been running with my --args patch installed for a while now.
> Hopefully it will get its final approval soon.

Are you waiting on me for something?

> I'd like to check in this patch after my --args patch goes in.
> Ok?

Is there a way to do this without modifying session_notice_file_change? I
don't know. It seems to me that if we want to override the session's
arguments, we should just do that.

> -    # must notice the initial session by hand.
> -    session_notice_file_change
> +    # must notice the initial session by hand.  We pass in the
> +    # arguments, if they exist -- if the user used `gdb --args' then
> +    # we want the new arguments to override the session's arguments.
> +    session_notice_file_change [gdb_get_inferior_args]

Soemthing like:

   set gdb_args [gdb_get_inferior_args]
   session_notice_file_change
   gdb_set_inferior_args $gdb_args

I don't know. It just semes like an odd thing to put in
session_notice_file_change, but maybe my brain is away right now.

?
Keith


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

* Startup with --args
  2001-10-04 14:36 Tom Tromey
  2001-10-04 15:09 ` Keith Seitz
@ 2001-11-20 16:19 ` Tom Tromey
  1 sibling, 0 replies; 16+ messages in thread
From: Tom Tromey @ 2001-11-20 16:19 UTC (permalink / raw)
  To: Insight List

I've been running with my --args patch installed for a while now.
Hopefully it will get its final approval soon.

I've noticed that when I use --args I'm always surprised when the
session's arguments override whatever I've specified on the command
line.  So I came up with this patch to let the command line --args
override the session.  To me at least this is the least surprising
behavior.

I'd like to check in this patch after my --args patch goes in.
Ok?

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* library/interface.tcl (gdbtk_tcl_preloop): Pass inferior
	arguments to session_notice_file_change.
	* library/session.tcl (session_notice_file_change): Added
	`arguments' argument.

Index: library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.32
diff -u -r1.32 interface.tcl
--- library/interface.tcl 2001/11/19 18:43:19 1.32
+++ library/interface.tcl 2001/11/21 00:10:05
@@ -113,8 +113,10 @@
 
   if {$gdb_exe_name != ""} {
     # At startup, file_changed_hook is called too late for us, so we
-    # must notice the initial session by hand.
-    session_notice_file_change
+    # must notice the initial session by hand.  We pass in the
+    # arguments, if they exist -- if the user used `gdb --args' then
+    # we want the new arguments to override the session's arguments.
+    session_notice_file_change [gdb_get_inferior_args]
   }
   
   gdbtk_update
Index: library/session.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/session.tcl,v
retrieving revision 1.9
diff -u -r1.9 session.tcl
--- library/session.tcl 2001/10/28 20:08:39 1.9
+++ library/session.tcl 2001/11/21 00:10:05
@@ -185,9 +185,10 @@
 #
 # This is called from file_changed_hook.  It does all the work of
 # loading a session, if one exists with the same name as the current
-# executable.
+# executable.  If ARGUMENTS is not empty, then it overrides whatever
+# arguments are stored in the session itself.
 #
-proc session_notice_file_change {} {
+proc session_notice_file_change {{arguments {}}} {
   global gdb_exe_name gdb_target_name
 
   debug "noticed file change event for $gdb_exe_name"
@@ -218,7 +219,11 @@
     gdb_cmd "cd $values(pwd)"
   }
 
-  if {[info exists values(args)]} {
+  # If the user ran `gdb --args foo bar', then we want to use the new
+  # arguments and override whatever is in the session.
+  if {[string length $arguments] > 0} {
+    gdb_set_inferior_args $arguments
+  } elseif {[info exists values(args)]} {
     gdb_set_inferior_args $values(args)
   }
 

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

* Re: Startup with --args
@ 2001-10-04 19:35 Tom Tromey
  2001-11-21 23:14 ` Tom Tromey
  0 siblings, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2001-10-04 19:35 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Insight List





>>>>> "Keith" == Keith Seitz <keiths@cygnus.com> writes:

>> It never occurred to me.  Unbelievable.  How about the appended?  It
>> is much simpler.

Keith> YES! Love that isolation!

I'm checking this in.

Tom


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

* Re: Startup with --args
@ 2001-10-04 19:28 Keith Seitz
  2001-11-21 23:13 ` Keith Seitz
  0 siblings, 1 reply; 16+ messages in thread
From: Keith Seitz @ 2001-10-04 19:28 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Insight List





On 21 Nov 2001, Tom Tromey wrote:

> It never occurred to me.  Unbelievable.  How about the appended?  It
> is much simpler.

YES! Love that isolation! Of course, late last night I convinced myself
that maybe your original patch is correct, too. :-(

Time will tell.
Keith

> Index: ChangeLog
> from  Tom Tromey  <tromey@redhat.com>
>
>    * library/interface.tcl (gdbtk_tcl_preloop): Override session's
>    command-line arguments if required.
>
> Index: library/interface.tcl
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
> retrieving revision 1.32
> diff -u -r1.32 interface.tcl
> --- library/interface.tcl 2001/11/19 18:43:19 1.32
> +++ library/interface.tcl 2001/11/21 22:36:53
> @@ -113,8 +113,14 @@
>
>    if {$gdb_exe_name != ""} {
>      # At startup, file_changed_hook is called too late for us, so we
> -    # must notice the initial session by hand.
> +    # 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.
> +    set current_args [gdb_get_inferior_args]
>      session_notice_file_change
> +    if {[string length $current_args] > 0} {
> +      gdb_set_inferior_args $current_args
> +    }
>    }
>
>    gdbtk_update
>


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

* Re: Startup with --args
  2001-10-04 18:44     ` Keith Seitz
@ 2001-10-04 19:13       ` Tom Tromey
  2001-11-21 16:26         ` Tom Tromey
  2001-11-21 14:45       ` Keith Seitz
  1 sibling, 1 reply; 16+ messages in thread
From: Tom Tromey @ 2001-10-04 19:13 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Insight List

>>>>> "Keith" == Keith Seitz <keiths@cygnus.com> writes:

>> It never occurred to me.  Unbelievable.  How about the appended?  It
>> is much simpler.

Keith> YES! Love that isolation!

I'm checking this in.

Tom

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

* Re: Startup with --args
  2001-10-04 18:08   ` Tom Tromey
@ 2001-10-04 18:44     ` Keith Seitz
  2001-10-04 19:13       ` Tom Tromey
  2001-11-21 14:45       ` Keith Seitz
  2001-11-21 14:38     ` Tom Tromey
  1 sibling, 2 replies; 16+ messages in thread
From: Keith Seitz @ 2001-10-04 18:44 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Insight List

On 21 Nov 2001, Tom Tromey wrote:

> It never occurred to me.  Unbelievable.  How about the appended?  It
> is much simpler.

YES! Love that isolation! Of course, late last night I convinced myself
that maybe your original patch is correct, too. :-(

Time will tell.
Keith

> Index: ChangeLog
> from  Tom Tromey  <tromey@redhat.com>
>
> 	* library/interface.tcl (gdbtk_tcl_preloop): Override session's
> 	command-line arguments if required.
>
> Index: library/interface.tcl
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
> retrieving revision 1.32
> diff -u -r1.32 interface.tcl
> --- library/interface.tcl 2001/11/19 18:43:19 1.32
> +++ library/interface.tcl 2001/11/21 22:36:53
> @@ -113,8 +113,14 @@
>
>    if {$gdb_exe_name != ""} {
>      # At startup, file_changed_hook is called too late for us, so we
> -    # must notice the initial session by hand.
> +    # 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.
> +    set current_args [gdb_get_inferior_args]
>      session_notice_file_change
> +    if {[string length $current_args] > 0} {
> +      gdb_set_inferior_args $current_args
> +    }
>    }
>
>    gdbtk_update
>

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

* Re: Startup with --args
  2001-10-04 15:09 ` Keith Seitz
@ 2001-10-04 18:08   ` Tom Tromey
  2001-10-04 18:44     ` Keith Seitz
  2001-11-21 14:38     ` Tom Tromey
  2001-11-20 16:53   ` Keith Seitz
  1 sibling, 2 replies; 16+ messages in thread
From: Tom Tromey @ 2001-10-04 18:08 UTC (permalink / raw)
  To: Keith Seitz; +Cc: Insight List

>>>>> "Keith" == Keith Seitz <keiths@cygnus.com> writes:

>> I've been running with my --args patch installed for a while now.
>> Hopefully it will get its final approval soon.

Keith> Are you waiting on me for something?

Nope.  I think (but I still have to check) that I got the last
approval for that patch from Elena today.

Keith> Is there a way to do this without modifying
Keith> session_notice_file_change? I don't know. It seems to me that
Keith> if we want to override the session's arguments, we should just
Keith> do that.

It never occurred to me.  Unbelievable.  How about the appended?  It
is much simpler.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* library/interface.tcl (gdbtk_tcl_preloop): Override session's
	command-line arguments if required.

Index: library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.32
diff -u -r1.32 interface.tcl
--- library/interface.tcl 2001/11/19 18:43:19 1.32
+++ library/interface.tcl 2001/11/21 22:36:53
@@ -113,8 +113,14 @@
 
   if {$gdb_exe_name != ""} {
     # At startup, file_changed_hook is called too late for us, so we
-    # must notice the initial session by hand.
+    # 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.
+    set current_args [gdb_get_inferior_args]
     session_notice_file_change
+    if {[string length $current_args] > 0} {
+      gdb_set_inferior_args $current_args
+    }
   }
   
   gdbtk_update

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

* Re: Startup with --args
  2001-10-04 14:36 Tom Tromey
@ 2001-10-04 15:09 ` Keith Seitz
  2001-10-04 18:08   ` Tom Tromey
  2001-11-20 16:53   ` Keith Seitz
  2001-11-20 16:19 ` Tom Tromey
  1 sibling, 2 replies; 16+ messages in thread
From: Keith Seitz @ 2001-10-04 15:09 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Insight List

On 20 Nov 2001, Tom Tromey wrote:

> I've been running with my --args patch installed for a while now.
> Hopefully it will get its final approval soon.

Are you waiting on me for something?

> I'd like to check in this patch after my --args patch goes in.
> Ok?

Is there a way to do this without modifying session_notice_file_change? I
don't know. It seems to me that if we want to override the session's
arguments, we should just do that.

> -    # must notice the initial session by hand.
> -    session_notice_file_change
> +    # must notice the initial session by hand.  We pass in the
> +    # arguments, if they exist -- if the user used `gdb --args' then
> +    # we want the new arguments to override the session's arguments.
> +    session_notice_file_change [gdb_get_inferior_args]

Soemthing like:

   set gdb_args [gdb_get_inferior_args]
   session_notice_file_change
   gdb_set_inferior_args $gdb_args

I don't know. It just semes like an odd thing to put in
session_notice_file_change, but maybe my brain is away right now.

?
Keith


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

* Startup with --args
@ 2001-10-04 14:36 Tom Tromey
  2001-10-04 15:09 ` Keith Seitz
  2001-11-20 16:19 ` Tom Tromey
  0 siblings, 2 replies; 16+ messages in thread
From: Tom Tromey @ 2001-10-04 14:36 UTC (permalink / raw)
  To: Insight List

I've been running with my --args patch installed for a while now.
Hopefully it will get its final approval soon.

I've noticed that when I use --args I'm always surprised when the
session's arguments override whatever I've specified on the command
line.  So I came up with this patch to let the command line --args
override the session.  To me at least this is the least surprising
behavior.

I'd like to check in this patch after my --args patch goes in.
Ok?

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>

	* library/interface.tcl (gdbtk_tcl_preloop): Pass inferior
	arguments to session_notice_file_change.
	* library/session.tcl (session_notice_file_change): Added
	`arguments' argument.

Index: library/interface.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/interface.tcl,v
retrieving revision 1.32
diff -u -r1.32 interface.tcl
--- library/interface.tcl 2001/11/19 18:43:19 1.32
+++ library/interface.tcl 2001/11/21 00:10:05
@@ -113,8 +113,10 @@
 
   if {$gdb_exe_name != ""} {
     # At startup, file_changed_hook is called too late for us, so we
-    # must notice the initial session by hand.
-    session_notice_file_change
+    # must notice the initial session by hand.  We pass in the
+    # arguments, if they exist -- if the user used `gdb --args' then
+    # we want the new arguments to override the session's arguments.
+    session_notice_file_change [gdb_get_inferior_args]
   }
   
   gdbtk_update
Index: library/session.tcl
===================================================================
RCS file: /cvs/src/src/gdb/gdbtk/library/session.tcl,v
retrieving revision 1.9
diff -u -r1.9 session.tcl
--- library/session.tcl 2001/10/28 20:08:39 1.9
+++ library/session.tcl 2001/11/21 00:10:05
@@ -185,9 +185,10 @@
 #
 # This is called from file_changed_hook.  It does all the work of
 # loading a session, if one exists with the same name as the current
-# executable.
+# executable.  If ARGUMENTS is not empty, then it overrides whatever
+# arguments are stored in the session itself.
 #
-proc session_notice_file_change {} {
+proc session_notice_file_change {{arguments {}}} {
   global gdb_exe_name gdb_target_name
 
   debug "noticed file change event for $gdb_exe_name"
@@ -218,7 +219,11 @@
     gdb_cmd "cd $values(pwd)"
   }
 
-  if {[info exists values(args)]} {
+  # If the user ran `gdb --args foo bar', then we want to use the new
+  # arguments and override whatever is in the session.
+  if {[string length $arguments] > 0} {
+    gdb_set_inferior_args $arguments
+  } elseif {[info exists values(args)]} {
     gdb_set_inferior_args $values(args)
   }
 

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

end of thread, other threads:[~2001-11-22  7:18 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-10-04 19:42 Startup with --args Tom Tromey
2001-11-21 23:18 ` Tom Tromey
  -- strict thread matches above, loose matches on Subject: below --
2001-10-04 19:35 Tom Tromey
2001-11-21 23:14 ` Tom Tromey
2001-10-04 19:28 Keith Seitz
2001-11-21 23:13 ` Keith Seitz
2001-10-04 14:36 Tom Tromey
2001-10-04 15:09 ` Keith Seitz
2001-10-04 18:08   ` Tom Tromey
2001-10-04 18:44     ` Keith Seitz
2001-10-04 19:13       ` Tom Tromey
2001-11-21 16:26         ` Tom Tromey
2001-11-21 14:45       ` Keith Seitz
2001-11-21 14:38     ` Tom Tromey
2001-11-20 16:53   ` Keith Seitz
2001-11-20 16:19 ` 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).