aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/corefile.c11
-rw-r--r--gdb/corelow.c2
-rw-r--r--gdb/fbsd-tdep.c2
-rw-r--r--gdb/linux-tdep.c14
-rw-r--r--gdb/linux-thread-db.c3
-rw-r--r--gdb/maint.c7
-rw-r--r--gdb/progspace.c13
-rw-r--r--gdb/progspace.h2
-rw-r--r--gdb/record-full.c5
-rw-r--r--gdb/sol-thread.c3
-rw-r--r--gdb/solib-dsbt.c3
-rw-r--r--gdb/solib-frv.c3
-rw-r--r--gdb/symfile-mem.c4
13 files changed, 32 insertions, 40 deletions
diff --git a/gdb/corefile.c b/gdb/corefile.c
index a2c75c0..666ff55 100644
--- a/gdb/corefile.c
+++ b/gdb/corefile.c
@@ -66,13 +66,14 @@ reopen_exec_file (void)
void
validate_files (void)
{
- if (current_program_space->exec_bfd () && current_program_space->core_bfd ())
+ bfd *ebfd = current_program_space->exec_bfd ();
+ bfd *cbfd = get_inferior_core_bfd (current_inferior ());
+
+ if (ebfd != nullptr && cbfd != nullptr)
{
- if (!core_file_matches_executable_p (current_program_space->core_bfd (),
- current_program_space->exec_bfd ()))
+ if (!core_file_matches_executable_p (cbfd, ebfd))
warning (_("core file may not match specified executable file."));
- else if (gdb_bfd_get_mtime (current_program_space->exec_bfd ())
- > gdb_bfd_get_mtime (current_program_space->core_bfd ()))
+ else if (gdb_bfd_get_mtime (ebfd) > gdb_bfd_get_mtime (cbfd))
warning (_("exec file is newer than core file."));
}
}
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 6175e96..d48154d 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -1015,7 +1015,7 @@ core_target_open (const char *arg, int from_tty)
gdb_assert (current_inferior ()->process_target () == nullptr);
/* Which will clear up any existing core file BFD. */
- gdb_assert (current_program_space->core_bfd () == nullptr);
+ gdb_assert (get_inferior_core_bfd (current_inferior ()) == nullptr);
std::string filename = extract_single_filename_arg (arg);
diff --git a/gdb/fbsd-tdep.c b/gdb/fbsd-tdep.c
index c0a93e8..a2f000b 100644
--- a/gdb/fbsd-tdep.c
+++ b/gdb/fbsd-tdep.c
@@ -2317,7 +2317,7 @@ fbsd_vdso_range (struct gdbarch *gdbarch, struct mem_range *range)
if (!target_has_execution ())
{
/* Search for the ending address in the NT_PROCSTAT_VMMAP note. */
- bfd *cbfd = current_program_space->core_bfd ();
+ bfd *cbfd = get_inferior_core_bfd (current_inferior ());
asection *section = bfd_get_section_by_name (cbfd,
".note.freebsdcore.vmmap");
if (section == nullptr)
diff --git a/gdb/linux-tdep.c b/gdb/linux-tdep.c
index 3c813f5..77557d5 100644
--- a/gdb/linux-tdep.c
+++ b/gdb/linux-tdep.c
@@ -1511,12 +1511,13 @@ linux_process_address_in_memtag_page (CORE_ADDR address)
static bool
linux_core_file_address_in_memtag_page (CORE_ADDR address)
{
- if (current_program_space->core_bfd () == nullptr)
+ bfd *cbfd = get_inferior_core_bfd (current_inferior ());
+
+ if (cbfd == nullptr)
return false;
memtag_section_info info;
- return get_next_core_memtag_section (current_program_space->core_bfd (),
- nullptr, address, info);
+ return get_next_core_memtag_section (cbfd, nullptr, address, info);
}
/* See linux-tdep.h. */
@@ -2693,15 +2694,14 @@ linux_vsyscall_range_raw (struct gdbarch *gdbarch, struct mem_range *range)
long phdrs_size;
int num_phdrs, i;
- phdrs_size
- = bfd_get_elf_phdr_upper_bound (current_program_space->core_bfd ());
+ bfd *cbfd = get_inferior_core_bfd (current_inferior ());
+ phdrs_size = bfd_get_elf_phdr_upper_bound (cbfd);
if (phdrs_size == -1)
return 0;
gdb::unique_xmalloc_ptr<Elf_Internal_Phdr>
phdrs ((Elf_Internal_Phdr *) xmalloc (phdrs_size));
- num_phdrs = bfd_get_elf_phdrs (current_program_space->core_bfd (),
- phdrs.get ());
+ num_phdrs = bfd_get_elf_phdrs (cbfd, phdrs.get ());
if (num_phdrs == -1)
return 0;
diff --git a/gdb/linux-thread-db.c b/gdb/linux-thread-db.c
index 63e4c69..f00e3b5 100644
--- a/gdb/linux-thread-db.c
+++ b/gdb/linux-thread-db.c
@@ -1215,7 +1215,8 @@ thread_db_load (void)
return false;
/* Don't attempt to use thread_db for remote targets. */
- if (!(target_can_run () || current_program_space->core_bfd () != nullptr))
+ if (!(target_can_run ()
+ || get_inferior_core_bfd (current_inferior ()) != nullptr))
return false;
if (thread_db_load_search ())
diff --git a/gdb/maint.c b/gdb/maint.c
index ca7648f..5765829 100644
--- a/gdb/maint.c
+++ b/gdb/maint.c
@@ -39,6 +39,7 @@
#include "gdbsupport/thread-pool.h"
#include "event-top.h"
#include "cp-support.h"
+#include "gdbcore.h"
#include "cli/cli-decode.h"
#include "cli/cli-utils.h"
@@ -474,9 +475,9 @@ maintenance_info_sections (const char *arg, int from_tty)
&ofile, arg);
}
- if (current_program_space->core_bfd () != nullptr)
- maint_print_all_sections (_("Core file: "),
- current_program_space->core_bfd (), nullptr, arg);
+ bfd *cbfd = get_inferior_core_bfd (current_inferior ());
+ if (cbfd != nullptr)
+ maint_print_all_sections (_("Core file: "), cbfd, nullptr, arg);
}
/* Implement the "maintenance info target-sections" command. */
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 59b9c8c..6ee0134 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -436,19 +436,6 @@ update_address_spaces (void)
/* See progspace.h. */
-bfd *
-program_space::core_bfd () const
-{
- /* This only works because we (currently) never call the core_bfd method
- on anything other than the current program space. Don't worry too
- much, this is a temporary bodge, and will be removed in the next
- commit. */
- gdb_assert (this == current_program_space);
- return get_inferior_core_bfd (current_inferior ());
-}
-
-/* See progspace.h. */
-
void
program_space::clear_solib_cache ()
{
diff --git a/gdb/progspace.h b/gdb/progspace.h
index 302520e..1cf6042 100644
--- a/gdb/progspace.h
+++ b/gdb/progspace.h
@@ -292,8 +292,6 @@ struct program_space
ebfd = std::move (abfd);
}
- bfd *core_bfd () const;
-
/* Reset saved solib data at the start of an solib event. This lets
us properly collect the data when calling solib_add, so it can then
later be printed. */
diff --git a/gdb/record-full.c b/gdb/record-full.c
index 22227c3..396ba32 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -987,8 +987,9 @@ record_full_open (const char *args, int from_tty)
record_full_list = &record_full_first;
record_full_list->next = NULL;
- if (current_program_space->core_bfd () != nullptr)
- record_full_core_open_1 (*current_program_space->core_bfd ());
+ bfd *cbfd = get_inferior_core_bfd (current_inferior ());
+ if (cbfd != nullptr)
+ record_full_core_open_1 (*cbfd);
else
record_full_open_1 ();
diff --git a/gdb/sol-thread.c b/gdb/sol-thread.c
index 55e1d3e..0aa4595 100644
--- a/gdb/sol-thread.c
+++ b/gdb/sol-thread.c
@@ -605,7 +605,8 @@ check_for_thread_db (void)
ptid_t ptid;
/* Don't attempt to use thread_db for remote targets. */
- if (!(target_can_run () || current_program_space->core_bfd () != nullptr))
+ if (!(target_can_run ()
+ || get_inferior_core_bfd(current_inferior ()) != nullptr))
return;
/* Do nothing if we couldn't load libthread_db.so.1. */
diff --git a/gdb/solib-dsbt.c b/gdb/solib-dsbt.c
index 719678b..883164e 100644
--- a/gdb/solib-dsbt.c
+++ b/gdb/solib-dsbt.c
@@ -27,6 +27,7 @@
#include "solib-dsbt.h"
#include "elf/common.h"
#include "cli/cli-cmds.h"
+#include "gdbcore.h"
#define GOT_MODULE_OFFSET 4
@@ -549,7 +550,7 @@ dsbt_solib_ops::current_sos () const
solib_create_inferior_hook. (See post_create_inferior in
infcmd.c.) */
if (info->main_executable_lm_info == 0
- && current_program_space->core_bfd () != nullptr)
+ && get_inferior_core_bfd (current_inferior ()) != nullptr)
dsbt_relocate_main_executable ();
/* Locate the address of the first link map struct. */
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index ac5872e..beb8802 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -26,6 +26,7 @@
#include "gdb_bfd.h"
#include "inferior.h"
#include "solib-frv.h"
+#include "gdbcore.h"
/* solib_ops for FR-V systems. */
@@ -341,7 +342,7 @@ frv_solib_ops::current_sos () const
solib_create_inferior_hook(). (See post_create_inferior() in
infcmd.c.) */
if (main_executable_lm_info == 0
- && current_program_space->core_bfd () != nullptr)
+ && get_inferior_core_bfd (current_inferior ()) != nullptr)
frv_relocate_main_executable ();
/* Fetch the GOT corresponding to the main executable. */
diff --git a/gdb/symfile-mem.c b/gdb/symfile-mem.c
index 274dc0f..9bf79f7 100644
--- a/gdb/symfile-mem.c
+++ b/gdb/symfile-mem.c
@@ -166,8 +166,8 @@ add_vsyscall_page (inferior *inf)
{
struct bfd *bfd;
- if (current_program_space->core_bfd () != nullptr)
- bfd = current_program_space->core_bfd ();
+ if (get_inferior_core_bfd (current_inferior ()) != nullptr)
+ bfd = get_inferior_core_bfd (current_inferior ());
else if (current_program_space->exec_bfd () != nullptr)
bfd = current_program_space->exec_bfd ();
else