This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 3/4] New agent command 'kill' and used by gdbserver
On 06/20/2012 02:49 PM, Yao Qi wrote:
> +
> +int
> +kill_inferior (int pid)
> +{
> + gdb_agent_about_to_close (pid);
"about to kill" was meant to indicate that the function does something
just before the caller kills. "about to close" sounds like the function
is called to react to the fact that the the caller is about to close
something else, but that is not what is happening, as the "about to close"
function is what really closes. gdb_agent_about_to_kill or gdb_agent_close
would sound right, but about_to_close doesn't.
> +/* Sent the agent a command to close it. */
> +
> +void
> +gdb_agent_about_to_close (int pid)
> +{
> + char buf[IPA_CMD_BUF_SIZE];
> +
> + if (!maybe_write_ipa_not_loaded (buf))
> + {
> + struct thread_info *save_inferior;
> + struct inferior_list_entry *inf = all_threads.head;
> +
> + save_inferior = current_inferior;
> +
> + /* Find a certain thread which belongs to process PID. */
> + while (inf != NULL)
> + {
> + if (ptid_get_pid (inf->id) == pid)
> + break;
> + inf = inf->next;
> + }
This is a little simpler if written as a for loop:
struct inferior_list_entry *inf;
/* Find a certain thread which belongs to process PID. */
for (inf = all_threads.head; inf != NULL; inf = inf->next)
if (ptid_get_pid (inf->id) == pid)
break;
Okay with those changes.
--
Pedro Alves