From 7e10abd146dbd17dc1b4e9701210e5724df2b2b0 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Thu, 29 Oct 2020 15:04:33 -0600 Subject: Remove the exec_bfd macro This removes the exec_bfd macro, in favor of new accessors on program_space. In one spot the accessor can't be used; but this is still a big improvement over the macro, IMO. gdb/ChangeLog 2020-10-29 Tom Tromey * windows-tdep.c (windows_solib_create_inferior_hook): Update. * symfile.c (reread_symbols): Update. * symfile-mem.c (add_symbol_file_from_memory_command) (add_vsyscall_page): Update. * source-cache.c (source_cache::get_plain_source_lines): Update. * solib-svr4.c (find_program_interpreter, elf_locate_base) (svr4_current_sos_direct, svr4_exec_displacement) (svr4_relocate_main_executable): Update. (svr4_iterate_over_objfiles_in_search_order): Update. * solib-frv.c (enable_break2, enable_break): Update. * solib-dsbt.c (lm_base, enable_break): Update. * solib-darwin.c (find_program_interpreter) (darwin_solib_create_inferior_hook): Update. * sol-thread.c (rw_common, ps_pdmodel): Update. * rs6000-nat.c (rs6000_nat_target::create_inferior): Update. * remote.c (compare_sections_command) (remote_target::trace_set_readonly_regions): Update. * remote-sim.c (get_sim_inferior_data) (gdbsim_target::create_inferior, gdbsim_target::create_inferior): Update. (gdbsim_target_open, gdbsim_target::files_info): Update. * exec.h (exec_bfd): Remove macro. * progspace.c (initialize_progspace): Update. * proc-service.c (ps_addr_to_core_addr, core_addr_to_ps_addr): Update. * nto-procfs.c (nto_procfs_target::post_attach) (nto_procfs_target::create_inferior): Update. * maint.c (maintenance_info_sections): Update. * linux-thread-db.c (thread_db_target::get_thread_local_address): Update. * infcmd.c (post_create_inferior): Update. * gcore.c (default_gcore_arch, default_gcore_target): Update. (objfile_find_memory_regions): Update. * exec.c (validate_exec_file, exec_file_attach) (exec_read_partial_read_only, print_section_info): Update. * corelow.c (core_target_open): Update. * corefile.c (reopen_exec_file, validate_files): Update. * arm-tdep.c (gdb_print_insn_arm): Update. * arch-utils.c (gdbarch_update_p, default_print_insn): Update. * progspace.h (struct program_space) : New methods. --- gdb/remote.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'gdb/remote.c') diff --git a/gdb/remote.c b/gdb/remote.c index 9ee1e8c..291b7c6 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -56,7 +56,7 @@ #include #include "serial.h" -#include "gdbcore.h" /* for exec_bfd */ +#include "gdbcore.h" #include "remote-fileio.h" #include "gdb/fileio.h" @@ -10770,7 +10770,7 @@ compare_sections_command (const char *args, int from_tty) int res; int read_only = 0; - if (!exec_bfd) + if (!current_program_space->exec_bfd ()) error (_("command cannot be used without an exec file")); if (args != NULL && strcmp (args, "-r") == 0) @@ -10779,7 +10779,7 @@ compare_sections_command (const char *args, int from_tty) args = NULL; } - for (s = exec_bfd->sections; s; s = s->next) + for (s = current_program_space->exec_bfd ()->sections; s; s = s->next) { if (!(s->flags & SEC_LOAD)) continue; /* Skip non-loadable section. */ @@ -10799,7 +10799,8 @@ compare_sections_command (const char *args, int from_tty) lma = s->lma; gdb::byte_vector sectdata (size); - bfd_get_section_contents (exec_bfd, s, sectdata.data (), 0, size); + bfd_get_section_contents (current_program_space->exec_bfd (), s, + sectdata.data (), 0, size); res = target_verify_memory (sectdata.data (), lma, size); @@ -13180,14 +13181,14 @@ remote_target::trace_set_readonly_regions () int anysecs = 0; int offset = 0; - if (!exec_bfd) + if (!current_program_space->exec_bfd ()) return; /* No information to give. */ struct remote_state *rs = get_remote_state (); strcpy (rs->buf.data (), "QTro"); offset = strlen (rs->buf.data ()); - for (s = exec_bfd->sections; s; s = s->next) + for (s = current_program_space->exec_bfd ()->sections; s; s = s->next) { char tmp1[40], tmp2[40]; int sec_length; -- cgit v1.1