From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6065 invoked by alias); 21 Jun 2012 16:05:25 -0000 Received: (qmail 6050 invoked by uid 22791); 21 Jun 2012 16:05:23 -0000 X-SWARE-Spam-Status: No, hits=-7.4 required=5.0 tests=AWL,BAYES_00,KHOP_RCVD_UNTRUST,KHOP_THREADED,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 21 Jun 2012 16:05:10 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q5LG56U2001788 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Thu, 21 Jun 2012 12:05:06 -0400 Received: from [127.0.0.1] (ovpn01.gateway.prod.ext.ams2.redhat.com [10.39.146.11]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q5LG55Uf023422; Thu, 21 Jun 2012 12:05:06 -0400 Message-ID: <4FE34631.3080108@redhat.com> Date: Thu, 21 Jun 2012 16:05:00 -0000 From: Pedro Alves User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:12.0) Gecko/20120430 Thunderbird/12.0.1 MIME-Version: 1.0 To: Yao Qi CC: gdb-patches@sourceware.org Subject: Re: [PATCH 3/4] New agent command 'kill' and used by gdbserver References: <1339246002-1987-1-git-send-email-yao@codesourcery.com> <1339246002-1987-4-git-send-email-yao@codesourcery.com> <4FD76ADB.7090302@redhat.com> <201206142250.01331.yao@codesourcery.com> <4FDB8BF0.4050502@redhat.com> <4FE1D4D4.4070506@codesourcery.com> In-Reply-To: <4FE1D4D4.4070506@codesourcery.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-06/txt/msg00662.txt.bz2 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