+2003-10-29 Mark Kettenis <kettenis@gnu.org>
+
+ * corelow.c: Include "arch-utils.h", "regset.h" and
+ "gdb_assert.h".
+ (core_gdbarch): New variable.
+ (sniff_core_bfd): Don't sniff if we have support for register sets
+ in CORE_GDBARCH.
+ (core_close): Reset CORE_GDBARCH.
+ (core_open): Initialize CORE_GDBARCH.
+ (get_core_register_section): Use register sets if they are
+ supported by CORE_GDBARCH.
+ (get_core_registers): Don't print error message if we have support
+ for register sets in CORE_GDBARCH.
+
2003-10-29 Andrew Cagney <cagney@redhat.com>
* ppc-linux-tdep.c (_initialize_ppc_linux_tdep): Instead of the
Boston, MA 02111-1307, USA. */
#include "defs.h"
+#include "arch-utils.h"
#include "gdb_string.h"
#include <errno.h>
#include <signal.h>
#include "gdbcore.h"
#include "gdbthread.h"
#include "regcache.h"
+#include "regset.h"
#include "symfile.h"
#include "exec.h"
#include <readline/readline.h>
+#include "gdb_assert.h"
+
#ifndef O_BINARY
#define O_BINARY 0
#endif
static struct core_fns *core_vec = NULL;
+/* FIXME: kettenis/20031023: Eventually this variable should
+ disappear. */
+
+struct gdbarch *core_gdbarch = NULL;
+
static void core_files_info (struct target_ops *);
#ifdef SOLIB_ADD
struct core_fns *yummy = NULL;
int matches = 0;;
+ /* Don't sniff if we have support for register sets in CORE_GDBARCH. */
+ if (core_gdbarch && gdbarch_regset_from_core_section_p (core_gdbarch))
+ return NULL;
+
for (cf = core_file_fns; cf != NULL; cf = cf->next)
{
if (cf->core_sniffer (cf, abfd))
}
}
core_vec = NULL;
+ core_gdbarch = NULL;
}
static void
core_bfd = temp_bfd;
old_chain = make_cleanup (core_close_cleanup, 0 /*ignore*/);
+ /* FIXME: kettenis/20031023: This is very dangerous. The
+ CORE_GDBARCH that results from this call may very well be
+ different from CURRENT_GDBARCH. However, its methods may only
+ work if it is selected as the current architecture, because they
+ rely on swapped data (see gdbarch.c). We should get rid of that
+ swapped data. */
+ core_gdbarch = gdbarch_from_bfd (core_bfd);
+
/* Find a suitable core file handler to munch on core_bfd */
core_vec = sniff_core_bfd (core_bfd);
return;
}
+ if (core_gdbarch && gdbarch_regset_from_core_section_p (core_gdbarch))
+ {
+ const struct regset *regset;
+
+ regset = gdbarch_regset_from_core_section (core_gdbarch, name, size);
+ if (regset == NULL)
+ {
+ if (required)
+ warning ("Couldn't recognize %s registers in core file.\n",
+ human_name);
+ return;
+ }
+
+ regset->supply_regset (regset, current_regcache, -1, contents, size);
+ return;
+ }
+
+ gdb_assert (core_vec);
core_vec->core_read_registers (contents, size, which,
((CORE_ADDR)
bfd_section_vma (core_bfd, section)));
{
int status;
- if (core_vec == NULL
- || core_vec->core_read_registers == NULL)
+ if (!(core_gdbarch && gdbarch_regset_from_core_section_p (core_gdbarch))
+ && (core_vec == NULL || core_vec->core_read_registers == NULL))
{
fprintf_filtered (gdb_stderr,
"Can't fetch registers from this type of core file\n");