From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 28758 invoked by alias); 16 Jun 2012 20:05:52 -0000 Received: (qmail 28742 invoked by uid 22791); 16 Jun 2012 20:05:51 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,KHOP_DNSBL_BUMP,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,RCVD_IN_MSPIKE_BL,RCVD_IN_MSPIKE_Z,SPF_SOFTFAIL X-Spam-Check-By: sourceware.org Received: from mtaout20.012.net.il (HELO mtaout20.012.net.il) (80.179.55.166) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 16 Jun 2012 20:05:27 +0000 Received: from conversion-daemon.a-mtaout20.012.net.il by a-mtaout20.012.net.il (HyperSendmail v2007.08) id <0M5Q00E007RKU200@a-mtaout20.012.net.il> for gdb-patches@sourceware.org; Sat, 16 Jun 2012 23:05:25 +0300 (IDT) Received: from HOME-C4E4A596F7 ([87.69.210.75]) by a-mtaout20.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M5Q00EZL7T0AS50@a-mtaout20.012.net.il>; Sat, 16 Jun 2012 23:05:25 +0300 (IDT) Date: Sat, 16 Jun 2012 20:05:00 -0000 From: Eli Zaretskii Subject: Re: [patch] -iex and -ix: Execute them _after_ gdbinits In-reply-to: <20120616195417.GA6368@host2.jankratochvil.net> To: Jan Kratochvil Cc: gdb-patches@sourceware.org Reply-to: Eli Zaretskii Message-id: <83txybdnue.fsf@gnu.org> References: <20120616195417.GA6368@host2.jankratochvil.net> X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00550.txt.bz2 > Date: Sat, 16 Jun 2012 21:54:17 +0200 > From: Jan Kratochvil > > Before 7.5 gets branched/released I would like to yet change behavior of this > new feature. The current order is: > 1. -iex and -ix > 2. /etc/gdbinit, ~/.gdbinit > 2. inferior load > 3. -ex and -x etc. > > I would like to swap 1 <-> 2: > 1. /etc/gdbinit, ~/.gdbinit > 2. -iex and -ix > 2. inferior load > 3. -ex and -x etc. That would make it impossible to run a command before loading .gdbinit, right? > In practice I found I need to override 'set auto-load safe-path ...' pre-set > by ~/.gdbinit for specific GDB runs by -iex. There is no other way to do it. We could invent some other way of doing that, but without taking away what users can do now. > Contrary to it I cannot imagine why one would want to get -iex commands > overriden by /etc/gdbinit and ~/.gdbinit. Not overriden by, _executed_before_. > gdb/doc/ > 2012-06-16 Jan Kratochvil > > * gdb.texinfo (File Options): Change -ix and -iex commands that apply > only after gdbinit files. > (Startup): Move -iex and -iex commands down after gdbinit files. > > diff --git a/gdb/main.c b/gdb/main.c > index 3148d72..025bbe0 100644 > --- a/gdb/main.c > +++ b/gdb/main.c > @@ -835,20 +835,6 @@ captured_main (void *data) > quit_pre_print = error_pre_print; > warning_pre_print = _("\nwarning: "); > > - /* Process '-ix' and '-iex' options early. */ > - for (i = 0; VEC_iterate (cmdarg_s, cmdarg_vec, i, cmdarg_p); i++) > - switch (cmdarg_p->type) > - { > - case CMDARG_INIT_FILE: > - catch_command_errors (source_script, cmdarg_p->string, > - !batch_flag, RETURN_MASK_ALL); > - break; > - case CMDARG_INIT_COMMAND: > - catch_command_errors (execute_command, cmdarg_p->string, > - !batch_flag, RETURN_MASK_ALL); > - break; > - } > - > /* Read and execute the system-wide gdbinit file, if it exists. > This is done *before* all the command line arguments are > processed; it sets global parameters, which are independent of > @@ -864,6 +850,20 @@ captured_main (void *data) > if (home_gdbinit && !inhibit_gdbinit) > catch_command_errors (source_script, home_gdbinit, 0, RETURN_MASK_ALL); > > + /* Process '-ix' and '-iex' options early. */ > + for (i = 0; VEC_iterate (cmdarg_s, cmdarg_vec, i, cmdarg_p); i++) > + switch (cmdarg_p->type) > + { > + case CMDARG_INIT_FILE: > + catch_command_errors (source_script, cmdarg_p->string, > + !batch_flag, RETURN_MASK_ALL); > + break; > + case CMDARG_INIT_COMMAND: > + catch_command_errors (execute_command, cmdarg_p->string, > + !batch_flag, RETURN_MASK_ALL); > + break; > + } > + > /* Now perform all the actions indicated by the arguments. */ > if (cdarg != NULL) > { > diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo > index a14e322..e0f8469 100644 > --- a/gdb/doc/gdb.texinfo > +++ b/gdb/doc/gdb.texinfo > @@ -997,16 +997,16 @@ also be interleaved with @samp{-command} as required. > @itemx -ix @var{file} > @cindex @code{--init-command} > @cindex @code{-ix} > -Execute commands from file @var{file} before loading gdbinit files or the > -inferior. > +Execute commands from file @var{file} before loading the inferior (but > +after loading gdbinit files). > @xref{Startup}. > > @item -init-eval-command @var{command} > @itemx -iex @var{command} > @cindex @code{--init-eval-command} > @cindex @code{-iex} > -Execute a single @value{GDBN} command before loading gdbinit files or the > -inferior. > +Execute a single @value{GDBN} command before loading the inferior (but > +after loading gdbinit files). > @xref{Startup}. > > @item -directory @var{directory} > @@ -1261,14 +1261,6 @@ Here's the description of what @value{GDBN} does during session startup: > Sets up the command interpreter as specified by the command line > (@pxref{Mode Options, interpreter}). > > -@anchor{Option -init-eval-command} > -@item > -Executes commands and command files specified by the @samp{-iex} and > -@samp{-ix} options in their specified order. Usually you should use the > -@samp{-ex} and @samp{-x} options instead, but this way you can apply > -settings before @value{GDBN} init files get executed and before inferior > -gets loaded. > - > @item > @cindex init file > Reads the system-wide @dfn{init file} (if @option{--with-system-gdbinit} was > @@ -1283,6 +1275,14 @@ DOS/Windows systems, the home directory is the one pointed to by the > @code{HOME} environment variable.} and executes all the commands in > that file. > > +@anchor{Option -init-eval-command} > +@item > +Executes commands and command files specified by the @samp{-iex} and > +@samp{-ix} options in their specified order. Usually you should use the > +@samp{-ex} and @samp{-x} options instead, but this way you can apply > +settings before @value{GDBN} init files get executed and before inferior > +gets loaded. > + > @item > Processes command line options and operands. This is OK, Texinfo-wise.