aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHui Li <lihui@loongson.cn>2025-08-26 09:28:29 +0800
committerTiezhu Yang <yangtiezhu@loongson.cn>2025-08-26 21:56:57 +0800
commita9baa37ce95141589359e2a11f1698cfd7fedda4 (patch)
tree95683b147e471e3554372813a9939de319a3b6eb
parent35bd58744ec9d64769cbf90693b7a860513c0133 (diff)
downloadbinutils-a9baa37ce95141589359e2a11f1698cfd7fedda4.zip
binutils-a9baa37ce95141589359e2a11f1698cfd7fedda4.tar.gz
binutils-a9baa37ce95141589359e2a11f1698cfd7fedda4.tar.bz2
gdb: LoongArch: Add the definition of loongarch_frame_cache
Add the definition of loongarch_frame_cache for loongarch_frame_unwind, this is preparation for later patch on LoongArch. Signed-off-by: Hui Li <lihui@loongson.cn> Signed-off-by: Tiezhu Yang <yangtiezhu@loongson.cn>
-rw-r--r--gdb/loongarch-tdep.c29
1 files changed, 28 insertions, 1 deletions
diff --git a/gdb/loongarch-tdep.c b/gdb/loongarch-tdep.c
index e497848..449c8e5 100644
--- a/gdb/loongarch-tdep.c
+++ b/gdb/loongarch-tdep.c
@@ -34,6 +34,33 @@
#include "trad-frame.h"
#include "user-regs.h"
+/* LoongArch frame cache structure. */
+struct loongarch_frame_cache
+{
+ /* The program counter at the start of the function. It is used to
+ identify this frame as a prologue frame. */
+ CORE_ADDR func;
+
+ /* The stack pointer at the time this frame was created; i.e. the
+ caller's stack pointer when this function was called. It is used
+ to identify this frame. */
+ CORE_ADDR prev_sp;
+
+ CORE_ADDR pc;
+
+ int available_p;
+
+ /* This register stores the frame base of the frame. */
+ int framebase_reg;
+
+ /* The framebase_offset is the distance from frame base to the prev_sp,
+ so the value of framebase_reg is just prev_sp - framebase_offset. */
+ int framebase_offset;
+
+ /* Saved register offsets. */
+ trad_frame_saved_reg *saved_regs;
+};
+
/* Fetch the instruction at PC. */
static insn_t
@@ -125,7 +152,7 @@ loongarch_insn_is_sc (insn_t insn)
static CORE_ADDR
loongarch_scan_prologue (struct gdbarch *gdbarch, CORE_ADDR start_pc,
CORE_ADDR limit_pc, const frame_info_ptr &this_frame,
- struct trad_frame_cache *this_cache)
+ struct loongarch_frame_cache *this_cache)
{
CORE_ADDR cur_pc = start_pc, prologue_end = 0;
int32_t sp = LOONGARCH_SP_REGNUM;