* [PATCH RFA] Zap EXTRA_FRAME_INFO for ARM target
@ 2001-12-15 0:27 Kevin Buettner
2002-01-20 15:16 ` Andrew Cagney
0 siblings, 1 reply; 8+ messages in thread
From: Kevin Buettner @ 2001-12-15 0:27 UTC (permalink / raw)
To: gdb-patches
The patch below represents a small step on the way to multiarching the
ARM target. It eliminates the use of the deprecated EXTRA_FRAME_INFO
macro for describing a frame. Instead, it now uses the ``extra_info''
and ``saved_regs'' members in the frame_info struct.
This patch is intended to be applied on top of two other patches that
I'm waiting for approval on. These are:
http://sources.redhat.com/ml/gdb-patches/2001-11/msg00484.html
http://sources.redhat.com/ml/gdb-patches/2001-12/msg00349.html
Okay to commit?
* tm-arm.h (EXTRA_FRAME_INFO): Delete definition.
(arm_frame_init_saved_regs): Declare.
(FRAME_INIT_SAVED_REGS): Define.
(arm_frame_find_saved_regs): Delete declaration.
(FRAME_FIND_SAVED_REGS): Delete definition.
* arm-tdep.c (gdb_assert.h): Include.
(struct frame_extra_info): Delete fsr member.
(thumb_scan_prologue, check_prologue_cache, save_prologue_cache)
(arm_scan_prologue, arm_find_callers_reg, arm_frame_chain)
(arm_init_extra_frame_info, arm_push_dummy_frame): Use
``saved_regs'' in place of ``fsr.regs''. Use
``extra_info->framesize'' in place of just ``framesize''.
Likewise for ``frameoffset'' and ``framereg''.
(arm_frame_init_saved_regs): New function.
(arm_frame_find_saved_regs): Delete.
(_initialize_arm_tdep): Allocate ``extra_info'' and ``saved_regs''
structs for the prologue cache.
(arm_frame_chain): Likewise for the hand created caller's
frame_info struct.
(arm_init_extra_frame_info): Likewise for the frame_info struct
undergoing initialization.
diff -upr ../../../sourceware-arm1+2/src/gdb/arm-tdep.c ./arm-tdep.c
--- ../../../sourceware-arm1+2/src/gdb/arm-tdep.c Sat Dec 15 00:13:02 2001
+++ ./arm-tdep.c Sat Dec 15 00:30:34 2001
@@ -33,6 +33,7 @@
#include "doublest.h"
#include "value.h"
#include "solib-svr4.h"
+#include "gdb_assert.h"
/* Each OS has a different mechanism for accessing the various
registers stored in the sigcontext structure.
@@ -108,7 +109,6 @@ static void convert_from_extended (void
struct frame_extra_info
{
- struct frame_saved_regs fsr;
int framesize;
int frameoffset;
int framereg;
@@ -534,7 +534,7 @@ thumb_scan_prologue (struct frame_info *
frame pointer, adjust the stack pointer, and save registers.
Do this until all basic prolog instructions are found. */
- fi->framesize = 0;
+ fi->extra_info->framesize = 0;
for (current_pc = prologue_start;
(current_pc < prologue_end) && ((findmask & 7) != 7);
current_pc += 2)
@@ -557,8 +557,8 @@ thumb_scan_prologue (struct frame_info *
for (regno = LR_REGNUM; regno >= 0; regno--)
if (mask & (1 << regno))
{
- fi->framesize += 4;
- fi->fsr.regs[saved_reg[regno]] = -(fi->framesize);
+ fi->extra_info->framesize += 4;
+ fi->saved_regs[saved_reg[regno]] = -(fi->extra_info->framesize);
saved_reg[regno] = regno; /* reset saved register map */
}
}
@@ -572,22 +572,22 @@ thumb_scan_prologue (struct frame_info *
offset = (insn & 0x7f) << 2; /* get scaled offset */
if (insn & 0x80) /* is it signed? (==subtracting) */
{
- fi->frameoffset += offset;
+ fi->extra_info->frameoffset += offset;
offset = -offset;
}
- fi->framesize -= offset;
+ fi->extra_info->framesize -= offset;
}
else if ((insn & 0xff00) == 0xaf00) /* add r7, sp, #imm */
{
findmask |= 2; /* setting of r7 found */
- fi->framereg = THUMB_FP_REGNUM;
- fi->frameoffset = (insn & 0xff) << 2; /* get scaled offset */
+ fi->extra_info->framereg = THUMB_FP_REGNUM;
+ fi->extra_info->frameoffset = (insn & 0xff) << 2; /* get scaled offset */
}
else if (insn == 0x466f) /* mov r7, sp */
{
findmask |= 2; /* setting of r7 found */
- fi->framereg = THUMB_FP_REGNUM;
- fi->frameoffset = 0;
+ fi->extra_info->framereg = THUMB_FP_REGNUM;
+ fi->extra_info->frameoffset = 0;
saved_reg[THUMB_FP_REGNUM] = SP_REGNUM;
}
else if ((insn & 0xffc0) == 0x4640) /* mov r0-r7, r8-r15 */
@@ -627,11 +627,11 @@ check_prologue_cache (struct frame_info
if (fi->pc == prologue_cache.pc)
{
- fi->framereg = prologue_cache.framereg;
- fi->framesize = prologue_cache.framesize;
- fi->frameoffset = prologue_cache.frameoffset;
+ fi->extra_info->framereg = prologue_cache.extra_info->framereg;
+ fi->extra_info->framesize = prologue_cache.extra_info->framesize;
+ fi->extra_info->frameoffset = prologue_cache.extra_info->frameoffset;
for (i = 0; i < NUM_REGS; i++)
- fi->fsr.regs[i] = prologue_cache.fsr.regs[i];
+ fi->saved_regs[i] = prologue_cache.saved_regs[i];
return 1;
}
else
@@ -647,12 +647,12 @@ save_prologue_cache (struct frame_info *
int i;
prologue_cache.pc = fi->pc;
- prologue_cache.framereg = fi->framereg;
- prologue_cache.framesize = fi->framesize;
- prologue_cache.frameoffset = fi->frameoffset;
+ prologue_cache.extra_info->framereg = fi->extra_info->framereg;
+ prologue_cache.extra_info->framesize = fi->extra_info->framesize;
+ prologue_cache.extra_info->frameoffset = fi->extra_info->frameoffset;
for (i = 0; i < NUM_REGS; i++)
- prologue_cache.fsr.regs[i] = fi->fsr.regs[i];
+ prologue_cache.saved_regs[i] = fi->saved_regs[i];
}
@@ -734,9 +734,9 @@ arm_scan_prologue (struct frame_info *fi
return;
/* Assume there is no frame until proven otherwise. */
- fi->framereg = SP_REGNUM;
- fi->framesize = 0;
- fi->frameoffset = 0;
+ fi->extra_info->framereg = SP_REGNUM;
+ fi->extra_info->framesize = 0;
+ fi->extra_info->frameoffset = 0;
/* Check for Thumb prologue. */
if (arm_pc_is_thumb (fi->pc))
@@ -835,7 +835,7 @@ arm_scan_prologue (struct frame_info *fi
if (mask & (1 << regno))
{
sp_offset -= 4;
- fi->fsr.regs[regno] = sp_offset;
+ fi->saved_regs[regno] = sp_offset;
}
}
else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */
@@ -844,7 +844,7 @@ arm_scan_prologue (struct frame_info *fi
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
fp_offset = -imm;
- fi->framereg = FP_REGNUM;
+ fi->extra_info->framereg = FP_REGNUM;
}
else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */
{
@@ -857,7 +857,7 @@ arm_scan_prologue (struct frame_info *fi
{
sp_offset -= 12;
regno = F0_REGNUM + ((insn >> 12) & 0x07);
- fi->fsr.regs[regno] = sp_offset;
+ fi->saved_regs[regno] = sp_offset;
}
else if ((insn & 0xffbf0fff) == 0xec2d0200) /* sfmfd f0, 4, [sp!] */
{
@@ -884,7 +884,7 @@ arm_scan_prologue (struct frame_info *fi
for (; fp_start_reg < fp_bound_reg; fp_start_reg++)
{
sp_offset -= 12;
- fi->fsr.regs[fp_start_reg++] = sp_offset;
+ fi->saved_regs[fp_start_reg++] = sp_offset;
}
}
else if ((insn & 0xf0000000) != 0xe0000000)
@@ -900,11 +900,11 @@ arm_scan_prologue (struct frame_info *fi
/* The frame size is just the negative of the offset (from the original SP)
of the last thing thing we pushed on the stack. The frame offset is
[new FP] - [new SP]. */
- fi->framesize = -sp_offset;
- if (fi->framereg == FP_REGNUM)
- fi->frameoffset = fp_offset - sp_offset;
+ fi->extra_info->framesize = -sp_offset;
+ if (fi->extra_info->framereg == FP_REGNUM)
+ fi->extra_info->frameoffset = fp_offset - sp_offset;
else
- fi->frameoffset = 0;
+ fi->extra_info->frameoffset = 0;
save_prologue_cache (fi);
}
@@ -926,8 +926,8 @@ arm_find_callers_reg (struct frame_info
return generic_read_register_dummy (fi->pc, fi->frame, regnum);
else
#endif
- if (fi->fsr.regs[regnum] != 0)
- return read_memory_integer (fi->fsr.regs[regnum],
+ if (fi->saved_regs[regnum] != 0)
+ return read_memory_integer (fi->saved_regs[regnum],
REGISTER_RAW_SIZE (regnum));
return read_register (regnum);
}
@@ -970,8 +970,7 @@ arm_frame_chain (struct frame_info *fi)
return 0; /* in _start fn, don't chain further */
#endif
CORE_ADDR caller_pc, fn_start;
- struct frame_info caller_fi;
- int framereg = fi->framereg;
+ int framereg = fi->extra_info->framereg;
if (fi->pc < LOWEST_PC)
return 0;
@@ -988,10 +987,25 @@ arm_frame_chain (struct frame_info *fi)
frame register number. */
if (arm_pc_is_thumb (caller_pc) != arm_pc_is_thumb (fi->pc))
{
+ struct frame_info caller_fi;
+ struct cleanup *old_chain;
+
+ /* Create a temporary frame suitable for scanning the caller's
+ prologue. (Ugh.) */
memset (&caller_fi, 0, sizeof (caller_fi));
+ caller_fi.saved_regs = (CORE_ADDR *) xcalloc (1, SIZEOF_FRAME_SAVED_REGS);
+ old_chain = make_cleanup (xfree, caller_fi.saved_regs);
+ caller_fi.extra_info = xcalloc (1, sizeof (struct frame_extra_info));
+ make_cleanup (xfree, caller_fi.extra_info);
+
+ /* Now, scan the prologue and obtain the frame register. */
caller_fi.pc = caller_pc;
arm_scan_prologue (&caller_fi);
- framereg = caller_fi.framereg;
+ framereg = caller_fi.extra_info->framereg;
+
+ /* Deallocate the storage associated with the temporary frame
+ created above. */
+ do_cleanups (old_chain);
}
/* If the caller used a frame register, return its value.
@@ -999,7 +1013,7 @@ arm_frame_chain (struct frame_info *fi)
if (framereg == FP_REGNUM || framereg == THUMB_FP_REGNUM)
return arm_find_callers_reg (fi, framereg);
else
- return fi->frame + fi->framesize;
+ return fi->frame + fi->extra_info->framesize;
}
/* This function actually figures out the frame address for a given pc
@@ -1017,19 +1031,22 @@ arm_init_extra_frame_info (int fromleaf,
int reg;
CORE_ADDR sp;
+ fi->extra_info = (struct frame_extra_info *)
+ frame_obstack_alloc (sizeof (struct frame_extra_info));
+
+ frame_saved_regs_zalloc (fi);
+
if (fi->next)
fi->pc = FRAME_SAVED_PC (fi->next);
- memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs);
-
#if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
{
/* We need to setup fi->frame here because run_stack_dummy gets it wrong
by assuming it's always FP. */
fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM);
- fi->framesize = 0;
- fi->frameoffset = 0;
+ fi->extra_info->framesize = 0;
+ fi->extra_info->frameoffset = 0;
return;
}
else
@@ -1040,7 +1057,7 @@ arm_init_extra_frame_info (int fromleaf,
if (!fi->next)
sp = read_sp();
else
- sp = fi->next->frame - fi->next->frameoffset + fi->next->framesize;
+ sp = fi->next->frame - fi->next->extra_info->frameoffset + fi->next->extra_info->framesize;
/* Determine whether or not we're in a sigtramp frame.
Unfortunately, it isn't sufficient to test
@@ -1058,14 +1075,14 @@ arm_init_extra_frame_info (int fromleaf,
&& (fi->signal_handler_caller || IN_SIGTRAMP (fi->pc, 0)))
{
for (reg = 0; reg < NUM_REGS; reg++)
- fi->fsr.regs[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, fi->pc, reg);
+ fi->saved_regs[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, fi->pc, reg);
/* FIXME: What about thumb mode? */
- fi->framereg = SP_REGNUM;
- fi->frame = read_memory_integer (fi->fsr.regs[fi->framereg],
- REGISTER_RAW_SIZE (fi->framereg));
- fi->framesize = 0;
- fi->frameoffset = 0;
+ fi->extra_info->framereg = SP_REGNUM;
+ fi->frame = read_memory_integer (fi->saved_regs[fi->extra_info->framereg],
+ REGISTER_RAW_SIZE (fi->extra_info->framereg));
+ fi->extra_info->framesize = 0;
+ fi->extra_info->frameoffset = 0;
}
else if (PC_IN_CALL_DUMMY (fi->pc, sp, fi->frame))
@@ -1077,19 +1094,19 @@ arm_init_extra_frame_info (int fromleaf,
rp = fi->frame - REGISTER_SIZE;
/* Fill in addresses of saved registers. */
- fi->fsr.regs[PS_REGNUM] = rp;
+ fi->saved_regs[PS_REGNUM] = rp;
rp -= REGISTER_RAW_SIZE (PS_REGNUM);
for (reg = PC_REGNUM; reg >= 0; reg--)
{
- fi->fsr.regs[reg] = rp;
+ fi->saved_regs[reg] = rp;
rp -= REGISTER_RAW_SIZE (reg);
}
- callers_sp = read_memory_integer (fi->fsr.regs[SP_REGNUM],
+ callers_sp = read_memory_integer (fi->saved_regs[SP_REGNUM],
REGISTER_RAW_SIZE (SP_REGNUM));
- fi->framereg = FP_REGNUM;
- fi->framesize = callers_sp - sp;
- fi->frameoffset = fi->frame - sp;
+ fi->extra_info->framereg = FP_REGNUM;
+ fi->extra_info->framesize = callers_sp - sp;
+ fi->extra_info->frameoffset = fi->frame - sp;
}
else
{
@@ -1097,14 +1114,14 @@ arm_init_extra_frame_info (int fromleaf,
if (!fi->next)
/* this is the innermost frame? */
- fi->frame = read_register (fi->framereg);
- else if (fi->framereg == FP_REGNUM || fi->framereg == THUMB_FP_REGNUM)
+ fi->frame = read_register (fi->extra_info->framereg);
+ else if (fi->extra_info->framereg == FP_REGNUM || fi->extra_info->framereg == THUMB_FP_REGNUM)
{
/* not the innermost frame */
/* If we have an FP, the callee saved it. */
- if (fi->next->fsr.regs[fi->framereg] != 0)
+ if (fi->next->saved_regs[fi->extra_info->framereg] != 0)
fi->frame =
- read_memory_integer (fi->next->fsr.regs[fi->framereg], 4);
+ read_memory_integer (fi->next->saved_regs[fi->extra_info->framereg], 4);
else if (fromleaf)
/* If we were called by a frameless fn. then our frame is
still in the frame pointer register on the board... */
@@ -1114,11 +1131,19 @@ arm_init_extra_frame_info (int fromleaf,
/* Calculate actual addresses of saved registers using offsets
determined by arm_scan_prologue. */
for (reg = 0; reg < NUM_REGS; reg++)
- if (fi->fsr.regs[reg] != 0)
- fi->fsr.regs[reg] += fi->frame + fi->framesize - fi->frameoffset;
+ if (fi->saved_regs[reg] != 0)
+ fi->saved_regs[reg] += fi->frame + fi->extra_info->framesize - fi->extra_info->frameoffset;
}
}
+/* Initialize the saved register addresses. There's nothing to do
+ here since these addresses were already computed by
+ arm_init_extra_frame_info(). */
+void
+arm_frame_init_saved_regs (struct frame_info *fi)
+{
+ gdb_assert (fi->extra_info != NULL && fi->saved_regs != NULL);
+}
/* Find the caller of this frame. We do this by seeing if LR_REGNUM
is saved in the stack anywhere, otherwise we get it from the
@@ -1136,9 +1161,9 @@ arm_frame_saved_pc (struct frame_info *f
return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
else
#endif
- if (PC_IN_CALL_DUMMY (fi->pc, fi->frame - fi->frameoffset, fi->frame))
+ if (PC_IN_CALL_DUMMY (fi->pc, fi->frame - fi->extra_info->frameoffset, fi->frame))
{
- return read_memory_integer (fi->fsr.regs[PC_REGNUM], REGISTER_RAW_SIZE (PC_REGNUM));
+ return read_memory_integer (fi->saved_regs[PC_REGNUM], REGISTER_RAW_SIZE (PC_REGNUM));
}
else
{
@@ -1159,15 +1184,6 @@ arm_target_read_fp (void)
return read_register (FP_REGNUM); /* R11 if ARM */
}
-/* Calculate the frame offsets of the saved registers (ARM version). */
-
-void
-arm_frame_find_saved_regs (struct frame_info *fi,
- struct frame_saved_regs *regaddr)
-{
- memcpy (regaddr, &fi->fsr, sizeof (struct frame_saved_regs));
-}
-
void
arm_push_dummy_frame (void)
{
@@ -1419,12 +1435,12 @@ arm_pop_frame (void)
{
int regnum;
struct frame_info *frame = get_current_frame ();
- CORE_ADDR old_SP = frame->frame - frame->frameoffset + frame->framesize;
+ CORE_ADDR old_SP = frame->frame - frame->extra_info->frameoffset + frame->extra_info->framesize;
for (regnum = 0; regnum < NUM_REGS; regnum++)
- if (frame->fsr.regs[regnum] != 0)
+ if (frame->saved_regs[regnum] != 0)
write_register (regnum,
- read_memory_integer (frame->fsr.regs[regnum],
+ read_memory_integer (frame->saved_regs[regnum],
REGISTER_RAW_SIZE (regnum)));
write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
@@ -2209,6 +2225,10 @@ The valid values are:\n");
add_com ("othernames", class_obscure, arm_othernames,
"Switch to the next set of register names.");
+
+ /* Allocate extra_info and saved_regs fields in the prologue cache. */
+ prologue_cache.extra_info = xcalloc (1, sizeof (struct frame_extra_info));
+ prologue_cache.saved_regs = xcalloc (1, SIZEOF_FRAME_SAVED_REGS);
}
/* Test whether the coff symbol specific value corresponds to a Thumb
diff -upr ../../../sourceware-arm1+2/src/gdb/config/arm/tm-arm.h ./config/arm/tm-arm.h
--- ../../../sourceware-arm1+2/src/gdb/config/arm/tm-arm.h Fri Nov 16 10:03:27 2001
+++ ./config/arm/tm-arm.h Sat Dec 15 00:30:34 2001
@@ -318,22 +318,13 @@ extern void convert_to_extended (void *d
#define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p))
\f
-/* Define other aspects of the stack frame. We keep the offsets of
- all saved registers, 'cause we need 'em a lot! We also keep the
- current size of the stack frame, and the offset of the frame
- pointer from the stack pointer (for frameless functions, and when
- we're still in the prologue of a function with a frame) */
-
-#define EXTRA_FRAME_INFO \
- struct frame_saved_regs fsr; \
- int framesize; \
- int frameoffset; \
- int framereg;
-
extern void arm_init_extra_frame_info (int fromleaf, struct frame_info * fi);
#define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
arm_init_extra_frame_info ((fromleaf), (fi))
+extern void arm_frame_init_saved_regs (struct frame_info *fi);
+#define FRAME_INIT_SAVED_REGS(fi) arm_frame_init_saved_regs (fi)
+
/* Return the frame address. On ARM, it is R11; on Thumb it is R7. */
CORE_ADDR arm_target_read_fp (void);
#define TARGET_READ_FP() arm_target_read_fp ()
@@ -393,20 +384,6 @@ extern CORE_ADDR arm_frame_saved_pc (str
/* Return number of bytes at start of arglist that are not really args. */
#define FRAME_ARGS_SKIP 0
-
-/* Put here the code to store, into a struct frame_saved_regs, the
- addresses of the saved registers of frame described by FRAME_INFO.
- This includes special registers such as pc and fp saved in special
- ways in the stack frame. sp is even more special: the address we
- return for it IS the sp for the next frame. */
-
-struct frame_saved_regs;
-struct frame_info;
-void arm_frame_find_saved_regs (struct frame_info * fi,
- struct frame_saved_regs * fsr);
-
-#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
- arm_frame_find_saved_regs (frame_info, &(frame_saved_regs));
/* Things needed for making the inferior call functions. */
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RFA] Zap EXTRA_FRAME_INFO for ARM target
2001-12-15 0:27 [PATCH RFA] Zap EXTRA_FRAME_INFO for ARM target Kevin Buettner
@ 2002-01-20 15:16 ` Andrew Cagney
2002-01-21 7:57 ` Fernando Nasser
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Andrew Cagney @ 2002-01-20 15:16 UTC (permalink / raw)
To: Kevin Buettner, Richard Earnshaw, Fernando Nasser, Scott Bambrough
Cc: gdb-patches
> The patch below represents a small step on the way to multiarching the
> ARM target. It eliminates the use of the deprecated EXTRA_FRAME_INFO
> macro for describing a frame. Instead, it now uses the ``extra_info''
> and ``saved_regs'' members in the frame_info struct.
Kevin, Richard, Fernando, Scott,
Jason Thorpe (I assume unintentionally) set a precident by treating as
obvious the patch transforming EXTRA_FRAME_INFO as part of multi-arching
the alpha.
Thinking about it Jason was correct in taking this aproach (I suspect
I've done this with other targets). A patch making the single
independant change of eliminating EXTRA_FRAME_INFO is mechanical, and as
such, can be treated as obvious. Clearly it is assumed that the person
committing the change is performing before/after testing to ensure no
regressions occure. A person looking to commit such a change is also,
obviously, strongly advised, to not try and make the change somehow
dependant on other changes, doing that will just bog down the process.
If GDB doesn't take this approach it is very quickly going to find that
the multi-arch task gets bogged down waiting on approval of trivial changes.
With that in mind I think either Kevin's or Richard's EXTRA_FRAME_INFO
patch (minus any dependencies) should be committed. The only proviso
being that they are before/after tested and show no regressions.
enjoy,
Andrew
> * tm-arm.h (EXTRA_FRAME_INFO): Delete definition.
> (arm_frame_init_saved_regs): Declare.
> (FRAME_INIT_SAVED_REGS): Define.
> (arm_frame_find_saved_regs): Delete declaration.
> (FRAME_FIND_SAVED_REGS): Delete definition.
> * arm-tdep.c (gdb_assert.h): Include.
> (struct frame_extra_info): Delete fsr member.
> (thumb_scan_prologue, check_prologue_cache, save_prologue_cache)
> (arm_scan_prologue, arm_find_callers_reg, arm_frame_chain)
> (arm_init_extra_frame_info, arm_push_dummy_frame): Use
> ``saved_regs'' in place of ``fsr.regs''. Use
> ``extra_info->framesize'' in place of just ``framesize''.
> Likewise for ``frameoffset'' and ``framereg''.
> (arm_frame_init_saved_regs): New function.
> (arm_frame_find_saved_regs): Delete.
> (_initialize_arm_tdep): Allocate ``extra_info'' and ``saved_regs''
> structs for the prologue cache.
> (arm_frame_chain): Likewise for the hand created caller's
> frame_info struct.
> (arm_init_extra_frame_info): Likewise for the frame_info struct
> undergoing initialization.
>
> diff -upr ../../../sourceware-arm1+2/src/gdb/arm-tdep.c ./arm-tdep.c
> --- ../../../sourceware-arm1+2/src/gdb/arm-tdep.c Sat Dec 15 00:13:02 2001
> +++ ./arm-tdep.c Sat Dec 15 00:30:34 2001
> @@ -33,6 +33,7 @@
> #include "doublest.h"
> #include "value.h"
> #include "solib-svr4.h"
> +#include "gdb_assert.h"
>
> /* Each OS has a different mechanism for accessing the various
> registers stored in the sigcontext structure.
> @@ -108,7 +109,6 @@ static void convert_from_extended (void
>
> struct frame_extra_info
> {
> - struct frame_saved_regs fsr;
> int framesize;
> int frameoffset;
> int framereg;
> @@ -534,7 +534,7 @@ thumb_scan_prologue (struct frame_info *
> frame pointer, adjust the stack pointer, and save registers.
> Do this until all basic prolog instructions are found. */
>
> - fi->framesize = 0;
> + fi->extra_info->framesize = 0;
> for (current_pc = prologue_start;
> (current_pc < prologue_end) && ((findmask & 7) != 7);
> current_pc += 2)
> @@ -557,8 +557,8 @@ thumb_scan_prologue (struct frame_info *
> for (regno = LR_REGNUM; regno >= 0; regno--)
> if (mask & (1 << regno))
> {
> - fi->framesize += 4;
> - fi->fsr.regs[saved_reg[regno]] = -(fi->framesize);
> + fi->extra_info->framesize += 4;
> + fi->saved_regs[saved_reg[regno]] = -(fi->extra_info->framesize);
> saved_reg[regno] = regno; /* reset saved register map */
> }
> }
> @@ -572,22 +572,22 @@ thumb_scan_prologue (struct frame_info *
> offset = (insn & 0x7f) << 2; /* get scaled offset */
> if (insn & 0x80) /* is it signed? (==subtracting) */
> {
> - fi->frameoffset += offset;
> + fi->extra_info->frameoffset += offset;
> offset = -offset;
> }
> - fi->framesize -= offset;
> + fi->extra_info->framesize -= offset;
> }
> else if ((insn & 0xff00) == 0xaf00) /* add r7, sp, #imm */
> {
> findmask |= 2; /* setting of r7 found */
> - fi->framereg = THUMB_FP_REGNUM;
> - fi->frameoffset = (insn & 0xff) << 2; /* get scaled offset */
> + fi->extra_info->framereg = THUMB_FP_REGNUM;
> + fi->extra_info->frameoffset = (insn & 0xff) << 2; /* get scaled offset */
> }
> else if (insn == 0x466f) /* mov r7, sp */
> {
> findmask |= 2; /* setting of r7 found */
> - fi->framereg = THUMB_FP_REGNUM;
> - fi->frameoffset = 0;
> + fi->extra_info->framereg = THUMB_FP_REGNUM;
> + fi->extra_info->frameoffset = 0;
> saved_reg[THUMB_FP_REGNUM] = SP_REGNUM;
> }
> else if ((insn & 0xffc0) == 0x4640) /* mov r0-r7, r8-r15 */
> @@ -627,11 +627,11 @@ check_prologue_cache (struct frame_info
>
> if (fi->pc == prologue_cache.pc)
> {
> - fi->framereg = prologue_cache.framereg;
> - fi->framesize = prologue_cache.framesize;
> - fi->frameoffset = prologue_cache.frameoffset;
> + fi->extra_info->framereg = prologue_cache.extra_info->framereg;
> + fi->extra_info->framesize = prologue_cache.extra_info->framesize;
> + fi->extra_info->frameoffset = prologue_cache.extra_info->frameoffset;
> for (i = 0; i < NUM_REGS; i++)
> - fi->fsr.regs[i] = prologue_cache.fsr.regs[i];
> + fi->saved_regs[i] = prologue_cache.saved_regs[i];
> return 1;
> }
> else
> @@ -647,12 +647,12 @@ save_prologue_cache (struct frame_info *
> int i;
>
> prologue_cache.pc = fi->pc;
> - prologue_cache.framereg = fi->framereg;
> - prologue_cache.framesize = fi->framesize;
> - prologue_cache.frameoffset = fi->frameoffset;
> + prologue_cache.extra_info->framereg = fi->extra_info->framereg;
> + prologue_cache.extra_info->framesize = fi->extra_info->framesize;
> + prologue_cache.extra_info->frameoffset = fi->extra_info->frameoffset;
>
> for (i = 0; i < NUM_REGS; i++)
> - prologue_cache.fsr.regs[i] = fi->fsr.regs[i];
> + prologue_cache.saved_regs[i] = fi->saved_regs[i];
> }
>
>
> @@ -734,9 +734,9 @@ arm_scan_prologue (struct frame_info *fi
> return;
>
> /* Assume there is no frame until proven otherwise. */
> - fi->framereg = SP_REGNUM;
> - fi->framesize = 0;
> - fi->frameoffset = 0;
> + fi->extra_info->framereg = SP_REGNUM;
> + fi->extra_info->framesize = 0;
> + fi->extra_info->frameoffset = 0;
>
> /* Check for Thumb prologue. */
> if (arm_pc_is_thumb (fi->pc))
> @@ -835,7 +835,7 @@ arm_scan_prologue (struct frame_info *fi
> if (mask & (1 << regno))
> {
> sp_offset -= 4;
> - fi->fsr.regs[regno] = sp_offset;
> + fi->saved_regs[regno] = sp_offset;
> }
> }
> else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */
> @@ -844,7 +844,7 @@ arm_scan_prologue (struct frame_info *fi
> unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
> imm = (imm >> rot) | (imm << (32 - rot));
> fp_offset = -imm;
> - fi->framereg = FP_REGNUM;
> + fi->extra_info->framereg = FP_REGNUM;
> }
> else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */
> {
> @@ -857,7 +857,7 @@ arm_scan_prologue (struct frame_info *fi
> {
> sp_offset -= 12;
> regno = F0_REGNUM + ((insn >> 12) & 0x07);
> - fi->fsr.regs[regno] = sp_offset;
> + fi->saved_regs[regno] = sp_offset;
> }
> else if ((insn & 0xffbf0fff) == 0xec2d0200) /* sfmfd f0, 4, [sp!] */
> {
> @@ -884,7 +884,7 @@ arm_scan_prologue (struct frame_info *fi
> for (; fp_start_reg < fp_bound_reg; fp_start_reg++)
> {
> sp_offset -= 12;
> - fi->fsr.regs[fp_start_reg++] = sp_offset;
> + fi->saved_regs[fp_start_reg++] = sp_offset;
> }
> }
> else if ((insn & 0xf0000000) != 0xe0000000)
> @@ -900,11 +900,11 @@ arm_scan_prologue (struct frame_info *fi
> /* The frame size is just the negative of the offset (from the original SP)
> of the last thing thing we pushed on the stack. The frame offset is
> [new FP] - [new SP]. */
> - fi->framesize = -sp_offset;
> - if (fi->framereg == FP_REGNUM)
> - fi->frameoffset = fp_offset - sp_offset;
> + fi->extra_info->framesize = -sp_offset;
> + if (fi->extra_info->framereg == FP_REGNUM)
> + fi->extra_info->frameoffset = fp_offset - sp_offset;
> else
> - fi->frameoffset = 0;
> + fi->extra_info->frameoffset = 0;
>
> save_prologue_cache (fi);
> }
> @@ -926,8 +926,8 @@ arm_find_callers_reg (struct frame_info
> return generic_read_register_dummy (fi->pc, fi->frame, regnum);
> else
> #endif
> - if (fi->fsr.regs[regnum] != 0)
> - return read_memory_integer (fi->fsr.regs[regnum],
> + if (fi->saved_regs[regnum] != 0)
> + return read_memory_integer (fi->saved_regs[regnum],
> REGISTER_RAW_SIZE (regnum));
> return read_register (regnum);
> }
> @@ -970,8 +970,7 @@ arm_frame_chain (struct frame_info *fi)
> return 0; /* in _start fn, don't chain further */
> #endif
> CORE_ADDR caller_pc, fn_start;
> - struct frame_info caller_fi;
> - int framereg = fi->framereg;
> + int framereg = fi->extra_info->framereg;
>
> if (fi->pc < LOWEST_PC)
> return 0;
> @@ -988,10 +987,25 @@ arm_frame_chain (struct frame_info *fi)
> frame register number. */
> if (arm_pc_is_thumb (caller_pc) != arm_pc_is_thumb (fi->pc))
> {
> + struct frame_info caller_fi;
> + struct cleanup *old_chain;
> +
> + /* Create a temporary frame suitable for scanning the caller's
> + prologue. (Ugh.) */
> memset (&caller_fi, 0, sizeof (caller_fi));
> + caller_fi.saved_regs = (CORE_ADDR *) xcalloc (1, SIZEOF_FRAME_SAVED_REGS);
> + old_chain = make_cleanup (xfree, caller_fi.saved_regs);
> + caller_fi.extra_info = xcalloc (1, sizeof (struct frame_extra_info));
> + make_cleanup (xfree, caller_fi.extra_info);
> +
> + /* Now, scan the prologue and obtain the frame register. */
> caller_fi.pc = caller_pc;
> arm_scan_prologue (&caller_fi);
> - framereg = caller_fi.framereg;
> + framereg = caller_fi.extra_info->framereg;
> +
> + /* Deallocate the storage associated with the temporary frame
> + created above. */
> + do_cleanups (old_chain);
> }
>
> /* If the caller used a frame register, return its value.
> @@ -999,7 +1013,7 @@ arm_frame_chain (struct frame_info *fi)
> if (framereg == FP_REGNUM || framereg == THUMB_FP_REGNUM)
> return arm_find_callers_reg (fi, framereg);
> else
> - return fi->frame + fi->framesize;
> + return fi->frame + fi->extra_info->framesize;
> }
>
> /* This function actually figures out the frame address for a given pc
> @@ -1017,19 +1031,22 @@ arm_init_extra_frame_info (int fromleaf,
> int reg;
> CORE_ADDR sp;
>
> + fi->extra_info = (struct frame_extra_info *)
> + frame_obstack_alloc (sizeof (struct frame_extra_info));
> +
> + frame_saved_regs_zalloc (fi);
> +
> if (fi->next)
> fi->pc = FRAME_SAVED_PC (fi->next);
>
> - memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs);
> -
> #if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
> if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
> {
> /* We need to setup fi->frame here because run_stack_dummy gets it wrong
> by assuming it's always FP. */
> fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM);
> - fi->framesize = 0;
> - fi->frameoffset = 0;
> + fi->extra_info->framesize = 0;
> + fi->extra_info->frameoffset = 0;
> return;
> }
> else
> @@ -1040,7 +1057,7 @@ arm_init_extra_frame_info (int fromleaf,
> if (!fi->next)
> sp = read_sp();
> else
> - sp = fi->next->frame - fi->next->frameoffset + fi->next->framesize;
> + sp = fi->next->frame - fi->next->extra_info->frameoffset + fi->next->extra_info->framesize;
>
> /* Determine whether or not we're in a sigtramp frame.
> Unfortunately, it isn't sufficient to test
> @@ -1058,14 +1075,14 @@ arm_init_extra_frame_info (int fromleaf,
> && (fi->signal_handler_caller || IN_SIGTRAMP (fi->pc, 0)))
> {
> for (reg = 0; reg < NUM_REGS; reg++)
> - fi->fsr.regs[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, fi->pc, reg);
> + fi->saved_regs[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, fi->pc, reg);
>
> /* FIXME: What about thumb mode? */
> - fi->framereg = SP_REGNUM;
> - fi->frame = read_memory_integer (fi->fsr.regs[fi->framereg],
> - REGISTER_RAW_SIZE (fi->framereg));
> - fi->framesize = 0;
> - fi->frameoffset = 0;
> + fi->extra_info->framereg = SP_REGNUM;
> + fi->frame = read_memory_integer (fi->saved_regs[fi->extra_info->framereg],
> + REGISTER_RAW_SIZE (fi->extra_info->framereg));
> + fi->extra_info->framesize = 0;
> + fi->extra_info->frameoffset = 0;
>
> }
> else if (PC_IN_CALL_DUMMY (fi->pc, sp, fi->frame))
> @@ -1077,19 +1094,19 @@ arm_init_extra_frame_info (int fromleaf,
> rp = fi->frame - REGISTER_SIZE;
>
> /* Fill in addresses of saved registers. */
> - fi->fsr.regs[PS_REGNUM] = rp;
> + fi->saved_regs[PS_REGNUM] = rp;
> rp -= REGISTER_RAW_SIZE (PS_REGNUM);
> for (reg = PC_REGNUM; reg >= 0; reg--)
> {
> - fi->fsr.regs[reg] = rp;
> + fi->saved_regs[reg] = rp;
> rp -= REGISTER_RAW_SIZE (reg);
> }
>
> - callers_sp = read_memory_integer (fi->fsr.regs[SP_REGNUM],
> + callers_sp = read_memory_integer (fi->saved_regs[SP_REGNUM],
> REGISTER_RAW_SIZE (SP_REGNUM));
> - fi->framereg = FP_REGNUM;
> - fi->framesize = callers_sp - sp;
> - fi->frameoffset = fi->frame - sp;
> + fi->extra_info->framereg = FP_REGNUM;
> + fi->extra_info->framesize = callers_sp - sp;
> + fi->extra_info->frameoffset = fi->frame - sp;
> }
> else
> {
> @@ -1097,14 +1114,14 @@ arm_init_extra_frame_info (int fromleaf,
>
> if (!fi->next)
> /* this is the innermost frame? */
> - fi->frame = read_register (fi->framereg);
> - else if (fi->framereg == FP_REGNUM || fi->framereg == THUMB_FP_REGNUM)
> + fi->frame = read_register (fi->extra_info->framereg);
> + else if (fi->extra_info->framereg == FP_REGNUM || fi->extra_info->framereg == THUMB_FP_REGNUM)
> {
> /* not the innermost frame */
> /* If we have an FP, the callee saved it. */
> - if (fi->next->fsr.regs[fi->framereg] != 0)
> + if (fi->next->saved_regs[fi->extra_info->framereg] != 0)
> fi->frame =
> - read_memory_integer (fi->next->fsr.regs[fi->framereg], 4);
> + read_memory_integer (fi->next->saved_regs[fi->extra_info->framereg], 4);
> else if (fromleaf)
> /* If we were called by a frameless fn. then our frame is
> still in the frame pointer register on the board... */
> @@ -1114,11 +1131,19 @@ arm_init_extra_frame_info (int fromleaf,
> /* Calculate actual addresses of saved registers using offsets
> determined by arm_scan_prologue. */
> for (reg = 0; reg < NUM_REGS; reg++)
> - if (fi->fsr.regs[reg] != 0)
> - fi->fsr.regs[reg] += fi->frame + fi->framesize - fi->frameoffset;
> + if (fi->saved_regs[reg] != 0)
> + fi->saved_regs[reg] += fi->frame + fi->extra_info->framesize - fi->extra_info->frameoffset;
> }
> }
>
> +/* Initialize the saved register addresses. There's nothing to do
> + here since these addresses were already computed by
> + arm_init_extra_frame_info(). */
> +void
> +arm_frame_init_saved_regs (struct frame_info *fi)
> +{
> + gdb_assert (fi->extra_info != NULL && fi->saved_regs != NULL);
> +}
>
> /* Find the caller of this frame. We do this by seeing if LR_REGNUM
> is saved in the stack anywhere, otherwise we get it from the
> @@ -1136,9 +1161,9 @@ arm_frame_saved_pc (struct frame_info *f
> return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
> else
> #endif
> - if (PC_IN_CALL_DUMMY (fi->pc, fi->frame - fi->frameoffset, fi->frame))
> + if (PC_IN_CALL_DUMMY (fi->pc, fi->frame - fi->extra_info->frameoffset, fi->frame))
> {
> - return read_memory_integer (fi->fsr.regs[PC_REGNUM], REGISTER_RAW_SIZE (PC_REGNUM));
> + return read_memory_integer (fi->saved_regs[PC_REGNUM], REGISTER_RAW_SIZE (PC_REGNUM));
> }
> else
> {
> @@ -1159,15 +1184,6 @@ arm_target_read_fp (void)
> return read_register (FP_REGNUM); /* R11 if ARM */
> }
>
> -/* Calculate the frame offsets of the saved registers (ARM version). */
> -
> -void
> -arm_frame_find_saved_regs (struct frame_info *fi,
> - struct frame_saved_regs *regaddr)
> -{
> - memcpy (regaddr, &fi->fsr, sizeof (struct frame_saved_regs));
> -}
> -
> void
> arm_push_dummy_frame (void)
> {
> @@ -1419,12 +1435,12 @@ arm_pop_frame (void)
> {
> int regnum;
> struct frame_info *frame = get_current_frame ();
> - CORE_ADDR old_SP = frame->frame - frame->frameoffset + frame->framesize;
> + CORE_ADDR old_SP = frame->frame - frame->extra_info->frameoffset + frame->extra_info->framesize;
>
> for (regnum = 0; regnum < NUM_REGS; regnum++)
> - if (frame->fsr.regs[regnum] != 0)
> + if (frame->saved_regs[regnum] != 0)
> write_register (regnum,
> - read_memory_integer (frame->fsr.regs[regnum],
> + read_memory_integer (frame->saved_regs[regnum],
> REGISTER_RAW_SIZE (regnum)));
>
> write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
> @@ -2209,6 +2225,10 @@ The valid values are:\n");
>
> add_com ("othernames", class_obscure, arm_othernames,
> "Switch to the next set of register names.");
> +
> + /* Allocate extra_info and saved_regs fields in the prologue cache. */
> + prologue_cache.extra_info = xcalloc (1, sizeof (struct frame_extra_info));
> + prologue_cache.saved_regs = xcalloc (1, SIZEOF_FRAME_SAVED_REGS);
> }
>
> /* Test whether the coff symbol specific value corresponds to a Thumb
> diff -upr ../../../sourceware-arm1+2/src/gdb/config/arm/tm-arm.h ./config/arm/tm-arm.h
> --- ../../../sourceware-arm1+2/src/gdb/config/arm/tm-arm.h Fri Nov 16 10:03:27 2001
> +++ ./config/arm/tm-arm.h Sat Dec 15 00:30:34 2001
> @@ -318,22 +318,13 @@ extern void convert_to_extended (void *d
> #define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p))
> \f
>
> -/* Define other aspects of the stack frame. We keep the offsets of
> - all saved registers, 'cause we need 'em a lot! We also keep the
> - current size of the stack frame, and the offset of the frame
> - pointer from the stack pointer (for frameless functions, and when
> - we're still in the prologue of a function with a frame) */
> -
> -#define EXTRA_FRAME_INFO \
> - struct frame_saved_regs fsr; \
> - int framesize; \
> - int frameoffset; \
> - int framereg;
> -
> extern void arm_init_extra_frame_info (int fromleaf, struct frame_info * fi);
> #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
> arm_init_extra_frame_info ((fromleaf), (fi))
>
> +extern void arm_frame_init_saved_regs (struct frame_info *fi);
> +#define FRAME_INIT_SAVED_REGS(fi) arm_frame_init_saved_regs (fi)
> +
> /* Return the frame address. On ARM, it is R11; on Thumb it is R7. */
> CORE_ADDR arm_target_read_fp (void);
> #define TARGET_READ_FP() arm_target_read_fp ()
> @@ -393,20 +384,6 @@ extern CORE_ADDR arm_frame_saved_pc (str
> /* Return number of bytes at start of arglist that are not really args. */
>
> #define FRAME_ARGS_SKIP 0
> -
> -/* Put here the code to store, into a struct frame_saved_regs, the
> - addresses of the saved registers of frame described by FRAME_INFO.
> - This includes special registers such as pc and fp saved in special
> - ways in the stack frame. sp is even more special: the address we
> - return for it IS the sp for the next frame. */
> -
> -struct frame_saved_regs;
> -struct frame_info;
> -void arm_frame_find_saved_regs (struct frame_info * fi,
> - struct frame_saved_regs * fsr);
> -
> -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
> - arm_frame_find_saved_regs (frame_info, &(frame_saved_regs));
>
> /* Things needed for making the inferior call functions. */
>
>
>
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RFA] Zap EXTRA_FRAME_INFO for ARM target
2002-01-20 15:16 ` Andrew Cagney
@ 2002-01-21 7:57 ` Fernando Nasser
2002-01-21 8:30 ` Richard Earnshaw
2002-01-21 12:46 ` Kevin Buettner
2 siblings, 0 replies; 8+ messages in thread
From: Fernando Nasser @ 2002-01-21 7:57 UTC (permalink / raw)
To: Andrew Cagney
Cc: Kevin Buettner, Richard Earnshaw, Scott Bambrough, gdb-patches
Andrew Cagney wrote:
>
> > The patch below represents a small step on the way to multiarching the
> > ARM target. It eliminates the use of the deprecated EXTRA_FRAME_INFO
> > macro for describing a frame. Instead, it now uses the ``extra_info''
> > and ``saved_regs'' members in the frame_info struct.
>
> Kevin, Richard, Fernando, Scott,
>
> Jason Thorpe (I assume unintentionally) set a precident by treating as
> obvious the patch transforming EXTRA_FRAME_INFO as part of multi-arching
> the alpha.
>
> Thinking about it Jason was correct in taking this aproach (I suspect
> I've done this with other targets). A patch making the single
> independant change of eliminating EXTRA_FRAME_INFO is mechanical, and as
> such, can be treated as obvious. Clearly it is assumed that the person
> committing the change is performing before/after testing to ensure no
> regressions occure. A person looking to commit such a change is also,
> obviously, strongly advised, to not try and make the change somehow
> dependant on other changes, doing that will just bog down the process.
>
> If GDB doesn't take this approach it is very quickly going to find that
> the multi-arch task gets bogged down waiting on approval of trivial changes.
>
> With that in mind I think either Kevin's or Richard's EXTRA_FRAME_INFO
> patch (minus any dependencies) should be committed. The only proviso
> being that they are before/after tested and show no regressions.
>
> enjoy,
> Andrew
>
I agree (with the same considerations as the ones you've stated).
We've always done that: once one of these cleanup forms are established,
they are applied as obvious everywhere they are needed (with the proper
safety considerations).
Fernando
> > * tm-arm.h (EXTRA_FRAME_INFO): Delete definition.
> > (arm_frame_init_saved_regs): Declare.
> > (FRAME_INIT_SAVED_REGS): Define.
> > (arm_frame_find_saved_regs): Delete declaration.
> > (FRAME_FIND_SAVED_REGS): Delete definition.
> > * arm-tdep.c (gdb_assert.h): Include.
> > (struct frame_extra_info): Delete fsr member.
> > (thumb_scan_prologue, check_prologue_cache, save_prologue_cache)
> > (arm_scan_prologue, arm_find_callers_reg, arm_frame_chain)
> > (arm_init_extra_frame_info, arm_push_dummy_frame): Use
> > ``saved_regs'' in place of ``fsr.regs''. Use
> > ``extra_info->framesize'' in place of just ``framesize''.
> > Likewise for ``frameoffset'' and ``framereg''.
> > (arm_frame_init_saved_regs): New function.
> > (arm_frame_find_saved_regs): Delete.
> > (_initialize_arm_tdep): Allocate ``extra_info'' and ``saved_regs''
> > structs for the prologue cache.
> > (arm_frame_chain): Likewise for the hand created caller's
> > frame_info struct.
> > (arm_init_extra_frame_info): Likewise for the frame_info struct
> > undergoing initialization.
> >
> > diff -upr ../../../sourceware-arm1+2/src/gdb/arm-tdep.c ./arm-tdep.c
> > --- ../../../sourceware-arm1+2/src/gdb/arm-tdep.c Sat Dec 15 00:13:02 2001
> > +++ ./arm-tdep.c Sat Dec 15 00:30:34 2001
> > @@ -33,6 +33,7 @@
> > #include "doublest.h"
> > #include "value.h"
> > #include "solib-svr4.h"
> > +#include "gdb_assert.h"
> >
> > /* Each OS has a different mechanism for accessing the various
> > registers stored in the sigcontext structure.
> > @@ -108,7 +109,6 @@ static void convert_from_extended (void
> >
> > struct frame_extra_info
> > {
> > - struct frame_saved_regs fsr;
> > int framesize;
> > int frameoffset;
> > int framereg;
> > @@ -534,7 +534,7 @@ thumb_scan_prologue (struct frame_info *
> > frame pointer, adjust the stack pointer, and save registers.
> > Do this until all basic prolog instructions are found. */
> >
> > - fi->framesize = 0;
> > + fi->extra_info->framesize = 0;
> > for (current_pc = prologue_start;
> > (current_pc < prologue_end) && ((findmask & 7) != 7);
> > current_pc += 2)
> > @@ -557,8 +557,8 @@ thumb_scan_prologue (struct frame_info *
> > for (regno = LR_REGNUM; regno >= 0; regno--)
> > if (mask & (1 << regno))
> > {
> > - fi->framesize += 4;
> > - fi->fsr.regs[saved_reg[regno]] = -(fi->framesize);
> > + fi->extra_info->framesize += 4;
> > + fi->saved_regs[saved_reg[regno]] = -(fi->extra_info->framesize);
> > saved_reg[regno] = regno; /* reset saved register map */
> > }
> > }
> > @@ -572,22 +572,22 @@ thumb_scan_prologue (struct frame_info *
> > offset = (insn & 0x7f) << 2; /* get scaled offset */
> > if (insn & 0x80) /* is it signed? (==subtracting) */
> > {
> > - fi->frameoffset += offset;
> > + fi->extra_info->frameoffset += offset;
> > offset = -offset;
> > }
> > - fi->framesize -= offset;
> > + fi->extra_info->framesize -= offset;
> > }
> > else if ((insn & 0xff00) == 0xaf00) /* add r7, sp, #imm */
> > {
> > findmask |= 2; /* setting of r7 found */
> > - fi->framereg = THUMB_FP_REGNUM;
> > - fi->frameoffset = (insn & 0xff) << 2; /* get scaled offset */
> > + fi->extra_info->framereg = THUMB_FP_REGNUM;
> > + fi->extra_info->frameoffset = (insn & 0xff) << 2; /* get scaled offset */
> > }
> > else if (insn == 0x466f) /* mov r7, sp */
> > {
> > findmask |= 2; /* setting of r7 found */
> > - fi->framereg = THUMB_FP_REGNUM;
> > - fi->frameoffset = 0;
> > + fi->extra_info->framereg = THUMB_FP_REGNUM;
> > + fi->extra_info->frameoffset = 0;
> > saved_reg[THUMB_FP_REGNUM] = SP_REGNUM;
> > }
> > else if ((insn & 0xffc0) == 0x4640) /* mov r0-r7, r8-r15 */
> > @@ -627,11 +627,11 @@ check_prologue_cache (struct frame_info
> >
> > if (fi->pc == prologue_cache.pc)
> > {
> > - fi->framereg = prologue_cache.framereg;
> > - fi->framesize = prologue_cache.framesize;
> > - fi->frameoffset = prologue_cache.frameoffset;
> > + fi->extra_info->framereg = prologue_cache.extra_info->framereg;
> > + fi->extra_info->framesize = prologue_cache.extra_info->framesize;
> > + fi->extra_info->frameoffset = prologue_cache.extra_info->frameoffset;
> > for (i = 0; i < NUM_REGS; i++)
> > - fi->fsr.regs[i] = prologue_cache.fsr.regs[i];
> > + fi->saved_regs[i] = prologue_cache.saved_regs[i];
> > return 1;
> > }
> > else
> > @@ -647,12 +647,12 @@ save_prologue_cache (struct frame_info *
> > int i;
> >
> > prologue_cache.pc = fi->pc;
> > - prologue_cache.framereg = fi->framereg;
> > - prologue_cache.framesize = fi->framesize;
> > - prologue_cache.frameoffset = fi->frameoffset;
> > + prologue_cache.extra_info->framereg = fi->extra_info->framereg;
> > + prologue_cache.extra_info->framesize = fi->extra_info->framesize;
> > + prologue_cache.extra_info->frameoffset = fi->extra_info->frameoffset;
> >
> > for (i = 0; i < NUM_REGS; i++)
> > - prologue_cache.fsr.regs[i] = fi->fsr.regs[i];
> > + prologue_cache.saved_regs[i] = fi->saved_regs[i];
> > }
> >
> >
> > @@ -734,9 +734,9 @@ arm_scan_prologue (struct frame_info *fi
> > return;
> >
> > /* Assume there is no frame until proven otherwise. */
> > - fi->framereg = SP_REGNUM;
> > - fi->framesize = 0;
> > - fi->frameoffset = 0;
> > + fi->extra_info->framereg = SP_REGNUM;
> > + fi->extra_info->framesize = 0;
> > + fi->extra_info->frameoffset = 0;
> >
> > /* Check for Thumb prologue. */
> > if (arm_pc_is_thumb (fi->pc))
> > @@ -835,7 +835,7 @@ arm_scan_prologue (struct frame_info *fi
> > if (mask & (1 << regno))
> > {
> > sp_offset -= 4;
> > - fi->fsr.regs[regno] = sp_offset;
> > + fi->saved_regs[regno] = sp_offset;
> > }
> > }
> > else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */
> > @@ -844,7 +844,7 @@ arm_scan_prologue (struct frame_info *fi
> > unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
> > imm = (imm >> rot) | (imm << (32 - rot));
> > fp_offset = -imm;
> > - fi->framereg = FP_REGNUM;
> > + fi->extra_info->framereg = FP_REGNUM;
> > }
> > else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */
> > {
> > @@ -857,7 +857,7 @@ arm_scan_prologue (struct frame_info *fi
> > {
> > sp_offset -= 12;
> > regno = F0_REGNUM + ((insn >> 12) & 0x07);
> > - fi->fsr.regs[regno] = sp_offset;
> > + fi->saved_regs[regno] = sp_offset;
> > }
> > else if ((insn & 0xffbf0fff) == 0xec2d0200) /* sfmfd f0, 4, [sp!] */
> > {
> > @@ -884,7 +884,7 @@ arm_scan_prologue (struct frame_info *fi
> > for (; fp_start_reg < fp_bound_reg; fp_start_reg++)
> > {
> > sp_offset -= 12;
> > - fi->fsr.regs[fp_start_reg++] = sp_offset;
> > + fi->saved_regs[fp_start_reg++] = sp_offset;
> > }
> > }
> > else if ((insn & 0xf0000000) != 0xe0000000)
> > @@ -900,11 +900,11 @@ arm_scan_prologue (struct frame_info *fi
> > /* The frame size is just the negative of the offset (from the original SP)
> > of the last thing thing we pushed on the stack. The frame offset is
> > [new FP] - [new SP]. */
> > - fi->framesize = -sp_offset;
> > - if (fi->framereg == FP_REGNUM)
> > - fi->frameoffset = fp_offset - sp_offset;
> > + fi->extra_info->framesize = -sp_offset;
> > + if (fi->extra_info->framereg == FP_REGNUM)
> > + fi->extra_info->frameoffset = fp_offset - sp_offset;
> > else
> > - fi->frameoffset = 0;
> > + fi->extra_info->frameoffset = 0;
> >
> > save_prologue_cache (fi);
> > }
> > @@ -926,8 +926,8 @@ arm_find_callers_reg (struct frame_info
> > return generic_read_register_dummy (fi->pc, fi->frame, regnum);
> > else
> > #endif
> > - if (fi->fsr.regs[regnum] != 0)
> > - return read_memory_integer (fi->fsr.regs[regnum],
> > + if (fi->saved_regs[regnum] != 0)
> > + return read_memory_integer (fi->saved_regs[regnum],
> > REGISTER_RAW_SIZE (regnum));
> > return read_register (regnum);
> > }
> > @@ -970,8 +970,7 @@ arm_frame_chain (struct frame_info *fi)
> > return 0; /* in _start fn, don't chain further */
> > #endif
> > CORE_ADDR caller_pc, fn_start;
> > - struct frame_info caller_fi;
> > - int framereg = fi->framereg;
> > + int framereg = fi->extra_info->framereg;
> >
> > if (fi->pc < LOWEST_PC)
> > return 0;
> > @@ -988,10 +987,25 @@ arm_frame_chain (struct frame_info *fi)
> > frame register number. */
> > if (arm_pc_is_thumb (caller_pc) != arm_pc_is_thumb (fi->pc))
> > {
> > + struct frame_info caller_fi;
> > + struct cleanup *old_chain;
> > +
> > + /* Create a temporary frame suitable for scanning the caller's
> > + prologue. (Ugh.) */
> > memset (&caller_fi, 0, sizeof (caller_fi));
> > + caller_fi.saved_regs = (CORE_ADDR *) xcalloc (1, SIZEOF_FRAME_SAVED_REGS);
> > + old_chain = make_cleanup (xfree, caller_fi.saved_regs);
> > + caller_fi.extra_info = xcalloc (1, sizeof (struct frame_extra_info));
> > + make_cleanup (xfree, caller_fi.extra_info);
> > +
> > + /* Now, scan the prologue and obtain the frame register. */
> > caller_fi.pc = caller_pc;
> > arm_scan_prologue (&caller_fi);
> > - framereg = caller_fi.framereg;
> > + framereg = caller_fi.extra_info->framereg;
> > +
> > + /* Deallocate the storage associated with the temporary frame
> > + created above. */
> > + do_cleanups (old_chain);
> > }
> >
> > /* If the caller used a frame register, return its value.
> > @@ -999,7 +1013,7 @@ arm_frame_chain (struct frame_info *fi)
> > if (framereg == FP_REGNUM || framereg == THUMB_FP_REGNUM)
> > return arm_find_callers_reg (fi, framereg);
> > else
> > - return fi->frame + fi->framesize;
> > + return fi->frame + fi->extra_info->framesize;
> > }
> >
> > /* This function actually figures out the frame address for a given pc
> > @@ -1017,19 +1031,22 @@ arm_init_extra_frame_info (int fromleaf,
> > int reg;
> > CORE_ADDR sp;
> >
> > + fi->extra_info = (struct frame_extra_info *)
> > + frame_obstack_alloc (sizeof (struct frame_extra_info));
> > +
> > + frame_saved_regs_zalloc (fi);
> > +
> > if (fi->next)
> > fi->pc = FRAME_SAVED_PC (fi->next);
> >
> > - memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs);
> > -
> > #if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
> > if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
> > {
> > /* We need to setup fi->frame here because run_stack_dummy gets it wrong
> > by assuming it's always FP. */
> > fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM);
> > - fi->framesize = 0;
> > - fi->frameoffset = 0;
> > + fi->extra_info->framesize = 0;
> > + fi->extra_info->frameoffset = 0;
> > return;
> > }
> > else
> > @@ -1040,7 +1057,7 @@ arm_init_extra_frame_info (int fromleaf,
> > if (!fi->next)
> > sp = read_sp();
> > else
> > - sp = fi->next->frame - fi->next->frameoffset + fi->next->framesize;
> > + sp = fi->next->frame - fi->next->extra_info->frameoffset + fi->next->extra_info->framesize;
> >
> > /* Determine whether or not we're in a sigtramp frame.
> > Unfortunately, it isn't sufficient to test
> > @@ -1058,14 +1075,14 @@ arm_init_extra_frame_info (int fromleaf,
> > && (fi->signal_handler_caller || IN_SIGTRAMP (fi->pc, 0)))
> > {
> > for (reg = 0; reg < NUM_REGS; reg++)
> > - fi->fsr.regs[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, fi->pc, reg);
> > + fi->saved_regs[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, fi->pc, reg);
> >
> > /* FIXME: What about thumb mode? */
> > - fi->framereg = SP_REGNUM;
> > - fi->frame = read_memory_integer (fi->fsr.regs[fi->framereg],
> > - REGISTER_RAW_SIZE (fi->framereg));
> > - fi->framesize = 0;
> > - fi->frameoffset = 0;
> > + fi->extra_info->framereg = SP_REGNUM;
> > + fi->frame = read_memory_integer (fi->saved_regs[fi->extra_info->framereg],
> > + REGISTER_RAW_SIZE (fi->extra_info->framereg));
> > + fi->extra_info->framesize = 0;
> > + fi->extra_info->frameoffset = 0;
> >
> > }
> > else if (PC_IN_CALL_DUMMY (fi->pc, sp, fi->frame))
> > @@ -1077,19 +1094,19 @@ arm_init_extra_frame_info (int fromleaf,
> > rp = fi->frame - REGISTER_SIZE;
> >
> > /* Fill in addresses of saved registers. */
> > - fi->fsr.regs[PS_REGNUM] = rp;
> > + fi->saved_regs[PS_REGNUM] = rp;
> > rp -= REGISTER_RAW_SIZE (PS_REGNUM);
> > for (reg = PC_REGNUM; reg >= 0; reg--)
> > {
> > - fi->fsr.regs[reg] = rp;
> > + fi->saved_regs[reg] = rp;
> > rp -= REGISTER_RAW_SIZE (reg);
> > }
> >
> > - callers_sp = read_memory_integer (fi->fsr.regs[SP_REGNUM],
> > + callers_sp = read_memory_integer (fi->saved_regs[SP_REGNUM],
> > REGISTER_RAW_SIZE (SP_REGNUM));
> > - fi->framereg = FP_REGNUM;
> > - fi->framesize = callers_sp - sp;
> > - fi->frameoffset = fi->frame - sp;
> > + fi->extra_info->framereg = FP_REGNUM;
> > + fi->extra_info->framesize = callers_sp - sp;
> > + fi->extra_info->frameoffset = fi->frame - sp;
> > }
> > else
> > {
> > @@ -1097,14 +1114,14 @@ arm_init_extra_frame_info (int fromleaf,
> >
> > if (!fi->next)
> > /* this is the innermost frame? */
> > - fi->frame = read_register (fi->framereg);
> > - else if (fi->framereg == FP_REGNUM || fi->framereg == THUMB_FP_REGNUM)
> > + fi->frame = read_register (fi->extra_info->framereg);
> > + else if (fi->extra_info->framereg == FP_REGNUM || fi->extra_info->framereg == THUMB_FP_REGNUM)
> > {
> > /* not the innermost frame */
> > /* If we have an FP, the callee saved it. */
> > - if (fi->next->fsr.regs[fi->framereg] != 0)
> > + if (fi->next->saved_regs[fi->extra_info->framereg] != 0)
> > fi->frame =
> > - read_memory_integer (fi->next->fsr.regs[fi->framereg], 4);
> > + read_memory_integer (fi->next->saved_regs[fi->extra_info->framereg], 4);
> > else if (fromleaf)
> > /* If we were called by a frameless fn. then our frame is
> > still in the frame pointer register on the board... */
> > @@ -1114,11 +1131,19 @@ arm_init_extra_frame_info (int fromleaf,
> > /* Calculate actual addresses of saved registers using offsets
> > determined by arm_scan_prologue. */
> > for (reg = 0; reg < NUM_REGS; reg++)
> > - if (fi->fsr.regs[reg] != 0)
> > - fi->fsr.regs[reg] += fi->frame + fi->framesize - fi->frameoffset;
> > + if (fi->saved_regs[reg] != 0)
> > + fi->saved_regs[reg] += fi->frame + fi->extra_info->framesize - fi->extra_info->frameoffset;
> > }
> > }
> >
> > +/* Initialize the saved register addresses. There's nothing to do
> > + here since these addresses were already computed by
> > + arm_init_extra_frame_info(). */
> > +void
> > +arm_frame_init_saved_regs (struct frame_info *fi)
> > +{
> > + gdb_assert (fi->extra_info != NULL && fi->saved_regs != NULL);
> > +}
> >
> > /* Find the caller of this frame. We do this by seeing if LR_REGNUM
> > is saved in the stack anywhere, otherwise we get it from the
> > @@ -1136,9 +1161,9 @@ arm_frame_saved_pc (struct frame_info *f
> > return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
> > else
> > #endif
> > - if (PC_IN_CALL_DUMMY (fi->pc, fi->frame - fi->frameoffset, fi->frame))
> > + if (PC_IN_CALL_DUMMY (fi->pc, fi->frame - fi->extra_info->frameoffset, fi->frame))
> > {
> > - return read_memory_integer (fi->fsr.regs[PC_REGNUM], REGISTER_RAW_SIZE (PC_REGNUM));
> > + return read_memory_integer (fi->saved_regs[PC_REGNUM], REGISTER_RAW_SIZE (PC_REGNUM));
> > }
> > else
> > {
> > @@ -1159,15 +1184,6 @@ arm_target_read_fp (void)
> > return read_register (FP_REGNUM); /* R11 if ARM */
> > }
> >
> > -/* Calculate the frame offsets of the saved registers (ARM version). */
> > -
> > -void
> > -arm_frame_find_saved_regs (struct frame_info *fi,
> > - struct frame_saved_regs *regaddr)
> > -{
> > - memcpy (regaddr, &fi->fsr, sizeof (struct frame_saved_regs));
> > -}
> > -
> > void
> > arm_push_dummy_frame (void)
> > {
> > @@ -1419,12 +1435,12 @@ arm_pop_frame (void)
> > {
> > int regnum;
> > struct frame_info *frame = get_current_frame ();
> > - CORE_ADDR old_SP = frame->frame - frame->frameoffset + frame->framesize;
> > + CORE_ADDR old_SP = frame->frame - frame->extra_info->frameoffset + frame->extra_info->framesize;
> >
> > for (regnum = 0; regnum < NUM_REGS; regnum++)
> > - if (frame->fsr.regs[regnum] != 0)
> > + if (frame->saved_regs[regnum] != 0)
> > write_register (regnum,
> > - read_memory_integer (frame->fsr.regs[regnum],
> > + read_memory_integer (frame->saved_regs[regnum],
> > REGISTER_RAW_SIZE (regnum)));
> >
> > write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
> > @@ -2209,6 +2225,10 @@ The valid values are:\n");
> >
> > add_com ("othernames", class_obscure, arm_othernames,
> > "Switch to the next set of register names.");
> > +
> > + /* Allocate extra_info and saved_regs fields in the prologue cache. */
> > + prologue_cache.extra_info = xcalloc (1, sizeof (struct frame_extra_info));
> > + prologue_cache.saved_regs = xcalloc (1, SIZEOF_FRAME_SAVED_REGS);
> > }
> >
> > /* Test whether the coff symbol specific value corresponds to a Thumb
> > diff -upr ../../../sourceware-arm1+2/src/gdb/config/arm/tm-arm.h ./config/arm/tm-arm.h
> > --- ../../../sourceware-arm1+2/src/gdb/config/arm/tm-arm.h Fri Nov 16 10:03:27 2001
> > +++ ./config/arm/tm-arm.h Sat Dec 15 00:30:34 2001
> > @@ -318,22 +318,13 @@ extern void convert_to_extended (void *d
> > #define VARIABLES_INSIDE_BLOCK(desc, gcc_p) (!(gcc_p))
> >
> >
> > -/* Define other aspects of the stack frame. We keep the offsets of
> > - all saved registers, 'cause we need 'em a lot! We also keep the
> > - current size of the stack frame, and the offset of the frame
> > - pointer from the stack pointer (for frameless functions, and when
> > - we're still in the prologue of a function with a frame) */
> > -
> > -#define EXTRA_FRAME_INFO \
> > - struct frame_saved_regs fsr; \
> > - int framesize; \
> > - int frameoffset; \
> > - int framereg;
> > -
> > extern void arm_init_extra_frame_info (int fromleaf, struct frame_info * fi);
> > #define INIT_EXTRA_FRAME_INFO(fromleaf, fi) \
> > arm_init_extra_frame_info ((fromleaf), (fi))
> >
> > +extern void arm_frame_init_saved_regs (struct frame_info *fi);
> > +#define FRAME_INIT_SAVED_REGS(fi) arm_frame_init_saved_regs (fi)
> > +
> > /* Return the frame address. On ARM, it is R11; on Thumb it is R7. */
> > CORE_ADDR arm_target_read_fp (void);
> > #define TARGET_READ_FP() arm_target_read_fp ()
> > @@ -393,20 +384,6 @@ extern CORE_ADDR arm_frame_saved_pc (str
> > /* Return number of bytes at start of arglist that are not really args. */
> >
> > #define FRAME_ARGS_SKIP 0
> > -
> > -/* Put here the code to store, into a struct frame_saved_regs, the
> > - addresses of the saved registers of frame described by FRAME_INFO.
> > - This includes special registers such as pc and fp saved in special
> > - ways in the stack frame. sp is even more special: the address we
> > - return for it IS the sp for the next frame. */
> > -
> > -struct frame_saved_regs;
> > -struct frame_info;
> > -void arm_frame_find_saved_regs (struct frame_info * fi,
> > - struct frame_saved_regs * fsr);
> > -
> > -#define FRAME_FIND_SAVED_REGS(frame_info, frame_saved_regs) \
> > - arm_frame_find_saved_regs (frame_info, &(frame_saved_regs));
> >
> > /* Things needed for making the inferior call functions. */
> >
> >
> >
> >
--
Fernando Nasser
Red Hat Canada Ltd. E-Mail: fnasser@redhat.com
2323 Yonge Street, Suite #300
Toronto, Ontario M4P 2C9
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RFA] Zap EXTRA_FRAME_INFO for ARM target
2002-01-20 15:16 ` Andrew Cagney
2002-01-21 7:57 ` Fernando Nasser
@ 2002-01-21 8:30 ` Richard Earnshaw
2002-01-21 12:46 ` Kevin Buettner
2 siblings, 0 replies; 8+ messages in thread
From: Richard Earnshaw @ 2002-01-21 8:30 UTC (permalink / raw)
To: Andrew Cagney
Cc: Kevin Buettner, Richard Earnshaw, Fernando Nasser,
Scott Bambrough, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 1283 bytes --]
> With that in mind I think either Kevin's or Richard's EXTRA_FRAME_INFO
> patch (minus any dependencies) should be committed. The only proviso
> being that they are before/after tested and show no regressions.
Ok, with that in mind I've committed the following. It's basically my
patch plus a couple of bits lifted from Kevin's.
R.
2002-01-21 Richard Earnshaw <rearnsha@arm.com>
Kevin Buettner <kevinb@redhat.com>
Convert arm targets to new FRAME interface.
* arm-tdep.c (struct frame_extra_info): Remove fsr.
(arm_frame_find_save_regs): Delete.
(arm_frame_init_saved_regs): New.
(arm_init_extra_frame_info): Alloacte saved_regs as required.
Allocate extra_info as required. Convert all uses of fsr.regs
to use saved_regs, similarly all uses of EXTRA_FRAME_INFO fields
to use extra_info.
(thumb_scan_prologue, arm_scan_prologue, arm_find_callers_reg)
(arm_frame_chain, arm_frame_saved_pc, arm_pop_frame): Likewise.
(check_prologue_cache, save_prologue_cache): Likewise.
(_initialize_arm_tdep): Ensure prologue_cache is correctly set up.
* config/arm/tm-arm.h (EXTRA_FRAME_INFO): Delete.
(FRAME_FIND_SAVED_REGS): Delete.
(arm_frame_find_saved_regs): Delete prototype.
(arm_frame_init_saved_regs): New prototype.
(FRAME_INIT_SAVED_REGS): Define.
[-- Attachment #2: gdb-frame.patch --]
[-- Type: text/x-patch , Size: 22703 bytes --]
Index: arm-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/arm-tdep.c,v
retrieving revision 1.26
diff -p -r1.26 arm-tdep.c
*** arm-tdep.c 2002/01/09 18:07:48 1.26
--- arm-tdep.c 2002/01/21 15:50:21
***************
*** 1,6 ****
/* Common target dependent code for GDB on ARM systems.
Copyright 1988, 1989, 1991, 1992, 1993, 1995, 1996, 1998, 1999, 2000,
! 2001 Free Software Foundation, Inc.
This file is part of GDB.
--- 1,6 ----
/* Common target dependent code for GDB on ARM systems.
Copyright 1988, 1989, 1991, 1992, 1993, 1995, 1996, 1998, 1999, 2000,
! 2001, 2002 Free Software Foundation, Inc.
This file is part of GDB.
*************** static void convert_from_extended (void
*** 107,118 ****
we're still in the prologue of a function with a frame) */
struct frame_extra_info
! {
! struct frame_saved_regs fsr;
! int framesize;
! int frameoffset;
! int framereg;
! };
/* Addresses for calling Thumb functions have the bit 0 set.
Here are some macros to test, set, or clear bit 0 of addresses. */
--- 107,117 ----
we're still in the prologue of a function with a frame) */
struct frame_extra_info
! {
! int framesize;
! int frameoffset;
! int framereg;
! };
/* Addresses for calling Thumb functions have the bit 0 set.
Here are some macros to test, set, or clear bit 0 of addresses. */
*************** thumb_scan_prologue (struct frame_info *
*** 534,540 ****
frame pointer, adjust the stack pointer, and save registers.
Do this until all basic prolog instructions are found. */
! fi->framesize = 0;
for (current_pc = prologue_start;
(current_pc < prologue_end) && ((findmask & 7) != 7);
current_pc += 2)
--- 533,539 ----
frame pointer, adjust the stack pointer, and save registers.
Do this until all basic prolog instructions are found. */
! fi->extra_info->framesize = 0;
for (current_pc = prologue_start;
(current_pc < prologue_end) && ((findmask & 7) != 7);
current_pc += 2)
*************** thumb_scan_prologue (struct frame_info *
*** 557,564 ****
for (regno = LR_REGNUM; regno >= 0; regno--)
if (mask & (1 << regno))
{
! fi->framesize += 4;
! fi->fsr.regs[saved_reg[regno]] = -(fi->framesize);
saved_reg[regno] = regno; /* reset saved register map */
}
}
--- 556,564 ----
for (regno = LR_REGNUM; regno >= 0; regno--)
if (mask & (1 << regno))
{
! fi->extra_info->framesize += 4;
! fi->saved_regs[saved_reg[regno]] =
! -(fi->extra_info->framesize);
saved_reg[regno] = regno; /* reset saved register map */
}
}
*************** thumb_scan_prologue (struct frame_info *
*** 572,593 ****
offset = (insn & 0x7f) << 2; /* get scaled offset */
if (insn & 0x80) /* is it signed? (==subtracting) */
{
! fi->frameoffset += offset;
offset = -offset;
}
! fi->framesize -= offset;
}
else if ((insn & 0xff00) == 0xaf00) /* add r7, sp, #imm */
{
findmask |= 2; /* setting of r7 found */
! fi->framereg = THUMB_FP_REGNUM;
! fi->frameoffset = (insn & 0xff) << 2; /* get scaled offset */
}
else if (insn == 0x466f) /* mov r7, sp */
{
findmask |= 2; /* setting of r7 found */
! fi->framereg = THUMB_FP_REGNUM;
! fi->frameoffset = 0;
saved_reg[THUMB_FP_REGNUM] = SP_REGNUM;
}
else if ((insn & 0xffc0) == 0x4640) /* mov r0-r7, r8-r15 */
--- 572,594 ----
offset = (insn & 0x7f) << 2; /* get scaled offset */
if (insn & 0x80) /* is it signed? (==subtracting) */
{
! fi->extra_info->frameoffset += offset;
offset = -offset;
}
! fi->extra_info->framesize -= offset;
}
else if ((insn & 0xff00) == 0xaf00) /* add r7, sp, #imm */
{
findmask |= 2; /* setting of r7 found */
! fi->extra_info->framereg = THUMB_FP_REGNUM;
! /* get scaled offset */
! fi->extra_info->frameoffset = (insn & 0xff) << 2;
}
else if (insn == 0x466f) /* mov r7, sp */
{
findmask |= 2; /* setting of r7 found */
! fi->extra_info->framereg = THUMB_FP_REGNUM;
! fi->extra_info->frameoffset = 0;
saved_reg[THUMB_FP_REGNUM] = SP_REGNUM;
}
else if ((insn & 0xffc0) == 0x4640) /* mov r0-r7, r8-r15 */
*************** check_prologue_cache (struct frame_info
*** 627,637 ****
if (fi->pc == prologue_cache.pc)
{
! fi->framereg = prologue_cache.framereg;
! fi->framesize = prologue_cache.framesize;
! fi->frameoffset = prologue_cache.frameoffset;
! for (i = 0; i < NUM_REGS; i++)
! fi->fsr.regs[i] = prologue_cache.fsr.regs[i];
return 1;
}
else
--- 628,638 ----
if (fi->pc == prologue_cache.pc)
{
! fi->extra_info->framereg = prologue_cache.extra_info->framereg;
! fi->extra_info->framesize = prologue_cache.extra_info->framesize;
! fi->extra_info->frameoffset = prologue_cache.extra_info->frameoffset;
! for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
! fi->saved_regs[i] = prologue_cache.saved_regs[i];
return 1;
}
else
*************** save_prologue_cache (struct frame_info *
*** 647,658 ****
int i;
prologue_cache.pc = fi->pc;
! prologue_cache.framereg = fi->framereg;
! prologue_cache.framesize = fi->framesize;
! prologue_cache.frameoffset = fi->frameoffset;
! for (i = 0; i < NUM_REGS; i++)
! prologue_cache.fsr.regs[i] = fi->fsr.regs[i];
}
--- 648,659 ----
int i;
prologue_cache.pc = fi->pc;
! prologue_cache.extra_info->framereg = fi->extra_info->framereg;
! prologue_cache.extra_info->framesize = fi->extra_info->framesize;
! prologue_cache.extra_info->frameoffset = fi->extra_info->frameoffset;
! for (i = 0; i < NUM_REGS + NUM_PSEUDO_REGS; i++)
! prologue_cache.saved_regs[i] = fi->saved_regs[i];
}
*************** arm_scan_prologue (struct frame_info *fi
*** 735,743 ****
return;
/* Assume there is no frame until proven otherwise. */
! fi->framereg = SP_REGNUM;
! fi->framesize = 0;
! fi->frameoffset = 0;
/* Check for Thumb prologue. */
if (arm_pc_is_thumb (fi->pc))
--- 736,744 ----
return;
/* Assume there is no frame until proven otherwise. */
! fi->extra_info->framereg = SP_REGNUM;
! fi->extra_info->framesize = 0;
! fi->extra_info->frameoffset = 0;
/* Check for Thumb prologue. */
if (arm_pc_is_thumb (fi->pc))
*************** arm_scan_prologue (struct frame_info *fi
*** 840,846 ****
if (mask & (1 << regno))
{
sp_offset -= 4;
! fi->fsr.regs[regno] = sp_offset;
}
}
else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */
--- 841,847 ----
if (mask & (1 << regno))
{
sp_offset -= 4;
! fi->saved_regs[regno] = sp_offset;
}
}
else if ((insn & 0xfffff000) == 0xe24cb000) /* sub fp, ip #n */
*************** arm_scan_prologue (struct frame_info *fi
*** 849,855 ****
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
fp_offset = -imm;
! fi->framereg = FP_REGNUM;
}
else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */
{
--- 850,856 ----
unsigned rot = (insn & 0xf00) >> 7; /* rotate amount */
imm = (imm >> rot) | (imm << (32 - rot));
fp_offset = -imm;
! fi->extra_info->framereg = FP_REGNUM;
}
else if ((insn & 0xfffff000) == 0xe24dd000) /* sub sp, sp #n */
{
*************** arm_scan_prologue (struct frame_info *fi
*** 862,868 ****
{
sp_offset -= 12;
regno = F0_REGNUM + ((insn >> 12) & 0x07);
! fi->fsr.regs[regno] = sp_offset;
}
else if ((insn & 0xffbf0fff) == 0xec2d0200) /* sfmfd f0, 4, [sp!] */
{
--- 863,869 ----
{
sp_offset -= 12;
regno = F0_REGNUM + ((insn >> 12) & 0x07);
! fi->saved_regs[regno] = sp_offset;
}
else if ((insn & 0xffbf0fff) == 0xec2d0200) /* sfmfd f0, 4, [sp!] */
{
*************** arm_scan_prologue (struct frame_info *fi
*** 889,895 ****
for (; fp_start_reg < fp_bound_reg; fp_start_reg++)
{
sp_offset -= 12;
! fi->fsr.regs[fp_start_reg++] = sp_offset;
}
}
else if ((insn & 0xf0000000) != 0xe0000000)
--- 890,896 ----
for (; fp_start_reg < fp_bound_reg; fp_start_reg++)
{
sp_offset -= 12;
! fi->saved_regs[fp_start_reg++] = sp_offset;
}
}
else if ((insn & 0xf0000000) != 0xe0000000)
*************** arm_scan_prologue (struct frame_info *fi
*** 905,915 ****
/* The frame size is just the negative of the offset (from the original SP)
of the last thing thing we pushed on the stack. The frame offset is
[new FP] - [new SP]. */
! fi->framesize = -sp_offset;
! if (fi->framereg == FP_REGNUM)
! fi->frameoffset = fp_offset - sp_offset;
else
! fi->frameoffset = 0;
save_prologue_cache (fi);
}
--- 906,916 ----
/* The frame size is just the negative of the offset (from the original SP)
of the last thing thing we pushed on the stack. The frame offset is
[new FP] - [new SP]. */
! fi->extra_info->framesize = -sp_offset;
! if (fi->extra_info->framereg == FP_REGNUM)
! fi->extra_info->frameoffset = fp_offset - sp_offset;
else
! fi->extra_info->frameoffset = 0;
save_prologue_cache (fi);
}
*************** arm_find_callers_reg (struct frame_info
*** 931,938 ****
return generic_read_register_dummy (fi->pc, fi->frame, regnum);
else
#endif
! if (fi->fsr.regs[regnum] != 0)
! return read_memory_integer (fi->fsr.regs[regnum],
REGISTER_RAW_SIZE (regnum));
return read_register (regnum);
}
--- 932,939 ----
return generic_read_register_dummy (fi->pc, fi->frame, regnum);
else
#endif
! if (fi->saved_regs[regnum] != 0)
! return read_memory_integer (fi->saved_regs[regnum],
REGISTER_RAW_SIZE (regnum));
return read_register (regnum);
}
*************** arm_frame_chain (struct frame_info *fi)
*** 975,982 ****
return 0; /* in _start fn, don't chain further */
#endif
CORE_ADDR caller_pc, fn_start;
! struct frame_info caller_fi;
! int framereg = fi->framereg;
if (fi->pc < LOWEST_PC)
return 0;
--- 976,982 ----
return 0; /* in _start fn, don't chain further */
#endif
CORE_ADDR caller_pc, fn_start;
! int framereg = fi->extra_info->framereg;
if (fi->pc < LOWEST_PC)
return 0;
*************** arm_frame_chain (struct frame_info *fi)
*** 991,1002 ****
the frame register of the caller is different from ours.
So we must scan the prologue of the caller to determine its
frame register number. */
if (arm_pc_is_thumb (caller_pc) != arm_pc_is_thumb (fi->pc))
{
memset (&caller_fi, 0, sizeof (caller_fi));
caller_fi.pc = caller_pc;
arm_scan_prologue (&caller_fi);
! framereg = caller_fi.framereg;
}
/* If the caller used a frame register, return its value.
--- 991,1021 ----
the frame register of the caller is different from ours.
So we must scan the prologue of the caller to determine its
frame register number. */
+ /* XXX Fixme, we should try to do this without creating a temporary
+ caller_fi. */
if (arm_pc_is_thumb (caller_pc) != arm_pc_is_thumb (fi->pc))
{
+ struct frame_info caller_fi;
+ struct cleanup *old_chain;
+
+ /* Create a temporary frame suitable for scanning the caller's
+ prologue. (Ugh.) */
memset (&caller_fi, 0, sizeof (caller_fi));
+ caller_fi.extra_info = (struct frame_extra_info *)
+ xcalloc (1, sizeof (struct frame_extra_info));
+ old_chain = make_cleanup (xfree, caller_fi.extra_info);
+ caller_fi.saved_regs = (CORE_ADDR *)
+ xcalloc (1, SIZEOF_FRAME_SAVED_REGS);
+ make_cleanup (xfree, caller_fi.saved_regs);
+
+ /* Now, scan the prologue and obtain the frame register. */
caller_fi.pc = caller_pc;
arm_scan_prologue (&caller_fi);
! framereg = caller_fi.extra_info->framereg;
!
! /* Deallocate the storage associated with the temporary frame
! created above. */
! do_cleanups (old_chain);
}
/* If the caller used a frame register, return its value.
*************** arm_frame_chain (struct frame_info *fi)
*** 1004,1010 ****
if (framereg == FP_REGNUM || framereg == THUMB_FP_REGNUM)
return arm_find_callers_reg (fi, framereg);
else
! return fi->frame + fi->framesize;
}
/* This function actually figures out the frame address for a given pc
--- 1023,1029 ----
if (framereg == FP_REGNUM || framereg == THUMB_FP_REGNUM)
return arm_find_callers_reg (fi, framereg);
else
! return fi->frame + fi->extra_info->framesize;
}
/* This function actually figures out the frame address for a given pc
*************** arm_init_extra_frame_info (int fromleaf,
*** 1022,1031 ****
int reg;
CORE_ADDR sp;
if (fi->next)
fi->pc = FRAME_SAVED_PC (fi->next);
! memset (fi->fsr.regs, '\000', sizeof fi->fsr.regs);
#if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
--- 1041,1060 ----
int reg;
CORE_ADDR sp;
+ if (fi->saved_regs == NULL)
+ frame_saved_regs_zalloc (fi);
+
+ fi->extra_info = (struct frame_extra_info *)
+ frame_obstack_alloc (sizeof (struct frame_extra_info));
+
+ fi->extra_info->framesize = 0;
+ fi->extra_info->frameoffset = 0;
+ fi->extra_info->framereg = 0;
+
if (fi->next)
fi->pc = FRAME_SAVED_PC (fi->next);
! memset (fi->saved_regs, '\000', sizeof fi->saved_regs);
#if 0 /* FIXME: enable this code if we convert to new call dummy scheme. */
if (PC_IN_CALL_DUMMY (fi->pc, fi->frame, fi->frame))
*************** arm_init_extra_frame_info (int fromleaf,
*** 1033,1040 ****
/* We need to setup fi->frame here because run_stack_dummy gets it wrong
by assuming it's always FP. */
fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM);
! fi->framesize = 0;
! fi->frameoffset = 0;
return;
}
else
--- 1062,1069 ----
/* We need to setup fi->frame here because run_stack_dummy gets it wrong
by assuming it's always FP. */
fi->frame = generic_read_register_dummy (fi->pc, fi->frame, SP_REGNUM);
! fi->extra_info->framesize = 0;
! fi->extra_info->frameoffset = 0;
return;
}
else
*************** arm_init_extra_frame_info (int fromleaf,
*** 1045,1051 ****
if (!fi->next)
sp = read_sp();
else
! sp = fi->next->frame - fi->next->frameoffset + fi->next->framesize;
/* Determine whether or not we're in a sigtramp frame.
Unfortunately, it isn't sufficient to test
--- 1074,1081 ----
if (!fi->next)
sp = read_sp();
else
! sp = (fi->next->frame - fi->next->extra_info->frameoffset
! + fi->next->extra_info->framesize);
/* Determine whether or not we're in a sigtramp frame.
Unfortunately, it isn't sufficient to test
*************** arm_init_extra_frame_info (int fromleaf,
*** 1063,1076 ****
&& (fi->signal_handler_caller || IN_SIGTRAMP (fi->pc, (char *)0)))
{
for (reg = 0; reg < NUM_REGS; reg++)
! fi->fsr.regs[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, fi->pc, reg);
/* FIXME: What about thumb mode? */
! fi->framereg = SP_REGNUM;
! fi->frame = read_memory_integer (fi->fsr.regs[fi->framereg],
! REGISTER_RAW_SIZE (fi->framereg));
! fi->framesize = 0;
! fi->frameoffset = 0;
}
else if (PC_IN_CALL_DUMMY (fi->pc, sp, fi->frame))
--- 1093,1107 ----
&& (fi->signal_handler_caller || IN_SIGTRAMP (fi->pc, (char *)0)))
{
for (reg = 0; reg < NUM_REGS; reg++)
! fi->saved_regs[reg] = SIGCONTEXT_REGISTER_ADDRESS (sp, fi->pc, reg);
/* FIXME: What about thumb mode? */
! fi->extra_info->framereg = SP_REGNUM;
! fi->frame =
! read_memory_integer (fi->saved_regs[fi->extra_info->framereg],
! REGISTER_RAW_SIZE (fi->extra_info->framereg));
! fi->extra_info->framesize = 0;
! fi->extra_info->frameoffset = 0;
}
else if (PC_IN_CALL_DUMMY (fi->pc, sp, fi->frame))
*************** arm_init_extra_frame_info (int fromleaf,
*** 1082,1100 ****
rp = fi->frame - REGISTER_SIZE;
/* Fill in addresses of saved registers. */
! fi->fsr.regs[PS_REGNUM] = rp;
rp -= REGISTER_RAW_SIZE (PS_REGNUM);
for (reg = PC_REGNUM; reg >= 0; reg--)
{
! fi->fsr.regs[reg] = rp;
rp -= REGISTER_RAW_SIZE (reg);
}
! callers_sp = read_memory_integer (fi->fsr.regs[SP_REGNUM],
REGISTER_RAW_SIZE (SP_REGNUM));
! fi->framereg = FP_REGNUM;
! fi->framesize = callers_sp - sp;
! fi->frameoffset = fi->frame - sp;
}
else
{
--- 1113,1131 ----
rp = fi->frame - REGISTER_SIZE;
/* Fill in addresses of saved registers. */
! fi->saved_regs[PS_REGNUM] = rp;
rp -= REGISTER_RAW_SIZE (PS_REGNUM);
for (reg = PC_REGNUM; reg >= 0; reg--)
{
! fi->saved_regs[reg] = rp;
rp -= REGISTER_RAW_SIZE (reg);
}
! callers_sp = read_memory_integer (fi->saved_regs[SP_REGNUM],
REGISTER_RAW_SIZE (SP_REGNUM));
! fi->extra_info->framereg = FP_REGNUM;
! fi->extra_info->framesize = callers_sp - sp;
! fi->extra_info->frameoffset = fi->frame - sp;
}
else
{
*************** arm_init_extra_frame_info (int fromleaf,
*** 1102,1115 ****
if (!fi->next)
/* this is the innermost frame? */
! fi->frame = read_register (fi->framereg);
! else if (fi->framereg == FP_REGNUM || fi->framereg == THUMB_FP_REGNUM)
{
/* not the innermost frame */
/* If we have an FP, the callee saved it. */
! if (fi->next->fsr.regs[fi->framereg] != 0)
fi->frame =
! read_memory_integer (fi->next->fsr.regs[fi->framereg], 4);
else if (fromleaf)
/* If we were called by a frameless fn. then our frame is
still in the frame pointer register on the board... */
--- 1133,1148 ----
if (!fi->next)
/* this is the innermost frame? */
! fi->frame = read_register (fi->extra_info->framereg);
! else if (fi->extra_info->framereg == FP_REGNUM
! || fi->extra_info->framereg == THUMB_FP_REGNUM)
{
/* not the innermost frame */
/* If we have an FP, the callee saved it. */
! if (fi->next->saved_regs[fi->extra_info->framereg] != 0)
fi->frame =
! read_memory_integer (fi->next
! ->saved_regs[fi->extra_info->framereg], 4);
else if (fromleaf)
/* If we were called by a frameless fn. then our frame is
still in the frame pointer register on the board... */
*************** arm_init_extra_frame_info (int fromleaf,
*** 1119,1126 ****
/* Calculate actual addresses of saved registers using offsets
determined by arm_scan_prologue. */
for (reg = 0; reg < NUM_REGS; reg++)
! if (fi->fsr.regs[reg] != 0)
! fi->fsr.regs[reg] += fi->frame + fi->framesize - fi->frameoffset;
}
}
--- 1152,1160 ----
/* Calculate actual addresses of saved registers using offsets
determined by arm_scan_prologue. */
for (reg = 0; reg < NUM_REGS; reg++)
! if (fi->saved_regs[reg] != 0)
! fi->saved_regs[reg] += (fi->frame + fi->extra_info->framesize
! - fi->extra_info->frameoffset);
}
}
*************** arm_frame_saved_pc (struct frame_info *f
*** 1141,1149 ****
return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
else
#endif
! if (PC_IN_CALL_DUMMY (fi->pc, fi->frame - fi->frameoffset, fi->frame))
{
! return read_memory_integer (fi->fsr.regs[PC_REGNUM], REGISTER_RAW_SIZE (PC_REGNUM));
}
else
{
--- 1175,1185 ----
return generic_read_register_dummy (fi->pc, fi->frame, PC_REGNUM);
else
#endif
! if (PC_IN_CALL_DUMMY (fi->pc, fi->frame - fi->extra_info->frameoffset,
! fi->frame))
{
! return read_memory_integer (fi->saved_regs[PC_REGNUM],
! REGISTER_RAW_SIZE (PC_REGNUM));
}
else
{
*************** arm_target_read_fp (void)
*** 1167,1176 ****
/* Calculate the frame offsets of the saved registers (ARM version). */
void
! arm_frame_find_saved_regs (struct frame_info *fi,
! struct frame_saved_regs *regaddr)
{
! memcpy (regaddr, &fi->fsr, sizeof (struct frame_saved_regs));
}
void
--- 1203,1215 ----
/* Calculate the frame offsets of the saved registers (ARM version). */
void
! arm_frame_init_saved_regs (struct frame_info *fip)
{
!
! if (fip->saved_regs)
! return;
!
! arm_init_extra_frame_info (0, fip);
}
void
*************** arm_pop_frame (void)
*** 1424,1435 ****
{
int regnum;
struct frame_info *frame = get_current_frame ();
! CORE_ADDR old_SP = frame->frame - frame->frameoffset + frame->framesize;
for (regnum = 0; regnum < NUM_REGS; regnum++)
! if (frame->fsr.regs[regnum] != 0)
write_register (regnum,
! read_memory_integer (frame->fsr.regs[regnum],
REGISTER_RAW_SIZE (regnum)));
write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
--- 1463,1475 ----
{
int regnum;
struct frame_info *frame = get_current_frame ();
! CORE_ADDR old_SP = (frame->frame - frame->extra_info->frameoffset
! + frame->extra_info->framesize);
for (regnum = 0; regnum < NUM_REGS; regnum++)
! if (frame->saved_regs[regnum] != 0)
write_register (regnum,
! read_memory_integer (frame->saved_regs[regnum],
REGISTER_RAW_SIZE (regnum)));
write_register (PC_REGNUM, FRAME_SAVED_PC (frame));
*************** The valid values are:\n");
*** 2240,2245 ****
--- 2280,2291 ----
add_com ("othernames", class_obscure, arm_othernames,
"Switch to the next set of register names.");
+
+ /* Fill in the prologue_cache fields. */
+ prologue_cache.extra_info = (struct frame_extra_info *)
+ xcalloc (1, sizeof (struct frame_extra_info));
+ prologue_cache.saved_regs = (CORE_ADDR *)
+ xcalloc (1, SIZEOF_FRAME_SAVED_REGS);
}
/* Test whether the coff symbol specific value corresponds to a Thumb
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RFA] Zap EXTRA_FRAME_INFO for ARM target
2002-01-20 15:16 ` Andrew Cagney
2002-01-21 7:57 ` Fernando Nasser
2002-01-21 8:30 ` Richard Earnshaw
@ 2002-01-21 12:46 ` Kevin Buettner
2002-01-21 12:57 ` Jason R Thorpe
2002-01-21 13:49 ` Andrew Cagney
2 siblings, 2 replies; 8+ messages in thread
From: Kevin Buettner @ 2002-01-21 12:46 UTC (permalink / raw)
To: Andrew Cagney, Kevin Buettner, Richard Earnshaw, Fernando Nasser,
Scott Bambrough
Cc: gdb-patches
On Jan 20, 6:15pm, Andrew Cagney wrote:
> > The patch below represents a small step on the way to multiarching the
> > ARM target. It eliminates the use of the deprecated EXTRA_FRAME_INFO
> > macro for describing a frame. Instead, it now uses the ``extra_info''
> > and ``saved_regs'' members in the frame_info struct.
>
> Jason Thorpe (I assume unintentionally) set a precident by treating as
> obvious the patch transforming EXTRA_FRAME_INFO as part of multi-arching
> the alpha.
>
> Thinking about it Jason was correct in taking this aproach (I suspect
> I've done this with other targets). A patch making the single
> independant change of eliminating EXTRA_FRAME_INFO is mechanical, and as
> such, can be treated as obvious.
I think it depends upon the target. For ARM, nearly all of the
changes were mechanical, but the ARM target has some pecularities
which required some care. I think it would have been better for a
responsive maintainer to have looked over these changes and approved
them.
I do agree, however, that Jason was correct in his approach for the
alpha since the alpha target doesn't have any listed maintainers.
> Clearly it is assumed that the person
> committing the change is performing before/after testing to ensure no
> regressions occure. A person looking to commit such a change is also,
> obviously, strongly advised, to not try and make the change somehow
> dependant on other changes, doing that will just bog down the process.
Ah. Perhaps you're referring to the fact that my patch had some
dependencies on other patches (which are now approved). I had
considered removing these dependencies before submitting my patch,
but that would've meant more work for me when it wasn't at all clear
that there would be any benefit.
> If GDB doesn't take this approach it is very quickly going to find that
> the multi-arch task gets bogged down waiting on approval of trivial changes.
I don't entirely agree with this. If the target in question has no
maintainers, then I am in complete agreement. If the target in
question has active maintainers, then I think the maintainers should
have a chance to comment on the proposed changes before they go in.
If Fernando and Scott no longer have the time or motivation to be
active maintainers, then they should step aside so that development
of the ARM target can proceed more rapidly.
Kevin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RFA] Zap EXTRA_FRAME_INFO for ARM target
2002-01-21 12:46 ` Kevin Buettner
@ 2002-01-21 12:57 ` Jason R Thorpe
2002-01-21 13:29 ` Kevin Buettner
2002-01-21 13:49 ` Andrew Cagney
1 sibling, 1 reply; 8+ messages in thread
From: Jason R Thorpe @ 2002-01-21 12:57 UTC (permalink / raw)
To: Kevin Buettner
Cc: Andrew Cagney, Richard Earnshaw, Fernando Nasser,
Scott Bambrough, gdb-patches
On Mon, Jan 21, 2002 at 01:45:28PM -0700, Kevin Buettner wrote:
> > Thinking about it Jason was correct in taking this aproach (I suspect
> > I've done this with other targets). A patch making the single
> > independant change of eliminating EXTRA_FRAME_INFO is mechanical, and as
> > such, can be treated as obvious.
>
...
> I do agree, however, that Jason was correct in his approach for the
> alpha since the alpha target doesn't have any listed maintainers.
Just to be clear... I treated it as obvious since in several e-mails Andrew
has said that the process of multi-arch'ing a target is considered obvious,
and the removal of EXTRA_FRAME_INFO is specifically mentioned in the
description of how to multi-arch a target.
--
-- Jason R. Thorpe <thorpej@wasabisystems.com>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RFA] Zap EXTRA_FRAME_INFO for ARM target
2002-01-21 12:57 ` Jason R Thorpe
@ 2002-01-21 13:29 ` Kevin Buettner
0 siblings, 0 replies; 8+ messages in thread
From: Kevin Buettner @ 2002-01-21 13:29 UTC (permalink / raw)
To: thorpej, Kevin Buettner
Cc: Andrew Cagney, Richard Earnshaw, Fernando Nasser,
Scott Bambrough, gdb-patches
On Jan 21, 12:57pm, Jason R Thorpe wrote:
> On Mon, Jan 21, 2002 at 01:45:28PM -0700, Kevin Buettner wrote:
>
> > > Thinking about it Jason was correct in taking this aproach (I suspect
> > > I've done this with other targets). A patch making the single
> > > independant change of eliminating EXTRA_FRAME_INFO is mechanical, and as
> > > such, can be treated as obvious.
> >
>
> ...
>
> > I do agree, however, that Jason was correct in his approach for the
> > alpha since the alpha target doesn't have any listed maintainers.
>
> Just to be clear... I treated it as obvious since in several e-mails Andrew
> has said that the process of multi-arch'ing a target is considered obvious,
> and the removal of EXTRA_FRAME_INFO is specifically mentioned in the
> description of how to multi-arch a target.
I see. (In what I'm about to say, I don't want you, Jason, to construe
anything I say as a criticism of your work.)
I think we need to be careful about what we declare to be "obvious".
The MAINTAINERS file says:
An "obvious fix" means that there is no possibility that anyone will
disagree with the change.
I agree with this definition. I also agree that mechanical changes --
so long as the nature of the change is agreed upon in advance -- ought
to be considered as obvious. The problem is that, on the ARM anyway,
the removal of EXTRA_FRAME_INFO was not entirely mechanical. And it
was precisely these non-mechanical changes that raised a red flag with
both Richard and Andrew. E.g, see
http://sources.redhat.com/ml/gdb-patches/2002-01/msg00340.html
http://sources.redhat.com/ml/gdb-patches/2002-01/msg00348.html
Now it turns out (I think) that my changes were okay. But, the fact
that two people chose to comment on certain aspects of my patch
suggests to me that it should be considered non-obvious.
Kevin
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH RFA] Zap EXTRA_FRAME_INFO for ARM target
2002-01-21 12:46 ` Kevin Buettner
2002-01-21 12:57 ` Jason R Thorpe
@ 2002-01-21 13:49 ` Andrew Cagney
1 sibling, 0 replies; 8+ messages in thread
From: Andrew Cagney @ 2002-01-21 13:49 UTC (permalink / raw)
To: Kevin Buettner
Cc: Richard Earnshaw, Fernando Nasser, Scott Bambrough, gdb-patches
> Thinking about it Jason was correct in taking this aproach (I suspect
>> I've done this with other targets). A patch making the single
>> independant change of eliminating EXTRA_FRAME_INFO is mechanical, and as
>> such, can be treated as obvious.
>
>
> I think it depends upon the target. For ARM, nearly all of the
> changes were mechanical, but the ARM target has some pecularities
> which required some care.
If someone is multi-arching a target and accidently breaks it (even
though before/after tests showed no problems) then I consider that
acceptable risk. (It is a testsuite bug right :-)
If a change is more technical then tableing it for a few days wouldn't
hurt. However, in the end I think us as maintainers need to show
confidence in the person doing the work and give them a free hand.
enjoy,
Andrew
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2002-01-21 21:49 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-12-15 0:27 [PATCH RFA] Zap EXTRA_FRAME_INFO for ARM target Kevin Buettner
2002-01-20 15:16 ` Andrew Cagney
2002-01-21 7:57 ` Fernando Nasser
2002-01-21 8:30 ` Richard Earnshaw
2002-01-21 12:46 ` Kevin Buettner
2002-01-21 12:57 ` Jason R Thorpe
2002-01-21 13:29 ` Kevin Buettner
2002-01-21 13:49 ` Andrew Cagney
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox