public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Torbjorn SVENSSON <torbjorn.svensson@foss.st.com>
To: Luis Machado <luis.machado@arm.com>, <gdb-patches@sourceware.org>
Cc: <pedro@palves.net>
Subject: Re: [PATCH] gdb/arm: Don't rely on loop detection to stop unwind
Date: Sat, 15 Oct 2022 11:40:22 +0200	[thread overview]
Message-ID: <2c9240b2-7106-dacd-bd4c-dea2b30d27e7@foss.st.com> (raw)
In-Reply-To: <3c83c771-bdc5-8d05-dd32-01a11420cf1e@arm.com>



On 2022-10-14 19:13, Luis Machado wrote:
> On 10/14/22 14:46, Torbjörn SVENSSON wrote:
>> Setting SP of the next frame to the same address as the current frame
>> is an ugly way to stop the unwind.  A cleaner way is to rely on the
> 
> stop the unwind -> stop the unwinding.
> 
>> frame_unwind_stop_reason function to return UNWIND_OUTERMOST.
>>
>> Signed-off-by: Torbjörn SVENSSON <torbjorn.svensson@foss.st.com>
>> ---
>>   gdb/arm-tdep.c | 13 ++++++-------
>>   1 file changed, 6 insertions(+), 7 deletions(-)
>>
>> diff --git a/gdb/arm-tdep.c b/gdb/arm-tdep.c
>> index fa6b08e4a54..b5facae8a5e 100644
>> --- a/gdb/arm-tdep.c
>> +++ b/gdb/arm-tdep.c
>> @@ -3356,7 +3356,6 @@ arm_m_exception_cache (frame_info_ptr this_frame)
>>        to the exception and if FPU is used (causing extended stack 
>> frame).  */
>>     CORE_ADDR lr = get_frame_register_unsigned (this_frame, 
>> ARM_LR_REGNUM);
>> -  CORE_ADDR sp = get_frame_register_unsigned (this_frame, 
>> ARM_SP_REGNUM);
>>     /* ARMv7-M Architecture Reference "A2.3.1 Arm core registers"
>>        states that LR is set to 0xffffffff on reset.  ARMv8-M 
>> Architecture
>> @@ -3364,8 +3363,8 @@ arm_m_exception_cache (frame_info_ptr this_frame)
>>        reset if Main Extension is implemented, otherwise the value is 
>> unknown.  */
>>     if (lr == 0xffffffff)
>>       {
>> -      /* Terminate any further stack unwinding by referring to self.  */
>> -      arm_cache_set_active_sp_value (cache, tdep, sp);
>> +      /* Terminate any further stack unwinding.  */
>> +      arm_cache_set_active_sp_value (cache, tdep, 0);
>>         return cache;
>>       }
>> @@ -3387,8 +3386,8 @@ arm_m_exception_cache (frame_info_ptr this_frame)
>>       {
>>         warning (_("Non-secure to secure stack unwinding disabled."));
>> -      /* Terminate any further stack unwinding by referring to self.  */
>> -      arm_cache_set_active_sp_value (cache, tdep, sp);
>> +      /* Terminate any further stack unwinding.  */
>> +      arm_cache_set_active_sp_value (cache, tdep, 0);
>>         return cache;
>>       }
>> @@ -3452,8 +3451,8 @@ arm_m_exception_cache (frame_info_ptr this_frame)
>>           {
>>             warning (_("Non-secure to secure stack unwinding 
>> disabled."));
>> -          /* Terminate any further stack unwinding by referring to 
>> self.  */
>> -          arm_cache_set_active_sp_value (cache, tdep, sp);
>> +          /* Terminate any further stack unwinding.  */
>> +          arm_cache_set_active_sp_value (cache, tdep, 0);
>>             return cache;
>>           }
> LGTM. Thanks.

Pushed.

      reply	other threads:[~2022-10-15  9:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-14 13:46 Torbjörn SVENSSON
2022-10-14 17:13 ` Luis Machado
2022-10-15  9:40   ` Torbjorn SVENSSON [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=2c9240b2-7106-dacd-bd4c-dea2b30d27e7@foss.st.com \
    --to=torbjorn.svensson@foss.st.com \
    --cc=gdb-patches@sourceware.org \
    --cc=luis.machado@arm.com \
    --cc=pedro@palves.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).