From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 6noAN5oTw2TzGTEAWB0awg (envelope-from ) for ; Thu, 27 Jul 2023 21:02:18 -0400 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=bW8+0kIA; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id D66881E0C0; Thu, 27 Jul 2023 21:02:18 -0400 (EDT) Received: from server2.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 BFEEA1E00F for ; Thu, 27 Jul 2023 21:02:16 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id CCA5A385703F for ; Fri, 28 Jul 2023 01:02:15 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CCA5A385703F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1690506135; bh=86AtuKKO8jbGlVhGBtVivZ3+dn6yJVKvcFL30sNr4n8=; 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=bW8+0kIAs3qBiZ+m/pqYV3M/XHVz/BVGQb3Cd7OZX0X8oNeS/48sC47+rbeo2YS73 f1qt7bGwKWfVDvv1Mh/YIxZiFqYNGuqfJ/Ykq3YodedtJH065uNbIwbUajlIe0XkqY ZrLD95hJeaoH4f3+zTJqjqg7oOIn/HHasX0HMXFo= Received: from mail-oa1-x33.google.com (mail-oa1-x33.google.com [IPv6:2001:4860:4864:20::33]) by sourceware.org (Postfix) with ESMTPS id 0B10E3858D37 for ; Fri, 28 Jul 2023 01:01:43 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 0B10E3858D37 Received: by mail-oa1-x33.google.com with SMTP id 586e51a60fabf-1b055510c9dso1115005fac.0 for ; Thu, 27 Jul 2023 18:01:42 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690506102; x=1691110902; 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=86AtuKKO8jbGlVhGBtVivZ3+dn6yJVKvcFL30sNr4n8=; b=gq8PLUE35anvAXV55w/7eDMbMtDvmJifBz2Pu3teWc3vp/O4WjidYOcKcqZgZui9pF UEQoG6Wbxci2M31yfwTrIhaSTKxLJ8ypW3RWXJz2vVswMTzurUhvkQoKWm0356tqyUqM 75zR51aWwZjfq7TSinwQWPoHEWHWqsWXo+uwrvrT3Z6rbw7l3CJXsOVWA8Vi5Dzi+dwz Qg4GXLptuxfJoI0karUjE2P/qjypmPsL1PIsdfsT54HRcUff1LbqgebLgnTYBjmlykS7 pFHbFnp+yDhiDxLthGjnAN2/erZGWu0BaZ2JhRgXffv2roVCliaxDoQpsXqAC2x2ATe5 wbuQ== X-Gm-Message-State: ABy/qLbCXWhhHQ6T6WNjEKnEroTFn6oJILGkL6RR2ui0IacNyRJTim6o MLpDCfQXXnjERGxrpeYkusDzHw== X-Google-Smtp-Source: APBJJlHGxhe/vyutwJKxRaGdC8o/TZtwa0MV/P2serGzFSaLntyNlVs6Y/JQsISznGl4FSA2YckJVw== X-Received: by 2002:a05:6870:4708:b0:1bb:9dfd:f4dc with SMTP id b8-20020a056870470800b001bb9dfdf4dcmr1146137oaq.19.1690506101797; Thu, 27 Jul 2023 18:01:41 -0700 (PDT) Received: from localhost ([2804:14d:7e39:8470:b6b2:cb77:8e91:bbbd]) by smtp.gmail.com with ESMTPSA id dv50-20020a056870d8b200b001962e45f0d4sm1255718oab.24.2023.07.27.18.01.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 Jul 2023 18:01:41 -0700 (PDT) References: <20230630134616.1238105-1-luis.machado@arm.com> <20230630134616.1238105-11-luis.machado@arm.com> User-agent: mu4e 1.10.5; emacs 28.2 To: Luis Machado Cc: gdb-patches@sourceware.org Subject: Re: [PATCH v3 10/16] [gdb/aarch64] sme: Fixup sigframe gdbarch when vg/svg changes In-reply-to: <20230630134616.1238105-11-luis.machado@arm.com> Date: Thu, 27 Jul 2023 22:01:38 -0300 Message-ID: <87jzuk7sst.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain 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, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org 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 via Gdb-patches writes: > case AARCH64_SVE_MAGIC: > { > /* Check if the section is followed by a full SVE dump, and set > sve_regs if it is. */ > gdb_byte buf[4]; > - uint16_t flags; > - > - if (!tdep->has_sve ()) > - break; > > + /* Extract the vector length. */ > if (target_read_memory (section + AARCH64_SVE_CONTEXT_VL_OFFSET, > buf, 2) != 0) > { > + warning (_("Failed to read the vector length from the SVE " > + " signal frame context.")); Extraneous space between "SVE" and "signal". > section += size; > break; > } > case AARCH64_ZA_MAGIC: > { > - if (!tdep->has_sme ()) > - { > - section += size; > - break; > - } > - > /* Check if the section is followed by a full ZA dump, and set > za_state if it is. */ > gdb_byte buf[2]; > > + /* Extract the streaming vector length. */ > if (target_read_memory (section + AARCH64_SVE_CONTEXT_VL_OFFSET, Same comment from the previous patch about using the SME macro instead of the SVE one. > buf, 2) != 0) > { > + warning (_("Failed to read the streaming vector length from " > + " ZA signal frame context.")); Extraneous space between "SVE" and "signal". > section += size; > break; > } > @@ -477,11 +499,49 @@ aarch64_linux_sigframe_init (const struct tramp_frame *self, > if (!extra_found && section > section_end) > break; > } > +} > + > +/* Implement the "init" method of struct tramp_frame. */ > + > +static void > +aarch64_linux_sigframe_init (const struct tramp_frame *self, > + frame_info_ptr this_frame, > + struct trad_frame_cache *this_cache, > + CORE_ADDR func) > +{ > + /* Read the signal context information. */ > + struct aarch64_linux_sigframe signal_frame; > + aarch64_linux_read_signal_frame_info (this_frame, signal_frame); > + > + /* Now we have all the data required to restore the registers from the > + signal frame. */ > + > + /* Restore the general purpose registers. */ > + CORE_ADDR offset > + = signal_frame.sigcontext_address + AARCH64_SIGCONTEXT_XO_OFFSET; You can simplify the above to CORE_ADDR offset = signal_frame.gpr_section; > + for (int i = 0; i < 31; i++) > + { > + trad_frame_set_reg_addr (this_cache, AARCH64_X0_REGNUM + i, offset); > + offset += AARCH64_SIGCONTEXT_REG_SIZE; > + } > + trad_frame_set_reg_addr (this_cache, AARCH64_SP_REGNUM, offset); > + offset += AARCH64_SIGCONTEXT_REG_SIZE; > + trad_frame_set_reg_addr (this_cache, AARCH64_PC_REGNUM, offset); > diff --git a/gdb/tramp-frame.h b/gdb/tramp-frame.h > index fa0241acb2d..563c34ae595 100644 > --- a/gdb/tramp-frame.h > +++ b/gdb/tramp-frame.h > @@ -42,6 +42,13 @@ struct trad_frame_cache; > instruction sequence. */ > #define TRAMP_SENTINEL_INSN ULONGEST_MAX > > +/* Assuming the frame chain: (outer) prev <-> this <-> next (inner); > + use THIS frame, and implicitly the NEXT frame's register unwind > + method, return PREV frame's architecture. */ Maybe s/return/to return/ ? > + > +typedef struct gdbarch *(frame_prev_arch_ftype) (frame_info_ptr this_frame, > + void **this_prologue_cache); > + > struct tramp_frame > { > /* The trampoline's type, some a signal trampolines, some are normal > @@ -75,6 +82,11 @@ struct tramp_frame > int (*validate) (const struct tramp_frame *self, > frame_info_ptr this_frame, > CORE_ADDR *pc); > + > + /* Given the current frame in THIS_FRAME and a frame cache in FRAME_CACHE, > + return the architecture of the previous frame. */ > + struct gdbarch *(*prev_arch) (frame_info_ptr this_frame, > + void **frame_cache); Shouldn't the typedef defined above be used here? > }; -- Thiago