* [PATCH] fix inferior_pid argument for arm-netbsd
@ 2002-01-09 5:39 Richard Earnshaw
[not found] ` <rearnsha@arm.com>
0 siblings, 1 reply; 14+ messages in thread
From: Richard Earnshaw @ 2002-01-09 5:39 UTC (permalink / raw)
To: gdb-patches; +Cc: Richard.Earnshaw
[-- Attachment #1: Type: text/plain, Size: 478 bytes --]
This is a mechanical change that is required to get the current sources to
build at all for arm-netbsd native. I guess the code I developed the
NetBSD sources for must have predated this global change.
With this and previous patch at least cvs gdb will now build on arm-netbsd.
[ The testsuite results are somewhat horrible :-( ]
R.
<date> Richard Earnshaw (rearnsha@arm.com)
* armnbsd-nat.c (fetch_inferior_registers): Change inferior_pid ->
inferior_ptid.pid.
[-- Attachment #2: pid.patch --]
[-- Type: text/x-patch , Size: 2199 bytes --]
Index: armnbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/armnbsd-nat.c,v
retrieving revision 1.1
diff -p -r1.1 armnbsd-nat.c
*** armnbsd-nat.c 2001/12/17 21:14:10 1.1
--- armnbsd-nat.c 2002/01/09 13:24:50
*************** fetch_inferior_registers (regno)
*** 34,46 ****
struct reg inferior_registers;
struct fpreg inferior_fpregisters;
! ptrace (PT_GETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0);
memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers,
16 * sizeof (unsigned int));
memcpy (®isters[REGISTER_BYTE (PS_REGNUM)], &inferior_registers.r_cpsr,
sizeof (unsigned int));
! ptrace (PT_GETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_fpregisters,
! 0);
memcpy (®isters[REGISTER_BYTE (F0_REGNUM)], &inferior_fpregisters.fpr[0],
8 * sizeof (fp_reg_t));
memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)],
--- 34,47 ----
struct reg inferior_registers;
struct fpreg inferior_fpregisters;
! ptrace (PT_GETREGS, inferior_ptid.pid,
! (PTRACE_ARG3_TYPE) &inferior_registers, 0);
memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers,
16 * sizeof (unsigned int));
memcpy (®isters[REGISTER_BYTE (PS_REGNUM)], &inferior_registers.r_cpsr,
sizeof (unsigned int));
! ptrace (PT_GETFPREGS, inferior_ptid.pid,
! (PTRACE_ARG3_TYPE) &inferior_fpregisters, 0);
memcpy (®isters[REGISTER_BYTE (F0_REGNUM)], &inferior_fpregisters.fpr[0],
8 * sizeof (fp_reg_t));
memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)],
*************** store_inferior_registers (regno)
*** 58,64 ****
16 * sizeof (unsigned int));
memcpy (&inferior_registers.r_cpsr, ®isters[REGISTER_BYTE (PS_REGNUM)],
sizeof (unsigned int));
! ptrace (PT_SETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0);
/* XXX Set FP regs. */
}
--- 59,66 ----
16 * sizeof (unsigned int));
memcpy (&inferior_registers.r_cpsr, ®isters[REGISTER_BYTE (PS_REGNUM)],
sizeof (unsigned int));
! ptrace (PT_SETREGS, inferior_ptid.pid,
! (PTRACE_ARG3_TYPE) &inferior_registers, 0);
/* XXX Set FP regs. */
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] fix inferior_pid argument for arm-netbsd
[not found] ` <rearnsha@arm.com>
@ 2002-01-09 7:40 ` Kevin Buettner
2002-01-09 7:54 ` Richard Earnshaw
2002-01-10 10:38 ` Kevin Buettner
` (2 subsequent siblings)
3 siblings, 1 reply; 14+ messages in thread
From: Kevin Buettner @ 2002-01-09 7:40 UTC (permalink / raw)
To: Richard.Earnshaw, gdb-patches
On Jan 9, 1:38pm, Richard Earnshaw wrote:
> * armnbsd-nat.c (fetch_inferior_registers): Change inferior_pid ->
> inferior_ptid.pid.
Please don't do it this way. Use the accessor functions instead. I've
looked over your patch, and in each case, you can simply use
ptid_get_pid (inferior_ptid)
instead.
Kevin
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] fix inferior_pid argument for arm-netbsd
2002-01-09 7:40 ` Kevin Buettner
@ 2002-01-09 7:54 ` Richard Earnshaw
2002-01-10 9:59 ` Richard Earnshaw
0 siblings, 1 reply; 14+ messages in thread
From: Richard Earnshaw @ 2002-01-09 7:54 UTC (permalink / raw)
To: Kevin Buettner; +Cc: Richard.Earnshaw, gdb-patches
[-- Attachment #1: Type: text/plain, Size: 480 bytes --]
> On Jan 9, 1:38pm, Richard Earnshaw wrote:
>
> > * armnbsd-nat.c (fetch_inferior_registers): Change inferior_pid ->
> > inferior_ptid.pid.
>
> Please don't do it this way. Use the accessor functions instead. I've
> looked over your patch, and in each case, you can simply use
>
> ptid_get_pid (inferior_ptid)
>
Ah! I wasn't aware of the accessor functions. In fact, most targets are
using the macro GETPID (from defs.h). I've fixed the code to use that.
R.
[-- Attachment #2: pid.patch --]
[-- Type: text/x-patch , Size: 2214 bytes --]
Index: armnbsd-nat.c
===================================================================
RCS file: /cvs/src/src/gdb/armnbsd-nat.c,v
retrieving revision 1.1
diff -p -r1.1 armnbsd-nat.c
*** armnbsd-nat.c 2001/12/17 21:14:10 1.1
--- armnbsd-nat.c 2002/01/09 15:51:15
*************** fetch_inferior_registers (regno)
*** 34,46 ****
struct reg inferior_registers;
struct fpreg inferior_fpregisters;
! ptrace (PT_GETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0);
memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers,
16 * sizeof (unsigned int));
memcpy (®isters[REGISTER_BYTE (PS_REGNUM)], &inferior_registers.r_cpsr,
sizeof (unsigned int));
! ptrace (PT_GETFPREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_fpregisters,
! 0);
memcpy (®isters[REGISTER_BYTE (F0_REGNUM)], &inferior_fpregisters.fpr[0],
8 * sizeof (fp_reg_t));
memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)],
--- 34,47 ----
struct reg inferior_registers;
struct fpreg inferior_fpregisters;
! ptrace (PT_GETREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) &inferior_registers, 0);
memcpy (®isters[REGISTER_BYTE (0)], &inferior_registers,
16 * sizeof (unsigned int));
memcpy (®isters[REGISTER_BYTE (PS_REGNUM)], &inferior_registers.r_cpsr,
sizeof (unsigned int));
! ptrace (PT_GETFPREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) &inferior_fpregisters, 0);
memcpy (®isters[REGISTER_BYTE (F0_REGNUM)], &inferior_fpregisters.fpr[0],
8 * sizeof (fp_reg_t));
memcpy (®isters[REGISTER_BYTE (FPS_REGNUM)],
*************** store_inferior_registers (regno)
*** 58,64 ****
16 * sizeof (unsigned int));
memcpy (&inferior_registers.r_cpsr, ®isters[REGISTER_BYTE (PS_REGNUM)],
sizeof (unsigned int));
! ptrace (PT_SETREGS, inferior_pid, (PTRACE_ARG3_TYPE) &inferior_registers, 0);
/* XXX Set FP regs. */
}
--- 59,66 ----
16 * sizeof (unsigned int));
memcpy (&inferior_registers.r_cpsr, ®isters[REGISTER_BYTE (PS_REGNUM)],
sizeof (unsigned int));
! ptrace (PT_SETREGS, PIDGET (inferior_ptid),
! (PTRACE_ARG3_TYPE) &inferior_registers, 0);
/* XXX Set FP regs. */
}
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] fix inferior_pid argument for arm-netbsd
2002-01-09 7:54 ` Richard Earnshaw
@ 2002-01-10 9:59 ` Richard Earnshaw
0 siblings, 0 replies; 14+ messages in thread
From: Richard Earnshaw @ 2002-01-10 9:59 UTC (permalink / raw)
To: Kevin Buettner; +Cc: Richard.Earnshaw, gdb-patches
> > On Jan 9, 1:38pm, Richard Earnshaw wrote:
> >
> > > * armnbsd-nat.c (fetch_inferior_registers): Change inferior_pid ->
> > > inferior_ptid.pid.
> >
> > Please don't do it this way. Use the accessor functions instead. I've
> > looked over your patch, and in each case, you can simply use
> >
> > ptid_get_pid (inferior_ptid)
> >
>
> Ah! I wasn't aware of the accessor functions. In fact, most targets are
> using the macro GETPID (from defs.h). I've fixed the code to use that.
>
I haven't heard anything further. Can I assume this is acceptable now, or
do I have to go into limbo for another month?
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] fix inferior_pid argument for arm-netbsd
[not found] ` <rearnsha@arm.com>
2002-01-09 7:40 ` Kevin Buettner
@ 2002-01-10 10:38 ` Kevin Buettner
2002-01-12 9:47 ` [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS Kevin Buettner
2002-01-13 9:32 ` Kevin Buettner
3 siblings, 0 replies; 14+ messages in thread
From: Kevin Buettner @ 2002-01-10 10:38 UTC (permalink / raw)
To: Richard.Earnshaw, Kevin Buettner; +Cc: gdb-patches
On Jan 10, 5:58pm, Richard Earnshaw wrote:
> > > On Jan 9, 1:38pm, Richard Earnshaw wrote:
> > >
> > > > * armnbsd-nat.c (fetch_inferior_registers): Change inferior_pid ->
> > > > inferior_ptid.pid.
> > >
> > > Please don't do it this way. Use the accessor functions instead. I've
> > > looked over your patch, and in each case, you can simply use
> > >
> > > ptid_get_pid (inferior_ptid)
> > >
> >
> > Ah! I wasn't aware of the accessor functions. In fact, most targets are
> > using the macro GETPID (from defs.h). I've fixed the code to use that.
>
> I haven't heard anything further. Can I assume this is acceptable now, or
> do I have to go into limbo for another month?
It's fine. Check it in.
Kevin
^ permalink raw reply [flat|nested] 14+ messages in thread
* [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS
@ 2002-01-12 3:51 Richard Earnshaw
0 siblings, 0 replies; 14+ messages in thread
From: Richard Earnshaw @ 2002-01-12 3:51 UTC (permalink / raw)
To: gdb-patches; +Cc: Richard.Earnshaw
[-- Attachment #1: Type: text/plain, Size: 1329 bytes --]
This patch eliminates the deprecated macros EXTRA_FRAME_INFO &
FRAME_FIND_SAVED_REGS from the arm target support files and replaces them
with the new methods for doing this. Tested on arm-netbsd and arm-linux
with no regressions.
Most of the patch is mechanical replacement of
Replace with
fip->fsr.regs fip->saved_regs
fip->framereg fip->extra_info->framereg
fip->framesize fip->extra_info->framesize
fip->frameoffset fip->extra_info->framesize
R.
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): Likewise. Also ensure prologue_cache is
correctly set up on first use.
(save_prologue_cache): Likewise.
* 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: 24031 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/11 20:53:07
*************** 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
*** 625,637 ****
{
int i;
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
--- 626,646 ----
{
int i;
+ if (prologue_cache.extra_info == NULL)
+ {
+ 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);
+ }
+
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 *
*** 646,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];
}
--- 655,675 ----
{
int i;
+ if (prologue_cache.extra_info == NULL)
+ {
+ 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);
+ }
+
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))
--- 752,760 ----
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 */
--- 857,863 ----
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 */
{
--- 866,872 ----
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!] */
{
--- 879,885 ----
{
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)
--- 906,912 ----
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);
}
--- 922,932 ----
/* 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);
}
--- 948,955 ----
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;
--- 992,998 ----
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.
--- 1007,1030 ----
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;
+
memset (&caller_fi, 0, sizeof (caller_fi));
+ caller_fi.extra_info = (struct frame_extra_info *)
+ xcalloc (1, sizeof (struct frame_extra_info));
+ caller_fi.saved_regs = (CORE_ADDR *)
+ xcalloc (1, SIZEOF_FRAME_SAVED_REGS);
+
caller_fi.pc = caller_pc;
arm_scan_prologue (&caller_fi);
! framereg = caller_fi.extra_info->framereg;
!
! xfree(caller_fi.extra_info);
! xfree(caller_fi.saved_regs);
}
/* 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
--- 1032,1038 ----
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))
--- 1050,1069 ----
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
--- 1071,1078 ----
/* 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
--- 1083,1090 ----
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))
--- 1102,1116 ----
&& (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
{
--- 1122,1140 ----
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... */
--- 1142,1157 ----
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;
}
}
--- 1161,1169 ----
/* 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
{
--- 1184,1194 ----
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
--- 1212,1224 ----
/* 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));
--- 1472,1484 ----
{
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));
Index: config/arm/tm-arm.h
===================================================================
RCS file: /cvs/src/src/gdb/config/arm/tm-arm.h,v
retrieving revision 1.13
diff -p -r1.13 tm-arm.h
*** tm-arm.h 2002/01/09 18:39:37 1.13
--- tm-arm.h 2002/01/11 20:53:11
*************** extern void convert_to_extended (void *d
*** 318,335 ****
#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))
--- 318,323 ----
*************** extern CORE_ADDR arm_frame_saved_pc (str
*** 399,412 ****
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. */
--- 387,396 ----
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. */
! void arm_frame_init_saved_regs (struct frame_info *);
! #define FRAME_INIT_SAVED_REGS(frame_info) \
! arm_frame_init_saved_regs (frame_info);
/* Things needed for making the inferior call functions. */
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS
[not found] ` <rearnsha@arm.com>
2002-01-09 7:40 ` Kevin Buettner
2002-01-10 10:38 ` Kevin Buettner
@ 2002-01-12 9:47 ` Kevin Buettner
2002-01-13 7:28 ` Richard Earnshaw
2002-01-13 9:32 ` Kevin Buettner
3 siblings, 1 reply; 14+ messages in thread
From: Kevin Buettner @ 2002-01-12 9:47 UTC (permalink / raw)
To: Richard.Earnshaw, gdb-patches
On Jan 12, 11:50am, Richard Earnshaw wrote:
> This patch eliminates the deprecated macros EXTRA_FRAME_INFO &
> FRAME_FIND_SAVED_REGS from the arm target support files and replaces them
> with the new methods for doing this.
I submitted a patch to do this last month. Unfortunately, the ARM
maintainers have not had a chance to review it yet.
See http://sources.redhat.com/ml/gdb-patches/2001-12/msg00397.html
Kevin
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS
2002-01-12 9:47 ` [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS Kevin Buettner
@ 2002-01-13 7:28 ` Richard Earnshaw
0 siblings, 0 replies; 14+ messages in thread
From: Richard Earnshaw @ 2002-01-13 7:28 UTC (permalink / raw)
To: Kevin Buettner; +Cc: Richard.Earnshaw, gdb-patches
> On Jan 12, 11:50am, Richard Earnshaw wrote:
>
> > This patch eliminates the deprecated macros EXTRA_FRAME_INFO &
> > FRAME_FIND_SAVED_REGS from the arm target support files and replaces them
> > with the new methods for doing this.
>
> I submitted a patch to do this last month. Unfortunately, the ARM
> maintainers have not had a chance to review it yet.
>
> See http://sources.redhat.com/ml/gdb-patches/2001-12/msg00397.html
>
> Kevin
Argh! Sorry Kevin, I'd missed that patch, and it isn't in the list of
posts I'd hung on to (actually, I'd already left for Xmas by that point,
so it was probably part of the 5000 or so emails I had to skim when I got
back in January ;-(.
Hmm, it seems substantially the same as mine, but with a couple of minor
differences.
1) You don't seem to initialize the pointer fields in the static frame
structure "prologue_cache".
2) Similarly you don't seem to be allocating the saved_regs for the
caller_fi frame (arm_frame_chain). You do, however, allocate the
extra_info.
3) You have a cleanup for the extra_info allocated above, which I hadn't
thought about. I think one is also needed for the saved_regs.
R.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS
[not found] ` <rearnsha@arm.com>
` (2 preceding siblings ...)
2002-01-12 9:47 ` [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS Kevin Buettner
@ 2002-01-13 9:32 ` Kevin Buettner
2002-01-13 10:40 ` Andrew Cagney
2002-01-14 2:18 ` Richard Earnshaw
3 siblings, 2 replies; 14+ messages in thread
From: Kevin Buettner @ 2002-01-13 9:32 UTC (permalink / raw)
To: Richard.Earnshaw; +Cc: Kevin Buettner, gdb-patches
On Jan 13, 3:28pm, Richard Earnshaw wrote:
> > On Jan 12, 11:50am, Richard Earnshaw wrote:
> >
> > > This patch eliminates the deprecated macros EXTRA_FRAME_INFO &
> > > FRAME_FIND_SAVED_REGS from the arm target support files and replaces them
> > > with the new methods for doing this.
> >
> > I submitted a patch to do this last month. Unfortunately, the ARM
> > maintainers have not had a chance to review it yet.
> >
> > See http://sources.redhat.com/ml/gdb-patches/2001-12/msg00397.html
[...]
> Hmm, it seems substantially the same as mine, but with a couple of minor
> differences.
>
> 1) You don't seem to initialize the pointer fields in the static frame
> structure "prologue_cache".
My patch does this allocation in _initialize_arm_tdep() whereas yours
does it in check_prologue_cache() and save_prologue_cache().
> 2) Similarly you don't seem to be allocating the saved_regs for the
> caller_fi frame (arm_frame_chain). You do, however, allocate the
> extra_info.
> 3) You have a cleanup for the extra_info allocated above, which I hadn't
> thought about. I think one is also needed for the saved_regs.
Are you sure? Here are what I believe to be the relevant lines from
the arm_frame_chain hunk:
+ 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);
saved_regs is being allocated and a cleanup is being created. Were you
perhaps refering to some other hunk?
Kevin
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS
2002-01-13 9:32 ` Kevin Buettner
@ 2002-01-13 10:40 ` Andrew Cagney
2002-01-13 11:08 ` Andrew Cagney
2002-01-14 2:18 ` Richard Earnshaw
1 sibling, 1 reply; 14+ messages in thread
From: Andrew Cagney @ 2002-01-13 10:40 UTC (permalink / raw)
To: Kevin Buettner, Richard.Earnshaw; +Cc: gdb-patches
> + 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);
That calloc() call caught my attention.
Just call frame_saved_regs_zalloc() and frame_obstack_alloc(). Since
all is on the frame obstack, worrying about cleanups is unnecessary.
I'll A.R.I. SIZEOF_FRAME_SAVED_REGS.
Andrew
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS
2002-01-13 10:40 ` Andrew Cagney
@ 2002-01-13 11:08 ` Andrew Cagney
2002-01-13 11:48 ` Kevin Buettner
0 siblings, 1 reply; 14+ messages in thread
From: Andrew Cagney @ 2002-01-13 11:08 UTC (permalink / raw)
To: Kevin Buettner, Richard.Earnshaw; +Cc: gdb-patches
> + 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);
>
>
> That calloc() call caught my attention.
>
> Just call frame_saved_regs_zalloc() and frame_obstack_alloc(). Since all is on the frame obstack, worrying about cleanups is unnecessary.
Hmm, no, sorry. That code is up to something wierd so it can't put the
stuff on the obstack. However, I would just use xmalloc().
> I'll A.R.I. SIZEOF_FRAME_SAVED_REGS.
I'll put a watch on it. Many of the uses shouldn't be there.
Andrew
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS
2002-01-13 11:08 ` Andrew Cagney
@ 2002-01-13 11:48 ` Kevin Buettner
2002-01-13 11:54 ` Andrew Cagney
0 siblings, 1 reply; 14+ messages in thread
From: Kevin Buettner @ 2002-01-13 11:48 UTC (permalink / raw)
To: Andrew Cagney, Kevin Buettner, Richard.Earnshaw; +Cc: gdb-patches
On Jan 13, 2:08pm, Andrew Cagney wrote:
> Subject: Re: [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_RE
> > + 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);
> >
> >
> > That calloc() call caught my attention.
> >
> > Just call frame_saved_regs_zalloc() and frame_obstack_alloc(). Since all is on the frame obstack, worrying about cleanups is unnecessary.
>
> Hmm, no, sorry. That code is up to something wierd so it can't put the
> stuff on the obstack. However, I would just use xmalloc().
With an explicit memset following the allocation? (Otherwise, they're
not initialized.)
Kevin
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS
2002-01-13 11:48 ` Kevin Buettner
@ 2002-01-13 11:54 ` Andrew Cagney
0 siblings, 0 replies; 14+ messages in thread
From: Andrew Cagney @ 2002-01-13 11:54 UTC (permalink / raw)
To: Kevin Buettner; +Cc: Richard.Earnshaw, gdb-patches
> On Jan 13, 2:08pm, Andrew Cagney wrote:
>
>> Subject: Re: [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_RE
>
>> > + 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);
>> >
>> >
>> > That calloc() call caught my attention.
>> >
>> > Just call frame_saved_regs_zalloc() and frame_obstack_alloc(). Since all is on the frame obstack, worrying about cleanups is unnecessary.
>
>>
>> Hmm, no, sorry. That code is up to something wierd so it can't put the
>> stuff on the obstack. However, I would just use xmalloc().
>
>
> With an explicit memset following the allocation? (Otherwise, they're
> not initialized.)
Hmm (figures out what exactly that calloc() is doing). Yes, ok, doesn't
matter either way.
Andrew
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS
2002-01-13 9:32 ` Kevin Buettner
2002-01-13 10:40 ` Andrew Cagney
@ 2002-01-14 2:18 ` Richard Earnshaw
1 sibling, 0 replies; 14+ messages in thread
From: Richard Earnshaw @ 2002-01-14 2:18 UTC (permalink / raw)
To: Kevin Buettner; +Cc: Richard.Earnshaw, gdb-patches
> > 1) You don't seem to initialize the pointer fields in the static frame
> > structure "prologue_cache".
>
> My patch does this allocation in _initialize_arm_tdep() whereas yours
> does it in check_prologue_cache() and save_prologue_cache().
>
Argh! I even looked for this and couldn't find it :-( I suspect because
patch hasn't set the function signature correctly for the hunk....
@@ -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. */
> > 2) Similarly you don't seem to be allocating the saved_regs for the
> > caller_fi frame (arm_frame_chain). You do, however, allocate the
> > extra_info.
> > 3) You have a cleanup for the extra_info allocated above, which I hadn't
> > thought about. I think one is also needed for the saved_regs.
>
> Are you sure? Here are what I believe to be the relevant lines from
> the arm_frame_chain hunk:
>
> + 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);
>
> saved_regs is being allocated and a cleanup is being created. Were you
> perhaps refering to some other hunk?
Doh! right again.
OK. I withdraw my version in favour of yours. All we need to do now is
get someone to approve it.
R.
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2002-01-14 10:18 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-01-09 5:39 [PATCH] fix inferior_pid argument for arm-netbsd Richard Earnshaw
[not found] ` <rearnsha@arm.com>
2002-01-09 7:40 ` Kevin Buettner
2002-01-09 7:54 ` Richard Earnshaw
2002-01-10 9:59 ` Richard Earnshaw
2002-01-10 10:38 ` Kevin Buettner
2002-01-12 9:47 ` [PATCH] ARM: Eliminate EXTRA_FRAME_INFO & FRAME_FIND_SAVED_REGS Kevin Buettner
2002-01-13 7:28 ` Richard Earnshaw
2002-01-13 9:32 ` Kevin Buettner
2002-01-13 10:40 ` Andrew Cagney
2002-01-13 11:08 ` Andrew Cagney
2002-01-13 11:48 ` Kevin Buettner
2002-01-13 11:54 ` Andrew Cagney
2002-01-14 2:18 ` Richard Earnshaw
2002-01-12 3:51 Richard Earnshaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox