- xsnprintf (buf, sizeof buf, "LWP %ld", ptid_get_lwp (ptid));
- return buf;
+ /* Check whether we're printing an LWP (gdb thread) or a
+ process. */
+ pid = ptid.lwp ();
+ if (pid != 0)
+ {
+ /* A thread. */
+ return string_printf ("LWP %ld", ptid.lwp ());
+ }
+
+ /* GDB didn't use to put a NT_PSTATUS note in Solaris cores. If
+ that's missing, then we're dealing with a fake PID corelow.c made
+ up. */
+ inf = find_inferior_ptid (current_inferior ()->process_target (), ptid);
+ if (inf == NULL || inf->fake_pid_p)
+ return "<core>";
+
+ /* Not fake; print as usual. */
+ return normal_pid_to_str (ptid);