X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=gdb%2Fmain.c;h=7d9492b8761b1902cae6322f23573c19b9041a16;hb=aed57c537116ae91f553ac835b3f96d1f87b3bb0;hp=8709357e924ca8e6ef40b8d7c7e98f81673e01ed;hpb=b926417afaea99ed17663e06d6654d0048536017;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/main.c b/gdb/main.c index 8709357e92..7d9492b876 100644 --- a/gdb/main.c +++ b/gdb/main.c @@ -1,6 +1,6 @@ /* Top level stuff for GDB, the GNU debugger. - Copyright (C) 1986-2018 Free Software Foundation, Inc. + Copyright (C) 1986-2019 Free Software Foundation, Inc. This file is part of GDB. @@ -485,7 +485,6 @@ captured_main_1 (struct captured_main_args *context) int i; int save_auto_load; - struct objfile *objfile; int ret = 1; #ifdef HAVE_USEFUL_SBRK @@ -506,7 +505,6 @@ captured_main_1 (struct captured_main_args *context) textdomain (PACKAGE); #endif - bfd_init (); notice_open_fds (); saved_command_line = (char *) xstrdup (""); @@ -517,12 +515,17 @@ captured_main_1 (struct captured_main_args *context) setvbuf (stderr, NULL, _IONBF, BUFSIZ); #endif + /* Note: `error' cannot be called before this point, because the + caller will crash when trying to print the exception. */ main_ui = new ui (stdin, stdout, stderr); current_ui = main_ui; gdb_stdtargerr = gdb_stderr; /* for moment */ gdb_stdtargin = gdb_stdin; /* for moment */ + if (bfd_init () != BFD_INIT_MAGIC) + error (_("fatal error: libbfd ABI mismatch")); + #ifdef __MINGW32__ /* On Windows, argv[0] is not necessarily set to absolute form when GDB is found along PATH, without which relocation doesn't work. */ @@ -1120,7 +1123,7 @@ captured_main_1 (struct captured_main_args *context) We wait until now because it is common to add to the source search path in local_gdbinit. */ global_auto_load = save_auto_load; - ALL_OBJFILES (objfile) + for (objfile *objfile : all_objfiles (current_program_space)) load_auto_scripts_for_objfile (objfile); /* Process '-x' and '-ex' options. */