From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id uNuDF3Wq6GI43x4AWB0awg (envelope-from ) for ; Tue, 02 Aug 2022 00:39:17 -0400 Received: by simark.ca (Postfix, from userid 112) id 46E9F1EA05; Tue, 2 Aug 2022 00:39:17 -0400 (EDT) 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=X2uJeECx; 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=-3.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from sourceware.org (server2.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 DA6E21E9EB for ; Tue, 2 Aug 2022 00:39:14 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 329D33856DD3 for ; Tue, 2 Aug 2022 04:39:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 329D33856DD3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1659415154; bh=1u+HBDVeMLKhNbaVMDotwsAff72vP00wwTHys8oIgv8=; h=References:To:Subject:Date:In-reply-to:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=X2uJeECx4KOVksqdNUDRNzHTfu7AabgOi9o8K4g2qo67Q54ENPm0vWpOzIIv3Wj0p a34S3kuQWM8maL4UAOyBffuVlRIdgG3fX+p//lONX4BWe+suVvZoTzwwzNpoMMYvhB kqDxg6NUWcXxzDOltXkK3j5ss/J0sDZF6PG/pe+8= Received: from mail-vs1-xe2a.google.com (mail-vs1-xe2a.google.com [IPv6:2607:f8b0:4864:20::e2a]) by sourceware.org (Postfix) with ESMTPS id A67453857B8A for ; Tue, 2 Aug 2022 04:38:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org A67453857B8A Received: by mail-vs1-xe2a.google.com with SMTP id a63so13415395vsa.3 for ; Mon, 01 Aug 2022 21:38:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:in-reply-to:date :subject:cc:to:from:user-agent:references:x-gm-message-state:from:to :cc; bh=1u+HBDVeMLKhNbaVMDotwsAff72vP00wwTHys8oIgv8=; b=WJxGligEMARZrqqFV9VgIgkZl3hobDiX67D5ovl7LYJgdZAgsJNqz0RhsJsbVl80yv cQlA3cxMteoS5w1580nqDQHQChYbjGE2Ztg1NkwLaf4Fe9dBgQm6NLFKwlwa8O6tvlHU RvVfFCquIyk+TdydVrF2Y7HAf+Yi+KlSK7Y59Q9PxWjKdHPGLM6Nfqg6Dag9mjRCGCN6 qPR9apuB9F1rCDaZ4nLsPs1D/HMS5HUY13A5OsAvNsMRpeEV/+aXsebZ6XFUyFaRwMCv Gw3rGaMx4NeHdJe5yoLTrDIHT2v+yHglaBQyZxlJcvqmQVslzAlJOp6uHFLch3E2ypAf 5G6Q== X-Gm-Message-State: AJIora+2kSK2T4xv1yXjYeBJOKSM6tHfRhxgGlYDlkF7FOJ5YX+R4fsQ H2liWfdYsgIkaGy5IR+C4COCFA== X-Google-Smtp-Source: AGRyM1s3QB2hW5A6l3FY7zUzA4QHZOqmdBYbTauJSa1hZ/2GDZd0WD/W5REW3KwGTxSiJt4kVREyPg== X-Received: by 2002:a05:6102:2223:b0:32d:2ae1:412 with SMTP id d3-20020a056102222300b0032d2ae10412mr7116182vsb.6.1659415117962; Mon, 01 Aug 2022 21:38:37 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:ca3d:73f5:abf6:466]) by smtp.gmail.com with ESMTPSA id k4-20020a67fd84000000b0035854a1894esm6175723vsq.5.2022.08.01.21.38.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 01 Aug 2022 21:38:37 -0700 (PDT) References: <20220728012306.157639-1-thiago.bauermann@linaro.org> <20220728012306.157639-2-thiago.bauermann@linaro.org> <3218f696-c2de-bcba-e73b-7409cf0a8b66@arm.com> User-agent: mu4e 1.6.11; emacs 28.1 To: Luis Machado Subject: Re: [PATCH 1/2] gdb/aarch64: Fix thread's gdbarch when SVE vector length changes Date: Tue, 02 Aug 2022 04:15:49 +0000 In-reply-to: <3218f696-c2de-bcba-e73b-7409cf0a8b66@arm.com> Message-ID: <87zggnuunp.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable 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 Cc: gdb-patches@sourceware.org Errors-To: gdb-patches-bounces+public-inbox=simark.ca@sourceware.org Sender: "Gdb-patches" Hello Luis, Luis Machado writes: > Thanks for the patch. Thank you for your prompt review! > On 7/28/22 02:23, Thiago Jung Bauermann via Gdb-patches wrote: >> --- a/gdb/aarch64-linux-nat.c >> +++ b/gdb/aarch64-linux-nat.c >> @@ -900,11 +900,16 @@ aarch64_linux_nat_target::thread_architecture (pti= d_t ptid) >> /* We reach here if the vector length for the thread is different = from its >> value at process start. Lookup gdbarch via info (potentially cre= ating a >> - new one), stashing the vector length inside id. Use -1 for when S= VE >> - unavailable, to distinguish from an unset value of 0. */ >> + new one) by using a target description that corresponds to the new= vq value >> + and the current architecture features. */ >> + >> + const struct target_desc *tdesc =3D gdbarch_target_desc (inf->gdbarch= ); >> + aarch64_features features =3D aarch64_features_from_target_desc (tdes= c); >> + features.vq =3D vq; >> + >> struct gdbarch_info info; >> info.bfd_arch_info =3D bfd_lookup_arch (bfd_arch_aarch64, bfd_mach_a= arch64); >> - info.id =3D (int *) (vq =3D=3D 0 ? -1 : vq); > > Even though we're removing this code, we're still actively using > info.id in aarch64_gdbarch_init (). Will that work correctly? Ah, well spotted. It will =E2=80=94 the statements that check info.id become dead code. Your comment made me notice that the line I remove above was the only place in all of GDB that was setting info.id, and aarch64_gdbarch_init () was the only place reading it. So v2 will remove the id member of struct gdbarch_info altogether (and thus the anonymous union it was part of) and simplify a bit the vq-related code in aarch64_gdbarch_init (). >> + info.target_desc =3D aarch64_create_target_description (features); > > The current mechanism caches potentially multiple target description > (to account for threads having different VL's). Instead of creating a > fresh target description here, Well spotted again. This was actually a thinko on my part. I thought I was using the function that does the target description caching. In v2 this code will call aarch64_read_description () instead of aarch64_create_target_description (). > would it make more sense to figure out the features from this > particular thread and then check if we have the right target > description already? > > Maybe through aarch64_linux_nat_target::read_description ()? This patch is figuring out the features from this particular thread by looking at its current target description so I don't think it's necessary to use aarch64_linux_nat_target::read_description (), unless I'm misunderstanding your point. I'll now work on your comments for the testcase patch and will respond to it tomorrow. --=20 Thiago