From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gateway23.websitewelcome.com (gateway23.websitewelcome.com [192.185.48.84]) by sourceware.org (Postfix) with ESMTPS id 214703844070 for ; Wed, 22 Jul 2020 03:34:57 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 214703844070 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm12.websitewelcome.com (cm12.websitewelcome.com [100.42.49.8]) by gateway23.websitewelcome.com (Postfix) with ESMTP id 517EB7537 for ; Tue, 21 Jul 2020 22:34:49 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id y5WrjvjVBzOauy5Wrjlo6F; Tue, 21 Jul 2020 22:34:49 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=NcWbVDQHqFZnB8fXeWg74CAacV7mSezm5c6Z6dbagW8=; b=UlQu3CUV07ACOppnLwnyLVMqW8 h8HqdTJ6P2Nggkzr5YodjH3mL94NUpFlscWAPy8bGOyW6Ng54BwtyNNoQvMpWPmhvagCQsNGda0o4 XunlgsgIH+K6t/MCCD8bL9CWh; Received: from 174-16-104-48.hlrn.qwest.net ([174.16.104.48]:44534 helo=bapiya.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jy5Wr-000kGI-2d; Tue, 21 Jul 2020 21:34:49 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH 9/9] Remove symfile_objfile macro Date: Tue, 21 Jul 2020 21:34:44 -0600 Message-Id: <20200722033444.18522-10-tom@tromey.com> X-Mailer: git-send-email 2.17.2 In-Reply-To: <20200722033444.18522-1-tom@tromey.com> References: <20200722033444.18522-1-tom@tromey.com> X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 174.16.104.48 X-Source-L: No X-Exim-ID: 1jy5Wr-000kGI-2d X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 174-16-104-48.hlrn.qwest.net (bapiya.Home) [174.16.104.48]:44534 X-Source-Auth: tom+tromey.com X-Email-Count: 10 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3034.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_STOCKGEN, RCVD_IN_ABUSEAT, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SBL_CSS, SPF_HELO_PASS, TXREP, T_SPF_TEMPERROR, URIBL_CSS, URIBL_CSS_A autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 22 Jul 2020 03:34:59 -0000 This removes the symfile_objfile macro, in favor of just spelling out the member access. 2020-07-21 Tom Tromey * windows-tdep.c (windows_solib_create_inferior_hook): Update. * target.c (info_target_command): Update. * symfile.c (syms_from_objfile_1, finish_new_objfile) (symbol_file_clear, reread_symbols): Update. * symfile-mem.c (add_symbol_file_from_memory_command): Update. * stabsread.c (scan_file_globals): Update. * solib.c (update_solib_list): Update. * solib-svr4.c (elf_locate_base, open_symbol_file_object) (svr4_fetch_objfile_link_map, enable_break) (svr4_relocate_main_executable) (svr4_iterate_over_objfiles_in_search_order): Update. * solib-frv.c (lm_base, enable_break) (frv_relocate_main_executable): Update. (main_got, frv_fdpic_find_canonical_descriptor): Update. (frv_fetch_objfile_link_map): Update. * solib-dsbt.c (lm_base, dsbt_relocate_main_executable): Update. * solib-darwin.c (darwin_solib_create_inferior_hook): Update. * solib-aix.c (solib_aix_solib_create_inferior_hook): Update. * remote.c (remote_target::get_offsets): Update. (remote_target::start_remote) (extended_remote_target::post_attach): Update. * objfiles.c (entry_point_address_query): Update. * nto-procfs.c (nto_procfs_target::create_inferior): Update. * minsyms.c (get_symbol_leading_char): Update. * frame.c (inside_main_func): Update. * progspace.h (symfile_objfile): Remove macro. --- gdb/ChangeLog | 29 +++++++++++++++++++++++++++++ gdb/frame.c | 5 +++-- gdb/minsyms.c | 8 ++++++-- gdb/nto-procfs.c | 3 ++- gdb/objfiles.c | 8 ++++---- gdb/progspace.h | 5 ----- gdb/remote.c | 23 ++++++++++++----------- gdb/solib-aix.c | 9 +++++---- gdb/solib-darwin.c | 5 +++-- gdb/solib-dsbt.c | 17 +++++++++-------- gdb/solib-frv.c | 28 +++++++++++++++------------- gdb/solib-svr4.c | 21 ++++++++++++--------- gdb/solib.c | 3 ++- gdb/stabsread.c | 5 +++-- gdb/symfile-mem.c | 4 ++-- gdb/symfile.c | 16 ++++++++-------- gdb/target.c | 9 ++++++--- gdb/windows-tdep.c | 5 +++-- 18 files changed, 124 insertions(+), 79 deletions(-) diff --git a/gdb/frame.c b/gdb/frame.c index ac1016b083f..0a774ab005d 100644 --- a/gdb/frame.c +++ b/gdb/frame.c @@ -2235,9 +2235,10 @@ inside_main_func (struct frame_info *this_frame) struct bound_minimal_symbol msymbol; CORE_ADDR maddr; - if (symfile_objfile == 0) + if (current_program_space->symfile_object_file == 0) return 0; - msymbol = lookup_minimal_symbol (main_name (), NULL, symfile_objfile); + msymbol = lookup_minimal_symbol (main_name (), NULL, + current_program_space->symfile_object_file); if (msymbol.minsym == NULL) return 0; /* Make certain that the code, and not descriptor, address is diff --git a/gdb/minsyms.c b/gdb/minsyms.c index f4a2544eb19..0dec18d21ab 100644 --- a/gdb/minsyms.c +++ b/gdb/minsyms.c @@ -1008,8 +1008,12 @@ get_symbol_leading_char (bfd *abfd) { if (abfd != NULL) return bfd_get_symbol_leading_char (abfd); - if (symfile_objfile != NULL && symfile_objfile->obfd != NULL) - return bfd_get_symbol_leading_char (symfile_objfile->obfd); + if (current_program_space->symfile_object_file != NULL) + { + objfile *objf = current_program_space->symfile_object_file; + if (objf->obfd != NULL) + return bfd_get_symbol_leading_char (objf->obfd); + } return 0; } diff --git a/gdb/nto-procfs.c b/gdb/nto-procfs.c index 90cd67fd776..9e041b79f34 100644 --- a/gdb/nto-procfs.c +++ b/gdb/nto-procfs.c @@ -1323,7 +1323,8 @@ nto_procfs_target::create_inferior (const char *exec_file, target_terminal::init (); if (current_program_space->exec_bfd () != NULL - || (symfile_objfile != NULL && symfile_objfile->obfd != NULL)) + || (current_program_space->symfile_object_file != NULL + && current_program_space->symfile_object_file->obfd != NULL)) solib_create_inferior_hook (0); } diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 3aa7973e0d5..f91a4af36a1 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -380,12 +380,12 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_) int entry_point_address_query (CORE_ADDR *entry_p) { - if (symfile_objfile == NULL || !symfile_objfile->per_bfd->ei.entry_point_p) + objfile *objf = current_program_space->symfile_object_file; + if (objf == NULL || !objf->per_bfd->ei.entry_point_p) return 0; - int idx = symfile_objfile->per_bfd->ei.the_bfd_section_index; - *entry_p = (symfile_objfile->per_bfd->ei.entry_point - + symfile_objfile->section_offsets[idx]); + int idx = objf->per_bfd->ei.the_bfd_section_index; + *entry_p = objf->per_bfd->ei.entry_point + objf->section_offsets[idx]; return 1; } diff --git a/gdb/progspace.h b/gdb/progspace.h index 70b32198c20..aeba9b255f4 100644 --- a/gdb/progspace.h +++ b/gdb/progspace.h @@ -372,11 +372,6 @@ struct address_space REGISTRY_FIELDS; }; -/* The object file that the main symbol table was loaded from (e.g. the - argument to the "symbol-file" or "file" command). */ - -#define symfile_objfile current_program_space->symfile_object_file - /* The list of all program spaces. There's always at least one. */ extern std::vectorprogram_spaces; diff --git a/gdb/remote.c b/gdb/remote.c index d0836fff6e5..4de06173562 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -4106,7 +4106,7 @@ remote_target::get_offsets () int lose, num_segments = 0, do_sections, do_segments; CORE_ADDR text_addr, data_addr, bss_addr, segments[2]; - if (symfile_objfile == NULL) + if (current_program_space->symfile_object_file == NULL) return; putpkt ("qOffsets"); @@ -4182,10 +4182,10 @@ remote_target::get_offsets () else if (*ptr != '\0') warning (_("Target reported unsupported offsets: %s"), buf); - section_offsets offs = symfile_objfile->section_offsets; + objfile *objf = current_program_space->symfile_object_file; + section_offsets offs = objf->section_offsets; - symfile_segment_data_up data - = get_symfile_segment_data (symfile_objfile->obfd); + symfile_segment_data_up data = get_symfile_segment_data (objf->obfd); do_segments = (data != NULL); do_sections = num_segments == 0; @@ -4220,7 +4220,7 @@ remote_target::get_offsets () if (do_segments) { - int ret = symfile_map_offsets_to_segments (symfile_objfile->obfd, + int ret = symfile_map_offsets_to_segments (objf->obfd, data.get (), offs, num_segments, segments); @@ -4234,18 +4234,18 @@ remote_target::get_offsets () if (do_sections) { - offs[SECT_OFF_TEXT (symfile_objfile)] = text_addr; + offs[SECT_OFF_TEXT (objf)] = text_addr; /* This is a temporary kludge to force data and bss to use the same offsets because that's what nlmconv does now. The real solution requires changes to the stub and remote.c that I don't have time to do right now. */ - offs[SECT_OFF_DATA (symfile_objfile)] = data_addr; - offs[SECT_OFF_BSS (symfile_objfile)] = data_addr; + offs[SECT_OFF_DATA (objf)] = data_addr; + offs[SECT_OFF_BSS (objf)] = data_addr; } - objfile_relocate (symfile_objfile, offs); + objfile_relocate (objf, offs); } /* Send interrupt_sequence to remote target. */ @@ -4845,7 +4845,8 @@ remote_target::start_remote (int from_tty, int extended_p) /* If we connected to a live target, do some additional setup. */ if (target_has_execution) { - if (symfile_objfile) /* No use without a symbol-file. */ + /* No use without a symbol-file. */ + if (current_program_space->symfile_object_file) remote_check_symbols (); } @@ -5981,7 +5982,7 @@ extended_remote_target::post_attach (int pid) binary is not using shared libraries, the vsyscall page is not present (on Linux) and the binary itself hadn't changed since the debugging process was started. */ - if (symfile_objfile != NULL) + if (current_program_space->symfile_object_file != NULL) remote_check_symbols(); } diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c index 344c1f57600..0897d067c40 100644 --- a/gdb/solib-aix.c +++ b/gdb/solib-aix.c @@ -462,12 +462,13 @@ solib_aix_solib_create_inferior_hook (int from_tty) } lm_info_aix &exec_info = (*library_list)[0]; - if (symfile_objfile != NULL) + if (current_program_space->symfile_object_file != NULL) { - section_offsets offsets - = solib_aix_get_section_offsets (symfile_objfile, &exec_info); + objfile *objf = current_program_space->symfile_object_file; + section_offsets offsets = solib_aix_get_section_offsets (objf, + &exec_info); - objfile_relocate (symfile_objfile, offsets); + objfile_relocate (objf, offsets); } } diff --git a/gdb/solib-darwin.c b/gdb/solib-darwin.c index e55b2082949..90d2be534c0 100644 --- a/gdb/solib-darwin.c +++ b/gdb/solib-darwin.c @@ -538,7 +538,7 @@ darwin_solib_create_inferior_hook (int from_tty) load_addr = darwin_read_exec_load_addr_at_init (info); } - if (load_addr != 0 && symfile_objfile != NULL) + if (load_addr != 0 && current_program_space->symfile_object_file != NULL) { CORE_ADDR vmaddr; @@ -547,7 +547,8 @@ darwin_solib_create_inferior_hook (int from_tty) /* Relocate. */ if (vmaddr != load_addr) - objfile_rebase (symfile_objfile, load_addr - vmaddr); + objfile_rebase (current_program_space->symfile_object_file, + load_addr - vmaddr); } /* Set solib notifier (to reload list of shared libraries). */ diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c index 6b0f068191f..6e38b9534e9 100644 --- a/gdb/solib-dsbt.c +++ b/gdb/solib-dsbt.c @@ -552,7 +552,7 @@ lm_base (void) return info->lm_base_cache; got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL, - symfile_objfile); + current_program_space->symfile_object_file); if (got_sym.minsym != 0) { @@ -909,21 +909,22 @@ dsbt_relocate_main_executable (void) info->main_executable_lm_info = new lm_info_dsbt; info->main_executable_lm_info->map = ldm; - section_offsets new_offsets (symfile_objfile->section_offsets.size ()); + objfile *objf = current_program_space->symfile_object_file; + section_offsets new_offsets (objf->section_offsets.size ()); changed = 0; - ALL_OBJFILE_OSECTIONS (symfile_objfile, osect) + ALL_OBJFILE_OSECTIONS (objf, osect) { CORE_ADDR orig_addr, addr, offset; int osect_idx; int seg; - osect_idx = osect - symfile_objfile->sections; + osect_idx = osect - objf->sections; /* Current address of section. */ addr = obj_section_addr (osect); /* Offset from where this section started. */ - offset = symfile_objfile->section_offsets[osect_idx]; + offset = objf->section_offsets[osect_idx]; /* Original address prior to any past relocations. */ orig_addr = addr - offset; @@ -943,10 +944,10 @@ dsbt_relocate_main_executable (void) } if (changed) - objfile_relocate (symfile_objfile, new_offsets); + objfile_relocate (objf, new_offsets); - /* Now that symfile_objfile has been relocated, we can compute the - GOT value and stash it away. */ + /* Now that OBJF has been relocated, we can compute the GOT value + and stash it away. */ } /* When gdb starts up the inferior, it nurses it along (through the diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c index 08c9cf7ca5c..6c9ab1757b2 100644 --- a/gdb/solib-frv.c +++ b/gdb/solib-frv.c @@ -287,7 +287,7 @@ lm_base (void) return lm_base_cache; got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL, - symfile_objfile); + current_program_space->symfile_object_file); if (got_sym.minsym == 0) { if (solib_frv_debug) @@ -717,7 +717,7 @@ enable_break (void) asection *interp_sect; CORE_ADDR entry_point; - if (symfile_objfile == NULL) + if (current_program_space->symfile_object_file == NULL) { if (solib_frv_debug) fprintf_unfiltered (gdb_stdlog, @@ -784,21 +784,22 @@ frv_relocate_main_executable (void) main_executable_lm_info = new lm_info_frv; main_executable_lm_info->map = ldm; - section_offsets new_offsets (symfile_objfile->section_offsets.size ()); + objfile *objf = current_program_space->symfile_object_file; + section_offsets new_offsets (objf->section_offsets.size ()); changed = 0; - ALL_OBJFILE_OSECTIONS (symfile_objfile, osect) + ALL_OBJFILE_OSECTIONS (objf, osect) { CORE_ADDR orig_addr, addr, offset; int osect_idx; int seg; - osect_idx = osect - symfile_objfile->sections; + osect_idx = osect - objf->sections; /* Current address of section. */ addr = obj_section_addr (osect); /* Offset from where this section started. */ - offset = symfile_objfile->section_offsets[osect_idx]; + offset = objf->section_offsets[osect_idx]; /* Original address prior to any past relocations. */ orig_addr = addr - offset; @@ -818,10 +819,10 @@ frv_relocate_main_executable (void) } if (changed) - objfile_relocate (symfile_objfile, new_offsets); + objfile_relocate (objf, new_offsets); - /* Now that symfile_objfile has been relocated, we can compute the - GOT value and stash it away. */ + /* Now that OBJF has been relocated, we can compute the GOT value + and stash it away. */ main_executable_lm_info->got_value = main_got (); } @@ -894,8 +895,8 @@ main_got (void) { struct bound_minimal_symbol got_sym; - got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", - NULL, symfile_objfile); + objfile *objf = current_program_space->symfile_object_file; + got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL, objf); if (got_sym.minsym == 0) return 0; @@ -955,8 +956,9 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point) name = sym->linkage_name (); /* Check the main executable. */ + objfile *objf = current_program_space->symfile_object_file; addr = find_canonical_descriptor_in_load_object - (entry_point, got_value, name, symfile_objfile->obfd, + (entry_point, got_value, name, objf->obfd, main_executable_lm_info); /* If descriptor not found via main executable, check each load object @@ -1110,7 +1112,7 @@ frv_fetch_objfile_link_map (struct objfile *objfile) solib_add (0, 0, 1); /* frv_current_sos() will set main_lm_addr for the main executable. */ - if (objfile == symfile_objfile) + if (objfile == current_program_space->symfile_object_file) return main_lm_addr; /* The other link map addresses may be found by examining the list diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 7b004828761..909e806e09e 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -806,7 +806,8 @@ elf_locate_base (void) /* This may be a static executable. Look for the symbol conventionally named _r_debug, as a last resort. */ - msymbol = lookup_minimal_symbol ("_r_debug", NULL, symfile_objfile); + msymbol = lookup_minimal_symbol ("_r_debug", NULL, + current_program_space->symfile_object_file); if (msymbol.minsym != NULL) return BMSYMBOL_VALUE_ADDRESS (msymbol); @@ -971,7 +972,7 @@ open_symbol_file_object (int from_tty) if (from_tty) add_flags |= SYMFILE_VERBOSE; - if (symfile_objfile) + if (current_program_space->symfile_object_file) if (!query (_("Attempt to reload symbols from process? "))) return 0; @@ -1544,7 +1545,7 @@ svr4_fetch_objfile_link_map (struct objfile *objfile) solib_add (NULL, 0, auto_solib_add); /* svr4_current_sos() will set main_lm_addr for the main executable. */ - if (objfile == symfile_objfile) + if (objfile == current_program_space->symfile_object_file) return info->main_lm_addr; /* If OBJFILE is a separate debug object file, look for the @@ -2465,9 +2466,10 @@ enable_break (struct svr4_info *info, int from_tty) /* Scan through the lists of symbols, trying to look up the symbol and set a breakpoint there. Terminate loop when we/if we succeed. */ + objfile *objf = current_program_space->symfile_object_file; for (bkpt_namep = solib_break_names; *bkpt_namep != NULL; bkpt_namep++) { - msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile); + msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, objf); if ((msymbol.minsym != NULL) && (BMSYMBOL_VALUE_ADDRESS (msymbol) != 0)) { @@ -2485,7 +2487,7 @@ enable_break (struct svr4_info *info, int from_tty) { for (bkpt_namep = bkpt_names; *bkpt_namep != NULL; bkpt_namep++) { - msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, symfile_objfile); + msymbol = lookup_minimal_symbol (*bkpt_namep, NULL, objf); if ((msymbol.minsym != NULL) && (BMSYMBOL_VALUE_ADDRESS (msymbol) != 0)) { @@ -2976,11 +2978,12 @@ svr4_relocate_main_executable (void) /* Even DISPLACEMENT 0 is a valid new difference of in-memory vs. in-file addresses. */ - if (symfile_objfile) + objfile *objf = current_program_space->symfile_object_file; + if (objf) { - section_offsets new_offsets (symfile_objfile->section_offsets.size (), + section_offsets new_offsets (objf->section_offsets.size (), displacement); - objfile_relocate (symfile_objfile, new_offsets); + objfile_relocate (objf, new_offsets); } else if (current_program_space->exec_bfd ()) { @@ -3241,7 +3244,7 @@ svr4_iterate_over_objfiles_in_search_order if (current_objfile->separate_debug_objfile_backlink != nullptr) current_objfile = current_objfile->separate_debug_objfile_backlink; - if (current_objfile == symfile_objfile) + if (current_objfile == current_program_space->symfile_object_file) abfd = current_program_space->exec_bfd (); else abfd = current_objfile->obfd; diff --git a/gdb/solib.c b/gdb/solib.c index cd410bb9e3e..9e3e59e8c6c 100644 --- a/gdb/solib.c +++ b/gdb/solib.c @@ -736,7 +736,8 @@ update_solib_list (int from_tty) /* If we are attaching to a running process for which we have not opened a symbol file, we may be able to get its symbols now! */ - if (inf->attach_flag && symfile_objfile == NULL) + if (inf->attach_flag + && current_program_space->symfile_object_file == NULL) { try { diff --git a/gdb/stabsread.c b/gdb/stabsread.c index d2ff54a47bd..8d859e5ff6f 100644 --- a/gdb/stabsread.c +++ b/gdb/stabsread.c @@ -4521,8 +4521,9 @@ scan_file_globals (struct objfile *objfile) If we are scanning the symbols for a shared library, try to resolve them from the minimal symbols of the main executable first. */ - if (symfile_objfile && objfile != symfile_objfile) - resolve_objfile = symfile_objfile; + if (current_program_space->symfile_object_file + && objfile != current_program_space->symfile_object_file) + resolve_objfile = current_program_space->symfile_object_file; else resolve_objfile = objfile; diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c index fc5407c6372..9d9e6d5f152 100644 --- a/gdb/symfile-mem.c +++ b/gdb/symfile-mem.c @@ -142,8 +142,8 @@ add_symbol_file_from_memory_command (const char *args, int from_tty) addr = parse_and_eval_address (args); /* We need some representative bfd to know the target we are looking at. */ - if (symfile_objfile != NULL) - templ = symfile_objfile->obfd; + if (current_program_space->symfile_object_file != NULL) + templ = current_program_space->symfile_object_file->obfd; else templ = current_program_space->exec_bfd (); if (templ == NULL) diff --git a/gdb/symfile.c b/gdb/symfile.c index 57ad9829dec..5dfecf944cb 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -943,10 +943,10 @@ syms_from_objfile_1 (struct objfile *objfile, /* Since no error yet, throw away the old symbol table. */ - if (symfile_objfile != NULL) + if (current_program_space->symfile_object_file != NULL) { - symfile_objfile->unlink (); - gdb_assert (symfile_objfile == NULL); + current_program_space->symfile_object_file->unlink (); + gdb_assert (current_program_space->symfile_object_file == NULL); } /* Currently we keep symbols from the add-symbol-file command. @@ -1009,7 +1009,7 @@ finish_new_objfile (struct objfile *objfile, symfile_add_flags add_flags) if (add_flags & SYMFILE_MAINLINE) { /* OK, make it the "real" symbol file. */ - symfile_objfile = objfile; + current_program_space->symfile_object_file = objfile; clear_symtab_users (add_flags); } @@ -1230,9 +1230,9 @@ symbol_file_clear (int from_tty) { if ((have_full_symbols () || have_partial_symbols ()) && from_tty - && (symfile_objfile + && (current_program_space->symfile_object_file ? !query (_("Discard symbol table from `%s'? "), - objfile_name (symfile_objfile)) + objfile_name (current_program_space->symfile_object_file)) : !query (_("Discard symbol table? ")))) error (_("Not confirmed.")); @@ -1244,7 +1244,7 @@ symbol_file_clear (int from_tty) clear_symtab_users (0); - gdb_assert (symfile_objfile == NULL); + gdb_assert (current_program_space->symfile_object_file == NULL); if (from_tty) printf_filtered (_("No symbol file now.\n")); } @@ -2578,7 +2578,7 @@ reread_symbols (void) /* What the hell is sym_new_init for, anyway? The concept of distinguishing between the main file and additional files in this way seems rather dubious. */ - if (objfile == symfile_objfile) + if (objfile == current_program_space->symfile_object_file) { (*objfile->sf->sym_new_init) (objfile); } diff --git a/gdb/target.c b/gdb/target.c index cd66675e8a4..277e6072e55 100644 --- a/gdb/target.c +++ b/gdb/target.c @@ -1838,9 +1838,12 @@ info_target_command (const char *args, int from_tty) { int has_all_mem = 0; - if (symfile_objfile != NULL) - printf_unfiltered (_("Symbols from \"%s\".\n"), - objfile_name (symfile_objfile)); + if (current_program_space->symfile_object_file != NULL) + { + objfile *objf = current_program_space->symfile_object_file; + printf_unfiltered (_("Symbols from \"%s\".\n"), + objfile_name (objf)); + } for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ()) { diff --git a/gdb/windows-tdep.c b/gdb/windows-tdep.c index 6fcb629fe73..f28fd5c030c 100644 --- a/gdb/windows-tdep.c +++ b/gdb/windows-tdep.c @@ -908,12 +908,13 @@ windows_solib_create_inferior_hook (int from_tty) } /* Rebase executable if the base address changed because of ASLR. */ - if (symfile_objfile != nullptr && exec_base != 0) + if (current_program_space->symfile_object_file != nullptr && exec_base != 0) { CORE_ADDR vmaddr = pe_data (current_program_space->exec_bfd ())->pe_opthdr.ImageBase; if (vmaddr != exec_base) - objfile_rebase (symfile_objfile, exec_base - vmaddr); + objfile_rebase (current_program_space->symfile_object_file, + exec_base - vmaddr); } } -- 2.17.2