aboutsummaryrefslogtreecommitdiff
path: root/gdb/corelow.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/corelow.c')
-rw-r--r--gdb/corelow.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/gdb/corelow.c b/gdb/corelow.c
index 4518781..af534bf 100644
--- a/gdb/corelow.c
+++ b/gdb/corelow.c
@@ -37,7 +37,6 @@
#include "exec.h"
#include "readline/tilde.h"
#include "solib.h"
-#include "solist.h"
#include "filenames.h"
#include "progspace.h"
#include "objfiles.h"
@@ -452,11 +451,8 @@ core_target::build_file_mappings ()
const bfd_build_id *core_build_id
= build_id_bfd_get (current_program_space->core_bfd ());
- for (const auto &iter : mapped_files)
+ for (const auto &[filename, file_data] : mapped_files)
{
- const std::string &filename = iter.first;
- const mapped_file &file_data = iter.second;
-
/* If this mapped file has the same build-id as was discovered for
the core-file itself, then we assume this is the main
executable. Record the filename as we can use this later. */
@@ -794,10 +790,13 @@ core_file_command (const char *filename, int from_tty)
.reg/1, .reg2/1, .reg/2, .reg2/2
After calling this function the rest of the core file handling code can
- treat this core file just like any other core file. */
+ treat this core file just like any other core file.
+
+ CBFD is the core file being loaded, and INF is the inferior through
+ which the core file will be examined. */
static void
-rename_vmcore_idle_reg_sections (bfd *abfd, inferior *inf)
+rename_vmcore_idle_reg_sections (bfd *cbfd, inferior *inf)
{
/* Map from the bfd section to its lwpid (the /NN number). */
std::vector<std::pair<asection *, int>> sections_and_lwpids;
@@ -812,7 +811,7 @@ rename_vmcore_idle_reg_sections (bfd *abfd, inferior *inf)
/* Look for all the .reg sections. Record the section object and the
lwpid which is extracted from the section name. Spot if any have an
lwpid of zero. */
- for (asection *sect : gdb_bfd_sections (current_program_space->core_bfd ()))
+ for (asection *sect : gdb_bfd_sections (cbfd))
{
if (startswith (bfd_section_name (sect), ".reg/"))
{
@@ -845,7 +844,7 @@ rename_vmcore_idle_reg_sections (bfd *abfd, inferior *inf)
std::string replacement_lwpid_str;
auto iter = sections_and_lwpids.begin ();
int replacement_lwpid = 0;
- for (asection *sect : gdb_bfd_sections (current_program_space->core_bfd ()))
+ for (asection *sect : gdb_bfd_sections (cbfd))
{
if (iter != sections_and_lwpids.end () && sect == iter->first)
{
@@ -883,7 +882,7 @@ rename_vmcore_idle_reg_sections (bfd *abfd, inferior *inf)
static_cast<int> (len - 2),
name, replacement_lwpid);
char *name_buf
- = static_cast<char *> (bfd_alloc (abfd, name_str.size () + 1));
+ = static_cast<char *> (bfd_alloc (cbfd, name_str.size () + 1));
if (name_buf == nullptr)
error (_("failed to allocate space for section name '%s'"),
name_str.c_str ());
@@ -957,7 +956,7 @@ locate_exec_from_corefile_exec_context (bfd *cbfd,
execbfd = open_and_check_build_id (exec_name);
else
{
- std::string p = (ldirname (bfd_get_filename (cbfd))
+ std::string p = (gdb_ldirname (bfd_get_filename (cbfd))
+ '/'
+ exec_name);
execbfd = open_and_check_build_id (p.c_str ());
@@ -971,7 +970,7 @@ locate_exec_from_corefile_exec_context (bfd *cbfd,
if (execbfd == nullptr)
{
const char *base_name = lbasename (exec_name);
- std::string p = (ldirname (bfd_get_filename (cbfd))
+ std::string p = (gdb_ldirname (bfd_get_filename (cbfd))
+ '/'
+ base_name);
execbfd = open_and_check_build_id (p.c_str ());
@@ -1181,7 +1180,7 @@ core_target_open (const char *arg, int from_tty)
if (current_program_space->exec_bfd () == nullptr)
set_gdbarch_from_file (current_program_space->core_bfd ());
- post_create_inferior (from_tty);
+ post_create_inferior (from_tty, true);
/* Now go through the target stack looking for threads since there
may be a thread_stratum target loaded on top of target core by
@@ -1830,7 +1829,8 @@ core_target::info_proc (const char *args, enum info_proc_what request)
/* Since this is the core file target, call the 'core_info_proc'
method on gdbarch, not 'info_proc'. */
if (gdbarch_core_info_proc_p (gdbarch))
- gdbarch_core_info_proc (gdbarch, args, request);
+ gdbarch_core_info_proc (gdbarch, current_program_space->core_bfd (),
+ args, request);
return true;
}
@@ -2158,9 +2158,7 @@ core_target_find_mapped_file (const char *filename,
return targ->lookup_mapped_file_info (filename, addr);
}
-void _initialize_corelow ();
-void
-_initialize_corelow ()
+INIT_GDB_FILE (corelow)
{
add_target (core_target_info, core_target_open,
filename_maybe_quoted_completer);