+/* 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 (core_gdbarch && gdbarch_core_read_description_p (core_gdbarch))
+ return gdbarch_core_read_description (core_gdbarch,
+ target, core_bfd);
+
+ return NULL;
+}
+
+static char *
+core_pid_to_str (struct target_ops *ops, ptid_t ptid)
+{
+ static char buf[64];
+ struct inferior *inf;
+ int pid;
+
+ /* The preferred way is to have a gdbarch/OS specific
+ implementation. */
+ if (core_gdbarch
+ && gdbarch_core_pid_to_str_p (core_gdbarch))
+ return gdbarch_core_pid_to_str (core_gdbarch, ptid);
+
+ /* Otherwise, if we don't have one, we'll just fallback to
+ "process", with normal_pid_to_str. */
+
+ /* Try the LWPID field first. */
+ pid = ptid_get_lwp (ptid);
+ if (pid != 0)
+ return normal_pid_to_str (pid_to_ptid (pid));
+
+ /* Otherwise, this isn't a "threaded" core -- use the PID field, but
+ only if it isn't a fake PID. */
+ inf = find_inferior_pid (ptid_get_pid (ptid));
+ if (inf != NULL && !inf->fake_pid_p)
+ return normal_pid_to_str (ptid);
+
+ /* No luck. We simply don't have a valid PID to print. */
+ xsnprintf (buf, sizeof buf, "<main task>");
+ return buf;
+}
+
+static int
+core_has_memory (struct target_ops *ops)
+{
+ return (core_bfd != NULL);
+}
+
+static int
+core_has_stack (struct target_ops *ops)
+{
+ return (core_bfd != NULL);
+}
+
+static int
+core_has_registers (struct target_ops *ops)
+{
+ return (core_bfd != NULL);
+}
+
+/* Implement the to_info_proc method. */
+
+static void
+core_info_proc (struct target_ops *ops, char *args, enum info_proc_what request)
+{
+ struct gdbarch *gdbarch = get_current_arch ();
+
+ /* 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);
+}
+