From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id sAv3Ghd43mPw0CkAWB0awg (envelope-from ) for ; Sat, 04 Feb 2023 10:21:59 -0500 Received: by simark.ca (Postfix, from userid 112) id 6AD451E128; Sat, 4 Feb 2023 10:21:59 -0500 (EST) Authentication-Results: simark.ca; dkim=pass (1024-bit key; secure) header.d=sourceware.org header.i=@sourceware.org header.a=rsa-sha256 header.s=default header.b=y7j8H37d; dkim-atps=neutral X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-7.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, RDNS_DYNAMIC,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.6 Received: from sourceware.org (ip-8-43-85-97.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id BAB881E0D3 for ; Sat, 4 Feb 2023 10:21:58 -0500 (EST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 34C7E3858291 for ; Sat, 4 Feb 2023 15:21:58 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 34C7E3858291 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675524118; bh=rzzYeXdSUHtW9pBLKWKgE2ugccz09xlaNTzGUs9kQ6I=; h=References:To:Cc:Subject:In-reply-to:Date:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=y7j8H37dLBaw/wyTvfKYG6QaD18r1sV+z86FaR2uLVEu2JD0uJTjjasXjI8gcAond mvhlfv0KLOdKseqHusX2Wt8z1rdXhbYvI870vnxEjWC0q/1IOy4OmNkwmeyGwQk56j 8910xSJBjfIJ8w9wVDQuk7nrNtzU7SmQQ3Pi9gh4= Received: from mail-oa1-x30.google.com (mail-oa1-x30.google.com [IPv6:2001:4860:4864:20::30]) by sourceware.org (Postfix) with ESMTPS id 3FAA53858C52 for ; Sat, 4 Feb 2023 15:21:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3FAA53858C52 Received: by mail-oa1-x30.google.com with SMTP id 586e51a60fabf-142b72a728fso10086186fac.9 for ; Sat, 04 Feb 2023 07:21:37 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :user-agent:references:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=rzzYeXdSUHtW9pBLKWKgE2ugccz09xlaNTzGUs9kQ6I=; b=nwRzM77lN9n12KuwEOGlG2xbX6qQCZJmaGvQswwSZ+8j90RSI4D5jnxDYLdA4VfKIr DwLMi56jraTOXfbKy9DW6GQkjZEXSgMIcpggnlwDzq6Pfo9BEQFEZdwdP3kvWPFS5H5p FaPLZJNFhWWBK4p9VpcwW2A2WVBiPep74hBR4XcP98ktBXqwTwa0Upo8cuhJ56kfpZuQ x4GGl5dG+KFWmHcXVEszhUxtKmo83EobUhmzlVKM0jtjtxRmD0iDKe3wSRFTcu8ARDA7 W9iOUdea7L5/h8kx+slE1dtwBL7I7FqRMg+Se0zQwMADUtrGNoHnJvCHQ/izxrG0RUME ZtXQ== X-Gm-Message-State: AO0yUKXiL/m92HGW2OAPwpzjEgRuBoe/xdJ2Jx6OAgnRUxyyxtIGsTtG qPmeeI/dy8+TAXiCKDtuiJr0yQ== X-Google-Smtp-Source: AK7set8LMEfO4dJYt7KC7c+cad933+UiydZ/JO5jSr6C3cFBccYlKOfnsomcE4pSmpASGBwOge4Vvg== X-Received: by 2002:a05:6870:1717:b0:163:88f9:2c56 with SMTP id h23-20020a056870171700b0016388f92c56mr7985856oae.13.1675524096528; Sat, 04 Feb 2023 07:21:36 -0800 (PST) Received: from localhost ([189.100.172.221]) by smtp.gmail.com with ESMTPSA id e5-20020a056870450500b0011d02a3fa63sm1903349oao.14.2023.02.04.07.21.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Feb 2023 07:21:35 -0800 (PST) References: <20230130044518.3322695-1-thiago.bauermann@linaro.org> <20230130044518.3322695-5-thiago.bauermann@linaro.org> <87pmattzjw.fsf@redhat.com> <7970ac03-1123-d5f6-7b17-808832d43be6@simark.ca> <9a85e2fe-078a-e2ee-7e49-53fe0ceef492@arm.com> <87y1pgaib6.fsf@linaro.org> <9d30751a-589b-eb95-09b1-61d083ad9730@arm.com> User-agent: mu4e 1.8.13; emacs 28.2 To: Luis Machado Cc: Simon Marchi , Andrew Burgess , Thiago Jung Bauermann via Gdb-patches Subject: Re: [PATCH v3 4/8] gdbserver/linux-aarch64: When thread stops, update its target description In-reply-to: <9d30751a-589b-eb95-09b1-61d083ad9730@arm.com> Date: Sat, 04 Feb 2023 15:21:32 +0000 Message-ID: <87leldmp6r.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Thiago Jung Bauermann via Gdb-patches Reply-To: Thiago Jung Bauermann Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Luis Machado writes: > On 2/2/23 03:47, Simon Marchi wrote: >> On 2/1/23 21:54, Thiago Jung Bauermann wrote: >>> In any case, it wouldn't be possible to make get_thread_target_desc just >>> return thread_info->tdesc because at least the way these patches are >>> currently written, when the inferior starts or a new thread of the >>> inferior is spawned thread_info->tdesc is nullptr. gdbserver will only >>> call get_thread_tdesc after the first stop (in get_thread_regcache, in >>> the process of obtaining the pc register), so we will need to cope with >>> that situation. >> Ok. Would it work if a new thread initially inherited the tdesc from >> its process? >> > > It should be fine because the first time we fetch a process target > description, it is eventually obtained from the first and only thread. > So the SVE vector length should be correct. > > Any subsequent attempts to use the process' target description (the > first one we obtained), after further stops, may end up using an > incorrect description. > > I think this is handled correctly by the target architecture target > hook though. But there are other places where this is potentially > incorrect. > > For example... > > - When using gcore to dump a core file, GDB only dumps a single target > description. While this might be correct for a target with a fixed > target description or a AArch64 target that doesn't support SVE, it > likely won't be correctly for one AArch64 target supporting SVE if its > threads changed vector length mid-execution. Either we emit target > description notes by thread, or we don't emit a target description > note for those cases. > > - When loading the above/older gcore core files back, GDB will use a > potentially incorrect target description. If we decide to emit > per-thread target descriptions, it should be fine. Otherwise we may > need to have a "thread architecture" hook for core files as well. > > - The remote has no concept of a thread architecture (Thiago is > addressing this with this patch series). > > - AArch64 frames may have slightly different vg values, which means > their gdbarches are different as well. > > Given the differences between two gdbarches are small, we mostly get > away with it. But if there are further differences (different hooks, > for example), I fear we may run into a situation where we use an > incorrect gdbarch to call a particular hook. Indeed, good points! Thank you for bringing them up. I can address core file dumping/loading after this series. Regarding frames with different vg values, it's important to be aware of this discrepancy but IMHO it makes sense to work on it when it becomes a problem... -- Thiago