From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x22e.google.com (mail-oi1-x22e.google.com [IPv6:2607:f8b0:4864:20::22e]) by sourceware.org (Postfix) with ESMTPS id C028D38451A3 for ; Sat, 26 Nov 2022 01:49:50 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C028D38451A3 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-oi1-x22e.google.com with SMTP id c129so6121159oia.0 for ; Fri, 25 Nov 2022 17:49:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:message-id:date:in-reply-to:subject:cc:to:from :user-agent:references:from:to:cc:subject:date:message-id:reply-to; bh=vMKQPS4zBrTFxkn77nfgL/ZWy58K43aLMmZoHylxRq8=; b=tpKtgyJIlMWdC1vHUcNA1jjHyOfBDFI5QqZPYFdDBXGuTxMfh3Fsr+KGzSwUPgCu12 A8E0hSTd7xHQnnMWtJ99ab7CVH/lGAAMDq8OBvwTAihyG3WAeI1+UOOLBrmmjwu/jlC2 ehyJMCXoh9L39IsLvmi9xYxUAQS++hA3fOxOkKLe8P/EssHbIOsiVzApHqnlCJ9QnvKo ahS9iofZ4OAd1YWXq+vCW/CxE6hF2Xhn+Eaysm8+rNf3PTMPtM2QsBHuQvEXq6BKOReS 2n5vjBQNiqUi8O+WGYb8yZPc5OUs0x83z1172/g10eq8G5KVp89UmC6vkUEEONOvhB+q gbRQ== 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=vMKQPS4zBrTFxkn77nfgL/ZWy58K43aLMmZoHylxRq8=; b=BsjqXCqta+FeEiGifgosCmkMiTS+hDxaWGrlwrgtyPQ2QeRumzWurCMenvpMT3bflo MiWNiibbQLpRTRv4mf3zSldH2COlC5E/mnFJwkgu6iekIsLiNMY5aic6PdA21TYQW6Bi W4TGeXMLWZm/B125JBgyY0Ro5e/zT7t+Vx8xCFBTQPiHQbag/mcs8845UUIq2q5kcXmP H0M8y356vcLqJH0hG7+SdmMnpUByBklbkemHumTL0kYs1yEbeFrYRwMg52MarKSj65Fw SCmWt67I5Yw4Z4AkFu7hH91MsQijZVY/Ld2JStLi5AveGrg7qG0JgwdvGramewIThEba mcqg== X-Gm-Message-State: ANoB5pmmz9LUpfZDdZ6qzlj0jFbBeP62jvR94t870FG0EZuP+sFDbWBD KEQMYir9N5ZWkzJlO0XoBk+V/YU/CQLsRg== X-Google-Smtp-Source: AA0mqf5OdS3exnwuaUi5nqqGJewVq15IyotxzjrunuGgLyXrQtv5tQnx1cRbNTCkgtcRJuUfS1733Q== X-Received: by 2002:a05:6808:140c:b0:35b:a29f:71e6 with SMTP id w12-20020a056808140c00b0035ba29f71e6mr91052oiv.139.1669427390128; Fri, 25 Nov 2022 17:49:50 -0800 (PST) Received: from localhost ([2804:14d:7e39:8470:41ee:c7fc:c991:eee6]) by smtp.gmail.com with ESMTPSA id e32-20020a9d2aa3000000b00666a5b5d20fsm2266369otb.32.2022.11.25.17.49.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 25 Nov 2022 17:49:49 -0800 (PST) References: <20220908064151.3959930-1-thiago.bauermann@linaro.org> <20220908064151.3959930-8-thiago.bauermann@linaro.org> <19e5e216-1f4e-8663-783a-a710e3b0e596@arm.com> User-agent: mu4e 1.8.11; emacs 28.2 From: Thiago Jung Bauermann To: Luis Machado Cc: gdb-patches@sourceware.org Subject: Re: [PATCH 7/8] gdb/aarch64: Factor out most of the thread_architecture method In-reply-to: <19e5e216-1f4e-8663-783a-a710e3b0e596@arm.com> Date: Sat, 26 Nov 2022 01:49:46 +0000 Message-ID: <87h6ym8oxx.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-10.9 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,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: Luis Machado writes: > On 9/8/22 07:41, Thiago Jung Bauermann via Gdb-patches wrote: >> +struct gdbarch * >> +aarch64_update_gdbarch (struct gdbarch *gdbarch, uint64_t vq) >> +{ >> + /* If this is a 32-bit architecture, then this is ARM, not AArch64. >> + There's no SVE vectors here, so just return the inferior >> + architecture. */ >> + if (gdbarch_bfd_arch_info (gdbarch)->bits_per_word == 32) >> + return gdbarch; >> + >> + /* Only return it if the current vector length matches the one in the tdep. */ >> + aarch64_gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); >> + if (vq == tdep->vq) >> + return gdbarch; >> + >> + /* We reach here if the vector length for the thread is different from its >> + value at process start. Lookup gdbarch via info (potentially creating a >> + new one) by using a target description that corresponds to the new vq >> + value and the current architecture features. */ >> + >> + const struct target_desc *tdesc = gdbarch_target_desc (gdbarch); >> + aarch64_features features = aarch64_features_from_target_desc (tdesc); >> + features.vq = vq; >> + >> + struct gdbarch_info info; >> + info.bfd_arch_info = bfd_lookup_arch (bfd_arch_aarch64, bfd_mach_aarch64); >> + info.target_desc = aarch64_create_target_description (features); Oops, I hadn't noticed that this patch had a bug (memory leak, actually): it inadvertently changed the moved code to call aarch64_create_target_description instead of aarch64_read_description. In v2 I fixed this, and double-checked that there's no actual change in the moved code. >> + return gdbarch_find_by_info (info); >> +} >> + >> /* Implement the stack_frame_destroyed_p gdbarch method. */ >> static int >> diff --git a/gdb/aarch64-tdep.h b/gdb/aarch64-tdep.h >> index d8513023c376..3d78515e167f 100644 >> --- a/gdb/aarch64-tdep.h >> +++ b/gdb/aarch64-tdep.h >> @@ -139,4 +139,6 @@ void aarch64_displaced_step_fixup (struct gdbarch *gdbarch, >> bool aarch64_displaced_step_hw_singlestep (struct gdbarch *gdbarch); >> +struct gdbarch *aarch64_update_gdbarch (struct gdbarch *gdbarch, uint64_t vq); >> + >> #endif /* aarch64-tdep.h */ > > LGTM Thank you for your review! -- Thiago