Remove symfile_objfile macro

This removes the symfile_objfile macro, in favor of just spelling out
the member access.

gdb/ChangeLog
2020-10-29  Tom Tromey  <tom@tromey.com>

	* 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.
This commit is contained in:
Tom Tromey 2020-10-29 15:04:33 -06:00
parent 19f6550ebb
commit a42d7dd873
18 changed files with 124 additions and 79 deletions

View File

@ -1,3 +1,32 @@
2020-10-29 Tom Tromey <tom@tromey.com>
* 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.
2020-10-29 Tom Tromey <tom@tromey.com> 2020-10-29 Tom Tromey <tom@tromey.com>
* exec.c (exec_file_attach): Update. * exec.c (exec_file_attach): Update.

View File

@ -2292,13 +2292,14 @@ frame_debug_got_null_frame (struct frame_info *this_frame,
static bool static bool
inside_main_func (frame_info *this_frame) inside_main_func (frame_info *this_frame)
{ {
if (symfile_objfile == nullptr) if (current_program_space->symfile_object_file == nullptr)
return false; return false;
CORE_ADDR sym_addr; CORE_ADDR sym_addr;
const char *name = main_name (); const char *name = main_name ();
bound_minimal_symbol msymbol bound_minimal_symbol msymbol
= lookup_minimal_symbol (name, NULL, symfile_objfile); = lookup_minimal_symbol (name, NULL,
current_program_space->symfile_object_file);
if (msymbol.minsym == nullptr) if (msymbol.minsym == nullptr)
{ {
/* In some language (for example Fortran) there will be no minimal /* In some language (for example Fortran) there will be no minimal

View File

@ -1008,8 +1008,12 @@ get_symbol_leading_char (bfd *abfd)
{ {
if (abfd != NULL) if (abfd != NULL)
return bfd_get_symbol_leading_char (abfd); return bfd_get_symbol_leading_char (abfd);
if (symfile_objfile != NULL && symfile_objfile->obfd != NULL) if (current_program_space->symfile_object_file != NULL)
return bfd_get_symbol_leading_char (symfile_objfile->obfd); {
objfile *objf = current_program_space->symfile_object_file;
if (objf->obfd != NULL)
return bfd_get_symbol_leading_char (objf->obfd);
}
return 0; return 0;
} }

View File

@ -1323,7 +1323,8 @@ nto_procfs_target::create_inferior (const char *exec_file,
target_terminal::init (); target_terminal::init ();
if (current_program_space->exec_bfd () != NULL 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); solib_create_inferior_hook (0);
} }

View File

@ -373,12 +373,12 @@ objfile::objfile (bfd *abfd, const char *name, objfile_flags flags_)
int int
entry_point_address_query (CORE_ADDR *entry_p) 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; return 0;
int idx = symfile_objfile->per_bfd->ei.the_bfd_section_index; int idx = objf->per_bfd->ei.the_bfd_section_index;
*entry_p = (symfile_objfile->per_bfd->ei.entry_point *entry_p = objf->per_bfd->ei.entry_point + objf->section_offsets[idx];
+ symfile_objfile->section_offsets[idx]);
return 1; return 1;
} }

View File

@ -372,11 +372,6 @@ struct address_space
REGISTRY_FIELDS; 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. */ /* The list of all program spaces. There's always at least one. */
extern std::vector<struct program_space *>program_spaces; extern std::vector<struct program_space *>program_spaces;

View File

@ -4107,7 +4107,7 @@ remote_target::get_offsets ()
int lose, num_segments = 0, do_sections, do_segments; int lose, num_segments = 0, do_sections, do_segments;
CORE_ADDR text_addr, data_addr, bss_addr, segments[2]; CORE_ADDR text_addr, data_addr, bss_addr, segments[2];
if (symfile_objfile == NULL) if (current_program_space->symfile_object_file == NULL)
return; return;
putpkt ("qOffsets"); putpkt ("qOffsets");
@ -4183,10 +4183,10 @@ remote_target::get_offsets ()
else if (*ptr != '\0') else if (*ptr != '\0')
warning (_("Target reported unsupported offsets: %s"), buf); 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 symfile_segment_data_up data = get_symfile_segment_data (objf->obfd);
= get_symfile_segment_data (symfile_objfile->obfd);
do_segments = (data != NULL); do_segments = (data != NULL);
do_sections = num_segments == 0; do_sections = num_segments == 0;
@ -4221,7 +4221,7 @@ remote_target::get_offsets ()
if (do_segments) 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, data.get (), offs,
num_segments, segments); num_segments, segments);
@ -4235,18 +4235,18 @@ remote_target::get_offsets ()
if (do_sections) 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 /* This is a temporary kludge to force data and bss to use the
same offsets because that's what nlmconv does now. The real same offsets because that's what nlmconv does now. The real
solution requires changes to the stub and remote.c that I solution requires changes to the stub and remote.c that I
don't have time to do right now. */ don't have time to do right now. */
offs[SECT_OFF_DATA (symfile_objfile)] = data_addr; offs[SECT_OFF_DATA (objf)] = data_addr;
offs[SECT_OFF_BSS (symfile_objfile)] = data_addr; offs[SECT_OFF_BSS (objf)] = data_addr;
} }
objfile_relocate (symfile_objfile, offs); objfile_relocate (objf, offs);
} }
/* Send interrupt_sequence to remote target. */ /* Send interrupt_sequence to remote target. */
@ -4846,7 +4846,8 @@ remote_target::start_remote (int from_tty, int extended_p)
/* If we connected to a live target, do some additional setup. */ /* If we connected to a live target, do some additional setup. */
if (target_has_execution ()) 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 (); remote_check_symbols ();
} }
@ -5983,7 +5984,7 @@ extended_remote_target::post_attach (int pid)
binary is not using shared libraries, the vsyscall page is not binary is not using shared libraries, the vsyscall page is not
present (on Linux) and the binary itself hadn't changed since the present (on Linux) and the binary itself hadn't changed since the
debugging process was started. */ debugging process was started. */
if (symfile_objfile != NULL) if (current_program_space->symfile_object_file != NULL)
remote_check_symbols(); remote_check_symbols();
} }

View File

@ -462,12 +462,13 @@ solib_aix_solib_create_inferior_hook (int from_tty)
} }
lm_info_aix &exec_info = (*library_list)[0]; lm_info_aix &exec_info = (*library_list)[0];
if (symfile_objfile != NULL) if (current_program_space->symfile_object_file != NULL)
{ {
section_offsets offsets objfile *objf = current_program_space->symfile_object_file;
= solib_aix_get_section_offsets (symfile_objfile, &exec_info); section_offsets offsets = solib_aix_get_section_offsets (objf,
&exec_info);
objfile_relocate (symfile_objfile, offsets); objfile_relocate (objf, offsets);
} }
} }

View File

@ -539,7 +539,7 @@ darwin_solib_create_inferior_hook (int from_tty)
load_addr = darwin_read_exec_load_addr_at_init (info); 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; CORE_ADDR vmaddr;
@ -548,7 +548,8 @@ darwin_solib_create_inferior_hook (int from_tty)
/* Relocate. */ /* Relocate. */
if (vmaddr != load_addr) 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). */ /* Set solib notifier (to reload list of shared libraries). */

View File

@ -552,7 +552,7 @@ lm_base (void)
return info->lm_base_cache; return info->lm_base_cache;
got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL, got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL,
symfile_objfile); current_program_space->symfile_object_file);
if (got_sym.minsym != 0) 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 = new lm_info_dsbt;
info->main_executable_lm_info->map = ldm; 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; changed = 0;
ALL_OBJFILE_OSECTIONS (symfile_objfile, osect) ALL_OBJFILE_OSECTIONS (objf, osect)
{ {
CORE_ADDR orig_addr, addr, offset; CORE_ADDR orig_addr, addr, offset;
int osect_idx; int osect_idx;
int seg; int seg;
osect_idx = osect - symfile_objfile->sections; osect_idx = osect - objf->sections;
/* Current address of section. */ /* Current address of section. */
addr = obj_section_addr (osect); addr = obj_section_addr (osect);
/* Offset from where this section started. */ /* 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. */ /* Original address prior to any past relocations. */
orig_addr = addr - offset; orig_addr = addr - offset;
@ -943,10 +944,10 @@ dsbt_relocate_main_executable (void)
} }
if (changed) if (changed)
objfile_relocate (symfile_objfile, new_offsets); objfile_relocate (objf, new_offsets);
/* Now that symfile_objfile has been relocated, we can compute the /* Now that OBJF has been relocated, we can compute the GOT value
GOT value and stash it away. */ and stash it away. */
} }
/* When gdb starts up the inferior, it nurses it along (through the /* When gdb starts up the inferior, it nurses it along (through the

View File

@ -287,7 +287,7 @@ lm_base (void)
return lm_base_cache; return lm_base_cache;
got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL, got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL,
symfile_objfile); current_program_space->symfile_object_file);
if (got_sym.minsym == 0) if (got_sym.minsym == 0)
{ {
if (solib_frv_debug) if (solib_frv_debug)
@ -717,7 +717,7 @@ enable_break (void)
asection *interp_sect; asection *interp_sect;
CORE_ADDR entry_point; CORE_ADDR entry_point;
if (symfile_objfile == NULL) if (current_program_space->symfile_object_file == NULL)
{ {
if (solib_frv_debug) if (solib_frv_debug)
fprintf_unfiltered (gdb_stdlog, 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 = new lm_info_frv;
main_executable_lm_info->map = ldm; 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; changed = 0;
ALL_OBJFILE_OSECTIONS (symfile_objfile, osect) ALL_OBJFILE_OSECTIONS (objf, osect)
{ {
CORE_ADDR orig_addr, addr, offset; CORE_ADDR orig_addr, addr, offset;
int osect_idx; int osect_idx;
int seg; int seg;
osect_idx = osect - symfile_objfile->sections; osect_idx = osect - objf->sections;
/* Current address of section. */ /* Current address of section. */
addr = obj_section_addr (osect); addr = obj_section_addr (osect);
/* Offset from where this section started. */ /* 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. */ /* Original address prior to any past relocations. */
orig_addr = addr - offset; orig_addr = addr - offset;
@ -818,10 +819,10 @@ frv_relocate_main_executable (void)
} }
if (changed) if (changed)
objfile_relocate (symfile_objfile, new_offsets); objfile_relocate (objf, new_offsets);
/* Now that symfile_objfile has been relocated, we can compute the /* Now that OBJF has been relocated, we can compute the GOT value
GOT value and stash it away. */ and stash it away. */
main_executable_lm_info->got_value = main_got (); main_executable_lm_info->got_value = main_got ();
} }
@ -894,8 +895,8 @@ main_got (void)
{ {
struct bound_minimal_symbol got_sym; struct bound_minimal_symbol got_sym;
got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", objfile *objf = current_program_space->symfile_object_file;
NULL, symfile_objfile); got_sym = lookup_minimal_symbol ("_GLOBAL_OFFSET_TABLE_", NULL, objf);
if (got_sym.minsym == 0) if (got_sym.minsym == 0)
return 0; return 0;
@ -955,8 +956,9 @@ frv_fdpic_find_canonical_descriptor (CORE_ADDR entry_point)
name = sym->linkage_name (); name = sym->linkage_name ();
/* Check the main executable. */ /* Check the main executable. */
objfile *objf = current_program_space->symfile_object_file;
addr = find_canonical_descriptor_in_load_object 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); main_executable_lm_info);
/* If descriptor not found via main executable, check each load object /* 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); solib_add (0, 0, 1);
/* frv_current_sos() will set main_lm_addr for the main executable. */ /* 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; return main_lm_addr;
/* The other link map addresses may be found by examining the list /* The other link map addresses may be found by examining the list

View File

@ -806,7 +806,8 @@ elf_locate_base (void)
/* This may be a static executable. Look for the symbol /* This may be a static executable. Look for the symbol
conventionally named _r_debug, as a last resort. */ 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) if (msymbol.minsym != NULL)
return BMSYMBOL_VALUE_ADDRESS (msymbol); return BMSYMBOL_VALUE_ADDRESS (msymbol);
@ -971,7 +972,7 @@ open_symbol_file_object (int from_tty)
if (from_tty) if (from_tty)
add_flags |= SYMFILE_VERBOSE; add_flags |= SYMFILE_VERBOSE;
if (symfile_objfile) if (current_program_space->symfile_object_file)
if (!query (_("Attempt to reload symbols from process? "))) if (!query (_("Attempt to reload symbols from process? ")))
return 0; return 0;
@ -1544,7 +1545,7 @@ svr4_fetch_objfile_link_map (struct objfile *objfile)
solib_add (NULL, 0, auto_solib_add); solib_add (NULL, 0, auto_solib_add);
/* svr4_current_sos() will set main_lm_addr for the main executable. */ /* 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; return info->main_lm_addr;
/* If OBJFILE is a separate debug object file, look for the /* 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 /* Scan through the lists of symbols, trying to look up the symbol and
set a breakpoint there. Terminate loop when we/if we succeed. */ 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++) 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) if ((msymbol.minsym != NULL)
&& (BMSYMBOL_VALUE_ADDRESS (msymbol) != 0)) && (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++) 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) if ((msymbol.minsym != NULL)
&& (BMSYMBOL_VALUE_ADDRESS (msymbol) != 0)) && (BMSYMBOL_VALUE_ADDRESS (msymbol) != 0))
{ {
@ -2981,11 +2983,12 @@ svr4_relocate_main_executable (void)
/* Even DISPLACEMENT 0 is a valid new difference of in-memory vs. in-file /* Even DISPLACEMENT 0 is a valid new difference of in-memory vs. in-file
addresses. */ 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); displacement);
objfile_relocate (symfile_objfile, new_offsets); objfile_relocate (objf, new_offsets);
} }
else if (current_program_space->exec_bfd ()) else if (current_program_space->exec_bfd ())
{ {
@ -3246,7 +3249,7 @@ svr4_iterate_over_objfiles_in_search_order
if (current_objfile->separate_debug_objfile_backlink != nullptr) if (current_objfile->separate_debug_objfile_backlink != nullptr)
current_objfile = current_objfile->separate_debug_objfile_backlink; 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 (); abfd = current_program_space->exec_bfd ();
else else
abfd = current_objfile->obfd; abfd = current_objfile->obfd;

View File

@ -729,7 +729,8 @@ update_solib_list (int from_tty)
/* If we are attaching to a running process for which we /* If we are attaching to a running process for which we
have not opened a symbol file, we may be able to get its have not opened a symbol file, we may be able to get its
symbols now! */ symbols now! */
if (inf->attach_flag && symfile_objfile == NULL) if (inf->attach_flag
&& current_program_space->symfile_object_file == NULL)
{ {
try try
{ {

View File

@ -4518,8 +4518,9 @@ scan_file_globals (struct objfile *objfile)
If we are scanning the symbols for a shared library, try to resolve If we are scanning the symbols for a shared library, try to resolve
them from the minimal symbols of the main executable first. */ them from the minimal symbols of the main executable first. */
if (symfile_objfile && objfile != symfile_objfile) if (current_program_space->symfile_object_file
resolve_objfile = symfile_objfile; && objfile != current_program_space->symfile_object_file)
resolve_objfile = current_program_space->symfile_object_file;
else else
resolve_objfile = objfile; resolve_objfile = objfile;

View File

@ -143,8 +143,8 @@ add_symbol_file_from_memory_command (const char *args, int from_tty)
addr = parse_and_eval_address (args); addr = parse_and_eval_address (args);
/* We need some representative bfd to know the target we are looking at. */ /* We need some representative bfd to know the target we are looking at. */
if (symfile_objfile != NULL) if (current_program_space->symfile_object_file != NULL)
templ = symfile_objfile->obfd; templ = current_program_space->symfile_object_file->obfd;
else else
templ = current_program_space->exec_bfd (); templ = current_program_space->exec_bfd ();
if (templ == NULL) if (templ == NULL)

View File

@ -929,10 +929,10 @@ syms_from_objfile_1 (struct objfile *objfile,
/* Since no error yet, throw away the old symbol table. */ /* 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 (); current_program_space->symfile_object_file->unlink ();
gdb_assert (symfile_objfile == NULL); gdb_assert (current_program_space->symfile_object_file == NULL);
} }
/* Currently we keep symbols from the add-symbol-file command. /* Currently we keep symbols from the add-symbol-file command.
@ -995,7 +995,7 @@ finish_new_objfile (struct objfile *objfile, symfile_add_flags add_flags)
if (add_flags & SYMFILE_MAINLINE) if (add_flags & SYMFILE_MAINLINE)
{ {
/* OK, make it the "real" symbol file. */ /* OK, make it the "real" symbol file. */
symfile_objfile = objfile; current_program_space->symfile_object_file = objfile;
clear_symtab_users (add_flags); clear_symtab_users (add_flags);
} }
@ -1216,9 +1216,9 @@ symbol_file_clear (int from_tty)
{ {
if ((have_full_symbols () || have_partial_symbols ()) if ((have_full_symbols () || have_partial_symbols ())
&& from_tty && from_tty
&& (symfile_objfile && (current_program_space->symfile_object_file
? !query (_("Discard symbol table from `%s'? "), ? !query (_("Discard symbol table from `%s'? "),
objfile_name (symfile_objfile)) objfile_name (current_program_space->symfile_object_file))
: !query (_("Discard symbol table? ")))) : !query (_("Discard symbol table? "))))
error (_("Not confirmed.")); error (_("Not confirmed."));
@ -1230,7 +1230,7 @@ symbol_file_clear (int from_tty)
clear_symtab_users (0); clear_symtab_users (0);
gdb_assert (symfile_objfile == NULL); gdb_assert (current_program_space->symfile_object_file == NULL);
if (from_tty) if (from_tty)
printf_filtered (_("No symbol file now.\n")); printf_filtered (_("No symbol file now.\n"));
} }
@ -2555,7 +2555,7 @@ reread_symbols (void)
/* What the hell is sym_new_init for, anyway? The concept of /* What the hell is sym_new_init for, anyway? The concept of
distinguishing between the main file and additional files distinguishing between the main file and additional files
in this way seems rather dubious. */ in this way seems rather dubious. */
if (objfile == symfile_objfile) if (objfile == current_program_space->symfile_object_file)
{ {
(*objfile->sf->sym_new_init) (objfile); (*objfile->sf->sym_new_init) (objfile);
} }

View File

@ -1828,9 +1828,12 @@ info_target_command (const char *args, int from_tty)
{ {
int has_all_mem = 0; int has_all_mem = 0;
if (symfile_objfile != NULL) if (current_program_space->symfile_object_file != NULL)
{
objfile *objf = current_program_space->symfile_object_file;
printf_unfiltered (_("Symbols from \"%s\".\n"), printf_unfiltered (_("Symbols from \"%s\".\n"),
objfile_name (symfile_objfile)); objfile_name (objf));
}
for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ()) for (target_ops *t = current_top_target (); t != NULL; t = t->beneath ())
{ {

View File

@ -912,12 +912,13 @@ windows_solib_create_inferior_hook (int from_tty)
} }
/* Rebase executable if the base address changed because of ASLR. */ /* 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 CORE_ADDR vmaddr
= pe_data (current_program_space->exec_bfd ())->pe_opthdr.ImageBase; = pe_data (current_program_space->exec_bfd ())->pe_opthdr.ImageBase;
if (vmaddr != exec_base) if (vmaddr != exec_base)
objfile_rebase (symfile_objfile, exec_base - vmaddr); objfile_rebase (current_program_space->symfile_object_file,
exec_base - vmaddr);
} }
} }