From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-x42e.google.com (mail-wr1-x42e.google.com [IPv6:2a00:1450:4864:20::42e]) by sourceware.org (Postfix) with ESMTPS id 419813858D3C for ; Sun, 6 Feb 2022 15:30:54 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 419813858D3C Received: by mail-wr1-x42e.google.com with SMTP id c19so5887870wrb.10 for ; Sun, 06 Feb 2022 07:30:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=KP8jgUSrZ6vDLy+Hu5VD/mh98E9CQz3KsUF7a968b8U=; b=KuNf+NUSqzI5fBHuSDG5fNpbFp/lgyLUpnEbUNpgbg11Dp0i1RnrzrYA4qUDPmYh0J zZ9KokvwHbcnZequIO0z5P+pAhbvZCSEKfEkg1RRuWje986hpuA2kOb8xHrHLdV+rj3u v5EYzRBd066gYkxAS8O8cvKLeuhiJ0nYajpb2pbPMNRaogMON8LLS1ooi1H2davXgHLd gQ0+ktRwd1vjxDsFkprdnBfyKTW4T/vPI8wpJWQT6U0AGrZVgNGSNqKKk4TDm5zWWJn2 S+CRUsqoKzm7mRStwqMqhKcnE7R5H8hSQ3flnZqmSR2v/63LJMs8FzjBSSuCHg8KTbVy D2qg== X-Gm-Message-State: AOAM5319PgcyBlfeET0dX+qUewfiHZGCifOxt6weyj1lRmmN10NO2jY0 V+KUHVtFmDYQfJsUXPC9lSPPk+JwpBjGZYc= X-Google-Smtp-Source: ABdhPJzGbBtAVFrwdjEqiBD6+E28EtmYkKy5urdl57zxufqfrQWDlZBKSJpoF3OuBZYFVB4iZujKDQ== X-Received: by 2002:a05:6000:18a4:: with SMTP id b4mr6824259wri.641.1644161453177; Sun, 06 Feb 2022 07:30:53 -0800 (PST) Received: from takamaka.home ([165.169.246.70]) by smtp.gmail.com with ESMTPSA id n11sm11115262wms.3.2022.02.06.07.30.52 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 06 Feb 2022 07:30:52 -0800 (PST) Received: by takamaka.home (Postfix, from userid 1000) id C555DA160D; Sun, 6 Feb 2022 19:30:40 +0400 (+04) Date: Sun, 6 Feb 2022 16:30:40 +0100 From: Joel Brobecker To: Christophe Lyon via Gdb-patches Cc: torbjorn.svensson@st.com, Joel Brobecker Subject: Re: [PATCH v2 1/5] gdb/arm: Fix prologue analysis to support vpush Message-ID: References: <20220127133247.440019-1-christophe.lyon@foss.st.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220127133247.440019-1-christophe.lyon@foss.st.com> X-Spam-Status: No, score=-10.6 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.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) 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: , X-List-Received-Date: Sun, 06 Feb 2022 15:30:56 -0000 Hi Christophe, > While working on adding support for Non-secure/Secure modes unwinding, > I noticed that the prologue analysis lacked support for vpush, which > is used for instance in the CMSE stub routine. > > This patch updates thumb_analyze_prologue accordingly, adding support > for vpush of D-registers. Thanks. Just one minor command, and perhaps a suggestion. > --- > gdb/arm-tdep.c | 25 +++++++++++++++++++++++++ > 1 file changed, 25 insertions(+) > > diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c > index 7495434484e..7d52d2d78f6 100644 > --- a/gdb/arm-tdep.c > +++ b/gdb/arm-tdep.c > @@ -896,6 +896,31 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, > regs[bits (insn, 0, 3)] = addr; > } > > + else if ((insn & 0xff20) == 0xed20 /* vstmdb Rn{!}, { D-registers} */ > + && (inst2 & 0x0f00) == 0x0b00/* (aka vpush) */ Can you add a space between the end of the code and the start of the comment? (I assume that it is instr2 which is a vpush, right? I'm asking because of the "aka" which is generating a bit of confusion on my end). > + && pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM)) > + { > + /* Address SP points to. */ > + pv_t addr = regs[bits (insn, 0, 3)]; > + > + /* Number of registers saved. */ > + int number = bits (inst2, 0, 7) >> 1; > + > + if (stack.store_would_trash (addr)) > + break; > + > + /* Calculate offsets of saved registers. */ > + for (; number > 0; number--) > + { > + addr = pv_add_constant (addr, -8); > + stack.store (addr, 8, pv_register (ARM_D0_REGNUM + number, 0)); > + } > + > + /* Writeback SP if needed. */ > + if (insn & 0x0020) I suggest you clarify what the 0x20 is, in this case, and perhaps why SP needs to be written back. > + regs[bits (insn, 0, 3)] = addr; > + } > + > else if ((insn & 0xff50) == 0xe940 /* strd Rt, Rt2, > [Rn, #+/-imm]{!} */ > && pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM)) > -- > 2.25.1 > -- Joel