* corelow.c (core_read_description): New.
(init_core_ops): Set to_read_description.
* gdbarch.sh: Add gdbarch_core_read_description.
* mips-linux-tdep.c (mips_linux_core_read_description): New.
(mips_linux_init_abi): Call set_gdbarch_core_read_description.
* mips-tdep.c (mips_tdesc_gp32, mips_tdesc_gp64): New.
(mips_register_g_packet_guesses): Use them.
(_initialize_mips_tdep): Initialize them.
* mips-tdep.h (mips_tdesc_gp32, mips_tdesc_gp64): Declare.
* gdbarch.h, gdbarch.c: Regenerated.
+2007-09-10 Daniel Jacobowitz <dan@codesourcery.com>
+
+ * arch-utils.c (gdbarch_info_fill): Also try core_bfd.
+ * corelow.c (core_read_description): New.
+ (init_core_ops): Set to_read_description.
+ * gdbarch.sh: Add gdbarch_core_read_description.
+ * mips-linux-tdep.c (mips_linux_core_read_description): New.
+ (mips_linux_init_abi): Call set_gdbarch_core_read_description.
+ * mips-tdep.c (mips_tdesc_gp32, mips_tdesc_gp64): New.
+ (mips_register_g_packet_guesses): Use them.
+ (_initialize_mips_tdep): Initialize them.
+ * mips-tdep.h (mips_tdesc_gp32, mips_tdesc_gp64): Declare.
+ * gdbarch.h, gdbarch.c: Regenerated.
+
2007-09-10 Ulrich Weigand <uweigand@de.ibm.com>
* infrun.c (stepping_past_breakpoint): New global variable.
/* Check for the current file. */
if (info->abfd == NULL)
info->abfd = exec_bfd;
+ if (info->abfd == NULL)
+ info->abfd = core_bfd;
/* Check for the current target description. */
if (info->target_desc == NULL)
return 1;
}
+/* Ask the current architecture what it knows about this core file.
+ That will be used, in turn, to pick a better architecture. This
+ wrapper could be avoided if targets got a chance to specialize
+ core_ops. */
+
+static const struct target_desc *
+core_read_description (struct target_ops *target)
+{
+ if (gdbarch_core_read_description_p (current_gdbarch))
+ return gdbarch_core_read_description (current_gdbarch, target, core_bfd);
+
+ return NULL;
+}
+
/* Fill in core_ops with its defined operations and properties. */
static void
core_ops.to_remove_breakpoint = ignore;
core_ops.to_create_inferior = find_default_create_inferior;
core_ops.to_thread_alive = core_file_thread_alive;
+ core_ops.to_read_description = core_read_description;
core_ops.to_stratum = core_stratum;
core_ops.to_has_memory = 1;
core_ops.to_has_stack = 1;
int vbit_in_delta;
gdbarch_skip_permanent_breakpoint_ftype *skip_permanent_breakpoint;
gdbarch_overlay_update_ftype *overlay_update;
+ gdbarch_core_read_description_ftype *core_read_description;
};
0, /* vbit_in_delta */
0, /* skip_permanent_breakpoint */
0, /* overlay_update */
+ 0, /* core_read_description */
/* startup_gdbarch() */
};
/* Skip verify of vbit_in_delta, invalid_p == 0 */
/* Skip verify of skip_permanent_breakpoint, has predicate */
/* Skip verify of overlay_update, has predicate */
+ /* Skip verify of core_read_description, has predicate */
buf = ui_file_xstrdup (log, &dummy);
make_cleanup (xfree, buf);
if (strlen (buf) > 0)
fprintf_unfiltered (file,
"gdbarch_dump: convert_register_p = <0x%lx>\n",
(long) current_gdbarch->convert_register_p);
+ fprintf_unfiltered (file,
+ "gdbarch_dump: gdbarch_core_read_description_p() = %d\n",
+ gdbarch_core_read_description_p (current_gdbarch));
+ fprintf_unfiltered (file,
+ "gdbarch_dump: core_read_description = <0x%lx>\n",
+ (long) current_gdbarch->core_read_description);
fprintf_unfiltered (file,
"gdbarch_dump: gdbarch_core_xfer_shared_libraries_p() = %d\n",
gdbarch_core_xfer_shared_libraries_p (current_gdbarch));
gdbarch->overlay_update = overlay_update;
}
+int
+gdbarch_core_read_description_p (struct gdbarch *gdbarch)
+{
+ gdb_assert (gdbarch != NULL);
+ return gdbarch->core_read_description != NULL;
+}
+
+const struct target_desc *
+gdbarch_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd)
+{
+ gdb_assert (gdbarch != NULL);
+ gdb_assert (gdbarch->core_read_description != NULL);
+ if (gdbarch_debug >= 2)
+ fprintf_unfiltered (gdb_stdlog, "gdbarch_core_read_description called\n");
+ return gdbarch->core_read_description (gdbarch, target, abfd);
+}
+
+void
+set_gdbarch_core_read_description (struct gdbarch *gdbarch,
+ gdbarch_core_read_description_ftype core_read_description)
+{
+ gdbarch->core_read_description = core_read_description;
+}
+
/* Keep a registry of per-architecture data-pointers required by GDB
modules. */
extern void gdbarch_overlay_update (struct gdbarch *gdbarch, struct obj_section *osect);
extern void set_gdbarch_overlay_update (struct gdbarch *gdbarch, gdbarch_overlay_update_ftype *overlay_update);
+extern int gdbarch_core_read_description_p (struct gdbarch *gdbarch);
+
+typedef const struct target_desc * (gdbarch_core_read_description_ftype) (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd);
+extern const struct target_desc * gdbarch_core_read_description (struct gdbarch *gdbarch, struct target_ops *target, bfd *abfd);
+extern void set_gdbarch_core_read_description (struct gdbarch *gdbarch, gdbarch_core_read_description_ftype *core_read_description);
+
extern struct gdbarch_tdep *gdbarch_tdep (struct gdbarch *gdbarch);
# Refresh overlay mapped state for section OSECT.
F::void:overlay_update:struct obj_section *osect:osect
+
+M::const struct target_desc *:core_read_description:struct target_ops *target, bfd *abfd:target, abfd
EOF
}
NULL /* next */
};
+static const struct target_desc *
+mips_linux_core_read_description (struct gdbarch *gdbarch,
+ struct target_ops *target,
+ bfd *abfd)
+{
+ asection *section = bfd_get_section_by_name (abfd, ".reg");
+ if (! section)
+ return NULL;
+
+ switch (bfd_section_size (abfd, section))
+ {
+ case sizeof (mips_elf_gregset_t):
+ return mips_tdesc_gp32;
+
+ case sizeof (mips64_elf_gregset_t):
+ return mips_tdesc_gp64;
+
+ default:
+ return NULL;
+ }
+}
+
/* Check the code at PC for a dynamic linker lazy resolution stub.
Because they aren't in the .plt section, we pattern-match on the
set_gdbarch_write_pc (gdbarch, mips_linux_write_pc);
+ set_gdbarch_core_read_description (gdbarch,
+ mips_linux_core_read_description);
+
if (tdesc_data)
{
const struct tdesc_feature *feature;
#define PROPERTY_GP32 "internal: transfers-32bit-registers"
#define PROPERTY_GP64 "internal: transfers-64bit-registers"
+struct target_desc *mips_tdesc_gp32;
+struct target_desc *mips_tdesc_gp64;
+
/* MIPS specific per-architecture information */
struct gdbarch_tdep
{
static void
mips_register_g_packet_guesses (struct gdbarch *gdbarch)
{
- static struct target_desc *tdesc_gp32, *tdesc_gp64;
-
- if (tdesc_gp32 == NULL)
- {
- /* Create feature sets with the appropriate properties. The values
- are not important. */
-
- tdesc_gp32 = allocate_target_description ();
- set_tdesc_property (tdesc_gp32, PROPERTY_GP32, "");
-
- tdesc_gp64 = allocate_target_description ();
- set_tdesc_property (tdesc_gp64, PROPERTY_GP64, "");
- }
-
/* If the size matches the set of 32-bit or 64-bit integer registers,
assume that's what we've got. */
- register_remote_g_packet_guess (gdbarch, 38 * 4, tdesc_gp32);
- register_remote_g_packet_guess (gdbarch, 38 * 8, tdesc_gp64);
+ register_remote_g_packet_guess (gdbarch, 38 * 4, mips_tdesc_gp32);
+ register_remote_g_packet_guess (gdbarch, 38 * 8, mips_tdesc_gp64);
/* If the size matches the full set of registers GDB traditionally
knows about, including floating point, for either 32-bit or
64-bit, assume that's what we've got. */
- register_remote_g_packet_guess (gdbarch, 90 * 4, tdesc_gp32);
- register_remote_g_packet_guess (gdbarch, 90 * 8, tdesc_gp64);
+ register_remote_g_packet_guess (gdbarch, 90 * 4, mips_tdesc_gp32);
+ register_remote_g_packet_guess (gdbarch, 90 * 8, mips_tdesc_gp64);
/* Otherwise we don't have a useful guess. */
}
mips_pdr_data = register_objfile_data ();
+ /* Create feature sets with the appropriate properties. The values
+ are not important. */
+ mips_tdesc_gp32 = allocate_target_description ();
+ set_tdesc_property (mips_tdesc_gp32, PROPERTY_GP32, "");
+
+ mips_tdesc_gp64 = allocate_target_description ();
+ set_tdesc_property (mips_tdesc_gp64, PROPERTY_GP64, "");
+
/* Add root prefix command for all "set mips"/"show mips" commands */
add_prefix_cmd ("mips", no_class, set_mips_command,
_("Various MIPS specific commands."),
/* Return the currently configured (or set) saved register size. */
extern unsigned int mips_abi_regsize (struct gdbarch *gdbarch);
+/* Target descriptions which only indicate the size of general
+ registers. */
+extern struct target_desc *mips_tdesc_gp32;
+extern struct target_desc *mips_tdesc_gp64;
+
#endif /* MIPS_TDEP_H */