From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 7705B385841C for ; Fri, 18 Nov 2022 16:12:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 7705B385841C Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca Received: from [10.0.0.11] (unknown [217.28.27.60]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id EAE3B1E0CB; Fri, 18 Nov 2022 11:12:11 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1668787932; bh=n7KHdHWqGuSoCzi1pCtHGFTv3gquWN53HdQYGj0luag=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=mZaq06UdL/xXqycHtmfSZxvMxbkvb8PCwTov/L13uCp0TpvWDm2/iu8JUkBhgiIph EMEc9pMgZT8ERWNiB5hoaCjDW0lbX4bkQB0IGAutYKKP0+RQfOuGVIWds0Qwwe59DU rNXv0smxv36dyHby9cflVCmmoy8cqvILya1RZMfY= Message-ID: <0a6b4922-36a7-70af-41cf-8747a378c26c@simark.ca> Date: Fri, 18 Nov 2022 11:12:11 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: [PATCH 5/8] gdbserver/linux-x86: make is_64bit_tdesc accept thread as a parameter Content-Language: en-US To: Andrew Burgess , Simon Marchi via Gdb-patches Cc: Simon Marchi References: <20221117194241.1776125-1-simon.marchi@efficios.com> <20221117194241.1776125-6-simon.marchi@efficios.com> <87edu08plm.fsf@redhat.com> From: Simon Marchi In-Reply-To: <87edu08plm.fsf@redhat.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-11.0 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,SPF_HELO_PASS,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 11/18/22 06:32, Andrew Burgess via Gdb-patches wrote: > Simon Marchi via Gdb-patches writes: > >> ps_get_thread_area receives as a parameter the lwpid it must work on. >> It then calls is_64bit_tdesc, which uses the current_thread as the >> thread to work on. However, it is not said that both are the same. >> >> This became a problem when working in a following patch that pmakes > > s/pmakes/makes/ Fixed. >> find_one_thread switch to a process but to no thread (current_thread == >> nullptr). When libthread_db needed to get the thread area, >> is_64bit_tdesc would try to get the regcache of a nullptr thread. >> >> Fix that by making is_64bit_tdesc accept the thread to work on as a >> parameter. Find the right thread from the context, when possible (when >> we know the lwpid to work on). Otherwise, pass "current_thread", to >> retain the existing behavior. >> >> Change-Id: I44394d6be92392fa28de71982fd04517ce8a3007 >> --- >> gdbserver/linux-x86-low.cc | 27 +++++++++++++++------------ >> 1 file changed, 15 insertions(+), 12 deletions(-) >> >> diff --git a/gdbserver/linux-x86-low.cc b/gdbserver/linux-x86-low.cc >> index d2b55f6f0d2..c98a7a461fe 100644 >> --- a/gdbserver/linux-x86-low.cc >> +++ b/gdbserver/linux-x86-low.cc >> @@ -275,9 +275,9 @@ static /*const*/ int i386_regmap[] = >> per the tdesc. */ >> >> static int >> -is_64bit_tdesc (void) >> +is_64bit_tdesc (thread_info *thread) > > I think the comment for this function needs updating, the reference to > "current inferior" probably needs to be replaced with THREAD. Indeed, fixed. > > With those changes, LGTM. > > Reviewed-By: Andrew Burgess Thanks, pushed. Simon