From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-oi1-x236.google.com (mail-oi1-x236.google.com [IPv6:2607:f8b0:4864:20::236]) by sourceware.org (Postfix) with ESMTPS id 2DBA638515EB for ; Mon, 17 Jan 2022 12:49:46 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2DBA638515EB Received: by mail-oi1-x236.google.com with SMTP id r138so23236042oie.3 for ; Mon, 17 Jan 2022 04:49:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=lV2BkN90sil54NhLemjwzUuX5HT3iuNPB3gKrDo8mVM=; b=i3r593uDvIip6R7VPB5pxwDVIyGNBbEHuGgut/JNtXTwOK/sS5tIFnKmldBt3dCIA3 f2w0YHMX9D0MwCU5YRkwQBzOChL3EkGn99FBSCrC/s9rLeNPAWL9i06lIJaUqmGmjMsL B8F4O+ufrUiAmsHqqc2pygwynRMHVcf9j1elLLBN3PFIGaLE3DrrSp/d0fDLCWUzsW3E jfNKRp5xDWSgyl6kOZBaT5OtZ/Kwak6Cd1vzyGtXj4/j469e3l8z+/FW/E+ib4t3HKY+ rOc7SCjdTJ4gFluTgp3NI2VF2orQqBXlUxosgcHmK76jXPDLkvCDic6svobaLYQ1aiuj Nv5Q== X-Gm-Message-State: AOAM531rGCjGXPnepp0flDJyKILOihOVkTYGtome+fjRX4eabVSZ5kAM G5MRvp4RlyR8FHOaj7tSbrg9/jS03mesNQ== X-Google-Smtp-Source: ABdhPJzzSGOms8f0fQP1Cz0c51YVP3IbIlx7u/dn5bJerbZF59pNNe7aLZW5JmrqIQG2FzFh9oHNlA== X-Received: by 2002:a54:4498:: with SMTP id v24mr17505975oiv.126.1642423785594; Mon, 17 Jan 2022 04:49:45 -0800 (PST) Received: from ?IPv6:2804:7f0:4841:563b:30b1:6189:5c0d:a8d8? ([2804:7f0:4841:563b:30b1:6189:5c0d:a8d8]) by smtp.gmail.com with ESMTPSA id e1sm4841474ooo.14.2022.01.17.04.49.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 17 Jan 2022 04:49:44 -0800 (PST) From: Luis Machado Subject: Re: [PATCH 1/5] gdb/arm: Fix prologue analysis to support vpush To: Christophe Lyon , gdb-patches@sourceware.org Cc: torjborn.svensson@st.com References: <20220114163552.4107885-1-christophe.lyon@foss.st.com> Message-ID: Date: Mon, 17 Jan 2022 09:49:41 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20220114163552.4107885-1-christophe.lyon@foss.st.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-12.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP 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: Mon, 17 Jan 2022 12:49:47 -0000 Hi! On 1/14/22 1:35 PM, Christophe Lyon via Gdb-patches wrote: > 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. Thanks for the patch. > > This patch updates thumb_analyze_prologue accordingly. > --- > gdb/arm-tdep.c | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c > index 7495434484e..14ec0bc8f9e 100644 > --- a/gdb/arm-tdep.c > +++ b/gdb/arm-tdep.c > @@ -896,6 +896,27 @@ thumb_analyze_prologue (struct gdbarch *gdbarch, > regs[bits (insn, 0, 3)] = addr; > } > I wish we'd use constants for instruction masks, but right now the code is full of magic numbers, so it is fine to use these. The code doesn't change that much anyway. > + else if ((insn & 0xff20) == 0xed20 /* vstmdb Rn{!}, > + { registers } */ > + && pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM)) > + { > + pv_t addr = regs[bits (insn, 0, 3)]; > + int number = bits (inst2, 0, 7) >> 1; I'd add a comment making it clear what is being checked/extracted here... > + > + 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)); > + } > + > + if (insn & 0x0020) > + regs[bits (insn, 0, 3)] = addr; ... and here as well. > + } > + > else if ((insn & 0xff50) == 0xe940 /* strd Rt, Rt2, > [Rn, #+/-imm]{!} */ > && pv_is_register (regs[bits (insn, 0, 3)], ARM_SP_REGNUM)) > Otherwise this look good to me.