From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 48077 invoked by alias); 12 Dec 2017 02:06:33 -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 48066 invoked by uid 89); 12 Dec 2017 02:06:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy= X-HELO: smtp.polymtl.ca Received: from smtp.polymtl.ca (HELO smtp.polymtl.ca) (132.207.4.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 12 Dec 2017 02:06:30 +0000 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id vBC26Ogh016915 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT) for ; Mon, 11 Dec 2017 21:06:28 -0500 Received: by simark.ca (Postfix, from userid 112) id 274DB1E59B; Mon, 11 Dec 2017 21:06:24 -0500 (EST) Received: from simark.ca (localhost [127.0.0.1]) by simark.ca (Postfix) with ESMTP id 6A6FF1E02D; Mon, 11 Dec 2017 21:06:23 -0500 (EST) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Tue, 12 Dec 2017 02:06:00 -0000 From: Simon Marchi To: Pedro Alves Cc: Simon Marchi , gdb-patches@sourceware.org Subject: Re: [PATCH] remote: Return NULL extra_info/name if they are empty In-Reply-To: References: <1513016513-26428-1-git-send-email-simon.marchi@ericsson.com> Message-ID: X-Sender: simon.marchi@polymtl.ca User-Agent: Roundcube Webmail/1.3.2 X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 12 Dec 2017 02:06:24 +0000 X-IsSubscribed: yes X-SW-Source: 2017-12/txt/msg00269.txt.bz2 On 2017-12-11 19:24, Pedro Alves wrote: > On 12/11/2017 06:21 PM, Simon Marchi wrote: >> Commit >> >> remote: C++ify thread_item and threads_listing_context >> 21fe1c752e254167d953fa8c846280f63a3a5290 >> >> broke the test gdb.threads/names.exp. The problem is that since we >> now >> use an std::string to hold the extra_info, an empty string is returned >> by target_extra_thread_info to print_thread_info_1 when the remote >> stub >> didn't send any extra info, instead of NULL before. Because of that, >> print_thread_info_1 prints the extra info between parentheses, which >> results in some spurious empty parentheses. >> >> Expected: * 1 Thread 22752.22752 "main" all_threads_ready () at >> ... >> Actual : * 1 Thread 22752.22752 "main" () all_threads_ready () a >> ... >> >> Since the bug was introduced by a behavior change in the remote >> target, >> I chose to fix it on the remote target side by making it return NULL >> when the extra string is empty. This will avoid possibly changing the >> behavior of the common code and affecting other targets. >> >> The name field has the same problem. If a remote stub returns no >> thread >> names, remote_thread_name will return an empty string instead of NULL, >> so print_thread_info_1 will show empty quotes ("") instead of nothing. >> >> gdb/ChangeLog: >> >> PR gdb/22556 >> * remote.c (remote_thread_name): Return NULL if name is empty. >> (remote_threads_extra_info): Return NULL if extra info is empty. > > Looks good, thanks. > > Pedro Alves Thanks, pushed. Simon