#include "cli/cli-cmds.h"
#include "python/python.h"
#include "objfiles.h"
+#include "auto-load.h"
/* The selected interpreter. This will be used as a set command
variable, so it should always be malloc'ed - since
are not that well behaved. do_cleanups should either be replaced
with a do_cleanups call (to cover the problem) or an assertion
check to detect bad FUNCs code. */
- do_cleanups (ALL_CLEANUPS);
+ do_cleanups (all_cleanups ());
/* If the command_loop returned, normally (rather than threw an
error) we try to quit. If the quit is aborted, catch_errors()
which called this catch the signal and restart the command
dirarg = (char **) xmalloc (dirsize * sizeof (*dirarg));
ndir = 0;
- quit_flag = 0;
+ clear_quit_flag ();
saved_command_line = (char *) xmalloc (saved_command_line_size);
saved_command_line[0] = '\0';
instream = stdin;
{"args", no_argument, &set_args, 1},
{"l", required_argument, 0, 'l'},
{"return-child-result", no_argument, &return_child_result, 1},
- {"use-deprecated-index-sections", no_argument,
- &use_deprecated_index_sections, 1},
{0, no_argument, 0, 0}
};
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
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)
{
/* Skip auto-loading section-specified scripts until we've sourced
local_gdbinit (which is often used to augment the source search
path). */
- save_auto_load = gdbpy_global_auto_load;
- gdbpy_global_auto_load = 0;
+ save_auto_load = global_auto_load;
+ global_auto_load = 0;
if (execarg != NULL
&& symarg != NULL
/* Read the .gdbinit file in the current directory, *if* it isn't
the same as the $HOME/.gdbinit file (it should exist, also). */
- if (local_gdbinit && !inhibit_gdbinit)
- catch_command_errors (source_script, local_gdbinit, 0, RETURN_MASK_ALL);
+ if (local_gdbinit)
+ {
+ auto_load_local_gdbinit_pathname = gdb_realpath (local_gdbinit);
+
+ if (!inhibit_gdbinit && auto_load_local_gdbinit
+ && file_is_auto_load_safe (local_gdbinit,
+ _("auto-load: Loading .gdbinit "
+ "file \"%s\".\n"),
+ local_gdbinit))
+ {
+ auto_load_local_gdbinit_loaded = 1;
+
+ catch_command_errors (source_script, local_gdbinit, 0,
+ RETURN_MASK_ALL);
+ }
+ }
/* Now that all .gdbinit's have been read and all -d options have been
processed, we can read any scripts mentioned in SYMARG.
We wait until now because it is common to add to the source search
path in local_gdbinit. */
- gdbpy_global_auto_load = save_auto_load;
+ global_auto_load = save_auto_load;
ALL_OBJFILES (objfile)
load_auto_scripts_for_objfile (objfile);
--tui Use a terminal user interface.\n\
"), stream);
#endif
- fputs_unfiltered (_("\
- --use-deprecated-index-sections\n\
- Do not reject deprecated .gdb_index sections.\n\
-"), stream);
fputs_unfiltered (_("\
--version Print version information and then exit.\n\
-w Use a window interface.\n\
"), home_gdbinit);
if (local_gdbinit)
fprintf_unfiltered (stream, _("\
- * local init file: ./%s\n\
+ * local init file (see also 'set auto-load local-gdbinit'): ./%s\n\
"), local_gdbinit);
fputs_unfiltered (_("\n\
For more information, type \"help\" from within GDB, or consult the\n\