From: Tomas Vanek <vanekt@fbl.cz>
To: gdb-patches@sourceware.org
Cc: Tomas Vanek <vanekt@fbl.cz>
Subject: [RFC PATCH 3/5] gdb/dwarf2: Add dwarf2_frame_reg_rule for GDB register number
Date: Sat, 5 Nov 2022 10:44:34 +0100 [thread overview]
Message-ID: <1667641476-31602-3-git-send-email-vanekt@fbl.cz> (raw)
In-Reply-To: <1667641476-31602-1-git-send-email-vanekt@fbl.cz>
Arm M-profile security extension requires the dwarf2 unwinder to
copy a value from a mode specific stack pointer to the general sp.
We can achive this using DWARF2_FRAME_REG_SAVED_REG but
it is complicated as the DWARF base register number has to be filled
to reg->loc.reg (and dwarf2_frame_prev_register() in turn converts
it back to the GDB register number).
To avoid the useless conversion forth and back introduce a new item
in enum dwarf2_frame_reg_rule for GDB internal use.
DWARF2_FRAME_REG_SAVED_GDB_REG copies the value from a register
indexed by GDB number.
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
---
gdb/dwarf2/frame.c | 4 ++++
gdb/dwarf2/frame.h | 5 ++++-
2 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/gdb/dwarf2/frame.c b/gdb/dwarf2/frame.c
index 3f884ab..a0e554f 100644
--- a/gdb/dwarf2/frame.c
+++ b/gdb/dwarf2/frame.c
@@ -1166,6 +1166,10 @@ struct dwarf2_frame_cache
(gdbarch, cache->reg[regnum].loc.reg);
return frame_unwind_got_register (this_frame, regnum, realnum);
+ case DWARF2_FRAME_REG_SAVED_GDB_REG:
+ realnum = cache->reg[regnum].loc.reg;
+ return frame_unwind_got_register (this_frame, regnum, realnum);
+
case DWARF2_FRAME_REG_SAVED_EXP:
addr = execute_stack_op (cache->reg[regnum].loc.exp.start,
cache->reg[regnum].loc.exp.len,
diff --git a/gdb/dwarf2/frame.h b/gdb/dwarf2/frame.h
index 06c8a10..848e924 100644
--- a/gdb/dwarf2/frame.h
+++ b/gdb/dwarf2/frame.h
@@ -61,7 +61,10 @@ enum dwarf2_frame_reg_rule
DWARF2_FRAME_REG_RA, /* Return Address. */
DWARF2_FRAME_REG_RA_OFFSET, /* Return Address with offset. */
DWARF2_FRAME_REG_CFA, /* Call Frame Address. */
- DWARF2_FRAME_REG_CFA_OFFSET /* Call Frame Address with offset. */
+ DWARF2_FRAME_REG_CFA_OFFSET, /* Call Frame Address with offset. */
+ DWARF2_FRAME_REG_SAVED_GDB_REG
+ /* As DWARF2_FRAME_REG_SAVED_REG, loc.reg contains GDB register number,
+ not DWARF register number. */
};
/* Register state. */
--
1.9.1
next prev parent reply other threads:[~2022-11-05 9:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-05 9:44 [RFC PATCH 1/5] gdb/arm: Introduce control_s and control_ns registers Tomas Vanek
2022-11-05 9:44 ` [RFC PATCH 2/5] gdb/arm: PR 29716 Fix FNC_RETURN stack selection in exception unwinder Tomas Vanek
2022-11-11 9:23 ` Luis Machado
2022-11-05 9:44 ` Tomas Vanek [this message]
2022-11-05 9:44 ` [RFC PATCH 4/5] gdb/arm: Unwinding of secure procedure with cmse_nonsecure_entry attribute Tomas Vanek
2022-11-05 9:44 ` [RFC PATCH 5/5] HACK frame inner than comparison for Arm M-profile sec ext Tomas Vanek
2022-11-08 11:23 ` [RFC PATCH 1/5] gdb/arm: Introduce control_s and control_ns registers Luis Machado
2022-11-08 15:52 ` Tomas Vanek
2022-11-08 15:58 ` Tomas Vanek
2022-11-09 15:27 ` Luis Machado
2022-11-08 16:48 ` Torbjorn SVENSSON
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=1667641476-31602-3-git-send-email-vanekt@fbl.cz \
--to=vanekt@fbl.cz \
--cc=gdb-patches@sourceware.org \
/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).