* remote.c (remote_pid_to_str): If printing a process id and we

don't know what the remote pid could be, output "Remote target";
	otherwise, use normal_pid_to_str.
This commit is contained in:
Pedro Alves 2009-08-13 18:27:56 +00:00
parent 078bc676bd
commit ecd0ada520
2 changed files with 37 additions and 18 deletions

View File

@ -1,3 +1,9 @@
2009-08-13 Pedro Alves <pedro@codesourcery.com>
* remote.c (remote_pid_to_str): If printing a process id and we
don't know what the remote pid could be, output "Remote target";
otherwise, use normal_pid_to_str.
2009-08-13 Tom Tromey <tromey@redhat.com>
* language.h (longest_raw_hex_string): Remove unused declaration.

View File

@ -7835,26 +7835,39 @@ remote_pid_to_str (struct target_ops *ops, ptid_t ptid)
static char buf[64];
struct remote_state *rs = get_remote_state ();
if (ptid_equal (magic_null_ptid, ptid))
if (ptid_is_pid (ptid))
{
xsnprintf (buf, sizeof buf, "Thread <main>");
return buf;
}
else if (remote_multi_process_p (rs)
&& ptid_get_tid (ptid) != 0 && ptid_get_pid (ptid) != 0)
{
xsnprintf (buf, sizeof buf, "Thread %d.%ld",
ptid_get_pid (ptid), ptid_get_tid (ptid));
return buf;
}
else if (ptid_get_tid (ptid) != 0)
{
xsnprintf (buf, sizeof buf, "Thread %ld",
ptid_get_tid (ptid));
return buf;
}
/* Printing an inferior target id. */
return normal_pid_to_str (ptid);
/* When multi-process extensions are off, there's no way in the
remote protocol to know the remote process id, if there's any
at all. There's one exception --- when we're connected with
target extended-remote, and we manually attached to a process
with "attach PID". We don't record anywhere a flag that
allows us to distinguish that case from the case of
connecting with extended-remote and the stub already being
attached to a process, and reporting yes to qAttached, hence
no smart special casing here. */
if (!remote_multi_process_p (rs))
{
xsnprintf (buf, sizeof buf, "Remote target");
return buf;
}
return normal_pid_to_str (ptid);
}
else
{
if (ptid_equal (magic_null_ptid, ptid))
xsnprintf (buf, sizeof buf, "Thread <main>");
else if (remote_multi_process_p (rs))
xsnprintf (buf, sizeof buf, "Thread %d.%ld",
ptid_get_pid (ptid), ptid_get_tid (ptid));
else
xsnprintf (buf, sizeof buf, "Thread %ld",
ptid_get_tid (ptid));
return buf;
}
}
/* Get the address of the thread local variable in OBJFILE which is