From 2d7b58e8d63907b0dd76f7447f514ef66035a62f Mon Sep 17 00:00:00 2001 From: Jan Kratochvil Date: Mon, 2 Jul 2012 12:05:01 +0000 Subject: [PATCH] gdb/ Execute -ix and -iex only after system and user gdbinit files. * main.c (captured_main): Move CMDARG_INIT_FILE and CMDARG_INIT_COMMAND processing down after gdbinit files. gdb/doc/ * 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. --- gdb/ChangeLog | 6 ++++++ gdb/doc/ChangeLog | 6 ++++++ gdb/doc/gdb.texinfo | 24 ++++++++++++------------ gdb/main.c | 28 ++++++++++++++-------------- 4 files changed, 38 insertions(+), 26 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 26f596f4473..2a910bac5a5 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2012-07-02 Jan Kratochvil + + Execute -ix and -iex only after system and user gdbinit files. + * main.c (captured_main): Move CMDARG_INIT_FILE and CMDARG_INIT_COMMAND + processing down after gdbinit files. + 2012-07-02 Jan Kratochvil Add fnmatch-gnu module. diff --git a/gdb/doc/ChangeLog b/gdb/doc/ChangeLog index 2a398fefcaf..1b75b4efedb 100644 --- a/gdb/doc/ChangeLog +++ b/gdb/doc/ChangeLog @@ -1,3 +1,9 @@ +2012-07-02 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. + 2012-07-02 Jan Kratochvil * gdb.texinfo (Auto-loading safe path): Note the shell wildcard diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo index a01ce9a4c3f..83ce123692c 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. diff --git a/gdb/main.c b/gdb/main.c index 3148d72da29..025bbe0defe 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) { -- 2.30.2