From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id 3F7123830B22 for ; Thu, 24 Nov 2022 16:25:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 3F7123830B22 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca 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 2AOGPHFn008264 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 24 Nov 2022 11:25:21 -0500 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 2AOGPHFn008264 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=default; t=1669307122; bh=w79Jj8V36IiECfRF2VWlnCjb8iNafoQ4zXRb1WAdwW4=; h=Date:Subject:To:References:From:In-Reply-To:From; b=k6OoGgIUK7b0byccd1HIDEyl1ZPP83kZ7PHOgI/vI7CfSLMqiDXBmsFBsmgCuadYU bbdKse81BRUvaa2hjjrwQ7BiGq/NPDCimHd7dOSXKTw5blFj9kMP1Zt4KAQWJGu/Sg /ycr2mwB9au8KHuPZUgeksd8wo4aZrr3XKQCtUOo= Received: from [172.16.0.64] (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) (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 E9F791E112; Thu, 24 Nov 2022 11:25:16 -0500 (EST) Message-ID: <4efcb8b6-8f0c-a83b-6688-665d0fd5e10e@polymtl.ca> Date: Thu, 24 Nov 2022 11:25:16 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH 4/5] gdb: add inferior parameter to target_find_description Content-Language: fr To: Simon Marchi , gdb-patches@sourceware.org References: <20221124160428.83804-1-simon.marchi@efficios.com> <20221124160428.83804-5-simon.marchi@efficios.com> From: Simon Marchi In-Reply-To: <20221124160428.83804-5-simon.marchi@efficios.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Thu, 24 Nov 2022 16:25:17 +0000 X-Spam-Status: No, score=-3032.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,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: > @@ -546,16 +545,22 @@ target_find_description (void) > if (!tdesc_info->filename.empty ()) > tdesc_info->tdesc = file_read_description_xml (tdesc_info->filename.data ()); > > + /* The calls that get the target description from the target depend on INF > + being the current inferior, and some targets need a specific thread to > + be selected. */ > + scoped_restore_current_thread restore_thread; > + thread_info *thread = any_thread_of_inferior (inf); > + gdb_assert (thread != nullptr); > + switch_to_thread (thread); Sorry, looks like I messed up my testing, this doesn't work when using the "set tdesc filename" command while there are no threads: 37 (gdb) set tdesc filename /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.arch/arc-tdesc-cpu/trivial.xml^M 38 /home/smarchi/src/binutils-gdb/gdb/thread.c:631: internal-error: any_thread_of_inferior: Assertion `inf->pid != 0' failed.^M 39 A problem internal to GDB has been detected,^M 40 further debugging may prove unreliable.^M 41 ----- Backtrace -----^M 42 FAIL: gdb.arch/arc-tdesc-cpu.exp: set tdesc filename /home/smarchi/build/binutils-gdb/gdb/testsuite/outputs/gdb.arch/arc-tdesc-cpu/trivial.xml (GDB internal error) I made it this way because the remote target uses inferior_ptid to set the general thread in remote_target::xfer_partial, regardless of the object. For TARGET_OBJECT_AVAILABLE_FEATURES, since target descriptions are a per-inferior thing (for now), it could look at the current inferior instead, it doesn't really need a current thread. This is part of my larger work that I picked these patches from, so I will have to re-check the order of the changes. Simon