From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 58443 invoked by alias); 9 Jan 2020 23:26:18 -0000 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 Received: (qmail 58435 invoked by uid 89); 9 Jan 2020 23:26:18 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-17.3 required=5.0 tests=AWL,BAYES_00,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.1 spammy= X-HELO: mail-qk1-f195.google.com Received: from mail-qk1-f195.google.com (HELO mail-qk1-f195.google.com) (209.85.222.195) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 09 Jan 2020 23:26:16 +0000 Received: by mail-qk1-f195.google.com with SMTP id d71so294876qkc.0 for ; Thu, 09 Jan 2020 15:26:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=92pj0J+7ad9fggOB63LFqH+3tYbOGsXwp7eJmJ++eCA=; b=J872adLZ9G1ydLQPCG7gAK/ZFQwAdWjL6ZMxfzn4lytqdhEYqepRVue+Kw+OOEp6wK F0xHCq6erUj/pBWvjWYYUEeDyNlOJZXb7PPc04Tj6aASkUqrPMdJd1fm0pWpb/6JvqCQ Cdtbpe4ibCJ/i8pIO5KcKNCnXZu58s23z8HoKSToDiy4H6cIdpypYAQe00/zHsznIj+C NsAc8j2TCnBNrqLa7AyHIgkNCpQYHIYU4Cdmzc377nfo2OEJPCBTAuNRnqlujUYU7j1p I9ADpzwxP0wPO7aG8/VMH9vzubA7KztbOh42hRZf/SoPOzSy6Gd4ZELvNyXuKX2ZtqMt 6QAw== Return-Path: Received: from [192.168.0.185] ([177.158.86.92]) by smtp.gmail.com with ESMTPSA id m20sm50620qkk.15.2020.01.09.15.26.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Jan 2020 15:26:13 -0800 (PST) Subject: Re: [PATCH] Fix/Update misc comments To: Pedro Alves , gdb-patches@sourceware.org References: <20200106143620.2881-1-luis.machado@linaro.org> <75d91766-e9bd-0ab2-60fa-3234a4dd82fc@redhat.com> From: Luis Machado Message-ID: Date: Thu, 09 Jan 2020 23:26:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: <75d91766-e9bd-0ab2-60fa-3234a4dd82fc@redhat.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00229.txt.bz2 On 1/9/20 4:48 PM, Pedro Alves wrote: > On 1/6/20 2:36 PM, Luis Machado wrote: > >> @@ -354,8 +354,8 @@ inf_ptrace_target::resume (ptid_t ptid, int step, enum gdb_signal signal) >> if (step) >> { >> /* If this system does not support PT_STEP, a higher level >> - function will have called single_step() to transmute the step >> - request into a continue request (by setting breakpoints on >> + function will have called the appropriate functions to transmute the >> + step request into a continue request (by setting breakpoints on > > tabs vs spaces mixup. > Fixed the whole block now. It had spaces. >> @@ -4928,8 +4928,9 @@ Cannot fill $_exitsignal with the correct signal number.\n")); >> stop_waiting (ecs); >> return; >> >> - /* The following are the only cases in which we keep going; >> - the above cases end in a continue or goto. */ >> + /* The following and TARGET_WAITKIND_THREAD_CREATED are the only >> + cases in which we keep going. The other cases end in a continue or >> + goto. */ > > Double space after period after "keep going". But if you're changing this, > better to update it to current reality -- the "continue" or "goto" this is > referring to is loooooong gone. I think this is referring to the ancient > giant loop that wait_for_inferior used to be, and then was gradually over > the years broken down into separate functions. "continue" and "goto" are > probably the modern stop_waiting and prepare_to_wait functions > (guessing here). > > I'm just not seeing much value in the whole comment anymore. How about > just removing it? Yeah, i remember that old loop. The removal sounds OK to me. I've now dropped this block of comments. > > >> @@ -2976,7 +2977,12 @@ linux_nat_filter_event (int lwpid, int status) >> /* Make sure we don't report an event for the exit of an LWP not in >> our list, i.e. not part of the current process. This can happen >> if we detach from a program we originally forked and then it >> - exits. */ >> + exits. >> + >> + Note the forked children exiting may generate a SIGCHLD to the parent >> + process. We are still interested in that signal since the parent may >> + have handlers for it, so we don't ignore it. */ > > I'm not sure about this comment -- it seems distracting to me, in the > sense that I've read it a number of times to try to understand what is > it is that saying that is special, because in my view, we're interested in > that SIGCHLD signal simply if it is sent to a process that we're debugging, > just like all other signals. Maybe I didn't understand it and I'm missing > the special case here. > While trying to understand this bug (https://sourceware.org/ml/gdb-patches/2019-12/msg01071.html), i think i misunderstood the comment a little and ended up saying the same, sorry. I've now dropped this hunk. > Note that gdbserver has equivalent code in linux-low.c: Indeed. The signal gets passed on to the inferior, but shouldn't cause a visible stop. > > /* If we didn't find a process, one of two things presumably happened: > - A process we started and then detached from has exited. Ignore it. > - A process we are controlling has forked and the new child's stop > was reported to us by the kernel. Save its PID. */ > if (child == NULL && WIFSTOPPED (wstat)) > { > add_to_pid_list (&stopped_pids, lwpid, wstat); > return NULL; > } > else if (child == NULL) > return NULL; > >> + >> if (!WIFSTOPPED (status) && !lp) >> return NULL; >> > > >> --- a/gdb/linux-nat.h >> +++ b/gdb/linux-nat.h >> @@ -228,7 +228,7 @@ struct lwp_info >> >> /* When 'stopped' is set, this is where the lwp last stopped, with >> decr_pc_after_break already accounted for. If the LWP is >> - running, and stepping, this is the address at which the lwp was >> + running and stepping, this is the address at which the lwp was >> resumed (that is, it's the previous stop PC). If the LWP is >> running and not stepping, this is 0. */ >> CORE_ADDR stop_pc; >> @@ -237,7 +237,7 @@ struct lwp_info >> int step; >> >> /* The reason the LWP last stopped, if we need to track it >> - (breakpoint, watchpoint, etc.) */ >> + (breakpoint, watchpoint, etc). */ > > AFAIK, "etc." is the correct abbreviation of "et cetera". > So I think this should be: heh... it is true. Now i know! And i see there are quite a few offenders throughout the code. Something for a separate patch. > > (breakpoint, watchpoint, etc.). */ Fixed now. Thanks!