forked from Imagelibrary/binutils-gdb
* gdbarch.sh (gcore_bfd_target): New gdbarch callback.
* gdbarch.h, gdbarch.c: Regenerate. * gcore.c (default_gcore_target): Make return value const. Call gdbarch_gcore_bfd_target if present. (default_gcore_arch, default_gcore_mach): Use target_gdbarch. * corelow.c (core_read_description): Call gdbarch_core_read_description on core_gdbarch instead of current_gdbarch. * ppc-linux-tdep.c (ppc_linux_init_abi): Install gcore_bfd_target.
This commit is contained in:
16
gdb/gcore.c
16
gdb/gcore.c
@@ -35,7 +35,7 @@
|
||||
generate-core-file for programs with large resident data. */
|
||||
#define MAX_COPY_BYTES (1024 * 1024)
|
||||
|
||||
static char *default_gcore_target (void);
|
||||
static const char *default_gcore_target (void);
|
||||
static enum bfd_architecture default_gcore_arch (void);
|
||||
static unsigned long default_gcore_mach (void);
|
||||
static int gcore_memory_sections (bfd *);
|
||||
@@ -125,7 +125,7 @@ default_gcore_mach (void)
|
||||
return 0;
|
||||
#else
|
||||
|
||||
const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (current_gdbarch);
|
||||
const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (target_gdbarch);
|
||||
|
||||
if (bfdarch != NULL)
|
||||
return bfdarch->mach;
|
||||
@@ -139,8 +139,7 @@ default_gcore_mach (void)
|
||||
static enum bfd_architecture
|
||||
default_gcore_arch (void)
|
||||
{
|
||||
const struct bfd_arch_info * bfdarch = gdbarch_bfd_arch_info
|
||||
(current_gdbarch);
|
||||
const struct bfd_arch_info *bfdarch = gdbarch_bfd_arch_info (target_gdbarch);
|
||||
|
||||
if (bfdarch != NULL)
|
||||
return bfdarch->arch;
|
||||
@@ -150,10 +149,15 @@ default_gcore_arch (void)
|
||||
return bfd_get_arch (exec_bfd);
|
||||
}
|
||||
|
||||
static char *
|
||||
static const char *
|
||||
default_gcore_target (void)
|
||||
{
|
||||
/* FIXME: This may only work for ELF targets. */
|
||||
/* The gdbarch may define a target to use for core files. */
|
||||
if (gdbarch_gcore_bfd_target_p (target_gdbarch))
|
||||
return gdbarch_gcore_bfd_target (target_gdbarch);
|
||||
|
||||
/* Otherwise, try to fall back to the exec_bfd target. This will probably
|
||||
not work for non-ELF targets. */
|
||||
if (exec_bfd == NULL)
|
||||
return NULL;
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user