+2012-02-10 Pedro Alves <palves@redhat.com>
+
+ * inferior.c (inferior_pid_to_str): New.
+ (print_inferior, inferior_command): Use it.
+
2012-02-10 Pedro Alves <palves@redhat.com>
* configure.ac (HAVE_ELF test): Put the old CFLAGS at the end of
return count;
}
+/* Converts an inferior process id to a string. Like
+ target_pid_to_str, but special cases the null process. */
+
+static char *
+inferior_pid_to_str (int pid)
+{
+ if (pid != 0)
+ return target_pid_to_str (pid_to_ptid (pid));
+ else
+ return _("<null>");
+}
+
/* Prints the list of inferiors and their details on UIOUT. This is a
version of 'info_inferior_command' suitable for use from MI.
ui_out_field_int (uiout, "number", inf->num);
- if (inf->pid)
- ui_out_field_string (uiout, "target-id",
- target_pid_to_str (pid_to_ptid (inf->pid)));
- else
- ui_out_field_string (uiout, "target-id", "<null>");
+ ui_out_field_string (uiout, "target-id",
+ inferior_pid_to_str (inf->pid));
if (inf->pspace->ebfd)
ui_out_field_string (uiout, "exec",
printf_filtered (_("[Switching to inferior %d [%s] (%s)]\n"),
inf->num,
- target_pid_to_str (pid_to_ptid (inf->pid)),
+ inferior_pid_to_str (inf->pid),
(inf->pspace->ebfd
? bfd_get_filename (inf->pspace->ebfd)
: _("<noexec>")));