From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5965 invoked by alias); 21 Nov 2001 00:19:35 -0000 Mailing-List: contact insight-help@sourceware.cygnus.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: insight-owner@sources.redhat.com Received: (qmail 5862 invoked from network); 21 Nov 2001 00:19:25 -0000 To: Insight List Subject: Startup with --args X-Zippy: The entire CHINESE WOMEN'S VOLLEYBALL TEAM all share ONE personality -- and have since BIRTH!! X-Attribution: Tom Reply-To: tromey@redhat.com From: Tom Tromey Date: Thu, 04 Oct 2001 14:36:00 -0000 Message-ID: <87wv0lkmb9.fsf@creche.redhat.com> X-SW-Source: 2001-q4/txt/msg00046.txt.bz2 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 * 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) } From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tom Tromey To: Insight List Subject: Startup with --args Date: Tue, 20 Nov 2001 16:19:00 -0000 Message-ID: <87wv0lkmb9.fsf@creche.redhat.com> X-SW-Source: 2001-q4/msg00347.html Message-ID: <20011120161900.Wzm9zOfvMEWhQMEcT-q6ptqtkz9p1FMxAf3euGftHLY@z> 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 * 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) }