From: Takayuki 'January June' Suwa <jjsuwa_sys3175@yahoo.co.jp>
To: GCC Patches <gcc-patches@gcc.gnu.org>
Cc: Max Filippov <jcmvbkbc@gmail.com>
Subject: [PATCH] xtensa: Enforce return address saving when -Og is specified
Date: Sat, 18 Feb 2023 13:54:10 +0900 [thread overview]
Message-ID: <ffa22cd6-978c-0f23-d2ff-c52000db3398@yahoo.co.jp> (raw)
In-Reply-To: <ffa22cd6-978c-0f23-d2ff-c52000db3398.ref@yahoo.co.jp>
Leaf function often omits saving its return address to the stack slot,
and this feature often makes debugging very confusing, especially for
stack dump analysis.
gcc/ChangeLog:
* config/xtensa/xtensa.cc (xtensa_call_save_reg): Change to return
true if register A0 (return address register) when -Og is specified.
---
gcc/config/xtensa/xtensa.cc | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/gcc/config/xtensa/xtensa.cc b/gcc/config/xtensa/xtensa.cc
index d987f1dfede..1d9e4d1561a 100644
--- a/gcc/config/xtensa/xtensa.cc
+++ b/gcc/config/xtensa/xtensa.cc
@@ -3224,8 +3224,11 @@ xtensa_call_save_reg (int regno)
return false;
if (regno == A0_REG)
- return crtl->profile || !crtl->is_leaf || crtl->calls_eh_return ||
- df_regs_ever_live_p (regno);
+ /* Ensure the return address to be saved to the stack slot in order
+ to assist stack dump analysis when -Og is specified. */
+ return optimize_debug
+ || crtl->profile || !crtl->is_leaf || crtl->calls_eh_return
+ || df_regs_ever_live_p (regno);
if (crtl->calls_eh_return && IN_RANGE (regno, 2, 3))
return true;
--
2.30.2
next parent reply other threads:[~2023-02-18 4:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <ffa22cd6-978c-0f23-d2ff-c52000db3398.ref@yahoo.co.jp>
2023-02-18 4:54 ` Takayuki 'January June' Suwa [this message]
2023-02-21 1:34 ` Max Filippov
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=ffa22cd6-978c-0f23-d2ff-c52000db3398@yahoo.co.jp \
--to=jjsuwa_sys3175@yahoo.co.jp \
--cc=gcc-patches@gcc.gnu.org \
--cc=jcmvbkbc@gmail.com \
/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).