* alphafbsd-tdep.c: Update for unwinder changes.
* alpha-linux-tdep.c: Likewise. * alphanbsd-tdep.c: Likewise. * alphaobsd-tdep.c: Likewise. * avr-tdep.c: Likewise. * cris-tdep.c: Likewise. * frv-linux-tdep.c: Likewise. * frv-tdep.c: Likewise. * h8300-tdep.c: Likewise. * hppa-linux-tdep.c: Likewise. * iq2000-tdep.c: Likewise. * m32c-tdep.c: Likewise. * m32r-linux-tdep.c: Likewise. * m32r-tdep.c: Likewise. * m68hc11-tdep.c: Likewise. * mep-tdep.c: Likewise. * mn10300-tdep.c: Likewise. * mt-tdep.c: Likewise. * score-tdep.c: Likewise. * sh64-tdep.c: Likewise. * sh-tdep.c: Likewise. * sparc64fbsd-tdep.c: Likewise. * sparc64nbsd-tdep.c: Likewise. * sparc64obsd-tdep.c: Likewise. * v850-tdep.c: Likewise. * vaxobsd-tdep.c: Likewise. * vax-tdep.c: Likewise. * xstormy16-tdep.c: Likewise.
This commit is contained in:
parent
e111d6c920
commit
94afd7a6d3
@ -1,3 +1,34 @@
|
|||||||
|
2008-06-28 Ulrich Weigand <uweigand@de.ibm.com>
|
||||||
|
|
||||||
|
* alphafbsd-tdep.c: Update for unwinder changes.
|
||||||
|
* alpha-linux-tdep.c: Likewise.
|
||||||
|
* alphanbsd-tdep.c: Likewise.
|
||||||
|
* alphaobsd-tdep.c: Likewise.
|
||||||
|
* avr-tdep.c: Likewise.
|
||||||
|
* cris-tdep.c: Likewise.
|
||||||
|
* frv-linux-tdep.c: Likewise.
|
||||||
|
* frv-tdep.c: Likewise.
|
||||||
|
* h8300-tdep.c: Likewise.
|
||||||
|
* hppa-linux-tdep.c: Likewise.
|
||||||
|
* iq2000-tdep.c: Likewise.
|
||||||
|
* m32c-tdep.c: Likewise.
|
||||||
|
* m32r-linux-tdep.c: Likewise.
|
||||||
|
* m32r-tdep.c: Likewise.
|
||||||
|
* m68hc11-tdep.c: Likewise.
|
||||||
|
* mep-tdep.c: Likewise.
|
||||||
|
* mn10300-tdep.c: Likewise.
|
||||||
|
* mt-tdep.c: Likewise.
|
||||||
|
* score-tdep.c: Likewise.
|
||||||
|
* sh64-tdep.c: Likewise.
|
||||||
|
* sh-tdep.c: Likewise.
|
||||||
|
* sparc64fbsd-tdep.c: Likewise.
|
||||||
|
* sparc64nbsd-tdep.c: Likewise.
|
||||||
|
* sparc64obsd-tdep.c: Likewise.
|
||||||
|
* v850-tdep.c: Likewise.
|
||||||
|
* vaxobsd-tdep.c: Likewise.
|
||||||
|
* vax-tdep.c: Likewise.
|
||||||
|
* xstormy16-tdep.c: Likewise.
|
||||||
|
|
||||||
2008-06-28 Vladimir Prus <vladimir@codesourcery.com>
|
2008-06-28 Vladimir Prus <vladimir@codesourcery.com>
|
||||||
|
|
||||||
* mi/mi-main.c (enum captured_mi_execute_command_actions)
|
* mi/mi-main.c (enum captured_mi_execute_command_actions)
|
||||||
|
@ -98,14 +98,14 @@ alpha_linux_pc_in_sigtramp (CORE_ADDR pc, char *func_name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
alpha_linux_sigcontext_addr (struct frame_info *next_frame)
|
alpha_linux_sigcontext_addr (struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
CORE_ADDR pc;
|
CORE_ADDR pc;
|
||||||
ULONGEST sp;
|
ULONGEST sp;
|
||||||
long off;
|
long off;
|
||||||
|
|
||||||
pc = frame_pc_unwind (next_frame);
|
pc = get_frame_pc (this_frame);
|
||||||
sp = frame_unwind_register_unsigned (next_frame, ALPHA_SP_REGNUM);
|
sp = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM);
|
||||||
|
|
||||||
off = alpha_linux_sigtramp_offset (pc);
|
off = alpha_linux_sigtramp_offset (pc);
|
||||||
gdb_assert (off >= 0);
|
gdb_assert (off >= 0);
|
||||||
|
@ -76,13 +76,13 @@ alphafbsd_sigtramp_offset (CORE_ADDR pc)
|
|||||||
return pc - alphafbsd_sigtramp_start;
|
return pc - alphafbsd_sigtramp_start;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assuming NEXT_FRAME is for a frame following a BSD sigtramp
|
/* Assuming THIS_FRAME is the frame of a BSD sigtramp routine,
|
||||||
routine, return the address of the associated sigcontext structure. */
|
return the address of the associated sigcontext structure. */
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
alphafbsd_sigcontext_addr (struct frame_info *next_frame)
|
alphafbsd_sigcontext_addr (struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
return frame_unwind_register_unsigned (next_frame, ALPHA_SP_REGNUM) + 24;
|
return get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM) + 24;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FreeBSD 5.0-RELEASE or later. */
|
/* FreeBSD 5.0-RELEASE or later. */
|
||||||
|
@ -253,7 +253,9 @@ alphanbsd_sigcontext_addr (struct frame_info *frame)
|
|||||||
/* FIXME: This is not correct for all versions of NetBSD/alpha.
|
/* FIXME: This is not correct for all versions of NetBSD/alpha.
|
||||||
We will probably need to disassemble the trampoline to figure
|
We will probably need to disassemble the trampoline to figure
|
||||||
out which trampoline frame type we have. */
|
out which trampoline frame type we have. */
|
||||||
return get_frame_base (frame);
|
if (!get_next_frame (frame))
|
||||||
|
return 0;
|
||||||
|
return get_frame_base (get_next_frame (frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -68,26 +68,26 @@ alphaobsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
alphaobsd_sigcontext_addr (struct frame_info *next_frame)
|
alphaobsd_sigcontext_addr (struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
CORE_ADDR pc = frame_pc_unwind (next_frame);
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
||||||
|
|
||||||
if (alphaobsd_sigtramp_offset (pc) < 3 * ALPHA_INSN_SIZE)
|
if (alphaobsd_sigtramp_offset (pc) < 3 * ALPHA_INSN_SIZE)
|
||||||
{
|
{
|
||||||
/* On entry, a pointer the `struct sigcontext' is passed in %a2. */
|
/* On entry, a pointer the `struct sigcontext' is passed in %a2. */
|
||||||
return frame_unwind_register_unsigned (next_frame, ALPHA_A0_REGNUM + 2);
|
return get_frame_register_unsigned (this_frame, ALPHA_A0_REGNUM + 2);
|
||||||
}
|
}
|
||||||
else if (alphaobsd_sigtramp_offset (pc) < 4 * ALPHA_INSN_SIZE)
|
else if (alphaobsd_sigtramp_offset (pc) < 4 * ALPHA_INSN_SIZE)
|
||||||
{
|
{
|
||||||
/* It is stored on the stack Before calling the signal handler. */
|
/* It is stored on the stack Before calling the signal handler. */
|
||||||
CORE_ADDR sp;
|
CORE_ADDR sp;
|
||||||
sp = frame_unwind_register_unsigned (next_frame, ALPHA_SP_REGNUM);
|
sp = get_frame_register_unsigned (this_frame, ALPHA_SP_REGNUM);
|
||||||
return get_frame_memory_unsigned (next_frame, sp, 8);
|
return get_frame_memory_unsigned (this_frame, sp, 8);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* It is reloaded into %a0 for the sigreturn(2) call. */
|
/* It is reloaded into %a0 for the sigreturn(2) call. */
|
||||||
return frame_unwind_register_unsigned (next_frame, ALPHA_A0_REGNUM);
|
return get_frame_register_unsigned (this_frame, ALPHA_A0_REGNUM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
127
gdb/avr-tdep.c
127
gdb/avr-tdep.c
@ -872,7 +872,7 @@ avr_return_value (struct gdbarch *gdbarch, struct type *func_type,
|
|||||||
for it IS the sp for the next frame. */
|
for it IS the sp for the next frame. */
|
||||||
|
|
||||||
struct avr_unwind_cache *
|
struct avr_unwind_cache *
|
||||||
avr_frame_unwind_cache (struct frame_info *next_frame,
|
avr_frame_unwind_cache (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
CORE_ADDR pc;
|
CORE_ADDR pc;
|
||||||
@ -886,14 +886,14 @@ avr_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
|
|
||||||
info = FRAME_OBSTACK_ZALLOC (struct avr_unwind_cache);
|
info = FRAME_OBSTACK_ZALLOC (struct avr_unwind_cache);
|
||||||
(*this_prologue_cache) = info;
|
(*this_prologue_cache) = info;
|
||||||
info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
info->size = 0;
|
info->size = 0;
|
||||||
info->prologue_type = AVR_PROLOGUE_NONE;
|
info->prologue_type = AVR_PROLOGUE_NONE;
|
||||||
|
|
||||||
pc = frame_func_unwind (next_frame, NORMAL_FRAME);
|
pc = get_frame_func (this_frame);
|
||||||
|
|
||||||
if ((pc > 0) && (pc < frame_pc_unwind (next_frame)))
|
if ((pc > 0) && (pc < get_frame_pc (this_frame)))
|
||||||
avr_scan_prologue (pc, info);
|
avr_scan_prologue (pc, info);
|
||||||
|
|
||||||
if ((info->prologue_type != AVR_PROLOGUE_NONE)
|
if ((info->prologue_type != AVR_PROLOGUE_NONE)
|
||||||
@ -904,8 +904,8 @@ avr_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
/* The SP was moved to the FP. This indicates that a new frame
|
/* The SP was moved to the FP. This indicates that a new frame
|
||||||
was created. Get THIS frame's FP value by unwinding it from
|
was created. Get THIS frame's FP value by unwinding it from
|
||||||
the next frame. */
|
the next frame. */
|
||||||
this_base = frame_unwind_register_unsigned (next_frame, AVR_FP_REGNUM);
|
this_base = get_frame_register_unsigned (this_frame, AVR_FP_REGNUM);
|
||||||
high_base = frame_unwind_register_unsigned (next_frame, AVR_FP_REGNUM+1);
|
high_base = get_frame_register_unsigned (this_frame, AVR_FP_REGNUM+1);
|
||||||
this_base += (high_base << 8);
|
this_base += (high_base << 8);
|
||||||
|
|
||||||
/* The FP points at the last saved register. Adjust the FP back
|
/* The FP points at the last saved register. Adjust the FP back
|
||||||
@ -916,7 +916,7 @@ avr_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
{
|
{
|
||||||
/* Assume that the FP is this frame's SP but with that pushed
|
/* Assume that the FP is this frame's SP but with that pushed
|
||||||
stack space added back. */
|
stack space added back. */
|
||||||
this_base = frame_unwind_register_unsigned (next_frame, AVR_SP_REGNUM);
|
this_base = get_frame_register_unsigned (this_frame, AVR_SP_REGNUM);
|
||||||
prev_sp = this_base + info->size;
|
prev_sp = this_base + info->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -928,7 +928,7 @@ avr_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
|
|
||||||
/* Adjust all the saved registers so that they contain addresses and not
|
/* Adjust all the saved registers so that they contain addresses and not
|
||||||
offsets. */
|
offsets. */
|
||||||
for (i = 0; i < gdbarch_num_regs (get_frame_arch (next_frame)) - 1; i++)
|
for (i = 0; i < gdbarch_num_regs (get_frame_arch (this_frame)) - 1; i++)
|
||||||
if (info->saved_regs[i].addr)
|
if (info->saved_regs[i].addr)
|
||||||
{
|
{
|
||||||
info->saved_regs[i].addr = (info->prev_sp - info->saved_regs[i].addr);
|
info->saved_regs[i].addr = (info->prev_sp - info->saved_regs[i].addr);
|
||||||
@ -973,18 +973,18 @@ avr_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
frame. This will be used to create a new GDB frame struct. */
|
frame. This will be used to create a new GDB frame struct. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
avr_frame_this_id (struct frame_info *next_frame,
|
avr_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct avr_unwind_cache *info
|
struct avr_unwind_cache *info
|
||||||
= avr_frame_unwind_cache (next_frame, this_prologue_cache);
|
= avr_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
CORE_ADDR base;
|
CORE_ADDR base;
|
||||||
CORE_ADDR func;
|
CORE_ADDR func;
|
||||||
struct frame_id id;
|
struct frame_id id;
|
||||||
|
|
||||||
/* The FUNC is easy. */
|
/* The FUNC is easy. */
|
||||||
func = frame_func_unwind (next_frame, NORMAL_FRAME);
|
func = get_frame_func (this_frame);
|
||||||
|
|
||||||
/* Hopefully the prologue analysis either correctly determined the
|
/* Hopefully the prologue analysis either correctly determined the
|
||||||
frame's base (which is the SP from the previous frame), or set
|
frame's base (which is the SP from the previous frame), or set
|
||||||
@ -997,83 +997,69 @@ avr_frame_this_id (struct frame_info *next_frame,
|
|||||||
(*this_id) = id;
|
(*this_id) = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
avr_frame_prev_register (struct frame_info *next_frame,
|
avr_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *bufferp)
|
|
||||||
{
|
{
|
||||||
struct avr_unwind_cache *info
|
struct avr_unwind_cache *info
|
||||||
= avr_frame_unwind_cache (next_frame, this_prologue_cache);
|
= avr_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
|
|
||||||
if (regnum == AVR_PC_REGNUM)
|
if (regnum == AVR_PC_REGNUM)
|
||||||
{
|
{
|
||||||
if (trad_frame_addr_p (info->saved_regs, regnum))
|
if (trad_frame_addr_p (info->saved_regs, regnum))
|
||||||
{
|
{
|
||||||
*optimizedp = 0;
|
/* Reading the return PC from the PC register is slightly
|
||||||
*lvalp = lval_memory;
|
abnormal. register_size(AVR_PC_REGNUM) says it is 4 bytes,
|
||||||
*addrp = info->saved_regs[regnum].addr;
|
but in reality, only two bytes (3 in upcoming mega256) are
|
||||||
*realnump = -1;
|
stored on the stack.
|
||||||
if (bufferp != NULL)
|
|
||||||
{
|
|
||||||
/* Reading the return PC from the PC register is slightly
|
|
||||||
abnormal. register_size(AVR_PC_REGNUM) says it is 4 bytes,
|
|
||||||
but in reality, only two bytes (3 in upcoming mega256) are
|
|
||||||
stored on the stack.
|
|
||||||
|
|
||||||
Also, note that the value on the stack is an addr to a word
|
Also, note that the value on the stack is an addr to a word
|
||||||
not a byte, so we will need to multiply it by two at some
|
not a byte, so we will need to multiply it by two at some
|
||||||
point.
|
point.
|
||||||
|
|
||||||
And to confuse matters even more, the return address stored
|
And to confuse matters even more, the return address stored
|
||||||
on the stack is in big endian byte order, even though most
|
on the stack is in big endian byte order, even though most
|
||||||
everything else about the avr is little endian. Ick! */
|
everything else about the avr is little endian. Ick! */
|
||||||
|
|
||||||
/* FIXME: number of bytes read here will need updated for the
|
/* FIXME: number of bytes read here will need updated for the
|
||||||
mega256 when it is available. */
|
mega256 when it is available. */
|
||||||
|
|
||||||
ULONGEST pc;
|
ULONGEST pc;
|
||||||
unsigned char tmp;
|
unsigned char tmp;
|
||||||
unsigned char buf[2];
|
unsigned char buf[2];
|
||||||
|
|
||||||
read_memory (info->saved_regs[regnum].addr, buf, 2);
|
read_memory (info->saved_regs[regnum].addr, buf, 2);
|
||||||
|
|
||||||
/* Convert the PC read from memory as a big-endian to
|
/* Convert the PC read from memory as a big-endian to
|
||||||
little-endian order. */
|
little-endian order. */
|
||||||
tmp = buf[0];
|
tmp = buf[0];
|
||||||
buf[0] = buf[1];
|
buf[0] = buf[1];
|
||||||
buf[1] = tmp;
|
buf[1] = tmp;
|
||||||
|
|
||||||
pc = (extract_unsigned_integer (buf, 2) * 2);
|
pc = (extract_unsigned_integer (buf, 2) * 2);
|
||||||
store_unsigned_integer
|
|
||||||
(bufferp, register_size (get_frame_arch (next_frame), regnum),
|
return frame_unwind_got_constant (this_frame, regnum, pc);
|
||||||
pc);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return frame_unwind_got_optimized (this_frame, regnum);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, bufferp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind avr_frame_unwind = {
|
static const struct frame_unwind avr_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
avr_frame_this_id,
|
avr_frame_this_id,
|
||||||
avr_frame_prev_register
|
avr_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct frame_unwind *
|
|
||||||
avr_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &avr_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
avr_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
avr_frame_base_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct avr_unwind_cache *info
|
struct avr_unwind_cache *info
|
||||||
= avr_frame_unwind_cache (next_frame, this_cache);
|
= avr_frame_unwind_cache (this_frame, this_cache);
|
||||||
|
|
||||||
return info->base;
|
return info->base;
|
||||||
}
|
}
|
||||||
@ -1085,18 +1071,17 @@ static const struct frame_base avr_frame_base = {
|
|||||||
avr_frame_base_address
|
avr_frame_base_address
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
|
/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
|
||||||
dummy frame. The frame ID's base needs to match the TOS value
|
frame. The frame ID's base needs to match the TOS value saved by
|
||||||
saved by save_dummy_frame_tos(), and the PC match the dummy frame's
|
save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */
|
||||||
breakpoint. */
|
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
avr_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
avr_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
ULONGEST base;
|
ULONGEST base;
|
||||||
|
|
||||||
base = frame_unwind_register_unsigned (next_frame, AVR_SP_REGNUM);
|
base = get_frame_register_unsigned (this_frame, AVR_SP_REGNUM);
|
||||||
return frame_id_build (avr_make_saddr (base), frame_pc_unwind (next_frame));
|
return frame_id_build (avr_make_saddr (base), get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* When arguments must be pushed onto the stack, they go on in reverse
|
/* When arguments must be pushed onto the stack, they go on in reverse
|
||||||
@ -1322,10 +1307,10 @@ avr_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
|
|
||||||
set_gdbarch_breakpoint_from_pc (gdbarch, avr_breakpoint_from_pc);
|
set_gdbarch_breakpoint_from_pc (gdbarch, avr_breakpoint_from_pc);
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, avr_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &avr_frame_unwind);
|
||||||
frame_base_set_default (gdbarch, &avr_frame_base);
|
frame_base_set_default (gdbarch, &avr_frame_base);
|
||||||
|
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, avr_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, avr_dummy_id);
|
||||||
|
|
||||||
set_gdbarch_unwind_pc (gdbarch, avr_unwind_pc);
|
set_gdbarch_unwind_pc (gdbarch, avr_unwind_pc);
|
||||||
set_gdbarch_unwind_sp (gdbarch, avr_unwind_sp);
|
set_gdbarch_unwind_sp (gdbarch, avr_unwind_sp);
|
||||||
|
193
gdb/cris-tdep.c
193
gdb/cris-tdep.c
@ -215,12 +215,12 @@ static const unsigned short rt_sigtramp_code[] =
|
|||||||
the routine. Otherwise, return 0. */
|
the routine. Otherwise, return 0. */
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
cris_sigtramp_start (struct frame_info *next_frame)
|
cris_sigtramp_start (struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
CORE_ADDR pc = frame_pc_unwind (next_frame);
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
||||||
gdb_byte buf[SIGTRAMP_LEN];
|
gdb_byte buf[SIGTRAMP_LEN];
|
||||||
|
|
||||||
if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
|
if (!safe_frame_unwind_memory (this_frame, pc, buf, SIGTRAMP_LEN))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (((buf[1] << 8) + buf[0]) != SIGTRAMP_INSN0)
|
if (((buf[1] << 8) + buf[0]) != SIGTRAMP_INSN0)
|
||||||
@ -229,7 +229,7 @@ cris_sigtramp_start (struct frame_info *next_frame)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pc -= SIGTRAMP_OFFSET1;
|
pc -= SIGTRAMP_OFFSET1;
|
||||||
if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
|
if (!safe_frame_unwind_memory (this_frame, pc, buf, SIGTRAMP_LEN))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -243,12 +243,12 @@ cris_sigtramp_start (struct frame_info *next_frame)
|
|||||||
the routine. Otherwise, return 0. */
|
the routine. Otherwise, return 0. */
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
cris_rt_sigtramp_start (struct frame_info *next_frame)
|
cris_rt_sigtramp_start (struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
CORE_ADDR pc = frame_pc_unwind (next_frame);
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
||||||
gdb_byte buf[SIGTRAMP_LEN];
|
gdb_byte buf[SIGTRAMP_LEN];
|
||||||
|
|
||||||
if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
|
if (!safe_frame_unwind_memory (this_frame, pc, buf, SIGTRAMP_LEN))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (((buf[1] << 8) + buf[0]) != SIGTRAMP_INSN0)
|
if (((buf[1] << 8) + buf[0]) != SIGTRAMP_INSN0)
|
||||||
@ -257,7 +257,7 @@ cris_rt_sigtramp_start (struct frame_info *next_frame)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
pc -= SIGTRAMP_OFFSET1;
|
pc -= SIGTRAMP_OFFSET1;
|
||||||
if (!safe_frame_unwind_memory (next_frame, pc, buf, SIGTRAMP_LEN))
|
if (!safe_frame_unwind_memory (this_frame, pc, buf, SIGTRAMP_LEN))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -267,22 +267,22 @@ cris_rt_sigtramp_start (struct frame_info *next_frame)
|
|||||||
return pc;
|
return pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assuming NEXT_FRAME is a frame following a GNU/Linux sigtramp
|
/* Assuming THIS_FRAME is a frame for a GNU/Linux sigtramp routine,
|
||||||
routine, return the address of the associated sigcontext structure. */
|
return the address of the associated sigcontext structure. */
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
cris_sigcontext_addr (struct frame_info *next_frame)
|
cris_sigcontext_addr (struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
CORE_ADDR pc;
|
CORE_ADDR pc;
|
||||||
CORE_ADDR sp;
|
CORE_ADDR sp;
|
||||||
char buf[4];
|
char buf[4];
|
||||||
|
|
||||||
frame_unwind_register (next_frame,
|
get_frame_register (this_frame,
|
||||||
gdbarch_sp_regnum (get_frame_arch (next_frame)), buf);
|
gdbarch_sp_regnum (get_frame_arch (this_frame)), buf);
|
||||||
sp = extract_unsigned_integer (buf, 4);
|
sp = extract_unsigned_integer (buf, 4);
|
||||||
|
|
||||||
/* Look for normal sigtramp frame first. */
|
/* Look for normal sigtramp frame first. */
|
||||||
pc = cris_sigtramp_start (next_frame);
|
pc = cris_sigtramp_start (this_frame);
|
||||||
if (pc)
|
if (pc)
|
||||||
{
|
{
|
||||||
/* struct signal_frame (arch/cris/kernel/signal.c) contains
|
/* struct signal_frame (arch/cris/kernel/signal.c) contains
|
||||||
@ -291,7 +291,7 @@ cris_sigcontext_addr (struct frame_info *next_frame)
|
|||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
pc = cris_rt_sigtramp_start (next_frame);
|
pc = cris_rt_sigtramp_start (this_frame);
|
||||||
if (pc)
|
if (pc)
|
||||||
{
|
{
|
||||||
/* struct rt_signal_frame (arch/cris/kernel/signal.c) contains
|
/* struct rt_signal_frame (arch/cris/kernel/signal.c) contains
|
||||||
@ -330,10 +330,10 @@ struct cris_unwind_cache
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct cris_unwind_cache *
|
static struct cris_unwind_cache *
|
||||||
cris_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
|
cris_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
|
||||||
void **this_cache)
|
void **this_cache)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
||||||
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||||
struct cris_unwind_cache *info;
|
struct cris_unwind_cache *info;
|
||||||
CORE_ADDR pc;
|
CORE_ADDR pc;
|
||||||
@ -347,7 +347,7 @@ cris_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
|
|
||||||
info = FRAME_OBSTACK_ZALLOC (struct cris_unwind_cache);
|
info = FRAME_OBSTACK_ZALLOC (struct cris_unwind_cache);
|
||||||
(*this_cache) = info;
|
(*this_cache) = info;
|
||||||
info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
/* Zero all fields. */
|
/* Zero all fields. */
|
||||||
info->prev_sp = 0;
|
info->prev_sp = 0;
|
||||||
@ -359,10 +359,10 @@ cris_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
info->return_pc = 0;
|
info->return_pc = 0;
|
||||||
info->leaf_function = 0;
|
info->leaf_function = 0;
|
||||||
|
|
||||||
frame_unwind_register (next_frame, gdbarch_sp_regnum (gdbarch), buf);
|
get_frame_register (this_frame, gdbarch_sp_regnum (gdbarch), buf);
|
||||||
info->base = extract_unsigned_integer (buf, 4);
|
info->base = extract_unsigned_integer (buf, 4);
|
||||||
|
|
||||||
addr = cris_sigcontext_addr (next_frame);
|
addr = cris_sigcontext_addr (this_frame);
|
||||||
|
|
||||||
/* Layout of the sigcontext struct:
|
/* Layout of the sigcontext struct:
|
||||||
struct sigcontext {
|
struct sigcontext {
|
||||||
@ -425,51 +425,48 @@ cris_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cris_sigtramp_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
cris_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct cris_unwind_cache *cache =
|
struct cris_unwind_cache *cache =
|
||||||
cris_sigtramp_frame_unwind_cache (next_frame, this_cache);
|
cris_sigtramp_frame_unwind_cache (this_frame, this_cache);
|
||||||
(*this_id) = frame_id_build (cache->base, frame_pc_unwind (next_frame));
|
(*this_id) = frame_id_build (cache->base, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Forward declaration. */
|
/* Forward declaration. */
|
||||||
|
|
||||||
static void cris_frame_prev_register (struct frame_info *next_frame,
|
static struct value *cris_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_cache, int regnum);
|
||||||
int regnum, int *optimizedp,
|
static struct value *
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
cris_sigtramp_frame_prev_register (struct frame_info *this_frame,
|
||||||
int *realnump, gdb_byte *bufferp);
|
void **this_cache, int regnum)
|
||||||
static void
|
|
||||||
cris_sigtramp_frame_prev_register (struct frame_info *next_frame,
|
|
||||||
void **this_cache,
|
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
/* Make sure we've initialized the cache. */
|
/* Make sure we've initialized the cache. */
|
||||||
cris_sigtramp_frame_unwind_cache (next_frame, this_cache);
|
cris_sigtramp_frame_unwind_cache (this_frame, this_cache);
|
||||||
cris_frame_prev_register (next_frame, this_cache, regnum,
|
return cris_frame_prev_register (this_frame, this_cache, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, valuep);
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
cris_sigtramp_frame_sniffer (const struct frame_unwind *self,
|
||||||
|
struct frame_info *this_frame,
|
||||||
|
void **this_cache)
|
||||||
|
{
|
||||||
|
if (cris_sigtramp_start (this_frame)
|
||||||
|
|| cris_rt_sigtramp_start (this_frame))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind cris_sigtramp_frame_unwind =
|
static const struct frame_unwind cris_sigtramp_frame_unwind =
|
||||||
{
|
{
|
||||||
SIGTRAMP_FRAME,
|
SIGTRAMP_FRAME,
|
||||||
cris_sigtramp_frame_this_id,
|
cris_sigtramp_frame_this_id,
|
||||||
cris_sigtramp_frame_prev_register
|
cris_sigtramp_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
cris_sigtramp_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
cris_sigtramp_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
if (cris_sigtramp_start (next_frame)
|
|
||||||
|| cris_rt_sigtramp_start (next_frame))
|
|
||||||
return &cris_sigtramp_frame_unwind;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int
|
int
|
||||||
crisv32_single_step_through_delay (struct gdbarch *gdbarch,
|
crisv32_single_step_through_delay (struct gdbarch *gdbarch,
|
||||||
struct frame_info *this_frame)
|
struct frame_info *this_frame)
|
||||||
@ -717,11 +714,11 @@ static void set_cris_dwarf2_cfi (char *ignore_args, int from_tty,
|
|||||||
struct cmd_list_element *c);
|
struct cmd_list_element *c);
|
||||||
|
|
||||||
static CORE_ADDR cris_scan_prologue (CORE_ADDR pc,
|
static CORE_ADDR cris_scan_prologue (CORE_ADDR pc,
|
||||||
struct frame_info *next_frame,
|
struct frame_info *this_frame,
|
||||||
struct cris_unwind_cache *info);
|
struct cris_unwind_cache *info);
|
||||||
|
|
||||||
static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc,
|
static CORE_ADDR crisv32_scan_prologue (CORE_ADDR pc,
|
||||||
struct frame_info *next_frame,
|
struct frame_info *this_frame,
|
||||||
struct cris_unwind_cache *info);
|
struct cris_unwind_cache *info);
|
||||||
|
|
||||||
static CORE_ADDR cris_unwind_pc (struct gdbarch *gdbarch,
|
static CORE_ADDR cris_unwind_pc (struct gdbarch *gdbarch,
|
||||||
@ -770,7 +767,7 @@ pop_stack_item (struct stack_item *si)
|
|||||||
for it IS the sp for the next frame. */
|
for it IS the sp for the next frame. */
|
||||||
|
|
||||||
struct cris_unwind_cache *
|
struct cris_unwind_cache *
|
||||||
cris_frame_unwind_cache (struct frame_info *next_frame,
|
cris_frame_unwind_cache (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
CORE_ADDR pc;
|
CORE_ADDR pc;
|
||||||
@ -782,7 +779,7 @@ cris_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
|
|
||||||
info = FRAME_OBSTACK_ZALLOC (struct cris_unwind_cache);
|
info = FRAME_OBSTACK_ZALLOC (struct cris_unwind_cache);
|
||||||
(*this_prologue_cache) = info;
|
(*this_prologue_cache) = info;
|
||||||
info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
/* Zero all fields. */
|
/* Zero all fields. */
|
||||||
info->prev_sp = 0;
|
info->prev_sp = 0;
|
||||||
@ -796,11 +793,9 @@ cris_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
|
|
||||||
/* Prologue analysis does the rest... */
|
/* Prologue analysis does the rest... */
|
||||||
if (cris_version () == 32)
|
if (cris_version () == 32)
|
||||||
crisv32_scan_prologue (frame_func_unwind (next_frame, NORMAL_FRAME),
|
crisv32_scan_prologue (get_frame_func (this_frame), this_frame, info);
|
||||||
next_frame, info);
|
|
||||||
else
|
else
|
||||||
cris_scan_prologue (frame_func_unwind (next_frame, NORMAL_FRAME),
|
cris_scan_prologue (get_frame_func (this_frame), this_frame, info);
|
||||||
next_frame, info);
|
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
@ -809,18 +804,18 @@ cris_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
frame. This will be used to create a new GDB frame struct. */
|
frame. This will be used to create a new GDB frame struct. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cris_frame_this_id (struct frame_info *next_frame,
|
cris_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct cris_unwind_cache *info
|
struct cris_unwind_cache *info
|
||||||
= cris_frame_unwind_cache (next_frame, this_prologue_cache);
|
= cris_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
CORE_ADDR base;
|
CORE_ADDR base;
|
||||||
CORE_ADDR func;
|
CORE_ADDR func;
|
||||||
struct frame_id id;
|
struct frame_id id;
|
||||||
|
|
||||||
/* The FUNC is easy. */
|
/* The FUNC is easy. */
|
||||||
func = frame_func_unwind (next_frame, NORMAL_FRAME);
|
func = get_frame_func (this_frame);
|
||||||
|
|
||||||
/* Hopefully the prologue analysis either correctly determined the
|
/* Hopefully the prologue analysis either correctly determined the
|
||||||
frame's base (which is the SP from the previous frame), or set
|
frame's base (which is the SP from the previous frame), or set
|
||||||
@ -834,29 +829,25 @@ cris_frame_this_id (struct frame_info *next_frame,
|
|||||||
(*this_id) = id;
|
(*this_id) = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
cris_frame_prev_register (struct frame_info *next_frame,
|
cris_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *bufferp)
|
|
||||||
{
|
{
|
||||||
struct cris_unwind_cache *info
|
struct cris_unwind_cache *info
|
||||||
= cris_frame_unwind_cache (next_frame, this_prologue_cache);
|
= cris_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, bufferp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
|
/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
|
||||||
dummy frame. The frame ID's base needs to match the TOS value
|
frame. The frame ID's base needs to match the TOS value saved by
|
||||||
saved by save_dummy_frame_tos(), and the PC match the dummy frame's
|
save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */
|
||||||
breakpoint. */
|
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
cris_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
cris_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
return frame_id_build (cris_unwind_sp (gdbarch, next_frame),
|
CORE_ADDR sp;
|
||||||
frame_pc_unwind (next_frame));
|
sp = get_frame_register_unsigned (this_frame, gdbarch_sp_regnum (gdbarch));
|
||||||
|
return frame_id_build (sp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
@ -1011,20 +1002,16 @@ static const struct frame_unwind cris_frame_unwind =
|
|||||||
{
|
{
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
cris_frame_this_id,
|
cris_frame_this_id,
|
||||||
cris_frame_prev_register
|
cris_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct frame_unwind *
|
|
||||||
cris_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &cris_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
cris_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
cris_frame_base_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct cris_unwind_cache *info
|
struct cris_unwind_cache *info
|
||||||
= cris_frame_unwind_cache (next_frame, this_cache);
|
= cris_frame_unwind_cache (this_frame, this_cache);
|
||||||
return info->base;
|
return info->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1113,10 +1100,10 @@ static const struct frame_base cris_frame_base =
|
|||||||
determine that it is a prologue (1). */
|
determine that it is a prologue (1). */
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame,
|
cris_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame,
|
||||||
struct cris_unwind_cache *info)
|
struct cris_unwind_cache *info)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
||||||
/* Present instruction. */
|
/* Present instruction. */
|
||||||
unsigned short insn;
|
unsigned short insn;
|
||||||
|
|
||||||
@ -1149,11 +1136,11 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame,
|
|||||||
val = 0;
|
val = 0;
|
||||||
regsave = -1;
|
regsave = -1;
|
||||||
|
|
||||||
/* If we were called without a next_frame, that means we were called
|
/* If we were called without a this_frame, that means we were called
|
||||||
from cris_skip_prologue which already tried to find the end of the
|
from cris_skip_prologue which already tried to find the end of the
|
||||||
prologue through the symbol information. 64 instructions past current
|
prologue through the symbol information. 64 instructions past current
|
||||||
pc is arbitrarily chosen, but at least it means we'll stop eventually. */
|
pc is arbitrarily chosen, but at least it means we'll stop eventually. */
|
||||||
limit = next_frame ? frame_pc_unwind (next_frame) : pc + 64;
|
limit = this_frame ? get_frame_pc (this_frame) : pc + 64;
|
||||||
|
|
||||||
/* Find the prologue instructions. */
|
/* Find the prologue instructions. */
|
||||||
while (pc > 0 && pc < limit)
|
while (pc > 0 && pc < limit)
|
||||||
@ -1322,9 +1309,9 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We only want to know the end of the prologue when next_frame and info
|
/* We only want to know the end of the prologue when this_frame and info
|
||||||
are NULL (called from cris_skip_prologue i.e.). */
|
are NULL (called from cris_skip_prologue i.e.). */
|
||||||
if (next_frame == NULL && info == NULL)
|
if (this_frame == NULL && info == NULL)
|
||||||
{
|
{
|
||||||
return pc;
|
return pc;
|
||||||
}
|
}
|
||||||
@ -1339,7 +1326,7 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame,
|
|||||||
/* The SP was moved to the FP. This indicates that a new frame
|
/* The SP was moved to the FP. This indicates that a new frame
|
||||||
was created. Get THIS frame's FP value by unwinding it from
|
was created. Get THIS frame's FP value by unwinding it from
|
||||||
the next frame. */
|
the next frame. */
|
||||||
this_base = frame_unwind_register_unsigned (next_frame, CRIS_FP_REGNUM);
|
this_base = get_frame_register_unsigned (this_frame, CRIS_FP_REGNUM);
|
||||||
info->base = this_base;
|
info->base = this_base;
|
||||||
info->saved_regs[CRIS_FP_REGNUM].addr = info->base;
|
info->saved_regs[CRIS_FP_REGNUM].addr = info->base;
|
||||||
|
|
||||||
@ -1352,8 +1339,8 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame,
|
|||||||
ULONGEST this_base;
|
ULONGEST this_base;
|
||||||
/* Assume that the FP is this frame's SP but with that pushed
|
/* Assume that the FP is this frame's SP but with that pushed
|
||||||
stack space added back. */
|
stack space added back. */
|
||||||
this_base = frame_unwind_register_unsigned (next_frame,
|
this_base = get_frame_register_unsigned (this_frame,
|
||||||
gdbarch_sp_regnum (gdbarch));
|
gdbarch_sp_regnum (gdbarch));
|
||||||
info->base = this_base;
|
info->base = this_base;
|
||||||
info->prev_sp = info->base + info->size;
|
info->prev_sp = info->base + info->size;
|
||||||
}
|
}
|
||||||
@ -1398,10 +1385,10 @@ cris_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
crisv32_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame,
|
crisv32_scan_prologue (CORE_ADDR pc, struct frame_info *this_frame,
|
||||||
struct cris_unwind_cache *info)
|
struct cris_unwind_cache *info)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
||||||
ULONGEST this_base;
|
ULONGEST this_base;
|
||||||
|
|
||||||
/* Unlike the CRISv10 prologue scanner (cris_scan_prologue), this is not
|
/* Unlike the CRISv10 prologue scanner (cris_scan_prologue), this is not
|
||||||
@ -1416,16 +1403,16 @@ crisv32_scan_prologue (CORE_ADDR pc, struct frame_info *next_frame,
|
|||||||
the stack pointer is not adjusted, and (as a consequence) the return
|
the stack pointer is not adjusted, and (as a consequence) the return
|
||||||
address is not pushed onto the stack. */
|
address is not pushed onto the stack. */
|
||||||
|
|
||||||
/* We only want to know the end of the prologue when next_frame and info
|
/* We only want to know the end of the prologue when this_frame and info
|
||||||
are NULL (called from cris_skip_prologue i.e.). */
|
are NULL (called from cris_skip_prologue i.e.). */
|
||||||
if (next_frame == NULL && info == NULL)
|
if (this_frame == NULL && info == NULL)
|
||||||
{
|
{
|
||||||
return pc;
|
return pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The SP is assumed to be unaltered. */
|
/* The SP is assumed to be unaltered. */
|
||||||
this_base = frame_unwind_register_unsigned (next_frame,
|
this_base = get_frame_register_unsigned (this_frame,
|
||||||
gdbarch_sp_regnum (gdbarch));
|
gdbarch_sp_regnum (gdbarch));
|
||||||
info->base = this_base;
|
info->base = this_base;
|
||||||
info->prev_sp = this_base;
|
info->prev_sp = this_base;
|
||||||
|
|
||||||
@ -4207,22 +4194,22 @@ cris_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
|
|
||||||
set_gdbarch_unwind_pc (gdbarch, cris_unwind_pc);
|
set_gdbarch_unwind_pc (gdbarch, cris_unwind_pc);
|
||||||
set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp);
|
set_gdbarch_unwind_sp (gdbarch, cris_unwind_sp);
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, cris_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, cris_dummy_id);
|
||||||
|
|
||||||
if (tdep->cris_dwarf2_cfi == 1)
|
if (tdep->cris_dwarf2_cfi == 1)
|
||||||
{
|
{
|
||||||
/* Hook in the Dwarf-2 frame sniffer. */
|
/* Hook in the Dwarf-2 frame sniffer. */
|
||||||
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, cris_dwarf2_reg_to_regnum);
|
set_gdbarch_dwarf2_reg_to_regnum (gdbarch, cris_dwarf2_reg_to_regnum);
|
||||||
dwarf2_frame_set_init_reg (gdbarch, cris_dwarf2_frame_init_reg);
|
dwarf2_frame_set_init_reg (gdbarch, cris_dwarf2_frame_init_reg);
|
||||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
dwarf2_append_unwinders (gdbarch);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tdep->cris_mode != cris_mode_guru)
|
if (tdep->cris_mode != cris_mode_guru)
|
||||||
{
|
{
|
||||||
frame_unwind_append_sniffer (gdbarch, cris_sigtramp_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &cris_sigtramp_frame_unwind);
|
||||||
}
|
}
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, cris_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &cris_frame_unwind);
|
||||||
frame_base_set_default (gdbarch, &cris_frame_base);
|
frame_base_set_default (gdbarch, &cris_frame_base);
|
||||||
|
|
||||||
set_solib_svr4_fetch_link_map_offsets
|
set_solib_svr4_fetch_link_map_offsets
|
||||||
|
@ -165,7 +165,7 @@ frv_linux_pc_in_sigtramp (CORE_ADDR pc, char *name)
|
|||||||
} __attribute__((aligned(8))); */
|
} __attribute__((aligned(8))); */
|
||||||
|
|
||||||
static LONGEST
|
static LONGEST
|
||||||
frv_linux_sigcontext_reg_addr (struct frame_info *next_frame, int regno,
|
frv_linux_sigcontext_reg_addr (struct frame_info *this_frame, int regno,
|
||||||
CORE_ADDR *sc_addr_cache_ptr)
|
CORE_ADDR *sc_addr_cache_ptr)
|
||||||
{
|
{
|
||||||
CORE_ADDR sc_addr;
|
CORE_ADDR sc_addr;
|
||||||
@ -180,10 +180,10 @@ frv_linux_sigcontext_reg_addr (struct frame_info *next_frame, int regno,
|
|||||||
char buf[4];
|
char buf[4];
|
||||||
int tramp_type;
|
int tramp_type;
|
||||||
|
|
||||||
pc = frame_pc_unwind (next_frame);
|
pc = get_frame_pc (this_frame);
|
||||||
tramp_type = frv_linux_pc_in_sigtramp (pc, 0);
|
tramp_type = frv_linux_pc_in_sigtramp (pc, 0);
|
||||||
|
|
||||||
frame_unwind_register (next_frame, sp_regnum, buf);
|
get_frame_register (this_frame, sp_regnum, buf);
|
||||||
sp = extract_unsigned_integer (buf, sizeof buf);
|
sp = extract_unsigned_integer (buf, sizeof buf);
|
||||||
|
|
||||||
if (tramp_type == NORMAL_SIGTRAMP)
|
if (tramp_type == NORMAL_SIGTRAMP)
|
||||||
@ -253,10 +253,10 @@ frv_linux_sigcontext_reg_addr (struct frame_info *next_frame, int regno,
|
|||||||
/* Signal trampolines. */
|
/* Signal trampolines. */
|
||||||
|
|
||||||
static struct trad_frame_cache *
|
static struct trad_frame_cache *
|
||||||
frv_linux_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
|
frv_linux_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct trad_frame_cache *cache;
|
struct trad_frame_cache *cache;
|
||||||
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
|
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
char buf[4];
|
char buf[4];
|
||||||
int regnum;
|
int regnum;
|
||||||
@ -266,20 +266,20 @@ frv_linux_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache
|
|||||||
if (*this_cache)
|
if (*this_cache)
|
||||||
return *this_cache;
|
return *this_cache;
|
||||||
|
|
||||||
cache = trad_frame_cache_zalloc (next_frame);
|
cache = trad_frame_cache_zalloc (this_frame);
|
||||||
|
|
||||||
/* FIXME: cagney/2004-05-01: This is is long standing broken code.
|
/* FIXME: cagney/2004-05-01: This is is long standing broken code.
|
||||||
The frame ID's code address should be the start-address of the
|
The frame ID's code address should be the start-address of the
|
||||||
signal trampoline and not the current PC within that
|
signal trampoline and not the current PC within that
|
||||||
trampoline. */
|
trampoline. */
|
||||||
frame_unwind_register (next_frame, sp_regnum, buf);
|
get_frame_register (this_frame, sp_regnum, buf);
|
||||||
this_id = frame_id_build (extract_unsigned_integer (buf, sizeof buf),
|
this_id = frame_id_build (extract_unsigned_integer (buf, sizeof buf),
|
||||||
frame_pc_unwind (next_frame));
|
get_frame_pc (this_frame));
|
||||||
trad_frame_set_id (cache, this_id);
|
trad_frame_set_id (cache, this_id);
|
||||||
|
|
||||||
for (regnum = 0; regnum < frv_num_regs; regnum++)
|
for (regnum = 0; regnum < frv_num_regs; regnum++)
|
||||||
{
|
{
|
||||||
LONGEST reg_addr = frv_linux_sigcontext_reg_addr (next_frame, regnum,
|
LONGEST reg_addr = frv_linux_sigcontext_reg_addr (this_frame, regnum,
|
||||||
&sc_addr_cache_val);
|
&sc_addr_cache_val);
|
||||||
if (reg_addr != -1)
|
if (reg_addr != -1)
|
||||||
trad_frame_set_reg_addr (cache, regnum, reg_addr);
|
trad_frame_set_reg_addr (cache, regnum, reg_addr);
|
||||||
@ -290,48 +290,47 @@ frv_linux_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
frv_linux_sigtramp_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
frv_linux_sigtramp_frame_this_id (struct frame_info *this_frame, void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct trad_frame_cache *cache =
|
struct trad_frame_cache *cache =
|
||||||
frv_linux_sigtramp_frame_cache (next_frame, this_cache);
|
frv_linux_sigtramp_frame_cache (this_frame, this_cache);
|
||||||
trad_frame_get_id (cache, this_id);
|
trad_frame_get_id (cache, this_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
frv_linux_sigtramp_frame_prev_register (struct frame_info *next_frame,
|
frv_linux_sigtramp_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_cache,
|
void **this_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
/* Make sure we've initialized the cache. */
|
/* Make sure we've initialized the cache. */
|
||||||
struct trad_frame_cache *cache =
|
struct trad_frame_cache *cache =
|
||||||
frv_linux_sigtramp_frame_cache (next_frame, this_cache);
|
frv_linux_sigtramp_frame_cache (this_frame, this_cache);
|
||||||
trad_frame_get_register (cache, next_frame, regnum, optimizedp, lvalp,
|
return trad_frame_get_register (cache, this_frame, regnum);
|
||||||
addrp, realnump, valuep);
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
frv_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
|
||||||
|
struct frame_info *this_frame,
|
||||||
|
void **this_cache)
|
||||||
|
{
|
||||||
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
find_pc_partial_function (pc, &name, NULL, NULL);
|
||||||
|
if (frv_linux_pc_in_sigtramp (pc, name))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind frv_linux_sigtramp_frame_unwind =
|
static const struct frame_unwind frv_linux_sigtramp_frame_unwind =
|
||||||
{
|
{
|
||||||
SIGTRAMP_FRAME,
|
SIGTRAMP_FRAME,
|
||||||
frv_linux_sigtramp_frame_this_id,
|
frv_linux_sigtramp_frame_this_id,
|
||||||
frv_linux_sigtramp_frame_prev_register
|
frv_linux_sigtramp_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
frv_linux_sigtramp_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
frv_linux_sigtramp_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
CORE_ADDR pc = frame_pc_unwind (next_frame);
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
find_pc_partial_function (pc, &name, NULL, NULL);
|
|
||||||
if (frv_linux_pc_in_sigtramp (pc, name))
|
|
||||||
return &frv_linux_sigtramp_frame_unwind;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* The FRV kernel defines ELF_NGREG as 46. We add 2 in order to include
|
/* The FRV kernel defines ELF_NGREG as 46. We add 2 in order to include
|
||||||
the loadmap addresses in the register set. (See below for more info.) */
|
the loadmap addresses in the register set. (See below for more info.) */
|
||||||
@ -485,7 +484,7 @@ static void
|
|||||||
frv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
frv_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
/* Set the sigtramp frame sniffer. */
|
/* Set the sigtramp frame sniffer. */
|
||||||
frame_unwind_append_sniffer (gdbarch, frv_linux_sigtramp_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &frv_linux_sigtramp_frame_unwind);
|
||||||
set_gdbarch_regset_from_core_section (gdbarch,
|
set_gdbarch_regset_from_core_section (gdbarch,
|
||||||
frv_linux_regset_from_core_section);
|
frv_linux_regset_from_core_section);
|
||||||
}
|
}
|
||||||
|
@ -510,7 +510,7 @@ is_argument_reg (int reg)
|
|||||||
arguments in any frame but the top, you'll need to do this serious
|
arguments in any frame but the top, you'll need to do this serious
|
||||||
prologue analysis. */
|
prologue analysis. */
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame,
|
frv_analyze_prologue (CORE_ADDR pc, struct frame_info *this_frame,
|
||||||
struct frv_unwind_cache *info)
|
struct frv_unwind_cache *info)
|
||||||
{
|
{
|
||||||
/* When writing out instruction bitpatterns, we use the following
|
/* When writing out instruction bitpatterns, we use the following
|
||||||
@ -579,9 +579,9 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame,
|
|||||||
|
|
||||||
/* If we have a frame, we don't want to scan past the frame's pc. This
|
/* If we have a frame, we don't want to scan past the frame's pc. This
|
||||||
will catch those cases where the pc is in the prologue. */
|
will catch those cases where the pc is in the prologue. */
|
||||||
if (next_frame)
|
if (this_frame)
|
||||||
{
|
{
|
||||||
CORE_ADDR frame_pc = frame_pc_unwind (next_frame);
|
CORE_ADDR frame_pc = get_frame_pc (this_frame);
|
||||||
if (frame_pc < lim_pc)
|
if (frame_pc < lim_pc)
|
||||||
lim_pc = frame_pc;
|
lim_pc = frame_pc;
|
||||||
}
|
}
|
||||||
@ -927,7 +927,7 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame,
|
|||||||
pc = next_pc;
|
pc = next_pc;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (next_frame && info)
|
if (this_frame && info)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
ULONGEST this_base;
|
ULONGEST this_base;
|
||||||
@ -938,9 +938,9 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *next_frame,
|
|||||||
because instructions may save relative to the SP, but we need
|
because instructions may save relative to the SP, but we need
|
||||||
their addresses relative to the FP. */
|
their addresses relative to the FP. */
|
||||||
if (fp_set)
|
if (fp_set)
|
||||||
this_base = frame_unwind_register_unsigned (next_frame, fp_regnum);
|
this_base = get_frame_register_unsigned (this_frame, fp_regnum);
|
||||||
else
|
else
|
||||||
this_base = frame_unwind_register_unsigned (next_frame, sp_regnum);
|
this_base = get_frame_register_unsigned (this_frame, sp_regnum);
|
||||||
|
|
||||||
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
||||||
if (gr_saved[i])
|
if (gr_saved[i])
|
||||||
@ -1000,10 +1000,10 @@ frv_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
|||||||
|
|
||||||
|
|
||||||
static struct frv_unwind_cache *
|
static struct frv_unwind_cache *
|
||||||
frv_frame_unwind_cache (struct frame_info *next_frame,
|
frv_frame_unwind_cache (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
||||||
CORE_ADDR pc;
|
CORE_ADDR pc;
|
||||||
ULONGEST this_base;
|
ULONGEST this_base;
|
||||||
struct frv_unwind_cache *info;
|
struct frv_unwind_cache *info;
|
||||||
@ -1013,11 +1013,10 @@ frv_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
|
|
||||||
info = FRAME_OBSTACK_ZALLOC (struct frv_unwind_cache);
|
info = FRAME_OBSTACK_ZALLOC (struct frv_unwind_cache);
|
||||||
(*this_prologue_cache) = info;
|
(*this_prologue_cache) = info;
|
||||||
info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
/* Prologue analysis does the rest... */
|
/* Prologue analysis does the rest... */
|
||||||
frv_analyze_prologue (frame_func_unwind (next_frame, NORMAL_FRAME),
|
frv_analyze_prologue (get_frame_func (this_frame), this_frame, info);
|
||||||
next_frame, info);
|
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
@ -1350,18 +1349,18 @@ frv_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
frame. This will be used to create a new GDB frame struct. */
|
frame. This will be used to create a new GDB frame struct. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
frv_frame_this_id (struct frame_info *next_frame,
|
frv_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache, struct frame_id *this_id)
|
void **this_prologue_cache, struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct frv_unwind_cache *info
|
struct frv_unwind_cache *info
|
||||||
= frv_frame_unwind_cache (next_frame, this_prologue_cache);
|
= frv_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
CORE_ADDR base;
|
CORE_ADDR base;
|
||||||
CORE_ADDR func;
|
CORE_ADDR func;
|
||||||
struct minimal_symbol *msym_stack;
|
struct minimal_symbol *msym_stack;
|
||||||
struct frame_id id;
|
struct frame_id id;
|
||||||
|
|
||||||
/* The FUNC is easy. */
|
/* The FUNC is easy. */
|
||||||
func = frame_func_unwind (next_frame, NORMAL_FRAME);
|
func = get_frame_func (this_frame);
|
||||||
|
|
||||||
/* Check if the stack is empty. */
|
/* Check if the stack is empty. */
|
||||||
msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL);
|
msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL);
|
||||||
@ -1379,36 +1378,28 @@ frv_frame_this_id (struct frame_info *next_frame,
|
|||||||
(*this_id) = id;
|
(*this_id) = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
frv_frame_prev_register (struct frame_info *next_frame,
|
frv_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *bufferp)
|
|
||||||
{
|
{
|
||||||
struct frv_unwind_cache *info
|
struct frv_unwind_cache *info
|
||||||
= frv_frame_unwind_cache (next_frame, this_prologue_cache);
|
= frv_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, bufferp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind frv_frame_unwind = {
|
static const struct frame_unwind frv_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
frv_frame_this_id,
|
frv_frame_this_id,
|
||||||
frv_frame_prev_register
|
frv_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
frv_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &frv_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
frv_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
frv_frame_base_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct frv_unwind_cache *info
|
struct frv_unwind_cache *info
|
||||||
= frv_frame_unwind_cache (next_frame, this_cache);
|
= frv_frame_unwind_cache (this_frame, this_cache);
|
||||||
return info->base;
|
return info->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1426,16 +1417,15 @@ frv_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
|
/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
|
||||||
dummy frame. The frame ID's base needs to match the TOS value
|
frame. The frame ID's base needs to match the TOS value saved by
|
||||||
saved by save_dummy_frame_tos(), and the PC match the dummy frame's
|
save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */
|
||||||
breakpoint. */
|
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
frv_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
frv_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
return frame_id_build (frv_unwind_sp (gdbarch, next_frame),
|
CORE_ADDR sp = get_frame_register_unsigned (this_frame, sp_regnum);
|
||||||
frame_pc_unwind (next_frame));
|
return frame_id_build (sp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct gdbarch *
|
static struct gdbarch *
|
||||||
@ -1527,7 +1517,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
|
|
||||||
/* Settings for calling functions in the inferior. */
|
/* Settings for calling functions in the inferior. */
|
||||||
set_gdbarch_push_dummy_call (gdbarch, frv_push_dummy_call);
|
set_gdbarch_push_dummy_call (gdbarch, frv_push_dummy_call);
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, frv_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, frv_dummy_id);
|
||||||
|
|
||||||
/* Settings that should be unnecessary. */
|
/* Settings that should be unnecessary. */
|
||||||
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
|
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
|
||||||
@ -1569,7 +1559,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
gdbarch_init_osabi (info, gdbarch);
|
gdbarch_init_osabi (info, gdbarch);
|
||||||
|
|
||||||
/* Set the fallback (prologue based) frame sniffer. */
|
/* Set the fallback (prologue based) frame sniffer. */
|
||||||
frame_unwind_append_sniffer (gdbarch, frv_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &frv_frame_unwind);
|
||||||
|
|
||||||
/* Enable TLS support. */
|
/* Enable TLS support. */
|
||||||
set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
set_gdbarch_fetch_tls_load_module_address (gdbarch,
|
||||||
|
@ -107,10 +107,10 @@ h8300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
h8300_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
h8300_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
return frame_id_build (h8300_unwind_sp (gdbarch, next_frame),
|
CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
|
||||||
frame_pc_unwind (next_frame));
|
return frame_id_build (sp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Normal frames. */
|
/* Normal frames. */
|
||||||
@ -420,9 +420,9 @@ h8300_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct h8300_frame_cache *
|
static struct h8300_frame_cache *
|
||||||
h8300_frame_cache (struct frame_info *next_frame, void **this_cache)
|
h8300_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
||||||
struct h8300_frame_cache *cache;
|
struct h8300_frame_cache *cache;
|
||||||
char buf[4];
|
char buf[4];
|
||||||
int i;
|
int i;
|
||||||
@ -441,14 +441,14 @@ h8300_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
optional. For these "frameless" functions the frame pointer is
|
optional. For these "frameless" functions the frame pointer is
|
||||||
actually the frame pointer of the calling frame. */
|
actually the frame pointer of the calling frame. */
|
||||||
|
|
||||||
cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM);
|
cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM);
|
||||||
if (cache->base == 0)
|
if (cache->base == 0)
|
||||||
return cache;
|
return cache;
|
||||||
|
|
||||||
cache->saved_regs[E_PC_REGNUM] = -BINWORD (gdbarch);
|
cache->saved_regs[E_PC_REGNUM] = -BINWORD (gdbarch);
|
||||||
|
|
||||||
cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
|
cache->pc = get_frame_func (this_frame);
|
||||||
current_pc = frame_pc_unwind (next_frame);
|
current_pc = get_frame_pc (this_frame);
|
||||||
if (cache->pc != 0)
|
if (cache->pc != 0)
|
||||||
h8300_analyze_prologue (cache->pc, current_pc, cache);
|
h8300_analyze_prologue (cache->pc, current_pc, cache);
|
||||||
|
|
||||||
@ -462,7 +462,7 @@ h8300_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
frame by looking at the stack pointer. For truly "frameless"
|
frame by looking at the stack pointer. For truly "frameless"
|
||||||
functions this might work too. */
|
functions this might work too. */
|
||||||
|
|
||||||
cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM)
|
cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM)
|
||||||
+ cache->sp_offset;
|
+ cache->sp_offset;
|
||||||
cache->saved_sp = cache->base + BINWORD (gdbarch);
|
cache->saved_sp = cache->base + BINWORD (gdbarch);
|
||||||
cache->saved_regs[E_PC_REGNUM] = 0;
|
cache->saved_regs[E_PC_REGNUM] = 0;
|
||||||
@ -483,11 +483,11 @@ h8300_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
h8300_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
h8300_frame_this_id (struct frame_info *this_frame, void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct h8300_frame_cache *cache =
|
struct h8300_frame_cache *cache =
|
||||||
h8300_frame_cache (next_frame, this_cache);
|
h8300_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
/* This marks the outermost frame. */
|
/* This marks the outermost frame. */
|
||||||
if (cache->base == 0)
|
if (cache->base == 0)
|
||||||
@ -496,65 +496,39 @@ h8300_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
|||||||
*this_id = frame_id_build (cache->saved_sp, cache->pc);
|
*this_id = frame_id_build (cache->saved_sp, cache->pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
h8300_frame_prev_register (struct frame_info *next_frame, void **this_cache,
|
h8300_frame_prev_register (struct frame_info *this_frame, void **this_cache,
|
||||||
int regnum, int *optimizedp,
|
int regnum)
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
||||||
struct h8300_frame_cache *cache =
|
struct h8300_frame_cache *cache =
|
||||||
h8300_frame_cache (next_frame, this_cache);
|
h8300_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
gdb_assert (regnum >= 0);
|
gdb_assert (regnum >= 0);
|
||||||
|
|
||||||
if (regnum == E_SP_REGNUM && cache->saved_sp)
|
if (regnum == E_SP_REGNUM && cache->saved_sp)
|
||||||
{
|
return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
|
||||||
*optimizedp = 0;
|
|
||||||
*lvalp = not_lval;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = -1;
|
|
||||||
if (valuep)
|
|
||||||
store_unsigned_integer (valuep, BINWORD (gdbarch), cache->saved_sp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (regnum < gdbarch_num_regs (gdbarch)
|
if (regnum < gdbarch_num_regs (gdbarch)
|
||||||
&& cache->saved_regs[regnum] != -1)
|
&& cache->saved_regs[regnum] != -1)
|
||||||
{
|
return frame_unwind_got_memory (this_frame, regnum,
|
||||||
*optimizedp = 0;
|
cache->saved_regs[regnum]);
|
||||||
*lvalp = lval_memory;
|
|
||||||
*addrp = cache->saved_regs[regnum];
|
|
||||||
*realnump = -1;
|
|
||||||
if (valuep)
|
|
||||||
read_memory (*addrp, valuep, register_size (gdbarch, regnum));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
*optimizedp = 0;
|
return frame_unwind_got_register (this_frame, regnum, regnum);
|
||||||
*lvalp = lval_register;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = regnum;
|
|
||||||
if (valuep)
|
|
||||||
frame_unwind_register (next_frame, *realnump, valuep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind h8300_frame_unwind = {
|
static const struct frame_unwind h8300_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
h8300_frame_this_id,
|
h8300_frame_this_id,
|
||||||
h8300_frame_prev_register
|
h8300_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
h8300_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &h8300_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
h8300_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
h8300_frame_base_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct h8300_frame_cache *cache = h8300_frame_cache (next_frame, this_cache);
|
struct h8300_frame_cache *cache = h8300_frame_cache (this_frame, this_cache);
|
||||||
return cache->base;
|
return cache->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1337,7 +1311,7 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
/* Frame unwinder. */
|
/* Frame unwinder. */
|
||||||
set_gdbarch_unwind_pc (gdbarch, h8300_unwind_pc);
|
set_gdbarch_unwind_pc (gdbarch, h8300_unwind_pc);
|
||||||
set_gdbarch_unwind_sp (gdbarch, h8300_unwind_sp);
|
set_gdbarch_unwind_sp (gdbarch, h8300_unwind_sp);
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, h8300_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, h8300_dummy_id);
|
||||||
frame_base_set_default (gdbarch, &h8300_frame_base);
|
frame_base_set_default (gdbarch, &h8300_frame_base);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1359,8 +1333,8 @@ h8300_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
|
set_gdbarch_believe_pcc_promotion (gdbarch, 1);
|
||||||
|
|
||||||
/* Hook in the DWARF CFI frame unwinder. */
|
/* Hook in the DWARF CFI frame unwinder. */
|
||||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
dwarf2_append_unwinders (gdbarch);
|
||||||
frame_unwind_append_sniffer (gdbarch, h8300_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &h8300_frame_unwind);
|
||||||
|
|
||||||
return gdbarch;
|
return gdbarch;
|
||||||
|
|
||||||
|
@ -196,10 +196,10 @@ struct hppa_linux_sigtramp_unwind_cache
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct hppa_linux_sigtramp_unwind_cache *
|
static struct hppa_linux_sigtramp_unwind_cache *
|
||||||
hppa_linux_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
|
hppa_linux_sigtramp_frame_unwind_cache (struct frame_info *this_frame,
|
||||||
void **this_cache)
|
void **this_cache)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
||||||
struct hppa_linux_sigtramp_unwind_cache *info;
|
struct hppa_linux_sigtramp_unwind_cache *info;
|
||||||
CORE_ADDR pc, scptr;
|
CORE_ADDR pc, scptr;
|
||||||
int i;
|
int i;
|
||||||
@ -209,9 +209,9 @@ hppa_linux_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
|
|
||||||
info = FRAME_OBSTACK_ZALLOC (struct hppa_linux_sigtramp_unwind_cache);
|
info = FRAME_OBSTACK_ZALLOC (struct hppa_linux_sigtramp_unwind_cache);
|
||||||
*this_cache = info;
|
*this_cache = info;
|
||||||
info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
pc = frame_pc_unwind (next_frame);
|
pc = get_frame_pc (this_frame);
|
||||||
scptr = hppa_linux_sigtramp_find_sigcontext (pc);
|
scptr = hppa_linux_sigtramp_find_sigcontext (pc);
|
||||||
|
|
||||||
/* structure of struct sigcontext:
|
/* structure of struct sigcontext:
|
||||||
@ -262,58 +262,59 @@ hppa_linux_sigtramp_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
info->saved_regs[HPPA_PCOQ_TAIL_REGNUM].addr = scptr;
|
info->saved_regs[HPPA_PCOQ_TAIL_REGNUM].addr = scptr;
|
||||||
scptr += 4;
|
scptr += 4;
|
||||||
|
|
||||||
info->base = frame_unwind_register_unsigned (next_frame, HPPA_SP_REGNUM);
|
info->base = get_frame_register_unsigned (this_frame, HPPA_SP_REGNUM);
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
hppa_linux_sigtramp_frame_this_id (struct frame_info *next_frame,
|
hppa_linux_sigtramp_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct hppa_linux_sigtramp_unwind_cache *info
|
struct hppa_linux_sigtramp_unwind_cache *info
|
||||||
= hppa_linux_sigtramp_frame_unwind_cache (next_frame, this_prologue_cache);
|
= hppa_linux_sigtramp_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
*this_id = frame_id_build (info->base, frame_pc_unwind (next_frame));
|
*this_id = frame_id_build (info->base, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
hppa_linux_sigtramp_frame_prev_register (struct frame_info *next_frame,
|
hppa_linux_sigtramp_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache,
|
||||||
int regnum, int *optimizedp,
|
int regnum)
|
||||||
enum lval_type *lvalp,
|
|
||||||
CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct hppa_linux_sigtramp_unwind_cache *info
|
struct hppa_linux_sigtramp_unwind_cache *info
|
||||||
= hppa_linux_sigtramp_frame_unwind_cache (next_frame, this_prologue_cache);
|
= hppa_linux_sigtramp_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
hppa_frame_prev_register_helper (next_frame, info->saved_regs, regnum,
|
return hppa_frame_prev_register_helper (this_frame,
|
||||||
optimizedp, lvalp, addrp, realnump, valuep);
|
info->saved_regs, regnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind hppa_linux_sigtramp_frame_unwind = {
|
|
||||||
SIGTRAMP_FRAME,
|
|
||||||
hppa_linux_sigtramp_frame_this_id,
|
|
||||||
hppa_linux_sigtramp_frame_prev_register
|
|
||||||
};
|
|
||||||
|
|
||||||
/* hppa-linux always uses "new-style" rt-signals. The signal handler's return
|
/* hppa-linux always uses "new-style" rt-signals. The signal handler's return
|
||||||
address should point to a signal trampoline on the stack. The signal
|
address should point to a signal trampoline on the stack. The signal
|
||||||
trampoline is embedded in a rt_sigframe structure that is aligned on
|
trampoline is embedded in a rt_sigframe structure that is aligned on
|
||||||
the stack. We take advantage of the fact that sp must be 64-byte aligned,
|
the stack. We take advantage of the fact that sp must be 64-byte aligned,
|
||||||
and the trampoline is small, so by rounding down the trampoline address
|
and the trampoline is small, so by rounding down the trampoline address
|
||||||
we can find the beginning of the struct rt_sigframe. */
|
we can find the beginning of the struct rt_sigframe. */
|
||||||
static const struct frame_unwind *
|
static int
|
||||||
hppa_linux_sigtramp_unwind_sniffer (struct frame_info *next_frame)
|
hppa_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
|
||||||
|
struct frame_info *this_frame,
|
||||||
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
CORE_ADDR pc = frame_pc_unwind (next_frame);
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
||||||
|
|
||||||
if (hppa_linux_sigtramp_find_sigcontext (pc))
|
if (hppa_linux_sigtramp_find_sigcontext (pc))
|
||||||
return &hppa_linux_sigtramp_frame_unwind;
|
return 1;
|
||||||
|
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct frame_unwind hppa_linux_sigtramp_frame_unwind = {
|
||||||
|
SIGTRAMP_FRAME,
|
||||||
|
hppa_linux_sigtramp_frame_this_id,
|
||||||
|
hppa_linux_sigtramp_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
hppa_linux_sigtramp_frame_sniffer
|
||||||
|
};
|
||||||
|
|
||||||
/* Attempt to find (and return) the global pointer for the given
|
/* Attempt to find (and return) the global pointer for the given
|
||||||
function.
|
function.
|
||||||
|
|
||||||
@ -522,7 +523,7 @@ hppa_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|||||||
|
|
||||||
set_gdbarch_write_pc (gdbarch, hppa_linux_target_write_pc);
|
set_gdbarch_write_pc (gdbarch, hppa_linux_target_write_pc);
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, hppa_linux_sigtramp_unwind_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &hppa_linux_sigtramp_frame_unwind);
|
||||||
|
|
||||||
/* GNU/Linux uses SVR4-style shared libraries. */
|
/* GNU/Linux uses SVR4-style shared libraries. */
|
||||||
set_solib_svr4_fetch_link_map_offsets
|
set_solib_svr4_fetch_link_map_offsets
|
||||||
|
@ -356,7 +356,7 @@ iq2000_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct iq2000_frame_cache *
|
static struct iq2000_frame_cache *
|
||||||
iq2000_frame_cache (struct frame_info *next_frame, void **this_cache)
|
iq2000_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct iq2000_frame_cache *cache;
|
struct iq2000_frame_cache *cache;
|
||||||
CORE_ADDR current_pc;
|
CORE_ADDR current_pc;
|
||||||
@ -369,16 +369,16 @@ iq2000_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
iq2000_init_frame_cache (cache);
|
iq2000_init_frame_cache (cache);
|
||||||
*this_cache = cache;
|
*this_cache = cache;
|
||||||
|
|
||||||
cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM);
|
cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM);
|
||||||
//if (cache->base == 0)
|
//if (cache->base == 0)
|
||||||
//return cache;
|
//return cache;
|
||||||
|
|
||||||
current_pc = frame_pc_unwind (next_frame);
|
current_pc = get_frame_pc (this_frame);
|
||||||
find_pc_partial_function (current_pc, NULL, &cache->pc, NULL);
|
find_pc_partial_function (current_pc, NULL, &cache->pc, NULL);
|
||||||
if (cache->pc != 0)
|
if (cache->pc != 0)
|
||||||
iq2000_scan_prologue (cache->pc, current_pc, next_frame, cache);
|
iq2000_scan_prologue (cache->pc, current_pc, this_frame, cache);
|
||||||
if (!cache->using_fp)
|
if (!cache->using_fp)
|
||||||
cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
|
cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
|
||||||
|
|
||||||
cache->saved_sp = cache->base + cache->framesize;
|
cache->saved_sp = cache->base + cache->framesize;
|
||||||
|
|
||||||
@ -389,52 +389,30 @@ iq2000_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
iq2000_frame_prev_register (struct frame_info *next_frame, void **this_cache,
|
iq2000_frame_prev_register (struct frame_info *this_frame, void **this_cache,
|
||||||
int regnum, int *optimizedp,
|
int regnum)
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct iq2000_frame_cache *cache = iq2000_frame_cache (next_frame, this_cache);
|
struct iq2000_frame_cache *cache = iq2000_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
if (regnum == E_SP_REGNUM && cache->saved_sp)
|
if (regnum == E_SP_REGNUM && cache->saved_sp)
|
||||||
{
|
return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
|
||||||
*optimizedp = 0;
|
|
||||||
*lvalp = not_lval;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = -1;
|
|
||||||
if (valuep)
|
|
||||||
store_unsigned_integer (valuep, 4, cache->saved_sp);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (regnum == E_PC_REGNUM)
|
if (regnum == E_PC_REGNUM)
|
||||||
regnum = E_LR_REGNUM;
|
regnum = E_LR_REGNUM;
|
||||||
|
|
||||||
if (regnum < E_NUM_REGS && cache->saved_regs[regnum] != -1)
|
if (regnum < E_NUM_REGS && cache->saved_regs[regnum] != -1)
|
||||||
{
|
return frame_unwind_got_memory (this_frame, regnum,
|
||||||
*optimizedp = 0;
|
cache->saved_regs[regnum]);
|
||||||
*lvalp = lval_memory;
|
|
||||||
*addrp = cache->saved_regs[regnum];
|
|
||||||
*realnump = -1;
|
|
||||||
if (valuep)
|
|
||||||
read_memory (*addrp, valuep,
|
|
||||||
register_size (get_frame_arch (next_frame), regnum));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
*optimizedp = 0;
|
return frame_unwind_got_register (this_frame, regnum, regnum);
|
||||||
*lvalp = lval_register;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = regnum;
|
|
||||||
if (valuep)
|
|
||||||
frame_unwind_register (next_frame, (*realnump), valuep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
iq2000_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
iq2000_frame_this_id (struct frame_info *this_frame, void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct iq2000_frame_cache *cache = iq2000_frame_cache (next_frame, this_cache);
|
struct iq2000_frame_cache *cache = iq2000_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
/* This marks the outermost frame. */
|
/* This marks the outermost frame. */
|
||||||
if (cache->base == 0)
|
if (cache->base == 0)
|
||||||
@ -446,15 +424,11 @@ iq2000_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
|||||||
static const struct frame_unwind iq2000_frame_unwind = {
|
static const struct frame_unwind iq2000_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
iq2000_frame_this_id,
|
iq2000_frame_this_id,
|
||||||
iq2000_frame_prev_register
|
iq2000_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
iq2000_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &iq2000_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
iq2000_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
iq2000_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
||||||
{
|
{
|
||||||
@ -468,16 +442,16 @@ iq2000_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
iq2000_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
iq2000_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
return frame_id_build (iq2000_unwind_sp (gdbarch, next_frame),
|
CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
|
||||||
frame_pc_unwind (next_frame));
|
return frame_id_build (sp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
iq2000_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
iq2000_frame_base_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct iq2000_frame_cache *cache = iq2000_frame_cache (next_frame, this_cache);
|
struct iq2000_frame_cache *cache = iq2000_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
return cache->base;
|
return cache->base;
|
||||||
}
|
}
|
||||||
@ -851,14 +825,14 @@ iq2000_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
|
set_gdbarch_frame_align (gdbarch, iq2000_frame_align);
|
||||||
set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp);
|
set_gdbarch_unwind_sp (gdbarch, iq2000_unwind_sp);
|
||||||
set_gdbarch_unwind_pc (gdbarch, iq2000_unwind_pc);
|
set_gdbarch_unwind_pc (gdbarch, iq2000_unwind_pc);
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, iq2000_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, iq2000_dummy_id);
|
||||||
frame_base_set_default (gdbarch, &iq2000_frame_base);
|
frame_base_set_default (gdbarch, &iq2000_frame_base);
|
||||||
set_gdbarch_push_dummy_call (gdbarch, iq2000_push_dummy_call);
|
set_gdbarch_push_dummy_call (gdbarch, iq2000_push_dummy_call);
|
||||||
|
|
||||||
gdbarch_init_osabi (info, gdbarch);
|
gdbarch_init_osabi (info, gdbarch);
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
dwarf2_append_unwinders (gdbarch);
|
||||||
frame_unwind_append_sniffer (gdbarch, iq2000_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &iq2000_frame_unwind);
|
||||||
|
|
||||||
return gdbarch;
|
return gdbarch;
|
||||||
}
|
}
|
||||||
|
@ -1828,13 +1828,13 @@ m32c_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR ip)
|
|||||||
/* Stack unwinding. */
|
/* Stack unwinding. */
|
||||||
|
|
||||||
static struct m32c_prologue *
|
static struct m32c_prologue *
|
||||||
m32c_analyze_frame_prologue (struct frame_info *next_frame,
|
m32c_analyze_frame_prologue (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
if (! *this_prologue_cache)
|
if (! *this_prologue_cache)
|
||||||
{
|
{
|
||||||
CORE_ADDR func_start = frame_func_unwind (next_frame, NORMAL_FRAME);
|
CORE_ADDR func_start = get_frame_func (this_frame);
|
||||||
CORE_ADDR stop_addr = frame_pc_unwind (next_frame);
|
CORE_ADDR stop_addr = get_frame_pc (this_frame);
|
||||||
|
|
||||||
/* If we couldn't find any function containing the PC, then
|
/* If we couldn't find any function containing the PC, then
|
||||||
just initialize the prologue cache, but don't do anything. */
|
just initialize the prologue cache, but don't do anything. */
|
||||||
@ -1842,7 +1842,7 @@ m32c_analyze_frame_prologue (struct frame_info *next_frame,
|
|||||||
stop_addr = func_start;
|
stop_addr = func_start;
|
||||||
|
|
||||||
*this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct m32c_prologue);
|
*this_prologue_cache = FRAME_OBSTACK_ZALLOC (struct m32c_prologue);
|
||||||
m32c_analyze_prologue (get_frame_arch (next_frame),
|
m32c_analyze_prologue (get_frame_arch (this_frame),
|
||||||
func_start, stop_addr, *this_prologue_cache);
|
func_start, stop_addr, *this_prologue_cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1851,12 +1851,12 @@ m32c_analyze_frame_prologue (struct frame_info *next_frame,
|
|||||||
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
m32c_frame_base (struct frame_info *next_frame,
|
m32c_frame_base (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
struct m32c_prologue *p
|
struct m32c_prologue *p
|
||||||
= m32c_analyze_frame_prologue (next_frame, this_prologue_cache);
|
= m32c_analyze_frame_prologue (this_frame, this_prologue_cache);
|
||||||
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
|
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
|
||||||
|
|
||||||
/* In functions that use alloca, the distance between the stack
|
/* In functions that use alloca, the distance between the stack
|
||||||
pointer and the frame base varies dynamically, so we can't use
|
pointer and the frame base varies dynamically, so we can't use
|
||||||
@ -1869,14 +1869,14 @@ m32c_frame_base (struct frame_info *next_frame,
|
|||||||
case prologue_with_frame_ptr:
|
case prologue_with_frame_ptr:
|
||||||
{
|
{
|
||||||
CORE_ADDR fb
|
CORE_ADDR fb
|
||||||
= frame_unwind_register_unsigned (next_frame, tdep->fb->num);
|
= get_frame_register_unsigned (this_frame, tdep->fb->num);
|
||||||
return fb - p->frame_ptr_offset;
|
return fb - p->frame_ptr_offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
case prologue_sans_frame_ptr:
|
case prologue_sans_frame_ptr:
|
||||||
{
|
{
|
||||||
CORE_ADDR sp
|
CORE_ADDR sp
|
||||||
= frame_unwind_register_unsigned (next_frame, tdep->sp->num);
|
= get_frame_register_unsigned (this_frame, tdep->sp->num);
|
||||||
return sp - p->frame_size;
|
return sp - p->frame_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1890,82 +1890,52 @@ m32c_frame_base (struct frame_info *next_frame,
|
|||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
m32c_this_id (struct frame_info *next_frame,
|
m32c_this_id (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
CORE_ADDR base = m32c_frame_base (next_frame, this_prologue_cache);
|
CORE_ADDR base = m32c_frame_base (this_frame, this_prologue_cache);
|
||||||
|
|
||||||
if (base)
|
if (base)
|
||||||
*this_id = frame_id_build (base,
|
*this_id = frame_id_build (base, get_frame_func (this_frame));
|
||||||
frame_func_unwind (next_frame, NORMAL_FRAME));
|
|
||||||
/* Otherwise, leave it unset, and that will terminate the backtrace. */
|
/* Otherwise, leave it unset, and that will terminate the backtrace. */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
m32c_prev_register (struct frame_info *next_frame,
|
m32c_prev_register (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *bufferp)
|
|
||||||
{
|
{
|
||||||
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (next_frame));
|
struct gdbarch_tdep *tdep = gdbarch_tdep (get_frame_arch (this_frame));
|
||||||
struct m32c_prologue *p
|
struct m32c_prologue *p
|
||||||
= m32c_analyze_frame_prologue (next_frame, this_prologue_cache);
|
= m32c_analyze_frame_prologue (this_frame, this_prologue_cache);
|
||||||
CORE_ADDR frame_base = m32c_frame_base (next_frame, this_prologue_cache);
|
CORE_ADDR frame_base = m32c_frame_base (this_frame, this_prologue_cache);
|
||||||
int reg_size = register_size (get_frame_arch (next_frame), regnum);
|
int reg_size = register_size (get_frame_arch (this_frame), regnum);
|
||||||
|
|
||||||
if (regnum == tdep->sp->num)
|
if (regnum == tdep->sp->num)
|
||||||
{
|
return frame_unwind_got_constant (this_frame, regnum, frame_base);
|
||||||
*optimizedp = 0;
|
|
||||||
*lvalp = not_lval;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = -1;
|
|
||||||
if (bufferp)
|
|
||||||
store_unsigned_integer (bufferp, reg_size, frame_base);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If prologue analysis says we saved this register somewhere,
|
/* If prologue analysis says we saved this register somewhere,
|
||||||
return a description of the stack slot holding it. */
|
return a description of the stack slot holding it. */
|
||||||
else if (p->reg_offset[regnum] != 1)
|
if (p->reg_offset[regnum] != 1)
|
||||||
{
|
return frame_unwind_got_memory (this_frame, regnum,
|
||||||
*optimizedp = 0;
|
frame_base + p->reg_offset[regnum]);
|
||||||
*lvalp = lval_memory;
|
|
||||||
*addrp = frame_base + p->reg_offset[regnum];
|
|
||||||
*realnump = -1;
|
|
||||||
if (bufferp)
|
|
||||||
get_frame_memory (next_frame, *addrp, bufferp, reg_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Otherwise, presume we haven't changed the value of this
|
/* Otherwise, presume we haven't changed the value of this
|
||||||
register, and get it from the next frame. */
|
register, and get it from the next frame. */
|
||||||
else
|
return frame_unwind_got_register (this_frame, regnum, regnum);
|
||||||
{
|
|
||||||
*optimizedp = 0;
|
|
||||||
*lvalp = lval_register;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = regnum;
|
|
||||||
if (bufferp)
|
|
||||||
frame_unwind_register (next_frame, *realnump, bufferp);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const struct frame_unwind m32c_unwind = {
|
static const struct frame_unwind m32c_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
m32c_this_id,
|
m32c_this_id,
|
||||||
m32c_prev_register
|
m32c_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
m32c_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &m32c_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
m32c_unwind_pc (struct gdbarch *arch, struct frame_info *next_frame)
|
m32c_unwind_pc (struct gdbarch *arch, struct frame_info *next_frame)
|
||||||
{
|
{
|
||||||
@ -2146,7 +2116,7 @@ m32c_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
|||||||
|
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
m32c_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
m32c_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
/* This needs to return a frame ID whose PC is the return address
|
/* This needs to return a frame ID whose PC is the return address
|
||||||
passed to m32c_push_dummy_call, and whose stack_addr is the SP
|
passed to m32c_push_dummy_call, and whose stack_addr is the SP
|
||||||
@ -2154,8 +2124,9 @@ m32c_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
|
|
||||||
m32c_unwind_sp gives us the CFA, which is the value the SP had
|
m32c_unwind_sp gives us the CFA, which is the value the SP had
|
||||||
before the return address was pushed. */
|
before the return address was pushed. */
|
||||||
return frame_id_build (m32c_unwind_sp (gdbarch, next_frame),
|
struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
|
||||||
frame_pc_unwind (next_frame));
|
CORE_ADDR sp = get_frame_register_unsigned (this_frame, tdep->sp->num);
|
||||||
|
return frame_id_build (sp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2611,14 +2582,14 @@ m32c_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
know which, but I do know that the prologue analyzer works better.
|
know which, but I do know that the prologue analyzer works better.
|
||||||
MVS 04/13/06
|
MVS 04/13/06
|
||||||
*/
|
*/
|
||||||
frame_unwind_append_sniffer (arch, dwarf2_frame_sniffer);
|
dwarf2_append_sniffers (arch);
|
||||||
#endif
|
#endif
|
||||||
frame_unwind_append_sniffer (arch, m32c_frame_sniffer);
|
frame_unwind_append_unwinder (arch, &m32c_unwind);
|
||||||
|
|
||||||
/* Inferior calls. */
|
/* Inferior calls. */
|
||||||
set_gdbarch_push_dummy_call (arch, m32c_push_dummy_call);
|
set_gdbarch_push_dummy_call (arch, m32c_push_dummy_call);
|
||||||
set_gdbarch_return_value (arch, m32c_return_value);
|
set_gdbarch_return_value (arch, m32c_return_value);
|
||||||
set_gdbarch_unwind_dummy_id (arch, m32c_unwind_dummy_id);
|
set_gdbarch_dummy_id (arch, m32c_dummy_id);
|
||||||
|
|
||||||
/* Trampolines. */
|
/* Trampolines. */
|
||||||
set_gdbarch_skip_trampoline_code (arch, m32c_skip_trampoline_code);
|
set_gdbarch_skip_trampoline_code (arch, m32c_skip_trampoline_code);
|
||||||
|
@ -84,7 +84,7 @@ static const gdb_byte linux_sigtramp_code[] = {
|
|||||||
the routine. Otherwise, return 0. */
|
the routine. Otherwise, return 0. */
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
m32r_linux_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
|
m32r_linux_sigtramp_start (CORE_ADDR pc, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
gdb_byte buf[4];
|
gdb_byte buf[4];
|
||||||
|
|
||||||
@ -98,7 +98,7 @@ m32r_linux_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
|
|||||||
|
|
||||||
if (pc % 2 != 0)
|
if (pc % 2 != 0)
|
||||||
{
|
{
|
||||||
if (!safe_frame_unwind_memory (next_frame, pc, buf, 2))
|
if (!safe_frame_unwind_memory (this_frame, pc, buf, 2))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (memcmp (buf, linux_sigtramp_code, 2) == 0)
|
if (memcmp (buf, linux_sigtramp_code, 2) == 0)
|
||||||
@ -107,7 +107,7 @@ m32r_linux_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!safe_frame_unwind_memory (next_frame, pc, buf, 4))
|
if (!safe_frame_unwind_memory (this_frame, pc, buf, 4))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (memcmp (buf, linux_sigtramp_code, 4) != 0)
|
if (memcmp (buf, linux_sigtramp_code, 4) != 0)
|
||||||
@ -132,7 +132,7 @@ static const gdb_byte linux_rt_sigtramp_code[] = {
|
|||||||
of the routine. Otherwise, return 0. */
|
of the routine. Otherwise, return 0. */
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
|
m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
gdb_byte buf[4];
|
gdb_byte buf[4];
|
||||||
|
|
||||||
@ -147,12 +147,12 @@ m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
|
|||||||
if (pc % 2 != 0)
|
if (pc % 2 != 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (!safe_frame_unwind_memory (next_frame, pc, buf, 4))
|
if (!safe_frame_unwind_memory (this_frame, pc, buf, 4))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0)
|
if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0)
|
||||||
{
|
{
|
||||||
if (!safe_frame_unwind_memory (next_frame, pc + 4, buf, 4))
|
if (!safe_frame_unwind_memory (this_frame, pc + 4, buf, 4))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0)
|
if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0)
|
||||||
@ -160,7 +160,7 @@ m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
|
|||||||
}
|
}
|
||||||
else if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0)
|
else if (memcmp (buf, linux_rt_sigtramp_code + 4, 4) == 0)
|
||||||
{
|
{
|
||||||
if (!safe_frame_unwind_memory (next_frame, pc - 4, buf, 4))
|
if (!safe_frame_unwind_memory (this_frame, pc - 4, buf, 4))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0)
|
if (memcmp (buf, linux_rt_sigtramp_code, 4) == 0)
|
||||||
@ -172,7 +172,7 @@ m32r_linux_rt_sigtramp_start (CORE_ADDR pc, struct frame_info *next_frame)
|
|||||||
|
|
||||||
static int
|
static int
|
||||||
m32r_linux_pc_in_sigtramp (CORE_ADDR pc, char *name,
|
m32r_linux_pc_in_sigtramp (CORE_ADDR pc, char *name,
|
||||||
struct frame_info *next_frame)
|
struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
/* If we have NAME, we can optimize the search. The trampolines are
|
/* If we have NAME, we can optimize the search. The trampolines are
|
||||||
named __restore and __restore_rt. However, they aren't dynamically
|
named __restore and __restore_rt. However, they aren't dynamically
|
||||||
@ -180,8 +180,8 @@ m32r_linux_pc_in_sigtramp (CORE_ADDR pc, char *name,
|
|||||||
be part of the preceding function. This should always be sigaction,
|
be part of the preceding function. This should always be sigaction,
|
||||||
__sigaction, or __libc_sigaction (all aliases to the same function). */
|
__sigaction, or __libc_sigaction (all aliases to the same function). */
|
||||||
if (name == NULL || strstr (name, "sigaction") != NULL)
|
if (name == NULL || strstr (name, "sigaction") != NULL)
|
||||||
return (m32r_linux_sigtramp_start (pc, next_frame) != 0
|
return (m32r_linux_sigtramp_start (pc, this_frame) != 0
|
||||||
|| m32r_linux_rt_sigtramp_start (pc, next_frame) != 0);
|
|| m32r_linux_rt_sigtramp_start (pc, this_frame) != 0);
|
||||||
|
|
||||||
return (strcmp ("__restore", name) == 0
|
return (strcmp ("__restore", name) == 0
|
||||||
|| strcmp ("__restore_rt", name) == 0);
|
|| strcmp ("__restore_rt", name) == 0);
|
||||||
@ -222,7 +222,7 @@ struct m32r_frame_cache
|
|||||||
};
|
};
|
||||||
|
|
||||||
static struct m32r_frame_cache *
|
static struct m32r_frame_cache *
|
||||||
m32r_linux_sigtramp_frame_cache (struct frame_info *next_frame,
|
m32r_linux_sigtramp_frame_cache (struct frame_info *this_frame,
|
||||||
void **this_cache)
|
void **this_cache)
|
||||||
{
|
{
|
||||||
struct m32r_frame_cache *cache;
|
struct m32r_frame_cache *cache;
|
||||||
@ -233,26 +233,26 @@ m32r_linux_sigtramp_frame_cache (struct frame_info *next_frame,
|
|||||||
return (*this_cache);
|
return (*this_cache);
|
||||||
cache = FRAME_OBSTACK_ZALLOC (struct m32r_frame_cache);
|
cache = FRAME_OBSTACK_ZALLOC (struct m32r_frame_cache);
|
||||||
(*this_cache) = cache;
|
(*this_cache) = cache;
|
||||||
cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
cache->base = frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM);
|
cache->base = get_frame_register_unsigned (this_frame, M32R_SP_REGNUM);
|
||||||
sigcontext_addr = cache->base + 4;
|
sigcontext_addr = cache->base + 4;
|
||||||
|
|
||||||
cache->pc = frame_pc_unwind (next_frame);
|
cache->pc = get_frame_pc (this_frame);
|
||||||
addr = m32r_linux_sigtramp_start (cache->pc, next_frame);
|
addr = m32r_linux_sigtramp_start (cache->pc, this_frame);
|
||||||
if (addr == 0)
|
if (addr == 0)
|
||||||
{
|
{
|
||||||
/* If this is a RT signal trampoline, adjust SIGCONTEXT_ADDR
|
/* If this is a RT signal trampoline, adjust SIGCONTEXT_ADDR
|
||||||
accordingly. */
|
accordingly. */
|
||||||
addr = m32r_linux_rt_sigtramp_start (cache->pc, next_frame);
|
addr = m32r_linux_rt_sigtramp_start (cache->pc, this_frame);
|
||||||
if (addr)
|
if (addr)
|
||||||
sigcontext_addr += 128;
|
sigcontext_addr += 128;
|
||||||
else
|
else
|
||||||
addr = frame_func_unwind (next_frame, NORMAL_FRAME);
|
addr = get_frame_func (this_frame);
|
||||||
}
|
}
|
||||||
cache->pc = addr;
|
cache->pc = addr;
|
||||||
|
|
||||||
cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
for (regnum = 0; regnum < sizeof (m32r_linux_sc_reg_offset) / 4; regnum++)
|
for (regnum = 0; regnum < sizeof (m32r_linux_sc_reg_offset) / 4; regnum++)
|
||||||
{
|
{
|
||||||
@ -265,50 +265,49 @@ m32r_linux_sigtramp_frame_cache (struct frame_info *next_frame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
m32r_linux_sigtramp_frame_this_id (struct frame_info *next_frame,
|
m32r_linux_sigtramp_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_cache,
|
void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct m32r_frame_cache *cache =
|
struct m32r_frame_cache *cache =
|
||||||
m32r_linux_sigtramp_frame_cache (next_frame, this_cache);
|
m32r_linux_sigtramp_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
(*this_id) = frame_id_build (cache->base, cache->pc);
|
(*this_id) = frame_id_build (cache->base, cache->pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
m32r_linux_sigtramp_frame_prev_register (struct frame_info *next_frame,
|
m32r_linux_sigtramp_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_cache,
|
void **this_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp,
|
|
||||||
CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct m32r_frame_cache *cache =
|
struct m32r_frame_cache *cache =
|
||||||
m32r_linux_sigtramp_frame_cache (next_frame, this_cache);
|
m32r_linux_sigtramp_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, valuep);
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
m32r_linux_sigtramp_frame_sniffer (const struct frame_unwind *self,
|
||||||
|
struct frame_info *this_frame,
|
||||||
|
void **this_cache)
|
||||||
|
{
|
||||||
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
find_pc_partial_function (pc, &name, NULL, NULL);
|
||||||
|
if (m32r_linux_pc_in_sigtramp (pc, name, this_frame))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind m32r_linux_sigtramp_frame_unwind = {
|
static const struct frame_unwind m32r_linux_sigtramp_frame_unwind = {
|
||||||
SIGTRAMP_FRAME,
|
SIGTRAMP_FRAME,
|
||||||
m32r_linux_sigtramp_frame_this_id,
|
m32r_linux_sigtramp_frame_this_id,
|
||||||
m32r_linux_sigtramp_frame_prev_register
|
m32r_linux_sigtramp_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
m32r_linux_sigtramp_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
m32r_linux_sigtramp_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
CORE_ADDR pc = frame_pc_unwind (next_frame);
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
find_pc_partial_function (pc, &name, NULL, NULL);
|
|
||||||
if (m32r_linux_pc_in_sigtramp (pc, name, next_frame))
|
|
||||||
return &m32r_linux_sigtramp_frame_unwind;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Mapping between the registers in `struct pt_regs'
|
/* Mapping between the registers in `struct pt_regs'
|
||||||
format and GDB's register array layout. */
|
format and GDB's register array layout. */
|
||||||
|
|
||||||
@ -409,7 +408,7 @@ m32r_linux_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|||||||
the number of registers. */
|
the number of registers. */
|
||||||
set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS - 1);
|
set_gdbarch_num_regs (gdbarch, M32R_NUM_REGS - 1);
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, m32r_linux_sigtramp_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &m32r_linux_sigtramp_frame_unwind);
|
||||||
|
|
||||||
/* GNU/Linux uses SVR4-style shared libraries. */
|
/* GNU/Linux uses SVR4-style shared libraries. */
|
||||||
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
|
||||||
|
@ -513,7 +513,7 @@ struct m32r_unwind_cache
|
|||||||
for it IS the sp for the next frame. */
|
for it IS the sp for the next frame. */
|
||||||
|
|
||||||
static struct m32r_unwind_cache *
|
static struct m32r_unwind_cache *
|
||||||
m32r_frame_unwind_cache (struct frame_info *next_frame,
|
m32r_frame_unwind_cache (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
CORE_ADDR pc, scan_limit;
|
CORE_ADDR pc, scan_limit;
|
||||||
@ -529,19 +529,19 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
|
|
||||||
info = FRAME_OBSTACK_ZALLOC (struct m32r_unwind_cache);
|
info = FRAME_OBSTACK_ZALLOC (struct m32r_unwind_cache);
|
||||||
(*this_prologue_cache) = info;
|
(*this_prologue_cache) = info;
|
||||||
info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
info->size = 0;
|
info->size = 0;
|
||||||
info->sp_offset = 0;
|
info->sp_offset = 0;
|
||||||
info->uses_frame = 0;
|
info->uses_frame = 0;
|
||||||
|
|
||||||
scan_limit = frame_pc_unwind (next_frame);
|
scan_limit = get_frame_pc (this_frame);
|
||||||
for (pc = frame_func_unwind (next_frame, NORMAL_FRAME);
|
for (pc = get_frame_func (this_frame);
|
||||||
pc > 0 && pc < scan_limit; pc += 2)
|
pc > 0 && pc < scan_limit; pc += 2)
|
||||||
{
|
{
|
||||||
if ((pc & 2) == 0)
|
if ((pc & 2) == 0)
|
||||||
{
|
{
|
||||||
op = get_frame_memory_unsigned (next_frame, pc, 4);
|
op = get_frame_memory_unsigned (this_frame, pc, 4);
|
||||||
if ((op & 0x80000000) == 0x80000000)
|
if ((op & 0x80000000) == 0x80000000)
|
||||||
{
|
{
|
||||||
/* 32-bit instruction */
|
/* 32-bit instruction */
|
||||||
@ -552,7 +552,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
info->sp_offset += n;
|
info->sp_offset += n;
|
||||||
}
|
}
|
||||||
else if (((op >> 8) == 0xe4)
|
else if (((op >> 8) == 0xe4)
|
||||||
&& get_frame_memory_unsigned (next_frame, pc + 2,
|
&& get_frame_memory_unsigned (this_frame, pc + 2,
|
||||||
2) == 0x0f24)
|
2) == 0x0f24)
|
||||||
{
|
{
|
||||||
/* ld24 r4, xxxxxx; sub sp, r4 */
|
/* ld24 r4, xxxxxx; sub sp, r4 */
|
||||||
@ -569,7 +569,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* 16-bit instructions */
|
/* 16-bit instructions */
|
||||||
op = get_frame_memory_unsigned (next_frame, pc, 2) & 0x7fff;
|
op = get_frame_memory_unsigned (this_frame, pc, 2) & 0x7fff;
|
||||||
if ((op & 0xf0ff) == 0x207f)
|
if ((op & 0xf0ff) == 0x207f)
|
||||||
{
|
{
|
||||||
/* st rn, @-sp */
|
/* st rn, @-sp */
|
||||||
@ -606,7 +606,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
/* The SP was moved to the FP. This indicates that a new frame
|
/* The SP was moved to the FP. This indicates that a new frame
|
||||||
was created. Get THIS frame's FP value by unwinding it from
|
was created. Get THIS frame's FP value by unwinding it from
|
||||||
the next frame. */
|
the next frame. */
|
||||||
this_base = frame_unwind_register_unsigned (next_frame, M32R_FP_REGNUM);
|
this_base = get_frame_register_unsigned (this_frame, M32R_FP_REGNUM);
|
||||||
/* The FP points at the last saved register. Adjust the FP back
|
/* The FP points at the last saved register. Adjust the FP back
|
||||||
to before the first saved register giving the SP. */
|
to before the first saved register giving the SP. */
|
||||||
prev_sp = this_base + info->size;
|
prev_sp = this_base + info->size;
|
||||||
@ -615,7 +615,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
{
|
{
|
||||||
/* Assume that the FP is this frame's SP but with that pushed
|
/* Assume that the FP is this frame's SP but with that pushed
|
||||||
stack space added back. */
|
stack space added back. */
|
||||||
this_base = frame_unwind_register_unsigned (next_frame, M32R_SP_REGNUM);
|
this_base = get_frame_register_unsigned (this_frame, M32R_SP_REGNUM);
|
||||||
prev_sp = this_base + info->size;
|
prev_sp = this_base + info->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -625,7 +625,7 @@ m32r_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
|
|
||||||
/* Adjust all the saved registers so that they contain addresses and
|
/* Adjust all the saved registers so that they contain addresses and
|
||||||
not offsets. */
|
not offsets. */
|
||||||
for (i = 0; i < gdbarch_num_regs (get_frame_arch (next_frame)) - 1; i++)
|
for (i = 0; i < gdbarch_num_regs (get_frame_arch (this_frame)) - 1; i++)
|
||||||
if (trad_frame_addr_p (info->saved_regs, i))
|
if (trad_frame_addr_p (info->saved_regs, i))
|
||||||
info->saved_regs[i].addr = (info->prev_sp + info->saved_regs[i].addr);
|
info->saved_regs[i].addr = (info->prev_sp + info->saved_regs[i].addr);
|
||||||
|
|
||||||
@ -814,18 +814,18 @@ m32r_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
frame. This will be used to create a new GDB frame struct. */
|
frame. This will be used to create a new GDB frame struct. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
m32r_frame_this_id (struct frame_info *next_frame,
|
m32r_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache, struct frame_id *this_id)
|
void **this_prologue_cache, struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct m32r_unwind_cache *info
|
struct m32r_unwind_cache *info
|
||||||
= m32r_frame_unwind_cache (next_frame, this_prologue_cache);
|
= m32r_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
CORE_ADDR base;
|
CORE_ADDR base;
|
||||||
CORE_ADDR func;
|
CORE_ADDR func;
|
||||||
struct minimal_symbol *msym_stack;
|
struct minimal_symbol *msym_stack;
|
||||||
struct frame_id id;
|
struct frame_id id;
|
||||||
|
|
||||||
/* The FUNC is easy. */
|
/* The FUNC is easy. */
|
||||||
func = frame_func_unwind (next_frame, NORMAL_FRAME);
|
func = get_frame_func (this_frame);
|
||||||
|
|
||||||
/* Check if the stack is empty. */
|
/* Check if the stack is empty. */
|
||||||
msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL);
|
msym_stack = lookup_minimal_symbol ("_stack", NULL, NULL);
|
||||||
@ -843,36 +843,28 @@ m32r_frame_this_id (struct frame_info *next_frame,
|
|||||||
(*this_id) = id;
|
(*this_id) = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
m32r_frame_prev_register (struct frame_info *next_frame,
|
m32r_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *bufferp)
|
|
||||||
{
|
{
|
||||||
struct m32r_unwind_cache *info
|
struct m32r_unwind_cache *info
|
||||||
= m32r_frame_unwind_cache (next_frame, this_prologue_cache);
|
= m32r_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, bufferp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind m32r_frame_unwind = {
|
static const struct frame_unwind m32r_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
m32r_frame_this_id,
|
m32r_frame_this_id,
|
||||||
m32r_frame_prev_register
|
m32r_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
m32r_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &m32r_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
m32r_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
m32r_frame_base_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct m32r_unwind_cache *info
|
struct m32r_unwind_cache *info
|
||||||
= m32r_frame_unwind_cache (next_frame, this_cache);
|
= m32r_frame_unwind_cache (this_frame, this_cache);
|
||||||
return info->base;
|
return info->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -883,16 +875,15 @@ static const struct frame_base m32r_frame_base = {
|
|||||||
m32r_frame_base_address
|
m32r_frame_base_address
|
||||||
};
|
};
|
||||||
|
|
||||||
/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
|
/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
|
||||||
dummy frame. The frame ID's base needs to match the TOS value
|
frame. The frame ID's base needs to match the TOS value saved by
|
||||||
saved by save_dummy_frame_tos(), and the PC match the dummy frame's
|
save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */
|
||||||
breakpoint. */
|
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
m32r_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
m32r_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
return frame_id_build (m32r_unwind_sp (gdbarch, next_frame),
|
CORE_ADDR sp = get_frame_register_unsigned (this_frame, M32R_SP_REGNUM);
|
||||||
frame_pc_unwind (next_frame));
|
return frame_id_build (sp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -940,7 +931,7 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
/* Methods for saving / extracting a dummy frame's ID. The ID's
|
/* Methods for saving / extracting a dummy frame's ID. The ID's
|
||||||
stack address must match the SP value returned by
|
stack address must match the SP value returned by
|
||||||
PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */
|
PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, m32r_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, m32r_dummy_id);
|
||||||
|
|
||||||
/* Return the unwound PC value. */
|
/* Return the unwound PC value. */
|
||||||
set_gdbarch_unwind_pc (gdbarch, m32r_unwind_pc);
|
set_gdbarch_unwind_pc (gdbarch, m32r_unwind_pc);
|
||||||
@ -951,7 +942,7 @@ m32r_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
gdbarch_init_osabi (info, gdbarch);
|
gdbarch_init_osabi (info, gdbarch);
|
||||||
|
|
||||||
/* Hook in the default unwinders. */
|
/* Hook in the default unwinders. */
|
||||||
frame_unwind_append_sniffer (gdbarch, m32r_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &m32r_frame_unwind);
|
||||||
|
|
||||||
/* Support simple overlay manager. */
|
/* Support simple overlay manager. */
|
||||||
set_gdbarch_overlay_update (gdbarch, simple_overlay_update);
|
set_gdbarch_overlay_update (gdbarch, simple_overlay_update);
|
||||||
|
@ -774,10 +774,10 @@ m68hc11_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
for it IS the sp for the next frame. */
|
for it IS the sp for the next frame. */
|
||||||
|
|
||||||
struct m68hc11_unwind_cache *
|
struct m68hc11_unwind_cache *
|
||||||
m68hc11_frame_unwind_cache (struct frame_info *next_frame,
|
m68hc11_frame_unwind_cache (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
||||||
ULONGEST prev_sp;
|
ULONGEST prev_sp;
|
||||||
ULONGEST this_base;
|
ULONGEST this_base;
|
||||||
struct m68hc11_unwind_cache *info;
|
struct m68hc11_unwind_cache *info;
|
||||||
@ -789,9 +789,9 @@ m68hc11_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
|
|
||||||
info = FRAME_OBSTACK_ZALLOC (struct m68hc11_unwind_cache);
|
info = FRAME_OBSTACK_ZALLOC (struct m68hc11_unwind_cache);
|
||||||
(*this_prologue_cache) = info;
|
(*this_prologue_cache) = info;
|
||||||
info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
info->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
|
info->pc = get_frame_func (this_frame);
|
||||||
|
|
||||||
info->size = 0;
|
info->size = 0;
|
||||||
info->return_kind = m68hc11_get_return_insn (info->pc);
|
info->return_kind = m68hc11_get_return_insn (info->pc);
|
||||||
@ -799,14 +799,14 @@ m68hc11_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
/* The SP was moved to the FP. This indicates that a new frame
|
/* The SP was moved to the FP. This indicates that a new frame
|
||||||
was created. Get THIS frame's FP value by unwinding it from
|
was created. Get THIS frame's FP value by unwinding it from
|
||||||
the next frame. */
|
the next frame. */
|
||||||
this_base = frame_unwind_register_unsigned (next_frame, SOFT_FP_REGNUM);
|
this_base = get_frame_register_unsigned (this_frame, SOFT_FP_REGNUM);
|
||||||
if (this_base == 0)
|
if (this_base == 0)
|
||||||
{
|
{
|
||||||
info->base = 0;
|
info->base = 0;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
current_pc = frame_pc_unwind (next_frame);
|
current_pc = get_frame_pc (this_frame);
|
||||||
if (info->pc != 0)
|
if (info->pc != 0)
|
||||||
m68hc11_scan_prologue (gdbarch, info->pc, current_pc, info);
|
m68hc11_scan_prologue (gdbarch, info->pc, current_pc, info);
|
||||||
|
|
||||||
@ -815,7 +815,7 @@ m68hc11_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
if (info->sp_offset != (CORE_ADDR) -1)
|
if (info->sp_offset != (CORE_ADDR) -1)
|
||||||
{
|
{
|
||||||
info->saved_regs[HARD_PC_REGNUM].addr = info->sp_offset;
|
info->saved_regs[HARD_PC_REGNUM].addr = info->sp_offset;
|
||||||
this_base = frame_unwind_register_unsigned (next_frame, HARD_SP_REGNUM);
|
this_base = get_frame_register_unsigned (this_frame, HARD_SP_REGNUM);
|
||||||
prev_sp = this_base + info->sp_offset + 2;
|
prev_sp = this_base + info->sp_offset + 2;
|
||||||
this_base += STACK_CORRECTION (gdbarch);
|
this_base += STACK_CORRECTION (gdbarch);
|
||||||
}
|
}
|
||||||
@ -874,18 +874,18 @@ m68hc11_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
frame. This will be used to create a new GDB frame struct. */
|
frame. This will be used to create a new GDB frame struct. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
m68hc11_frame_this_id (struct frame_info *next_frame,
|
m68hc11_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct m68hc11_unwind_cache *info
|
struct m68hc11_unwind_cache *info
|
||||||
= m68hc11_frame_unwind_cache (next_frame, this_prologue_cache);
|
= m68hc11_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
CORE_ADDR base;
|
CORE_ADDR base;
|
||||||
CORE_ADDR func;
|
CORE_ADDR func;
|
||||||
struct frame_id id;
|
struct frame_id id;
|
||||||
|
|
||||||
/* The FUNC is easy. */
|
/* The FUNC is easy. */
|
||||||
func = frame_func_unwind (next_frame, NORMAL_FRAME);
|
func = get_frame_func (this_frame);
|
||||||
|
|
||||||
/* Hopefully the prologue analysis either correctly determined the
|
/* Hopefully the prologue analysis either correctly determined the
|
||||||
frame's base (which is the SP from the previous frame), or set
|
frame's base (which is the SP from the previous frame), or set
|
||||||
@ -898,67 +898,69 @@ m68hc11_frame_this_id (struct frame_info *next_frame,
|
|||||||
(*this_id) = id;
|
(*this_id) = id;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
m68hc11_frame_prev_register (struct frame_info *next_frame,
|
m68hc11_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *bufferp)
|
|
||||||
{
|
{
|
||||||
|
struct value *value;
|
||||||
struct m68hc11_unwind_cache *info
|
struct m68hc11_unwind_cache *info
|
||||||
= m68hc11_frame_unwind_cache (next_frame, this_prologue_cache);
|
= m68hc11_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
|
|
||||||
trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
|
value = trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, bufferp);
|
|
||||||
|
|
||||||
if (regnum == HARD_PC_REGNUM)
|
/* Take into account the 68HC12 specific call (PC + page). */
|
||||||
|
if (regnum == HARD_PC_REGNUM
|
||||||
|
&& info->return_kind == RETURN_RTC
|
||||||
|
&& USE_PAGE_REGISTER (get_frame_arch (this_frame)))
|
||||||
{
|
{
|
||||||
/* Take into account the 68HC12 specific call (PC + page). */
|
CORE_ADDR pc = value_as_long (value);
|
||||||
if (info->return_kind == RETURN_RTC
|
if (pc >= 0x08000 && pc < 0x0c000)
|
||||||
&& *addrp >= 0x08000 && *addrp < 0x0c000
|
|
||||||
&& USE_PAGE_REGISTER (get_frame_arch (next_frame)))
|
|
||||||
{
|
{
|
||||||
int page_optimized;
|
|
||||||
|
|
||||||
CORE_ADDR page;
|
CORE_ADDR page;
|
||||||
|
|
||||||
trad_frame_get_prev_register (next_frame, info->saved_regs,
|
release_value (value);
|
||||||
HARD_PAGE_REGNUM, &page_optimized,
|
value_free (value);
|
||||||
0, &page, 0, 0);
|
|
||||||
*addrp -= 0x08000;
|
value = trad_frame_get_prev_register (this_frame, info->saved_regs,
|
||||||
*addrp += ((page & 0x0ff) << 14);
|
HARD_PAGE_REGNUM);
|
||||||
*addrp += 0x1000000;
|
page = value_as_long (value);
|
||||||
|
release_value (value);
|
||||||
|
value_free (value);
|
||||||
|
|
||||||
|
pc -= 0x08000;
|
||||||
|
pc += ((page & 0x0ff) << 14);
|
||||||
|
pc += 0x1000000;
|
||||||
|
|
||||||
|
return frame_unwind_got_constant (this_frame, regnum, pc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind m68hc11_frame_unwind = {
|
static const struct frame_unwind m68hc11_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
m68hc11_frame_this_id,
|
m68hc11_frame_this_id,
|
||||||
m68hc11_frame_prev_register
|
m68hc11_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct frame_unwind *
|
|
||||||
m68hc11_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &m68hc11_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
m68hc11_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
m68hc11_frame_base_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct m68hc11_unwind_cache *info
|
struct m68hc11_unwind_cache *info
|
||||||
= m68hc11_frame_unwind_cache (next_frame, this_cache);
|
= m68hc11_frame_unwind_cache (this_frame, this_cache);
|
||||||
|
|
||||||
return info->base;
|
return info->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
m68hc11_frame_args_address (struct frame_info *next_frame, void **this_cache)
|
m68hc11_frame_args_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
struct m68hc11_unwind_cache *info
|
struct m68hc11_unwind_cache *info
|
||||||
= m68hc11_frame_unwind_cache (next_frame, this_cache);
|
= m68hc11_frame_unwind_cache (this_frame, this_cache);
|
||||||
|
|
||||||
addr = info->base + info->size;
|
addr = info->base + info->size;
|
||||||
if (info->return_kind == RETURN_RTC)
|
if (info->return_kind == RETURN_RTC)
|
||||||
@ -984,18 +986,17 @@ m68hc11_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
|
/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
|
||||||
dummy frame. The frame ID's base needs to match the TOS value
|
frame. The frame ID's base needs to match the TOS value saved by
|
||||||
saved by save_dummy_frame_tos(), and the PC match the dummy frame's
|
save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */
|
||||||
breakpoint. */
|
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
m68hc11_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
m68hc11_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
ULONGEST tos;
|
ULONGEST tos;
|
||||||
CORE_ADDR pc = frame_pc_unwind (next_frame);
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
||||||
|
|
||||||
tos = frame_unwind_register_unsigned (next_frame, SOFT_FP_REGNUM);
|
tos = get_frame_register_unsigned (this_frame, SOFT_FP_REGNUM);
|
||||||
tos += 2;
|
tos += 2;
|
||||||
return frame_id_build (tos, pc);
|
return frame_id_build (tos, pc);
|
||||||
}
|
}
|
||||||
@ -1520,15 +1521,15 @@ m68hc11_gdbarch_init (struct gdbarch_info info,
|
|||||||
set_gdbarch_print_registers_info (gdbarch, m68hc11_print_registers_info);
|
set_gdbarch_print_registers_info (gdbarch, m68hc11_print_registers_info);
|
||||||
|
|
||||||
/* Hook in the DWARF CFI frame unwinder. */
|
/* Hook in the DWARF CFI frame unwinder. */
|
||||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
dwarf2_append_unwinders (gdbarch);
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, m68hc11_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &m68hc11_frame_unwind);
|
||||||
frame_base_set_default (gdbarch, &m68hc11_frame_base);
|
frame_base_set_default (gdbarch, &m68hc11_frame_base);
|
||||||
|
|
||||||
/* Methods for saving / extracting a dummy frame's ID. The ID's
|
/* Methods for saving / extracting a dummy frame's ID. The ID's
|
||||||
stack address must match the SP value returned by
|
stack address must match the SP value returned by
|
||||||
PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */
|
PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, m68hc11_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, m68hc11_dummy_id);
|
||||||
|
|
||||||
/* Return the unwound PC value. */
|
/* Return the unwound PC value. */
|
||||||
set_gdbarch_unwind_pc (gdbarch, m68hc11_unwind_pc);
|
set_gdbarch_unwind_pc (gdbarch, m68hc11_unwind_pc);
|
||||||
|
123
gdb/mep-tdep.c
123
gdb/mep-tdep.c
@ -1926,7 +1926,7 @@ mep_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR * pcptr, int *lenptr)
|
|||||||
|
|
||||||
|
|
||||||
static struct mep_prologue *
|
static struct mep_prologue *
|
||||||
mep_analyze_frame_prologue (struct frame_info *next_frame,
|
mep_analyze_frame_prologue (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
if (! *this_prologue_cache)
|
if (! *this_prologue_cache)
|
||||||
@ -1936,8 +1936,8 @@ mep_analyze_frame_prologue (struct frame_info *next_frame,
|
|||||||
*this_prologue_cache
|
*this_prologue_cache
|
||||||
= FRAME_OBSTACK_ZALLOC (struct mep_prologue);
|
= FRAME_OBSTACK_ZALLOC (struct mep_prologue);
|
||||||
|
|
||||||
func_start = frame_func_unwind (next_frame, NORMAL_FRAME);
|
func_start = get_frame_func (this_frame);
|
||||||
stop_addr = frame_pc_unwind (next_frame);
|
stop_addr = get_frame_pc (this_frame);
|
||||||
|
|
||||||
/* If we couldn't find any function containing the PC, then
|
/* If we couldn't find any function containing the PC, then
|
||||||
just initialize the prologue cache, but don't do anything. */
|
just initialize the prologue cache, but don't do anything. */
|
||||||
@ -1954,11 +1954,11 @@ mep_analyze_frame_prologue (struct frame_info *next_frame,
|
|||||||
/* Given the next frame and a prologue cache, return this frame's
|
/* Given the next frame and a prologue cache, return this frame's
|
||||||
base. */
|
base. */
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
mep_frame_base (struct frame_info *next_frame,
|
mep_frame_base (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
struct mep_prologue *p
|
struct mep_prologue *p
|
||||||
= mep_analyze_frame_prologue (next_frame, this_prologue_cache);
|
= mep_analyze_frame_prologue (this_frame, this_prologue_cache);
|
||||||
|
|
||||||
/* In functions that use alloca, the distance between the stack
|
/* In functions that use alloca, the distance between the stack
|
||||||
pointer and the frame base varies dynamically, so we can't use
|
pointer and the frame base varies dynamically, so we can't use
|
||||||
@ -1969,37 +1969,34 @@ mep_frame_base (struct frame_info *next_frame,
|
|||||||
if (p->has_frame_ptr)
|
if (p->has_frame_ptr)
|
||||||
{
|
{
|
||||||
CORE_ADDR fp
|
CORE_ADDR fp
|
||||||
= frame_unwind_register_unsigned (next_frame, MEP_FP_REGNUM);
|
= get_frame_register_unsigned (this_frame, MEP_FP_REGNUM);
|
||||||
return fp - p->frame_ptr_offset;
|
return fp - p->frame_ptr_offset;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CORE_ADDR sp
|
CORE_ADDR sp
|
||||||
= frame_unwind_register_unsigned (next_frame, MEP_SP_REGNUM);
|
= get_frame_register_unsigned (this_frame, MEP_SP_REGNUM);
|
||||||
return sp - p->frame_size;
|
return sp - p->frame_size;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mep_frame_this_id (struct frame_info *next_frame,
|
mep_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
*this_id = frame_id_build (mep_frame_base (next_frame, this_prologue_cache),
|
*this_id = frame_id_build (mep_frame_base (this_frame, this_prologue_cache),
|
||||||
frame_func_unwind (next_frame, NORMAL_FRAME));
|
get_frame_func (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
mep_frame_prev_register (struct frame_info *next_frame,
|
mep_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *bufferp)
|
|
||||||
{
|
{
|
||||||
struct mep_prologue *p
|
struct mep_prologue *p
|
||||||
= mep_analyze_frame_prologue (next_frame, this_prologue_cache);
|
= mep_analyze_frame_prologue (this_frame, this_prologue_cache);
|
||||||
|
|
||||||
/* There are a number of complications in unwinding registers on the
|
/* There are a number of complications in unwinding registers on the
|
||||||
MeP, having to do with core functions calling VLIW functions and
|
MeP, having to do with core functions calling VLIW functions and
|
||||||
@ -2021,68 +2018,59 @@ mep_frame_prev_register (struct frame_info *next_frame,
|
|||||||
do this. */
|
do this. */
|
||||||
if (regnum == MEP_PC_REGNUM)
|
if (regnum == MEP_PC_REGNUM)
|
||||||
{
|
{
|
||||||
mep_frame_prev_register (next_frame, this_prologue_cache, MEP_LP_REGNUM,
|
struct value *value;
|
||||||
optimizedp, lvalp, addrp, realnump, bufferp);
|
CORE_ADDR lp;
|
||||||
store_unsigned_integer (bufferp, MEP_LP_SIZE,
|
value = mep_frame_prev_register (this_frame, this_prologue_cache,
|
||||||
(extract_unsigned_integer (bufferp, MEP_LP_SIZE)
|
MEP_LP_REGNUM);
|
||||||
& ~1));
|
lp = value_as_long (value);
|
||||||
*lvalp = not_lval;
|
release_value (value);
|
||||||
|
value_free (value);
|
||||||
|
|
||||||
|
return frame_unwind_got_constant (this_frame, regnum, lp & ~1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CORE_ADDR frame_base = mep_frame_base (next_frame, this_prologue_cache);
|
CORE_ADDR frame_base = mep_frame_base (this_frame, this_prologue_cache);
|
||||||
int reg_size = register_size (get_frame_arch (next_frame), regnum);
|
struct value *value;
|
||||||
|
|
||||||
/* Our caller's SP is our frame base. */
|
/* Our caller's SP is our frame base. */
|
||||||
if (regnum == MEP_SP_REGNUM)
|
if (regnum == MEP_SP_REGNUM)
|
||||||
{
|
return frame_unwind_got_constant (this_frame, regnum, frame_base);
|
||||||
*optimizedp = 0;
|
|
||||||
*lvalp = not_lval;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = -1;
|
|
||||||
if (bufferp)
|
|
||||||
store_unsigned_integer (bufferp, reg_size, frame_base);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* If prologue analysis says we saved this register somewhere,
|
/* If prologue analysis says we saved this register somewhere,
|
||||||
return a description of the stack slot holding it. */
|
return a description of the stack slot holding it. */
|
||||||
else if (p->reg_offset[regnum] != 1)
|
if (p->reg_offset[regnum] != 1)
|
||||||
{
|
value = frame_unwind_got_memory (this_frame, regnum,
|
||||||
*optimizedp = 0;
|
frame_base + p->reg_offset[regnum]);
|
||||||
*lvalp = lval_memory;
|
|
||||||
*addrp = frame_base + p->reg_offset[regnum];
|
|
||||||
*realnump = -1;
|
|
||||||
if (bufferp)
|
|
||||||
get_frame_memory (next_frame, *addrp, bufferp, reg_size);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Otherwise, presume we haven't changed the value of this
|
/* Otherwise, presume we haven't changed the value of this
|
||||||
register, and get it from the next frame. */
|
register, and get it from the next frame. */
|
||||||
else
|
else
|
||||||
frame_register_unwind (next_frame, regnum,
|
value = frame_unwind_got_register (this_frame, regnum, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, bufferp);
|
|
||||||
|
|
||||||
/* If we need to toggle the operating mode, do so. */
|
/* If we need to toggle the operating mode, do so. */
|
||||||
if (regnum == MEP_PSW_REGNUM)
|
if (regnum == MEP_PSW_REGNUM)
|
||||||
{
|
{
|
||||||
int lp_optimized;
|
CORE_ADDR psw, lp;
|
||||||
enum lval_type lp_lval;
|
|
||||||
CORE_ADDR lp_addr;
|
psw = value_as_long (value);
|
||||||
int lp_realnum;
|
release_value (value);
|
||||||
char lp_buffer[MEP_LP_SIZE];
|
value_free (value);
|
||||||
|
|
||||||
/* Get the LP's value, too. */
|
/* Get the LP's value, too. */
|
||||||
frame_register_unwind (next_frame, MEP_LP_REGNUM,
|
value = get_frame_register_value (this_frame, MEP_LP_REGNUM);
|
||||||
&lp_optimized, &lp_lval, &lp_addr,
|
lp = value_as_long (value);
|
||||||
&lp_realnum, lp_buffer);
|
release_value (value);
|
||||||
|
value_free (value);
|
||||||
|
|
||||||
/* If LP.LTOM is set, then toggle PSW.OM. */
|
/* If LP.LTOM is set, then toggle PSW.OM. */
|
||||||
if (extract_unsigned_integer (lp_buffer, MEP_LP_SIZE) & 0x1)
|
if (lp & 0x1)
|
||||||
store_unsigned_integer
|
psw ^= 0x1000;
|
||||||
(bufferp, MEP_PSW_SIZE,
|
|
||||||
(extract_unsigned_integer (bufferp, MEP_PSW_SIZE) ^ 0x1000));
|
return frame_unwind_got_constant (this_frame, regnum, psw);
|
||||||
*lvalp = not_lval;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2090,17 +2078,12 @@ mep_frame_prev_register (struct frame_info *next_frame,
|
|||||||
static const struct frame_unwind mep_frame_unwind = {
|
static const struct frame_unwind mep_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
mep_frame_this_id,
|
mep_frame_this_id,
|
||||||
mep_frame_prev_register
|
mep_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
mep_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &mep_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Our general unwinding function can handle unwinding the PC. */
|
/* Our general unwinding function can handle unwinding the PC. */
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
mep_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
mep_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
||||||
@ -2379,10 +2362,10 @@ mep_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
|||||||
|
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
mep_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
mep_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
return frame_id_build (mep_unwind_sp (gdbarch, next_frame),
|
CORE_ADDR sp = get_frame_register_unsigned (this_frame, MEP_SP_REGNUM);
|
||||||
frame_pc_unwind (next_frame));
|
return frame_id_build (sp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2500,7 +2483,7 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
set_gdbarch_skip_prologue (gdbarch, mep_skip_prologue);
|
set_gdbarch_skip_prologue (gdbarch, mep_skip_prologue);
|
||||||
|
|
||||||
/* Frames and frame unwinding. */
|
/* Frames and frame unwinding. */
|
||||||
frame_unwind_append_sniffer (gdbarch, mep_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &mep_frame_unwind);
|
||||||
set_gdbarch_unwind_pc (gdbarch, mep_unwind_pc);
|
set_gdbarch_unwind_pc (gdbarch, mep_unwind_pc);
|
||||||
set_gdbarch_unwind_sp (gdbarch, mep_unwind_sp);
|
set_gdbarch_unwind_sp (gdbarch, mep_unwind_sp);
|
||||||
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
|
set_gdbarch_inner_than (gdbarch, core_addr_lessthan);
|
||||||
@ -2512,7 +2495,7 @@ mep_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
/* Inferior function calls. */
|
/* Inferior function calls. */
|
||||||
set_gdbarch_frame_align (gdbarch, mep_frame_align);
|
set_gdbarch_frame_align (gdbarch, mep_frame_align);
|
||||||
set_gdbarch_push_dummy_call (gdbarch, mep_push_dummy_call);
|
set_gdbarch_push_dummy_call (gdbarch, mep_push_dummy_call);
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, mep_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, mep_dummy_id);
|
||||||
|
|
||||||
return gdbarch;
|
return gdbarch;
|
||||||
}
|
}
|
||||||
|
@ -844,7 +844,7 @@ mn10300_skip_prologue (struct gdbarch *gdbarch, CORE_ADDR pc)
|
|||||||
/* Simple frame_unwind_cache.
|
/* Simple frame_unwind_cache.
|
||||||
This finds the "extra info" for the frame. */
|
This finds the "extra info" for the frame. */
|
||||||
struct trad_frame_cache *
|
struct trad_frame_cache *
|
||||||
mn10300_frame_unwind_cache (struct frame_info *next_frame,
|
mn10300_frame_unwind_cache (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch;
|
struct gdbarch *gdbarch;
|
||||||
@ -855,10 +855,10 @@ mn10300_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
if (*this_prologue_cache)
|
if (*this_prologue_cache)
|
||||||
return (*this_prologue_cache);
|
return (*this_prologue_cache);
|
||||||
|
|
||||||
gdbarch = get_frame_arch (next_frame);
|
gdbarch = get_frame_arch (this_frame);
|
||||||
cache_p = trad_frame_cache_zalloc (next_frame);
|
cache_p = trad_frame_cache_zalloc (this_frame);
|
||||||
pc = gdbarch_unwind_pc (gdbarch, next_frame);
|
pc = get_frame_register_unsigned (this_frame, E_PC_REGNUM);
|
||||||
mn10300_analyze_prologue (gdbarch, next_frame, &cache_p, pc);
|
mn10300_analyze_prologue (gdbarch, this_frame, &cache_p, pc);
|
||||||
cache = cache_p;
|
cache = cache_p;
|
||||||
|
|
||||||
if (find_pc_partial_function (pc, NULL, &start, &end))
|
if (find_pc_partial_function (pc, NULL, &start, &end))
|
||||||
@ -867,7 +867,7 @@ mn10300_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
start));
|
start));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
start = frame_func_unwind (next_frame, NORMAL_FRAME);
|
start = get_frame_func (this_frame);
|
||||||
trad_frame_set_id (cache,
|
trad_frame_set_id (cache,
|
||||||
frame_id_build (trad_frame_get_this_base (cache),
|
frame_id_build (trad_frame_get_this_base (cache),
|
||||||
start));
|
start));
|
||||||
@ -879,65 +879,53 @@ mn10300_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
|
|
||||||
/* Here is a dummy implementation. */
|
/* Here is a dummy implementation. */
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
mn10300_unwind_dummy_id (struct gdbarch *gdbarch,
|
mn10300_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
struct frame_info *next_frame)
|
|
||||||
{
|
{
|
||||||
return frame_id_build (frame_sp_unwind (next_frame),
|
CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
|
||||||
frame_pc_unwind (next_frame));
|
CORE_ADDR pc = get_frame_register_unsigned (this_frame, E_PC_REGNUM);
|
||||||
|
return frame_id_build (sp, pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trad frame implementation. */
|
/* Trad frame implementation. */
|
||||||
static void
|
static void
|
||||||
mn10300_frame_this_id (struct frame_info *next_frame,
|
mn10300_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct trad_frame_cache *cache =
|
struct trad_frame_cache *cache =
|
||||||
mn10300_frame_unwind_cache (next_frame, this_prologue_cache);
|
mn10300_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
|
|
||||||
trad_frame_get_id (cache, this_id);
|
trad_frame_get_id (cache, this_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
mn10300_frame_prev_register (struct frame_info *next_frame,
|
mn10300_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *bufferp)
|
|
||||||
{
|
{
|
||||||
struct trad_frame_cache *cache =
|
struct trad_frame_cache *cache =
|
||||||
mn10300_frame_unwind_cache (next_frame, this_prologue_cache);
|
mn10300_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
|
|
||||||
trad_frame_get_register (cache, next_frame, regnum, optimizedp,
|
return trad_frame_get_register (cache, this_frame, regnum);
|
||||||
lvalp, addrp, realnump, bufferp);
|
|
||||||
/* Or...
|
|
||||||
trad_frame_get_prev_register (next_frame, cache->prev_regs, regnum,
|
|
||||||
optimizedp, lvalp, addrp, realnump, bufferp);
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind mn10300_frame_unwind = {
|
static const struct frame_unwind mn10300_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
mn10300_frame_this_id,
|
mn10300_frame_this_id,
|
||||||
mn10300_frame_prev_register
|
mn10300_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
mn10300_frame_base_address (struct frame_info *next_frame,
|
mn10300_frame_base_address (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
struct trad_frame_cache *cache =
|
struct trad_frame_cache *cache =
|
||||||
mn10300_frame_unwind_cache (next_frame, this_prologue_cache);
|
mn10300_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
|
|
||||||
return trad_frame_get_this_base (cache);
|
return trad_frame_get_this_base (cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
mn10300_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &mn10300_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const struct frame_base mn10300_frame_base = {
|
static const struct frame_base mn10300_frame_base = {
|
||||||
&mn10300_frame_unwind,
|
&mn10300_frame_unwind,
|
||||||
mn10300_frame_base_address,
|
mn10300_frame_base_address,
|
||||||
@ -966,10 +954,10 @@ mn10300_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
static void
|
static void
|
||||||
mn10300_frame_unwind_init (struct gdbarch *gdbarch)
|
mn10300_frame_unwind_init (struct gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
dwarf2_append_unwinders (gdbarch);
|
||||||
frame_unwind_append_sniffer (gdbarch, mn10300_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &mn10300_frame_unwind);
|
||||||
frame_base_set_default (gdbarch, &mn10300_frame_base);
|
frame_base_set_default (gdbarch, &mn10300_frame_base);
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, mn10300_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, mn10300_dummy_id);
|
||||||
set_gdbarch_unwind_pc (gdbarch, mn10300_unwind_pc);
|
set_gdbarch_unwind_pc (gdbarch, mn10300_unwind_pc);
|
||||||
set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp);
|
set_gdbarch_unwind_sp (gdbarch, mn10300_unwind_sp);
|
||||||
}
|
}
|
||||||
|
@ -872,7 +872,7 @@ struct mt_unwind_cache
|
|||||||
the frame. */
|
the frame. */
|
||||||
|
|
||||||
static struct mt_unwind_cache *
|
static struct mt_unwind_cache *
|
||||||
mt_frame_unwind_cache (struct frame_info *next_frame,
|
mt_frame_unwind_cache (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch;
|
struct gdbarch *gdbarch;
|
||||||
@ -885,7 +885,7 @@ mt_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
if ((*this_prologue_cache))
|
if ((*this_prologue_cache))
|
||||||
return (*this_prologue_cache);
|
return (*this_prologue_cache);
|
||||||
|
|
||||||
gdbarch = get_frame_arch (next_frame);
|
gdbarch = get_frame_arch (this_frame);
|
||||||
info = FRAME_OBSTACK_ZALLOC (struct mt_unwind_cache);
|
info = FRAME_OBSTACK_ZALLOC (struct mt_unwind_cache);
|
||||||
(*this_prologue_cache) = info;
|
(*this_prologue_cache) = info;
|
||||||
|
|
||||||
@ -893,26 +893,26 @@ mt_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
info->framesize = 0;
|
info->framesize = 0;
|
||||||
info->frame_base = 0;
|
info->frame_base = 0;
|
||||||
info->frameless_p = 1;
|
info->frameless_p = 1;
|
||||||
info->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
info->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
/* Grab the frame-relative values of SP and FP, needed below.
|
/* Grab the frame-relative values of SP and FP, needed below.
|
||||||
The frame_saved_register function will find them on the
|
The frame_saved_register function will find them on the
|
||||||
stack or in the registers as appropriate. */
|
stack or in the registers as appropriate. */
|
||||||
sp = frame_unwind_register_unsigned (next_frame, MT_SP_REGNUM);
|
sp = get_frame_register_unsigned (this_frame, MT_SP_REGNUM);
|
||||||
fp = frame_unwind_register_unsigned (next_frame, MT_FP_REGNUM);
|
fp = get_frame_register_unsigned (this_frame, MT_FP_REGNUM);
|
||||||
|
|
||||||
start_addr = frame_func_unwind (next_frame, NORMAL_FRAME);
|
start_addr = get_frame_func (this_frame);
|
||||||
|
|
||||||
/* Return early if GDB couldn't find the function. */
|
/* Return early if GDB couldn't find the function. */
|
||||||
if (start_addr == 0)
|
if (start_addr == 0)
|
||||||
return info;
|
return info;
|
||||||
|
|
||||||
end_addr = frame_pc_unwind (next_frame);
|
end_addr = get_frame_pc (this_frame);
|
||||||
prologue_end_addr = skip_prologue_using_sal (start_addr);
|
prologue_end_addr = skip_prologue_using_sal (start_addr);
|
||||||
if (end_addr == 0)
|
if (end_addr == 0)
|
||||||
for (next_addr = start_addr; next_addr < end_addr; next_addr += 4)
|
for (next_addr = start_addr; next_addr < end_addr; next_addr += 4)
|
||||||
{
|
{
|
||||||
instr = get_frame_memory_unsigned (next_frame, next_addr, 4);
|
instr = get_frame_memory_unsigned (this_frame, next_addr, 4);
|
||||||
if (delayed_store) /* previous instr was a push */
|
if (delayed_store) /* previous instr was a push */
|
||||||
{
|
{
|
||||||
upper_half = delayed_store >> 16;
|
upper_half = delayed_store >> 16;
|
||||||
@ -1028,55 +1028,49 @@ mt_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Assuming NEXT_FRAME->prev is a dummy, return the frame ID of that
|
/* Assuming THIS_FRAME is a dummy, return the frame ID of that dummy
|
||||||
dummy frame. The frame ID's base needs to match the TOS value
|
frame. The frame ID's base needs to match the TOS value saved by
|
||||||
saved by save_dummy_frame_tos(), and the PC match the dummy frame's
|
save_dummy_frame_tos(), and the PC match the dummy frame's breakpoint. */
|
||||||
breakpoint. */
|
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
mt_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
mt_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
return frame_id_build (mt_unwind_sp (gdbarch, next_frame),
|
CORE_ADDR sp = get_frame_register_unsigned (this_frame, MT_SP_REGNUM);
|
||||||
frame_pc_unwind (next_frame));
|
return frame_id_build (sp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Given a GDB frame, determine the address of the calling function's
|
/* Given a GDB frame, determine the address of the calling function's
|
||||||
frame. This will be used to create a new GDB frame struct. */
|
frame. This will be used to create a new GDB frame struct. */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
mt_frame_this_id (struct frame_info *next_frame,
|
mt_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache, struct frame_id *this_id)
|
void **this_prologue_cache, struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct mt_unwind_cache *info =
|
struct mt_unwind_cache *info =
|
||||||
mt_frame_unwind_cache (next_frame, this_prologue_cache);
|
mt_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
|
|
||||||
if (!(info == NULL || info->prev_sp == 0))
|
if (!(info == NULL || info->prev_sp == 0))
|
||||||
(*this_id) = frame_id_build (info->prev_sp,
|
(*this_id) = frame_id_build (info->prev_sp, get_frame_func (this_frame));
|
||||||
frame_func_unwind (next_frame, NORMAL_FRAME));
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
mt_frame_prev_register (struct frame_info *next_frame,
|
mt_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache,
|
void **this_prologue_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *bufferp)
|
|
||||||
{
|
{
|
||||||
struct mt_unwind_cache *info =
|
struct mt_unwind_cache *info =
|
||||||
mt_frame_unwind_cache (next_frame, this_prologue_cache);
|
mt_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
|
|
||||||
trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, bufferp);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
mt_frame_base_address (struct frame_info *next_frame,
|
mt_frame_base_address (struct frame_info *this_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
struct mt_unwind_cache *info =
|
struct mt_unwind_cache *info =
|
||||||
mt_frame_unwind_cache (next_frame, this_prologue_cache);
|
mt_frame_unwind_cache (this_frame, this_prologue_cache);
|
||||||
|
|
||||||
return info->frame_base;
|
return info->frame_base;
|
||||||
}
|
}
|
||||||
@ -1090,18 +1084,11 @@ mt_frame_base_address (struct frame_info *next_frame,
|
|||||||
static const struct frame_unwind mt_frame_unwind = {
|
static const struct frame_unwind mt_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
mt_frame_this_id,
|
mt_frame_this_id,
|
||||||
mt_frame_prev_register
|
mt_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
/* The sniffer is a registered function that identifies our family of
|
|
||||||
frame unwind functions (this_id and prev_register). */
|
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
mt_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &mt_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Another shared interface: the 'frame_base' object specifies how to
|
/* Another shared interface: the 'frame_base' object specifies how to
|
||||||
unwind a frame and secure the base addresses for frame objects
|
unwind a frame and secure the base addresses for frame objects
|
||||||
(locals, args). */
|
(locals, args). */
|
||||||
@ -1168,8 +1155,8 @@ mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
|
|
||||||
/* Register the DWARF 2 sniffer first, and then the traditional prologue
|
/* Register the DWARF 2 sniffer first, and then the traditional prologue
|
||||||
based sniffer. */
|
based sniffer. */
|
||||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
dwarf2_append_unwinders (gdbarch);
|
||||||
frame_unwind_append_sniffer (gdbarch, mt_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &mt_frame_unwind);
|
||||||
frame_base_set_default (gdbarch, &mt_frame_base);
|
frame_base_set_default (gdbarch, &mt_frame_base);
|
||||||
|
|
||||||
/* Register the 'unwind_pc' method. */
|
/* Register the 'unwind_pc' method. */
|
||||||
@ -1179,7 +1166,7 @@ mt_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
/* Methods for saving / extracting a dummy frame's ID.
|
/* Methods for saving / extracting a dummy frame's ID.
|
||||||
The ID's stack address must match the SP value returned by
|
The ID's stack address must match the SP value returned by
|
||||||
PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */
|
PUSH_DUMMY_CALL, and saved by generic_save_dummy_frame_tos. */
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, mt_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, mt_dummy_id);
|
||||||
|
|
||||||
return gdbarch;
|
return gdbarch;
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ score_compare_pdr_entries (const void *a, const void *b)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
score_analyze_pdr_section (CORE_ADDR startaddr, CORE_ADDR pc,
|
score_analyze_pdr_section (CORE_ADDR startaddr, CORE_ADDR pc,
|
||||||
struct frame_info *next_frame,
|
struct frame_info *this_frame,
|
||||||
struct score_frame_cache *this_cache)
|
struct score_frame_cache *this_cache)
|
||||||
{
|
{
|
||||||
struct symbol *sym;
|
struct symbol *sym;
|
||||||
@ -442,12 +442,11 @@ score_return_value (struct gdbarch *gdbarch, struct type *func_type,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
score_unwind_dummy_id (struct gdbarch *gdbarch,
|
score_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
struct frame_info *next_frame)
|
|
||||||
{
|
{
|
||||||
return frame_id_build (
|
return frame_id_build (
|
||||||
frame_unwind_register_unsigned (next_frame, SCORE_SP_REGNUM),
|
get_frame_register_unsigned (this_frame, SCORE_SP_REGNUM),
|
||||||
frame_pc_unwind (next_frame));
|
get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -754,10 +753,10 @@ score_in_function_epilogue_p (struct gdbarch *gdbarch, CORE_ADDR cur_pc)
|
|||||||
|
|
||||||
static void
|
static void
|
||||||
score_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
|
score_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
|
||||||
struct frame_info *next_frame,
|
struct frame_info *this_frame,
|
||||||
struct score_frame_cache *this_cache)
|
struct score_frame_cache *this_cache)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
||||||
CORE_ADDR sp;
|
CORE_ADDR sp;
|
||||||
CORE_ADDR fp;
|
CORE_ADDR fp;
|
||||||
CORE_ADDR cur_pc = startaddr;
|
CORE_ADDR cur_pc = startaddr;
|
||||||
@ -777,8 +776,8 @@ score_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
|
|||||||
memblock_ptr = memblock =
|
memblock_ptr = memblock =
|
||||||
score_malloc_and_get_memblock (startaddr, pc - startaddr);
|
score_malloc_and_get_memblock (startaddr, pc - startaddr);
|
||||||
|
|
||||||
sp = frame_unwind_register_unsigned (next_frame, SCORE_SP_REGNUM);
|
sp = get_frame_register_unsigned (this_frame, SCORE_SP_REGNUM);
|
||||||
fp = frame_unwind_register_unsigned (next_frame, SCORE_FP_REGNUM);
|
fp = get_frame_register_unsigned (this_frame, SCORE_FP_REGNUM);
|
||||||
|
|
||||||
for (; cur_pc < pc; prev_pc = cur_pc, cur_pc += inst_len)
|
for (; cur_pc < pc; prev_pc = cur_pc, cur_pc += inst_len)
|
||||||
{
|
{
|
||||||
@ -938,7 +937,7 @@ score_analyze_prologue (CORE_ADDR startaddr, CORE_ADDR pc,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct score_frame_cache *
|
static struct score_frame_cache *
|
||||||
score_make_prologue_cache (struct frame_info *next_frame, void **this_cache)
|
score_make_prologue_cache (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct score_frame_cache *cache;
|
struct score_frame_cache *cache;
|
||||||
|
|
||||||
@ -947,17 +946,17 @@ score_make_prologue_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
|
|
||||||
cache = FRAME_OBSTACK_ZALLOC (struct score_frame_cache);
|
cache = FRAME_OBSTACK_ZALLOC (struct score_frame_cache);
|
||||||
(*this_cache) = cache;
|
(*this_cache) = cache;
|
||||||
cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
/* Analyze the prologue. */
|
/* Analyze the prologue. */
|
||||||
{
|
{
|
||||||
const CORE_ADDR pc = frame_pc_unwind (next_frame);
|
const CORE_ADDR pc = get_frame_pc (this_frame);
|
||||||
CORE_ADDR start_addr;
|
CORE_ADDR start_addr;
|
||||||
|
|
||||||
find_pc_partial_function (pc, NULL, &start_addr, NULL);
|
find_pc_partial_function (pc, NULL, &start_addr, NULL);
|
||||||
if (start_addr == 0)
|
if (start_addr == 0)
|
||||||
return cache;
|
return cache;
|
||||||
score_analyze_prologue (start_addr, pc, next_frame, *this_cache);
|
score_analyze_prologue (start_addr, pc, this_frame, *this_cache);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Save SP. */
|
/* Save SP. */
|
||||||
@ -967,47 +966,38 @@ score_make_prologue_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
score_prologue_this_id (struct frame_info *next_frame, void **this_cache,
|
score_prologue_this_id (struct frame_info *this_frame, void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct score_frame_cache *info = score_make_prologue_cache (next_frame,
|
struct score_frame_cache *info = score_make_prologue_cache (this_frame,
|
||||||
this_cache);
|
this_cache);
|
||||||
(*this_id) = frame_id_build (info->base,
|
(*this_id) = frame_id_build (info->base, get_frame_func (this_frame));
|
||||||
frame_func_unwind (next_frame, NORMAL_FRAME));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
score_prologue_prev_register (struct frame_info *next_frame,
|
score_prologue_prev_register (struct frame_info *this_frame,
|
||||||
void **this_cache,
|
void **this_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR * addrp,
|
|
||||||
int *realnump, gdb_byte * valuep)
|
|
||||||
{
|
{
|
||||||
struct score_frame_cache *info = score_make_prologue_cache (next_frame,
|
struct score_frame_cache *info = score_make_prologue_cache (this_frame,
|
||||||
this_cache);
|
this_cache);
|
||||||
trad_frame_get_prev_register (next_frame, info->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, info->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, valuep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind score_prologue_unwind =
|
static const struct frame_unwind score_prologue_unwind =
|
||||||
{
|
{
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
score_prologue_this_id,
|
score_prologue_this_id,
|
||||||
score_prologue_prev_register
|
score_prologue_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
score_prologue_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &score_prologue_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
score_prologue_frame_base_address (struct frame_info *next_frame,
|
score_prologue_frame_base_address (struct frame_info *this_frame,
|
||||||
void **this_cache)
|
void **this_cache)
|
||||||
{
|
{
|
||||||
struct score_frame_cache *info =
|
struct score_frame_cache *info =
|
||||||
score_make_prologue_cache (next_frame, this_cache);
|
score_make_prologue_cache (this_frame, this_cache);
|
||||||
return info->fp;
|
return info->fp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1020,7 +1010,7 @@ static const struct frame_base score_prologue_frame_base =
|
|||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_base *
|
static const struct frame_base *
|
||||||
score_prologue_frame_base_sniffer (struct frame_info *next_frame)
|
score_prologue_frame_base_sniffer (struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
return &score_prologue_frame_base;
|
return &score_prologue_frame_base;
|
||||||
}
|
}
|
||||||
@ -1063,13 +1053,13 @@ score_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
/* Dummy frame hooks. */
|
/* Dummy frame hooks. */
|
||||||
set_gdbarch_return_value (gdbarch, score_return_value);
|
set_gdbarch_return_value (gdbarch, score_return_value);
|
||||||
set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
|
set_gdbarch_call_dummy_location (gdbarch, AT_ENTRY_POINT);
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, score_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, score_dummy_id);
|
||||||
set_gdbarch_push_dummy_call (gdbarch, score_push_dummy_call);
|
set_gdbarch_push_dummy_call (gdbarch, score_push_dummy_call);
|
||||||
|
|
||||||
/* Normal frame hooks. */
|
/* Normal frame hooks. */
|
||||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
dwarf2_append_unwinders (gdbarch);
|
||||||
frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
|
frame_base_append_sniffer (gdbarch, dwarf2_frame_base_sniffer);
|
||||||
frame_unwind_append_sniffer (gdbarch, score_prologue_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &score_prologue_unwind);
|
||||||
frame_base_append_sniffer (gdbarch, score_prologue_frame_base_sniffer);
|
frame_base_append_sniffer (gdbarch, score_prologue_frame_base_sniffer);
|
||||||
|
|
||||||
return gdbarch;
|
return gdbarch;
|
||||||
|
@ -2512,7 +2512,7 @@ sh_alloc_frame_cache (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct sh_frame_cache *
|
static struct sh_frame_cache *
|
||||||
sh_frame_cache (struct frame_info *next_frame, void **this_cache)
|
sh_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct sh_frame_cache *cache;
|
struct sh_frame_cache *cache;
|
||||||
CORE_ADDR current_pc;
|
CORE_ADDR current_pc;
|
||||||
@ -2529,16 +2529,16 @@ sh_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
However, for functions that don't need it, the frame pointer is
|
However, for functions that don't need it, the frame pointer is
|
||||||
optional. For these "frameless" functions the frame pointer is
|
optional. For these "frameless" functions the frame pointer is
|
||||||
actually the frame pointer of the calling frame. */
|
actually the frame pointer of the calling frame. */
|
||||||
cache->base = frame_unwind_register_unsigned (next_frame, FP_REGNUM);
|
cache->base = get_frame_register_unsigned (this_frame, FP_REGNUM);
|
||||||
if (cache->base == 0)
|
if (cache->base == 0)
|
||||||
return cache;
|
return cache;
|
||||||
|
|
||||||
cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
|
cache->pc = get_frame_func (this_frame);
|
||||||
current_pc = frame_pc_unwind (next_frame);
|
current_pc = get_frame_pc (this_frame);
|
||||||
if (cache->pc != 0)
|
if (cache->pc != 0)
|
||||||
{
|
{
|
||||||
ULONGEST fpscr;
|
ULONGEST fpscr;
|
||||||
fpscr = frame_unwind_register_unsigned (next_frame, FPSCR_REGNUM);
|
fpscr = get_frame_register_unsigned (this_frame, FPSCR_REGNUM);
|
||||||
sh_analyze_prologue (cache->pc, current_pc, cache, fpscr);
|
sh_analyze_prologue (cache->pc, current_pc, cache, fpscr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2551,9 +2551,9 @@ sh_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
setup yet. Try to reconstruct the base address for the stack
|
setup yet. Try to reconstruct the base address for the stack
|
||||||
frame by looking at the stack pointer. For truly "frameless"
|
frame by looking at the stack pointer. For truly "frameless"
|
||||||
functions this might work too. */
|
functions this might work too. */
|
||||||
cache->base = frame_unwind_register_unsigned
|
cache->base = get_frame_register_unsigned
|
||||||
(next_frame,
|
(this_frame,
|
||||||
gdbarch_sp_regnum (get_frame_arch (next_frame)));
|
gdbarch_sp_regnum (get_frame_arch (this_frame)));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now that we have the base address for the stack frame we can
|
/* Now that we have the base address for the stack frame we can
|
||||||
@ -2569,30 +2569,17 @@ sh_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
sh_frame_prev_register (struct frame_info *next_frame, void **this_cache,
|
sh_frame_prev_register (struct frame_info *this_frame,
|
||||||
int regnum, int *optimizedp,
|
void **this_cache, int regnum)
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
||||||
struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache);
|
struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
gdb_assert (regnum >= 0);
|
gdb_assert (regnum >= 0);
|
||||||
|
|
||||||
if (regnum == gdbarch_sp_regnum (gdbarch) && cache->saved_sp)
|
if (regnum == gdbarch_sp_regnum (gdbarch) && cache->saved_sp)
|
||||||
{
|
return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
|
||||||
*optimizedp = 0;
|
|
||||||
*lvalp = not_lval;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = -1;
|
|
||||||
if (valuep)
|
|
||||||
{
|
|
||||||
/* Store the value. */
|
|
||||||
store_unsigned_integer (valuep, 4, cache->saved_sp);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The PC of the previous frame is stored in the PR register of
|
/* The PC of the previous frame is stored in the PR register of
|
||||||
the current frame. Frob regnum so that we pull the value from
|
the current frame. Frob regnum so that we pull the value from
|
||||||
@ -2601,33 +2588,17 @@ sh_frame_prev_register (struct frame_info *next_frame, void **this_cache,
|
|||||||
regnum = PR_REGNUM;
|
regnum = PR_REGNUM;
|
||||||
|
|
||||||
if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1)
|
if (regnum < SH_NUM_REGS && cache->saved_regs[regnum] != -1)
|
||||||
{
|
return frame_unwind_got_memory (this_frame, regnum,
|
||||||
*optimizedp = 0;
|
cache->saved_regs[regnum]);
|
||||||
*lvalp = lval_memory;
|
|
||||||
*addrp = cache->saved_regs[regnum];
|
|
||||||
*realnump = -1;
|
|
||||||
if (valuep)
|
|
||||||
{
|
|
||||||
/* Read the value in from memory. */
|
|
||||||
read_memory (*addrp, valuep,
|
|
||||||
register_size (gdbarch, regnum));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
*optimizedp = 0;
|
return frame_unwind_got_register (this_frame, regnum, regnum);
|
||||||
*lvalp = lval_register;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = regnum;
|
|
||||||
if (valuep)
|
|
||||||
frame_unwind_register (next_frame, (*realnump), valuep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sh_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
sh_frame_this_id (struct frame_info *this_frame, void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache);
|
struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
/* This marks the outermost frame. */
|
/* This marks the outermost frame. */
|
||||||
if (cache->base == 0)
|
if (cache->base == 0)
|
||||||
@ -2639,15 +2610,11 @@ sh_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
|||||||
static const struct frame_unwind sh_frame_unwind = {
|
static const struct frame_unwind sh_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
sh_frame_this_id,
|
sh_frame_this_id,
|
||||||
sh_frame_prev_register
|
sh_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
sh_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &sh_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
sh_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
sh_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
||||||
{
|
{
|
||||||
@ -2663,16 +2630,17 @@ sh_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
sh_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
sh_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
return frame_id_build (sh_unwind_sp (gdbarch, next_frame),
|
CORE_ADDR sp = get_frame_register_unsigned (this_frame,
|
||||||
frame_pc_unwind (next_frame));
|
gdbarch_sp_regnum (gdbarch));
|
||||||
|
return frame_id_build (sp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
sh_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
sh_frame_base_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct sh_frame_cache *cache = sh_frame_cache (next_frame, this_cache);
|
struct sh_frame_cache *cache = sh_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
return cache->base;
|
return cache->base;
|
||||||
}
|
}
|
||||||
@ -2862,7 +2830,7 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
set_gdbarch_frame_align (gdbarch, sh_frame_align);
|
set_gdbarch_frame_align (gdbarch, sh_frame_align);
|
||||||
set_gdbarch_unwind_sp (gdbarch, sh_unwind_sp);
|
set_gdbarch_unwind_sp (gdbarch, sh_unwind_sp);
|
||||||
set_gdbarch_unwind_pc (gdbarch, sh_unwind_pc);
|
set_gdbarch_unwind_pc (gdbarch, sh_unwind_pc);
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, sh_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, sh_dummy_id);
|
||||||
frame_base_set_default (gdbarch, &sh_frame_base);
|
frame_base_set_default (gdbarch, &sh_frame_base);
|
||||||
|
|
||||||
set_gdbarch_in_function_epilogue_p (gdbarch, sh_in_function_epilogue_p);
|
set_gdbarch_in_function_epilogue_p (gdbarch, sh_in_function_epilogue_p);
|
||||||
@ -2973,8 +2941,8 @@ sh_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
/* Hook in ABI-specific overrides, if they have been registered. */
|
/* Hook in ABI-specific overrides, if they have been registered. */
|
||||||
gdbarch_init_osabi (info, gdbarch);
|
gdbarch_init_osabi (info, gdbarch);
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
dwarf2_append_unwinders (gdbarch);
|
||||||
frame_unwind_append_sniffer (gdbarch, sh_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &sh_frame_unwind);
|
||||||
|
|
||||||
return gdbarch;
|
return gdbarch;
|
||||||
}
|
}
|
||||||
|
103
gdb/sh64-tdep.c
103
gdb/sh64-tdep.c
@ -2263,7 +2263,7 @@ sh64_alloc_frame_cache (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct sh64_frame_cache *
|
static struct sh64_frame_cache *
|
||||||
sh64_frame_cache (struct frame_info *next_frame, void **this_cache)
|
sh64_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct gdbarch *gdbarch;
|
struct gdbarch *gdbarch;
|
||||||
struct sh64_frame_cache *cache;
|
struct sh64_frame_cache *cache;
|
||||||
@ -2273,11 +2273,11 @@ sh64_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
if (*this_cache)
|
if (*this_cache)
|
||||||
return *this_cache;
|
return *this_cache;
|
||||||
|
|
||||||
gdbarch = get_frame_arch (next_frame);
|
gdbarch = get_frame_arch (this_frame);
|
||||||
cache = sh64_alloc_frame_cache ();
|
cache = sh64_alloc_frame_cache ();
|
||||||
*this_cache = cache;
|
*this_cache = cache;
|
||||||
|
|
||||||
current_pc = frame_pc_unwind (next_frame);
|
current_pc = get_frame_pc (this_frame);
|
||||||
cache->media_mode = pc_is_isa32 (current_pc);
|
cache->media_mode = pc_is_isa32 (current_pc);
|
||||||
|
|
||||||
/* In principle, for normal frames, fp holds the frame pointer,
|
/* In principle, for normal frames, fp holds the frame pointer,
|
||||||
@ -2285,11 +2285,11 @@ sh64_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
However, for functions that don't need it, the frame pointer is
|
However, for functions that don't need it, the frame pointer is
|
||||||
optional. For these "frameless" functions the frame pointer is
|
optional. For these "frameless" functions the frame pointer is
|
||||||
actually the frame pointer of the calling frame. */
|
actually the frame pointer of the calling frame. */
|
||||||
cache->base = frame_unwind_register_unsigned (next_frame, MEDIA_FP_REGNUM);
|
cache->base = get_frame_register_unsigned (this_frame, MEDIA_FP_REGNUM);
|
||||||
if (cache->base == 0)
|
if (cache->base == 0)
|
||||||
return cache;
|
return cache;
|
||||||
|
|
||||||
cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
|
cache->pc = get_frame_func (this_frame);
|
||||||
if (cache->pc != 0)
|
if (cache->pc != 0)
|
||||||
sh64_analyze_prologue (gdbarch, cache, cache->pc, current_pc);
|
sh64_analyze_prologue (gdbarch, cache, cache->pc, current_pc);
|
||||||
|
|
||||||
@ -2302,8 +2302,8 @@ sh64_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
setup yet. Try to reconstruct the base address for the stack
|
setup yet. Try to reconstruct the base address for the stack
|
||||||
frame by looking at the stack pointer. For truly "frameless"
|
frame by looking at the stack pointer. For truly "frameless"
|
||||||
functions this might work too. */
|
functions this might work too. */
|
||||||
cache->base = frame_unwind_register_unsigned
|
cache->base = get_frame_register_unsigned
|
||||||
(next_frame, gdbarch_sp_regnum (gdbarch));
|
(this_frame, gdbarch_sp_regnum (gdbarch));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now that we have the base address for the stack frame we can
|
/* Now that we have the base address for the stack frame we can
|
||||||
@ -2319,33 +2319,17 @@ sh64_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
sh64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
|
sh64_frame_prev_register (struct frame_info *this_frame,
|
||||||
int regnum, int *optimizedp,
|
void **this_cache, int regnum)
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct sh64_frame_cache *cache = sh64_frame_cache (next_frame, this_cache);
|
struct sh64_frame_cache *cache = sh64_frame_cache (this_frame, this_cache);
|
||||||
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
struct gdbarch *gdbarch = get_frame_arch (this_frame);
|
||||||
|
|
||||||
gdb_assert (regnum >= 0);
|
gdb_assert (regnum >= 0);
|
||||||
|
|
||||||
if (regnum == gdbarch_sp_regnum (gdbarch) && cache->saved_sp)
|
if (regnum == gdbarch_sp_regnum (gdbarch) && cache->saved_sp)
|
||||||
{
|
frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
|
||||||
*optimizedp = 0;
|
|
||||||
*lvalp = not_lval;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = -1;
|
|
||||||
if (valuep)
|
|
||||||
{
|
|
||||||
/* Store the value. */
|
|
||||||
store_unsigned_integer (valuep,
|
|
||||||
register_size (gdbarch,
|
|
||||||
gdbarch_sp_regnum (gdbarch)),
|
|
||||||
cache->saved_sp);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* The PC of the previous frame is stored in the PR register of
|
/* The PC of the previous frame is stored in the PR register of
|
||||||
the current frame. Frob regnum so that we pull the value from
|
the current frame. Frob regnum so that we pull the value from
|
||||||
@ -2355,42 +2339,26 @@ sh64_frame_prev_register (struct frame_info *next_frame, void **this_cache,
|
|||||||
|
|
||||||
if (regnum < SIM_SH64_NR_REGS && cache->saved_regs[regnum] != -1)
|
if (regnum < SIM_SH64_NR_REGS && cache->saved_regs[regnum] != -1)
|
||||||
{
|
{
|
||||||
int reg_size = register_size (gdbarch, regnum);
|
|
||||||
int size;
|
|
||||||
|
|
||||||
*optimizedp = 0;
|
|
||||||
*lvalp = lval_memory;
|
|
||||||
*addrp = cache->saved_regs[regnum];
|
|
||||||
*realnump = -1;
|
|
||||||
if (gdbarch_tdep (gdbarch)->sh_abi == SH_ABI_32
|
if (gdbarch_tdep (gdbarch)->sh_abi == SH_ABI_32
|
||||||
&& (regnum == MEDIA_FP_REGNUM || regnum == PR_REGNUM))
|
&& (regnum == MEDIA_FP_REGNUM || regnum == PR_REGNUM))
|
||||||
size = 4;
|
|
||||||
else
|
|
||||||
size = reg_size;
|
|
||||||
if (valuep)
|
|
||||||
{
|
{
|
||||||
memset (valuep, 0, reg_size);
|
CORE_ADDR val;
|
||||||
if (gdbarch_byte_order (gdbarch) == BFD_ENDIAN_LITTLE)
|
val = read_memory_unsigned_integer (cache->saved_regs[regnum], 4);
|
||||||
read_memory (*addrp, valuep, size);
|
return frame_unwind_got_constant (this_frame, regnum, val);
|
||||||
else
|
|
||||||
read_memory (*addrp, (char *) valuep + reg_size - size, size);
|
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
|
return frame_unwind_got_memory (this_frame, regnum,
|
||||||
|
cache->saved_regs[regnum]);
|
||||||
}
|
}
|
||||||
|
|
||||||
*optimizedp = 0;
|
return frame_unwind_got_register (this_frame, regnum, regnum);
|
||||||
*lvalp = lval_register;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = regnum;
|
|
||||||
if (valuep)
|
|
||||||
frame_unwind_register (next_frame, (*realnump), valuep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sh64_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
sh64_frame_this_id (struct frame_info *this_frame, void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct sh64_frame_cache *cache = sh64_frame_cache (next_frame, this_cache);
|
struct sh64_frame_cache *cache = sh64_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
/* This marks the outermost frame. */
|
/* This marks the outermost frame. */
|
||||||
if (cache->base == 0)
|
if (cache->base == 0)
|
||||||
@ -2402,15 +2370,11 @@ sh64_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
|||||||
static const struct frame_unwind sh64_frame_unwind = {
|
static const struct frame_unwind sh64_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
sh64_frame_this_id,
|
sh64_frame_this_id,
|
||||||
sh64_frame_prev_register
|
sh64_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
sh64_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &sh64_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
sh64_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
sh64_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
||||||
{
|
{
|
||||||
@ -2426,16 +2390,17 @@ sh64_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
sh64_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
sh64_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
return frame_id_build (sh64_unwind_sp (gdbarch, next_frame),
|
CORE_ADDR sp = get_frame_register_unsigned (this_frame,
|
||||||
frame_pc_unwind (next_frame));
|
gdbarch_sp_regnum (gdbarch));
|
||||||
|
return frame_id_build (sp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
sh64_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
sh64_frame_base_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct sh64_frame_cache *cache = sh64_frame_cache (next_frame, this_cache);
|
struct sh64_frame_cache *cache = sh64_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
return cache->base;
|
return cache->base;
|
||||||
}
|
}
|
||||||
@ -2521,7 +2486,7 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
set_gdbarch_frame_align (gdbarch, sh64_frame_align);
|
set_gdbarch_frame_align (gdbarch, sh64_frame_align);
|
||||||
set_gdbarch_unwind_sp (gdbarch, sh64_unwind_sp);
|
set_gdbarch_unwind_sp (gdbarch, sh64_unwind_sp);
|
||||||
set_gdbarch_unwind_pc (gdbarch, sh64_unwind_pc);
|
set_gdbarch_unwind_pc (gdbarch, sh64_unwind_pc);
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, sh64_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, sh64_dummy_id);
|
||||||
frame_base_set_default (gdbarch, &sh64_frame_base);
|
frame_base_set_default (gdbarch, &sh64_frame_base);
|
||||||
|
|
||||||
set_gdbarch_print_registers_info (gdbarch, sh64_print_registers_info);
|
set_gdbarch_print_registers_info (gdbarch, sh64_print_registers_info);
|
||||||
@ -2532,8 +2497,8 @@ sh64_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
/* Hook in ABI-specific overrides, if they have been registered. */
|
/* Hook in ABI-specific overrides, if they have been registered. */
|
||||||
gdbarch_init_osabi (info, gdbarch);
|
gdbarch_init_osabi (info, gdbarch);
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
dwarf2_append_unwinders (gdbarch);
|
||||||
frame_unwind_append_sniffer (gdbarch, sh64_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &sh64_frame_unwind);
|
||||||
|
|
||||||
return gdbarch;
|
return gdbarch;
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ sparc64fbsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct sparc_frame_cache *
|
static struct sparc_frame_cache *
|
||||||
sparc64fbsd_sigtramp_frame_cache (struct frame_info *next_frame,
|
sparc64fbsd_sigtramp_frame_cache (struct frame_info *this_frame,
|
||||||
void **this_cache)
|
void **this_cache)
|
||||||
{
|
{
|
||||||
struct sparc_frame_cache *cache;
|
struct sparc_frame_cache *cache;
|
||||||
@ -101,15 +101,15 @@ sparc64fbsd_sigtramp_frame_cache (struct frame_info *next_frame,
|
|||||||
if (*this_cache)
|
if (*this_cache)
|
||||||
return *this_cache;
|
return *this_cache;
|
||||||
|
|
||||||
cache = sparc_frame_cache (next_frame, this_cache);
|
cache = sparc_frame_cache (this_frame, this_cache);
|
||||||
gdb_assert (cache == *this_cache);
|
gdb_assert (cache == *this_cache);
|
||||||
|
|
||||||
cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
/* The third argument is a pointer to an instance of `ucontext_t',
|
/* The third argument is a pointer to an instance of `ucontext_t',
|
||||||
which has a member `uc_mcontext' that contains the saved
|
which has a member `uc_mcontext' that contains the saved
|
||||||
registers. */
|
registers. */
|
||||||
addr = frame_unwind_register_unsigned (next_frame, SPARC_O2_REGNUM);
|
addr = get_frame_register_unsigned (this_frame, SPARC_O2_REGNUM);
|
||||||
mcontext_addr = addr + 64;
|
mcontext_addr = addr + 64;
|
||||||
|
|
||||||
/* The following registers travel in the `mc_local' slots of
|
/* The following registers travel in the `mc_local' slots of
|
||||||
@ -136,7 +136,7 @@ sparc64fbsd_sigtramp_frame_cache (struct frame_info *next_frame,
|
|||||||
/* The `local' and `in' registers have been saved in the register
|
/* The `local' and `in' registers have been saved in the register
|
||||||
save area. */
|
save area. */
|
||||||
addr = cache->saved_regs[SPARC_SP_REGNUM].addr;
|
addr = cache->saved_regs[SPARC_SP_REGNUM].addr;
|
||||||
sp = get_frame_memory_unsigned (next_frame, addr, 8);
|
sp = get_frame_memory_unsigned (this_frame, addr, 8);
|
||||||
for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS;
|
for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS;
|
||||||
regnum <= SPARC_I7_REGNUM; regnum++, addr += 8)
|
regnum <= SPARC_I7_REGNUM; regnum++, addr += 8)
|
||||||
cache->saved_regs[regnum].addr = addr;
|
cache->saved_regs[regnum].addr = addr;
|
||||||
@ -147,7 +147,7 @@ sparc64fbsd_sigtramp_frame_cache (struct frame_info *next_frame,
|
|||||||
#define FPRS_FEF (1 << 2)
|
#define FPRS_FEF (1 << 2)
|
||||||
|
|
||||||
addr = cache->saved_regs[SPARC64_FPRS_REGNUM].addr;
|
addr = cache->saved_regs[SPARC64_FPRS_REGNUM].addr;
|
||||||
fprs = get_frame_memory_unsigned (next_frame, addr, 8);
|
fprs = get_frame_memory_unsigned (this_frame, addr, 8);
|
||||||
if (fprs & FPRS_FEF)
|
if (fprs & FPRS_FEF)
|
||||||
{
|
{
|
||||||
for (regnum = SPARC_F0_REGNUM, addr = mcontext_addr + 32 * 8;
|
for (regnum = SPARC_F0_REGNUM, addr = mcontext_addr + 32 * 8;
|
||||||
@ -163,50 +163,49 @@ sparc64fbsd_sigtramp_frame_cache (struct frame_info *next_frame,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sparc64fbsd_sigtramp_frame_this_id (struct frame_info *next_frame,
|
sparc64fbsd_sigtramp_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_cache,
|
void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct sparc_frame_cache *cache =
|
struct sparc_frame_cache *cache =
|
||||||
sparc64fbsd_sigtramp_frame_cache (next_frame, this_cache);
|
sparc64fbsd_sigtramp_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
(*this_id) = frame_id_build (cache->base, cache->pc);
|
(*this_id) = frame_id_build (cache->base, cache->pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
sparc64fbsd_sigtramp_frame_prev_register (struct frame_info *next_frame,
|
sparc64fbsd_sigtramp_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_cache,
|
void **this_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp,
|
|
||||||
CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct sparc_frame_cache *cache =
|
struct sparc_frame_cache *cache =
|
||||||
sparc64fbsd_sigtramp_frame_cache (next_frame, this_cache);
|
sparc64fbsd_sigtramp_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, valuep);
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
sparc64fbsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
|
||||||
|
struct frame_info *this_frame,
|
||||||
|
void **this_cache)
|
||||||
|
{
|
||||||
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
find_pc_partial_function (pc, &name, NULL, NULL);
|
||||||
|
if (sparc64fbsd_pc_in_sigtramp (pc, name))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind sparc64fbsd_sigtramp_frame_unwind =
|
static const struct frame_unwind sparc64fbsd_sigtramp_frame_unwind =
|
||||||
{
|
{
|
||||||
SIGTRAMP_FRAME,
|
SIGTRAMP_FRAME,
|
||||||
sparc64fbsd_sigtramp_frame_this_id,
|
sparc64fbsd_sigtramp_frame_this_id,
|
||||||
sparc64fbsd_sigtramp_frame_prev_register
|
sparc64fbsd_sigtramp_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
sparc64fbsd_sigtramp_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
sparc64fbsd_sigtramp_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
CORE_ADDR pc = frame_pc_unwind (next_frame);
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
find_pc_partial_function (pc, &name, NULL, NULL);
|
|
||||||
if (sparc64fbsd_pc_in_sigtramp (pc, name))
|
|
||||||
return &sparc64fbsd_sigtramp_frame_unwind;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -222,7 +221,7 @@ sparc64fbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|||||||
sparc64fbsd_collect_fpregset);
|
sparc64fbsd_collect_fpregset);
|
||||||
tdep->sizeof_fpregset = 272;
|
tdep->sizeof_fpregset = 272;
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, sparc64fbsd_sigtramp_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &sparc64fbsd_sigtramp_frame_unwind);
|
||||||
|
|
||||||
sparc64_init_abi (info, gdbarch);
|
sparc64_init_abi (info, gdbarch);
|
||||||
|
|
||||||
|
@ -90,13 +90,13 @@ sparc64nbsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
|
|||||||
|
|
||||||
struct trad_frame_saved_reg *
|
struct trad_frame_saved_reg *
|
||||||
sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
|
sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
|
||||||
struct frame_info *next_frame)
|
struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
struct trad_frame_saved_reg *saved_regs;
|
struct trad_frame_saved_reg *saved_regs;
|
||||||
CORE_ADDR addr, sp;
|
CORE_ADDR addr, sp;
|
||||||
int regnum, delta;
|
int regnum, delta;
|
||||||
|
|
||||||
saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
/* The registers are saved in bits and pieces scattered all over the
|
/* The registers are saved in bits and pieces scattered all over the
|
||||||
place. The code below records their location on the assumption
|
place. The code below records their location on the assumption
|
||||||
@ -127,7 +127,7 @@ sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
|
|||||||
/* The `local' and `in' registers have been saved in the register
|
/* The `local' and `in' registers have been saved in the register
|
||||||
save area. */
|
save area. */
|
||||||
addr = saved_regs[SPARC_SP_REGNUM].addr;
|
addr = saved_regs[SPARC_SP_REGNUM].addr;
|
||||||
sp = get_frame_memory_unsigned (next_frame, addr, 8);
|
sp = get_frame_memory_unsigned (this_frame, addr, 8);
|
||||||
for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS;
|
for (regnum = SPARC_L0_REGNUM, addr = sp + BIAS;
|
||||||
regnum <= SPARC_I7_REGNUM; regnum++, addr += 8)
|
regnum <= SPARC_I7_REGNUM; regnum++, addr += 8)
|
||||||
saved_regs[regnum].addr = addr;
|
saved_regs[regnum].addr = addr;
|
||||||
@ -141,7 +141,7 @@ sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
|
|||||||
ULONGEST i7;
|
ULONGEST i7;
|
||||||
|
|
||||||
addr = saved_regs[SPARC_I7_REGNUM].addr;
|
addr = saved_regs[SPARC_I7_REGNUM].addr;
|
||||||
i7 = get_frame_memory_unsigned (next_frame, addr, 8);
|
i7 = get_frame_memory_unsigned (this_frame, addr, 8);
|
||||||
trad_frame_set_value (saved_regs, SPARC_I7_REGNUM, i7 ^ wcookie);
|
trad_frame_set_value (saved_regs, SPARC_I7_REGNUM, i7 ^ wcookie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -152,7 +152,7 @@ sparc64nbsd_sigcontext_saved_regs (CORE_ADDR sigcontext_addr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct sparc_frame_cache *
|
static struct sparc_frame_cache *
|
||||||
sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame,
|
sparc64nbsd_sigcontext_frame_cache (struct frame_info *this_frame,
|
||||||
void **this_cache)
|
void **this_cache)
|
||||||
{
|
{
|
||||||
struct sparc_frame_cache *cache;
|
struct sparc_frame_cache *cache;
|
||||||
@ -161,7 +161,7 @@ sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame,
|
|||||||
if (*this_cache)
|
if (*this_cache)
|
||||||
return *this_cache;
|
return *this_cache;
|
||||||
|
|
||||||
cache = sparc_frame_cache (next_frame, this_cache);
|
cache = sparc_frame_cache (this_frame, this_cache);
|
||||||
gdb_assert (cache == *this_cache);
|
gdb_assert (cache == *this_cache);
|
||||||
|
|
||||||
/* If we couldn't find the frame's function, we're probably dealing
|
/* If we couldn't find the frame's function, we're probably dealing
|
||||||
@ -173,7 +173,7 @@ sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame,
|
|||||||
/* Since we couldn't find the frame's function, the cache was
|
/* Since we couldn't find the frame's function, the cache was
|
||||||
initialized under the assumption that we're frameless. */
|
initialized under the assumption that we're frameless. */
|
||||||
cache->frameless_p = 0;
|
cache->frameless_p = 0;
|
||||||
addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM);
|
addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM);
|
||||||
if (addr & 1)
|
if (addr & 1)
|
||||||
addr += BIAS;
|
addr += BIAS;
|
||||||
cache->base = addr;
|
cache->base = addr;
|
||||||
@ -182,59 +182,58 @@ sparc64nbsd_sigcontext_frame_cache (struct frame_info *next_frame,
|
|||||||
/* We find the appropriate instance of `struct sigcontext' at a
|
/* We find the appropriate instance of `struct sigcontext' at a
|
||||||
fixed offset in the signal frame. */
|
fixed offset in the signal frame. */
|
||||||
addr = cache->base + 128 + 8;
|
addr = cache->base + 128 + 8;
|
||||||
cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, next_frame);
|
cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, this_frame);
|
||||||
|
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sparc64nbsd_sigcontext_frame_this_id (struct frame_info *next_frame,
|
sparc64nbsd_sigcontext_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_cache,
|
void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct sparc_frame_cache *cache =
|
struct sparc_frame_cache *cache =
|
||||||
sparc64nbsd_sigcontext_frame_cache (next_frame, this_cache);
|
sparc64nbsd_sigcontext_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
(*this_id) = frame_id_build (cache->base, cache->pc);
|
(*this_id) = frame_id_build (cache->base, cache->pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
sparc64nbsd_sigcontext_frame_prev_register (struct frame_info *next_frame,
|
sparc64nbsd_sigcontext_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_cache,
|
void **this_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp,
|
|
||||||
CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct sparc_frame_cache *cache =
|
struct sparc_frame_cache *cache =
|
||||||
sparc64nbsd_sigcontext_frame_cache (next_frame, this_cache);
|
sparc64nbsd_sigcontext_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, valuep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind =
|
static int
|
||||||
|
sparc64nbsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
|
||||||
|
struct frame_info *this_frame,
|
||||||
|
void **this_cache)
|
||||||
{
|
{
|
||||||
SIGTRAMP_FRAME,
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
||||||
sparc64nbsd_sigcontext_frame_this_id,
|
|
||||||
sparc64nbsd_sigcontext_frame_prev_register
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
sparc64nbsd_sigtramp_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
CORE_ADDR pc = frame_pc_unwind (next_frame);
|
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
find_pc_partial_function (pc, &name, NULL, NULL);
|
find_pc_partial_function (pc, &name, NULL, NULL);
|
||||||
if (sparc64nbsd_pc_in_sigtramp (pc, name))
|
if (sparc64nbsd_pc_in_sigtramp (pc, name))
|
||||||
{
|
{
|
||||||
if (name == NULL || strncmp (name, "__sigtramp_sigcontext", 21))
|
if (name == NULL || strncmp (name, "__sigtramp_sigcontext", 21))
|
||||||
return &sparc64nbsd_sigcontext_frame_unwind;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct frame_unwind sparc64nbsd_sigcontext_frame_unwind =
|
||||||
|
{
|
||||||
|
SIGTRAMP_FRAME,
|
||||||
|
sparc64nbsd_sigcontext_frame_this_id,
|
||||||
|
sparc64nbsd_sigcontext_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
sparc64nbsd_sigtramp_frame_sniffer
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -251,7 +250,7 @@ sparc64nbsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|||||||
/* Make sure we can single-step "new" syscalls. */
|
/* Make sure we can single-step "new" syscalls. */
|
||||||
tdep->step_trap = sparcnbsd_step_trap;
|
tdep->step_trap = sparcnbsd_step_trap;
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, sparc64nbsd_sigtramp_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &sparc64nbsd_sigcontext_frame_unwind);
|
||||||
|
|
||||||
sparc64_init_abi (info, gdbarch);
|
sparc64_init_abi (info, gdbarch);
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ sparc64obsd_pc_in_sigtramp (CORE_ADDR pc, char *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct sparc_frame_cache *
|
static struct sparc_frame_cache *
|
||||||
sparc64obsd_frame_cache (struct frame_info *next_frame, void **this_cache)
|
sparc64obsd_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct sparc_frame_cache *cache;
|
struct sparc_frame_cache *cache;
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
@ -129,20 +129,20 @@ sparc64obsd_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
if (*this_cache)
|
if (*this_cache)
|
||||||
return *this_cache;
|
return *this_cache;
|
||||||
|
|
||||||
cache = sparc_frame_cache (next_frame, this_cache);
|
cache = sparc_frame_cache (this_frame, this_cache);
|
||||||
gdb_assert (cache == *this_cache);
|
gdb_assert (cache == *this_cache);
|
||||||
|
|
||||||
/* If we couldn't find the frame's function, we're probably dealing
|
/* If we couldn't find the frame's function, we're probably dealing
|
||||||
with an on-stack signal trampoline. */
|
with an on-stack signal trampoline. */
|
||||||
if (cache->pc == 0)
|
if (cache->pc == 0)
|
||||||
{
|
{
|
||||||
cache->pc = frame_pc_unwind (next_frame);
|
cache->pc = get_frame_pc (this_frame);
|
||||||
cache->pc &= ~(sparc64obsd_page_size - 1);
|
cache->pc &= ~(sparc64obsd_page_size - 1);
|
||||||
|
|
||||||
/* Since we couldn't find the frame's function, the cache was
|
/* Since we couldn't find the frame's function, the cache was
|
||||||
initialized under the assumption that we're frameless. */
|
initialized under the assumption that we're frameless. */
|
||||||
cache->frameless_p = 0;
|
cache->frameless_p = 0;
|
||||||
addr = frame_unwind_register_unsigned (next_frame, SPARC_FP_REGNUM);
|
addr = get_frame_register_unsigned (this_frame, SPARC_FP_REGNUM);
|
||||||
if (addr & 1)
|
if (addr & 1)
|
||||||
addr += BIAS;
|
addr += BIAS;
|
||||||
cache->base = addr;
|
cache->base = addr;
|
||||||
@ -151,59 +151,59 @@ sparc64obsd_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
/* We find the appropriate instance of `struct sigcontext' at a
|
/* We find the appropriate instance of `struct sigcontext' at a
|
||||||
fixed offset in the signal frame. */
|
fixed offset in the signal frame. */
|
||||||
addr = cache->base + 128 + 16;
|
addr = cache->base + 128 + 16;
|
||||||
cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, next_frame);
|
cache->saved_regs = sparc64nbsd_sigcontext_saved_regs (addr, this_frame);
|
||||||
|
|
||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sparc64obsd_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
sparc64obsd_frame_this_id (struct frame_info *this_frame, void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct sparc_frame_cache *cache =
|
struct sparc_frame_cache *cache =
|
||||||
sparc64obsd_frame_cache (next_frame, this_cache);
|
sparc64obsd_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
(*this_id) = frame_id_build (cache->base, cache->pc);
|
(*this_id) = frame_id_build (cache->base, cache->pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
sparc64obsd_frame_prev_register (struct frame_info *next_frame,
|
sparc64obsd_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_cache,
|
void **this_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct sparc_frame_cache *cache =
|
struct sparc_frame_cache *cache =
|
||||||
sparc64obsd_frame_cache (next_frame, this_cache);
|
sparc64obsd_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, valuep);
|
}
|
||||||
|
|
||||||
|
static int
|
||||||
|
sparc64obsd_sigtramp_frame_sniffer (const struct frame_unwind *self,
|
||||||
|
struct frame_info *this_frame,
|
||||||
|
void **this_cache)
|
||||||
|
{
|
||||||
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
||||||
|
char *name;
|
||||||
|
|
||||||
|
find_pc_partial_function (pc, &name, NULL, NULL);
|
||||||
|
if (sparc64obsd_pc_in_sigtramp (pc, name))
|
||||||
|
return 1;
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind sparc64obsd_frame_unwind =
|
static const struct frame_unwind sparc64obsd_frame_unwind =
|
||||||
{
|
{
|
||||||
SIGTRAMP_FRAME,
|
SIGTRAMP_FRAME,
|
||||||
sparc64obsd_frame_this_id,
|
sparc64obsd_frame_this_id,
|
||||||
sparc64obsd_frame_prev_register
|
sparc64obsd_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
sparc64obsd_sigtramp_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
sparc64obsd_sigtramp_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
CORE_ADDR pc = frame_pc_unwind (next_frame);
|
|
||||||
char *name;
|
|
||||||
|
|
||||||
find_pc_partial_function (pc, &name, NULL, NULL);
|
|
||||||
if (sparc64obsd_pc_in_sigtramp (pc, name))
|
|
||||||
return &sparc64obsd_frame_unwind;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Kernel debugging support. */
|
/* Kernel debugging support. */
|
||||||
|
|
||||||
static struct sparc_frame_cache *
|
static struct sparc_frame_cache *
|
||||||
sparc64obsd_trapframe_cache (struct frame_info *next_frame, void **this_cache)
|
sparc64obsd_trapframe_cache (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct sparc_frame_cache *cache;
|
struct sparc_frame_cache *cache;
|
||||||
CORE_ADDR sp, trapframe_addr;
|
CORE_ADDR sp, trapframe_addr;
|
||||||
@ -212,13 +212,13 @@ sparc64obsd_trapframe_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
if (*this_cache)
|
if (*this_cache)
|
||||||
return *this_cache;
|
return *this_cache;
|
||||||
|
|
||||||
cache = sparc_frame_cache (next_frame, this_cache);
|
cache = sparc_frame_cache (this_frame, this_cache);
|
||||||
gdb_assert (cache == *this_cache);
|
gdb_assert (cache == *this_cache);
|
||||||
|
|
||||||
sp = frame_unwind_register_unsigned (next_frame, SPARC_SP_REGNUM);
|
sp = get_frame_register_unsigned (this_frame, SPARC_SP_REGNUM);
|
||||||
trapframe_addr = sp + BIAS + 176;
|
trapframe_addr = sp + BIAS + 176;
|
||||||
|
|
||||||
cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
cache->saved_regs[SPARC64_STATE_REGNUM].addr = trapframe_addr;
|
cache->saved_regs[SPARC64_STATE_REGNUM].addr = trapframe_addr;
|
||||||
cache->saved_regs[SPARC64_PC_REGNUM].addr = trapframe_addr + 8;
|
cache->saved_regs[SPARC64_PC_REGNUM].addr = trapframe_addr + 8;
|
||||||
@ -232,55 +232,55 @@ sparc64obsd_trapframe_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sparc64obsd_trapframe_this_id (struct frame_info *next_frame,
|
sparc64obsd_trapframe_this_id (struct frame_info *this_frame,
|
||||||
void **this_cache, struct frame_id *this_id)
|
void **this_cache, struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct sparc_frame_cache *cache =
|
struct sparc_frame_cache *cache =
|
||||||
sparc64obsd_trapframe_cache (next_frame, this_cache);
|
sparc64obsd_trapframe_cache (this_frame, this_cache);
|
||||||
|
|
||||||
(*this_id) = frame_id_build (cache->base, cache->pc);
|
(*this_id) = frame_id_build (cache->base, cache->pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
sparc64obsd_trapframe_prev_register (struct frame_info *next_frame,
|
sparc64obsd_trapframe_prev_register (struct frame_info *this_frame,
|
||||||
void **this_cache,
|
void **this_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct sparc_frame_cache *cache =
|
struct sparc_frame_cache *cache =
|
||||||
sparc64obsd_trapframe_cache (next_frame, this_cache);
|
sparc64obsd_trapframe_cache (this_frame, this_cache);
|
||||||
|
|
||||||
trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, valuep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind sparc64obsd_trapframe_unwind =
|
static int
|
||||||
{
|
sparc64obsd_trapframe_sniffer (const struct frame_unwind *self,
|
||||||
NORMAL_FRAME,
|
struct frame_info *this_frame,
|
||||||
sparc64obsd_trapframe_this_id,
|
void **this_cache)
|
||||||
sparc64obsd_trapframe_prev_register
|
|
||||||
};
|
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
sparc64obsd_trapframe_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
{
|
||||||
CORE_ADDR pc;
|
CORE_ADDR pc;
|
||||||
ULONGEST pstate;
|
ULONGEST pstate;
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
/* Check whether we are in privileged mode, and bail out if we're not. */
|
/* Check whether we are in privileged mode, and bail out if we're not. */
|
||||||
pstate = frame_unwind_register_unsigned (next_frame, SPARC64_PSTATE_REGNUM);
|
pstate = get_frame_register_unsigned (this_frame, SPARC64_PSTATE_REGNUM);
|
||||||
if ((pstate & SPARC64_PSTATE_PRIV) == 0)
|
if ((pstate & SPARC64_PSTATE_PRIV) == 0)
|
||||||
return NULL;
|
return 0;
|
||||||
|
|
||||||
pc = frame_unwind_address_in_block (next_frame, NORMAL_FRAME);
|
pc = get_frame_address_in_block (this_frame);
|
||||||
find_pc_partial_function (pc, &name, NULL, NULL);
|
find_pc_partial_function (pc, &name, NULL, NULL);
|
||||||
if (name && strcmp (name, "Lslowtrap_reenter") == 0)
|
if (name && strcmp (name, "Lslowtrap_reenter") == 0)
|
||||||
return &sparc64obsd_trapframe_unwind;
|
return 1;
|
||||||
|
|
||||||
return NULL;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const struct frame_unwind sparc64obsd_trapframe_unwind =
|
||||||
|
{
|
||||||
|
NORMAL_FRAME,
|
||||||
|
sparc64obsd_trapframe_this_id,
|
||||||
|
sparc64obsd_trapframe_prev_register,
|
||||||
|
NULL,
|
||||||
|
sparc64obsd_trapframe_sniffer
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Threads support. */
|
/* Threads support. */
|
||||||
@ -378,8 +378,8 @@ sparc64obsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
|||||||
/* Make sure we can single-step "new" syscalls. */
|
/* Make sure we can single-step "new" syscalls. */
|
||||||
tdep->step_trap = sparcnbsd_step_trap;
|
tdep->step_trap = sparcnbsd_step_trap;
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, sparc64obsd_sigtramp_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &sparc64obsd_frame_unwind);
|
||||||
frame_unwind_append_sniffer (gdbarch, sparc64obsd_trapframe_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &sparc64obsd_trapframe_unwind);
|
||||||
|
|
||||||
sparc64_init_abi (info, gdbarch);
|
sparc64_init_abi (info, gdbarch);
|
||||||
|
|
||||||
|
@ -812,13 +812,13 @@ v850_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct v850_frame_cache *
|
static struct v850_frame_cache *
|
||||||
v850_alloc_frame_cache (struct frame_info *next_frame)
|
v850_alloc_frame_cache (struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
struct v850_frame_cache *cache;
|
struct v850_frame_cache *cache;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
cache = FRAME_OBSTACK_ZALLOC (struct v850_frame_cache);
|
cache = FRAME_OBSTACK_ZALLOC (struct v850_frame_cache);
|
||||||
cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
/* Base address. */
|
/* Base address. */
|
||||||
cache->base = 0;
|
cache->base = 0;
|
||||||
@ -832,7 +832,7 @@ v850_alloc_frame_cache (struct frame_info *next_frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct v850_frame_cache *
|
static struct v850_frame_cache *
|
||||||
v850_frame_cache (struct frame_info *next_frame, void **this_cache)
|
v850_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct v850_frame_cache *cache;
|
struct v850_frame_cache *cache;
|
||||||
CORE_ADDR current_pc;
|
CORE_ADDR current_pc;
|
||||||
@ -841,7 +841,7 @@ v850_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
if (*this_cache)
|
if (*this_cache)
|
||||||
return *this_cache;
|
return *this_cache;
|
||||||
|
|
||||||
cache = v850_alloc_frame_cache (next_frame);
|
cache = v850_alloc_frame_cache (this_frame);
|
||||||
*this_cache = cache;
|
*this_cache = cache;
|
||||||
|
|
||||||
/* In principle, for normal frames, fp holds the frame pointer,
|
/* In principle, for normal frames, fp holds the frame pointer,
|
||||||
@ -849,16 +849,16 @@ v850_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
However, for functions that don't need it, the frame pointer is
|
However, for functions that don't need it, the frame pointer is
|
||||||
optional. For these "frameless" functions the frame pointer is
|
optional. For these "frameless" functions the frame pointer is
|
||||||
actually the frame pointer of the calling frame. */
|
actually the frame pointer of the calling frame. */
|
||||||
cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM);
|
cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM);
|
||||||
if (cache->base == 0)
|
if (cache->base == 0)
|
||||||
return cache;
|
return cache;
|
||||||
|
|
||||||
cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
|
cache->pc = get_frame_func (this_frame);
|
||||||
current_pc = frame_pc_unwind (next_frame);
|
current_pc = get_frame_pc (this_frame);
|
||||||
if (cache->pc != 0)
|
if (cache->pc != 0)
|
||||||
{
|
{
|
||||||
ULONGEST ctbp;
|
ULONGEST ctbp;
|
||||||
ctbp = frame_unwind_register_unsigned (next_frame, E_CTBP_REGNUM);
|
ctbp = get_frame_register_unsigned (this_frame, E_CTBP_REGNUM);
|
||||||
v850_analyze_prologue (cache->pc, current_pc, cache, ctbp);
|
v850_analyze_prologue (cache->pc, current_pc, cache, ctbp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -871,7 +871,7 @@ v850_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
setup yet. Try to reconstruct the base address for the stack
|
setup yet. Try to reconstruct the base address for the stack
|
||||||
frame by looking at the stack pointer. For truly "frameless"
|
frame by looking at the stack pointer. For truly "frameless"
|
||||||
functions this might work too. */
|
functions this might work too. */
|
||||||
cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
|
cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now that we have the base address for the stack frame we can
|
/* Now that we have the base address for the stack frame we can
|
||||||
@ -896,25 +896,22 @@ v850_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
v850_frame_prev_register (struct frame_info *next_frame, void **this_cache,
|
v850_frame_prev_register (struct frame_info *this_frame,
|
||||||
int regnum, int *optimizedp,
|
void **this_cache, int regnum)
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct v850_frame_cache *cache = v850_frame_cache (next_frame, this_cache);
|
struct v850_frame_cache *cache = v850_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
gdb_assert (regnum >= 0);
|
gdb_assert (regnum >= 0);
|
||||||
|
|
||||||
trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, valuep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
v850_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
v850_frame_this_id (struct frame_info *this_frame, void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct v850_frame_cache *cache = v850_frame_cache (next_frame, this_cache);
|
struct v850_frame_cache *cache = v850_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
/* This marks the outermost frame. */
|
/* This marks the outermost frame. */
|
||||||
if (cache->base == 0)
|
if (cache->base == 0)
|
||||||
@ -926,14 +923,10 @@ v850_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
|||||||
static const struct frame_unwind v850_frame_unwind = {
|
static const struct frame_unwind v850_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
v850_frame_this_id,
|
v850_frame_this_id,
|
||||||
v850_frame_prev_register
|
v850_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
v850_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &v850_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
v850_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
v850_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
||||||
@ -950,16 +943,17 @@ v850_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
v850_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
v850_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
return frame_id_build (v850_unwind_sp (gdbarch, next_frame),
|
CORE_ADDR sp = get_frame_register_unsigned (this_frame,
|
||||||
frame_pc_unwind (next_frame));
|
gdbarch_sp_regnum (gdbarch));
|
||||||
|
return frame_id_build (sp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
v850_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
v850_frame_base_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct v850_frame_cache *cache = v850_frame_cache (next_frame, this_cache);
|
struct v850_frame_cache *cache = v850_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
return cache->base;
|
return cache->base;
|
||||||
}
|
}
|
||||||
@ -1026,14 +1020,14 @@ v850_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
set_gdbarch_frame_align (gdbarch, v850_frame_align);
|
set_gdbarch_frame_align (gdbarch, v850_frame_align);
|
||||||
set_gdbarch_unwind_sp (gdbarch, v850_unwind_sp);
|
set_gdbarch_unwind_sp (gdbarch, v850_unwind_sp);
|
||||||
set_gdbarch_unwind_pc (gdbarch, v850_unwind_pc);
|
set_gdbarch_unwind_pc (gdbarch, v850_unwind_pc);
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, v850_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, v850_dummy_id);
|
||||||
frame_base_set_default (gdbarch, &v850_frame_base);
|
frame_base_set_default (gdbarch, &v850_frame_base);
|
||||||
|
|
||||||
/* Hook in ABI-specific overrides, if they have been registered. */
|
/* Hook in ABI-specific overrides, if they have been registered. */
|
||||||
gdbarch_init_osabi (info, gdbarch);
|
gdbarch_init_osabi (info, gdbarch);
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
dwarf2_append_unwinders (gdbarch);
|
||||||
frame_unwind_append_sniffer (gdbarch, v850_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &v850_frame_unwind);
|
||||||
|
|
||||||
return gdbarch;
|
return gdbarch;
|
||||||
}
|
}
|
||||||
|
@ -191,12 +191,12 @@ vax_push_dummy_call (struct gdbarch *gdbarch, struct value *function,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
vax_unwind_dummy_id (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
vax_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
CORE_ADDR fp;
|
CORE_ADDR fp;
|
||||||
|
|
||||||
fp = frame_unwind_register_unsigned (next_frame, VAX_FP_REGNUM);
|
fp = get_frame_register_unsigned (this_frame, VAX_FP_REGNUM);
|
||||||
return frame_id_build (fp, frame_pc_unwind (next_frame));
|
return frame_id_build (fp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -311,7 +311,7 @@ struct vax_frame_cache
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct vax_frame_cache *
|
struct vax_frame_cache *
|
||||||
vax_frame_cache (struct frame_info *next_frame, void **this_cache)
|
vax_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct vax_frame_cache *cache;
|
struct vax_frame_cache *cache;
|
||||||
CORE_ADDR addr;
|
CORE_ADDR addr;
|
||||||
@ -323,16 +323,16 @@ vax_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
|
|
||||||
/* Allocate a new cache. */
|
/* Allocate a new cache. */
|
||||||
cache = FRAME_OBSTACK_ZALLOC (struct vax_frame_cache);
|
cache = FRAME_OBSTACK_ZALLOC (struct vax_frame_cache);
|
||||||
cache->saved_regs = trad_frame_alloc_saved_regs (next_frame);
|
cache->saved_regs = trad_frame_alloc_saved_regs (this_frame);
|
||||||
|
|
||||||
/* The frame pointer is used as the base for the frame. */
|
/* The frame pointer is used as the base for the frame. */
|
||||||
cache->base = frame_unwind_register_unsigned (next_frame, VAX_FP_REGNUM);
|
cache->base = get_frame_register_unsigned (this_frame, VAX_FP_REGNUM);
|
||||||
if (cache->base == 0)
|
if (cache->base == 0)
|
||||||
return cache;
|
return cache;
|
||||||
|
|
||||||
/* The register save mask and control bits determine the layout of
|
/* The register save mask and control bits determine the layout of
|
||||||
the stack frame. */
|
the stack frame. */
|
||||||
mask = get_frame_memory_unsigned (next_frame, cache->base + 4, 4) >> 16;
|
mask = get_frame_memory_unsigned (this_frame, cache->base + 4, 4) >> 16;
|
||||||
|
|
||||||
/* These are always saved. */
|
/* These are always saved. */
|
||||||
cache->saved_regs[VAX_PC_REGNUM].addr = cache->base + 16;
|
cache->saved_regs[VAX_PC_REGNUM].addr = cache->base + 16;
|
||||||
@ -362,7 +362,7 @@ vax_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
stack address for the arguments that were pushed onto the
|
stack address for the arguments that were pushed onto the
|
||||||
stack. The return instruction will automatically pop the
|
stack. The return instruction will automatically pop the
|
||||||
arguments from the stack. */
|
arguments from the stack. */
|
||||||
numarg = get_frame_memory_unsigned (next_frame, addr, 1);
|
numarg = get_frame_memory_unsigned (this_frame, addr, 1);
|
||||||
addr += 4 + numarg * 4;
|
addr += 4 + numarg * 4;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -373,57 +373,49 @@ vax_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vax_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
vax_frame_this_id (struct frame_info *this_frame, void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct vax_frame_cache *cache = vax_frame_cache (next_frame, this_cache);
|
struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
/* This marks the outermost frame. */
|
/* This marks the outermost frame. */
|
||||||
if (cache->base == 0)
|
if (cache->base == 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
(*this_id) = frame_id_build (cache->base,
|
(*this_id) = frame_id_build (cache->base, get_frame_func (this_frame));
|
||||||
frame_func_unwind (next_frame, NORMAL_FRAME));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
vax_frame_prev_register (struct frame_info *next_frame, void **this_cache,
|
vax_frame_prev_register (struct frame_info *this_frame,
|
||||||
int regnum, int *optimizedp,
|
void **this_cache, int regnum)
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct vax_frame_cache *cache = vax_frame_cache (next_frame, this_cache);
|
struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
trad_frame_get_prev_register (next_frame, cache->saved_regs, regnum,
|
return trad_frame_get_prev_register (this_frame, cache->saved_regs, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, valuep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind vax_frame_unwind =
|
static const struct frame_unwind vax_frame_unwind =
|
||||||
{
|
{
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
vax_frame_this_id,
|
vax_frame_this_id,
|
||||||
vax_frame_prev_register
|
vax_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
vax_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &vax_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
vax_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
vax_frame_base_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct vax_frame_cache *cache = vax_frame_cache (next_frame, this_cache);
|
struct vax_frame_cache *cache = vax_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
return cache->base;
|
return cache->base;
|
||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
vax_frame_args_address (struct frame_info *next_frame, void **this_cache)
|
vax_frame_args_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
return frame_unwind_register_unsigned (next_frame, VAX_AP_REGNUM);
|
return get_frame_register_unsigned (this_frame, VAX_AP_REGNUM);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_base vax_frame_base =
|
static const struct frame_base vax_frame_base =
|
||||||
@ -505,7 +497,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
|
|
||||||
/* Call dummy code. */
|
/* Call dummy code. */
|
||||||
set_gdbarch_push_dummy_call (gdbarch, vax_push_dummy_call);
|
set_gdbarch_push_dummy_call (gdbarch, vax_push_dummy_call);
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, vax_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, vax_dummy_id);
|
||||||
|
|
||||||
/* Breakpoint info */
|
/* Breakpoint info */
|
||||||
set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc);
|
set_gdbarch_breakpoint_from_pc (gdbarch, vax_breakpoint_from_pc);
|
||||||
@ -523,7 +515,7 @@ vax_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
/* Hook in ABI-specific overrides, if they have been registered. */
|
/* Hook in ABI-specific overrides, if they have been registered. */
|
||||||
gdbarch_init_osabi (info, gdbarch);
|
gdbarch_init_osabi (info, gdbarch);
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, vax_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &vax_frame_unwind);
|
||||||
|
|
||||||
return (gdbarch);
|
return (gdbarch);
|
||||||
}
|
}
|
||||||
|
@ -57,9 +57,11 @@ static const gdb_byte vaxobsd_sigreturn[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static int
|
static int
|
||||||
vaxobsd_sigtramp_p (struct frame_info *next_frame)
|
vaxobsd_sigtramp_sniffer (const struct frame_unwind *self,
|
||||||
|
struct frame_info *this_frame,
|
||||||
|
void **this_cache)
|
||||||
{
|
{
|
||||||
CORE_ADDR pc = frame_pc_unwind (next_frame);
|
CORE_ADDR pc = get_frame_pc (this_frame);
|
||||||
CORE_ADDR start_pc = (pc & ~(vaxobsd_page_size - 1));
|
CORE_ADDR start_pc = (pc & ~(vaxobsd_page_size - 1));
|
||||||
CORE_ADDR sigreturn_addr = start_pc + vaxobsd_sigreturn_offset;
|
CORE_ADDR sigreturn_addr = start_pc + vaxobsd_sigreturn_offset;
|
||||||
gdb_byte *buf;
|
gdb_byte *buf;
|
||||||
@ -70,7 +72,7 @@ vaxobsd_sigtramp_p (struct frame_info *next_frame)
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
buf = alloca(sizeof vaxobsd_sigreturn);
|
buf = alloca(sizeof vaxobsd_sigreturn);
|
||||||
if (!safe_frame_unwind_memory (next_frame, sigreturn_addr,
|
if (!safe_frame_unwind_memory (this_frame, sigreturn_addr,
|
||||||
buf, sizeof vaxobsd_sigreturn))
|
buf, sizeof vaxobsd_sigreturn))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@ -81,7 +83,7 @@ vaxobsd_sigtramp_p (struct frame_info *next_frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct trad_frame_cache *
|
static struct trad_frame_cache *
|
||||||
vaxobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
|
vaxobsd_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct trad_frame_cache *cache;
|
struct trad_frame_cache *cache;
|
||||||
CORE_ADDR addr, base, func;
|
CORE_ADDR addr, base, func;
|
||||||
@ -89,14 +91,14 @@ vaxobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
if (*this_cache)
|
if (*this_cache)
|
||||||
return *this_cache;
|
return *this_cache;
|
||||||
|
|
||||||
cache = trad_frame_cache_zalloc (next_frame);
|
cache = trad_frame_cache_zalloc (this_frame);
|
||||||
*this_cache = cache;
|
*this_cache = cache;
|
||||||
|
|
||||||
func = frame_pc_unwind (next_frame);
|
func = get_frame_pc (this_frame);
|
||||||
func &= ~(vaxobsd_page_size - 1);
|
func &= ~(vaxobsd_page_size - 1);
|
||||||
|
|
||||||
base = frame_unwind_register_unsigned (next_frame, VAX_SP_REGNUM);
|
base = get_frame_register_unsigned (this_frame, VAX_SP_REGNUM);
|
||||||
addr = get_frame_memory_unsigned (next_frame, base - 4, 4);
|
addr = get_frame_memory_unsigned (this_frame, base - 4, 4);
|
||||||
|
|
||||||
trad_frame_set_reg_addr (cache, VAX_SP_REGNUM, addr + 8);
|
trad_frame_set_reg_addr (cache, VAX_SP_REGNUM, addr + 8);
|
||||||
trad_frame_set_reg_addr (cache, VAX_FP_REGNUM, addr + 12);
|
trad_frame_set_reg_addr (cache, VAX_FP_REGNUM, addr + 12);
|
||||||
@ -111,43 +113,32 @@ vaxobsd_sigtramp_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
vaxobsd_sigtramp_frame_this_id (struct frame_info *next_frame,
|
vaxobsd_sigtramp_frame_this_id (struct frame_info *this_frame,
|
||||||
void **this_cache, struct frame_id *this_id)
|
void **this_cache, struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct trad_frame_cache *cache =
|
struct trad_frame_cache *cache =
|
||||||
vaxobsd_sigtramp_frame_cache (next_frame, this_cache);
|
vaxobsd_sigtramp_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
trad_frame_get_id (cache, this_id);
|
trad_frame_get_id (cache, this_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
vaxobsd_sigtramp_frame_prev_register (struct frame_info *next_frame,
|
vaxobsd_sigtramp_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_cache, int regnum,
|
void **this_cache, int regnum)
|
||||||
int *optimizedp, enum lval_type *lvalp,
|
|
||||||
CORE_ADDR *addrp, int *realnump,
|
|
||||||
gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct trad_frame_cache *cache =
|
struct trad_frame_cache *cache =
|
||||||
vaxobsd_sigtramp_frame_cache (next_frame, this_cache);
|
vaxobsd_sigtramp_frame_cache (this_frame, this_cache);
|
||||||
|
|
||||||
trad_frame_get_register (cache, next_frame, regnum,
|
return trad_frame_get_register (cache, this_frame, regnum);
|
||||||
optimizedp, lvalp, addrp, realnump, valuep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct frame_unwind vaxobsd_sigtramp_frame_unwind = {
|
static const struct frame_unwind vaxobsd_sigtramp_frame_unwind = {
|
||||||
SIGTRAMP_FRAME,
|
SIGTRAMP_FRAME,
|
||||||
vaxobsd_sigtramp_frame_this_id,
|
vaxobsd_sigtramp_frame_this_id,
|
||||||
vaxobsd_sigtramp_frame_prev_register
|
vaxobsd_sigtramp_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
vaxobsd_sigtramp_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
vaxobsd_sigtramp_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
if (vaxobsd_sigtramp_p (next_frame))
|
|
||||||
return &vaxobsd_sigtramp_frame_unwind;
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* OpenBSD a.out. */
|
/* OpenBSD a.out. */
|
||||||
@ -155,7 +146,7 @@ vaxobsd_sigtramp_frame_sniffer (struct frame_info *next_frame)
|
|||||||
static void
|
static void
|
||||||
vaxobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
vaxobsd_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
|
||||||
{
|
{
|
||||||
frame_unwind_append_sniffer (gdbarch, vaxobsd_sigtramp_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &vaxobsd_sigtramp_frame_unwind);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* FIXME: kettenis/20050821: Since OpenBSD/vax binaries are
|
/* FIXME: kettenis/20050821: Since OpenBSD/vax binaries are
|
||||||
|
@ -311,7 +311,7 @@ xstormy16_push_dummy_call (struct gdbarch *gdbarch,
|
|||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
xstormy16_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
|
xstormy16_analyze_prologue (CORE_ADDR start_addr, CORE_ADDR end_addr,
|
||||||
struct xstormy16_frame_cache *cache,
|
struct xstormy16_frame_cache *cache,
|
||||||
struct frame_info *next_frame)
|
struct frame_info *this_frame)
|
||||||
{
|
{
|
||||||
CORE_ADDR next_addr;
|
CORE_ADDR next_addr;
|
||||||
ULONGEST inst, inst2;
|
ULONGEST inst, inst2;
|
||||||
@ -638,7 +638,7 @@ xstormy16_alloc_frame_cache (void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct xstormy16_frame_cache *
|
static struct xstormy16_frame_cache *
|
||||||
xstormy16_frame_cache (struct frame_info *next_frame, void **this_cache)
|
xstormy16_frame_cache (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct xstormy16_frame_cache *cache;
|
struct xstormy16_frame_cache *cache;
|
||||||
CORE_ADDR current_pc;
|
CORE_ADDR current_pc;
|
||||||
@ -650,17 +650,17 @@ xstormy16_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
cache = xstormy16_alloc_frame_cache ();
|
cache = xstormy16_alloc_frame_cache ();
|
||||||
*this_cache = cache;
|
*this_cache = cache;
|
||||||
|
|
||||||
cache->base = frame_unwind_register_unsigned (next_frame, E_FP_REGNUM);
|
cache->base = get_frame_register_unsigned (this_frame, E_FP_REGNUM);
|
||||||
if (cache->base == 0)
|
if (cache->base == 0)
|
||||||
return cache;
|
return cache;
|
||||||
|
|
||||||
cache->pc = frame_func_unwind (next_frame, NORMAL_FRAME);
|
cache->pc = get_frame_func (this_frame);
|
||||||
current_pc = frame_pc_unwind (next_frame);
|
current_pc = get_frame_pc (this_frame);
|
||||||
if (cache->pc)
|
if (cache->pc)
|
||||||
xstormy16_analyze_prologue (cache->pc, current_pc, cache, next_frame);
|
xstormy16_analyze_prologue (cache->pc, current_pc, cache, this_frame);
|
||||||
|
|
||||||
if (!cache->uses_fp)
|
if (!cache->uses_fp)
|
||||||
cache->base = frame_unwind_register_unsigned (next_frame, E_SP_REGNUM);
|
cache->base = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
|
||||||
|
|
||||||
cache->saved_sp = cache->base - cache->framesize;
|
cache->saved_sp = cache->base - cache->framesize;
|
||||||
|
|
||||||
@ -671,59 +671,29 @@ xstormy16_frame_cache (struct frame_info *next_frame, void **this_cache)
|
|||||||
return cache;
|
return cache;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static struct value *
|
||||||
xstormy16_frame_prev_register (struct frame_info *next_frame,
|
xstormy16_frame_prev_register (struct frame_info *this_frame,
|
||||||
void **this_cache,
|
void **this_cache, int regnum)
|
||||||
int regnum, int *optimizedp,
|
|
||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
|
||||||
int *realnump, gdb_byte *valuep)
|
|
||||||
{
|
{
|
||||||
struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame,
|
struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame,
|
||||||
this_cache);
|
this_cache);
|
||||||
gdb_assert (regnum >= 0);
|
gdb_assert (regnum >= 0);
|
||||||
|
|
||||||
if (regnum == E_SP_REGNUM && cache->saved_sp)
|
if (regnum == E_SP_REGNUM && cache->saved_sp)
|
||||||
{
|
return frame_unwind_got_constant (this_frame, regnum, cache->saved_sp);
|
||||||
*optimizedp = 0;
|
|
||||||
*lvalp = not_lval;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = -1;
|
|
||||||
if (valuep)
|
|
||||||
{
|
|
||||||
/* Store the value. */
|
|
||||||
store_unsigned_integer (valuep, xstormy16_reg_size, cache->saved_sp);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (regnum < E_NUM_REGS && cache->saved_regs[regnum] != REG_UNAVAIL)
|
if (regnum < E_NUM_REGS && cache->saved_regs[regnum] != REG_UNAVAIL)
|
||||||
{
|
return frame_unwind_got_memory (this_frame, regnum,
|
||||||
*optimizedp = 0;
|
cache->saved_regs[regnum]);
|
||||||
*lvalp = lval_memory;
|
|
||||||
*addrp = cache->saved_regs[regnum];
|
|
||||||
*realnump = -1;
|
|
||||||
if (valuep)
|
|
||||||
{
|
|
||||||
/* Read the value in from memory. */
|
|
||||||
read_memory (*addrp, valuep,
|
|
||||||
register_size (get_frame_arch (next_frame), regnum));
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
*optimizedp = 0;
|
return frame_unwind_got_register (this_frame, regnum, regnum);
|
||||||
*lvalp = lval_register;
|
|
||||||
*addrp = 0;
|
|
||||||
*realnump = regnum;
|
|
||||||
if (valuep)
|
|
||||||
frame_unwind_register (next_frame, (*realnump), valuep);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
xstormy16_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
xstormy16_frame_this_id (struct frame_info *this_frame, void **this_cache,
|
||||||
struct frame_id *this_id)
|
struct frame_id *this_id)
|
||||||
{
|
{
|
||||||
struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame,
|
struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame,
|
||||||
this_cache);
|
this_cache);
|
||||||
|
|
||||||
/* This marks the outermost frame. */
|
/* This marks the outermost frame. */
|
||||||
@ -734,9 +704,9 @@ xstormy16_frame_this_id (struct frame_info *next_frame, void **this_cache,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
xstormy16_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
xstormy16_frame_base_address (struct frame_info *this_frame, void **this_cache)
|
||||||
{
|
{
|
||||||
struct xstormy16_frame_cache *cache = xstormy16_frame_cache (next_frame,
|
struct xstormy16_frame_cache *cache = xstormy16_frame_cache (this_frame,
|
||||||
this_cache);
|
this_cache);
|
||||||
return cache->base;
|
return cache->base;
|
||||||
}
|
}
|
||||||
@ -744,7 +714,9 @@ xstormy16_frame_base_address (struct frame_info *next_frame, void **this_cache)
|
|||||||
static const struct frame_unwind xstormy16_frame_unwind = {
|
static const struct frame_unwind xstormy16_frame_unwind = {
|
||||||
NORMAL_FRAME,
|
NORMAL_FRAME,
|
||||||
xstormy16_frame_this_id,
|
xstormy16_frame_this_id,
|
||||||
xstormy16_frame_prev_register
|
xstormy16_frame_prev_register,
|
||||||
|
NULL,
|
||||||
|
default_frame_sniffer
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_base xstormy16_frame_base = {
|
static const struct frame_base xstormy16_frame_base = {
|
||||||
@ -754,12 +726,6 @@ static const struct frame_base xstormy16_frame_base = {
|
|||||||
xstormy16_frame_base_address
|
xstormy16_frame_base_address
|
||||||
};
|
};
|
||||||
|
|
||||||
static const struct frame_unwind *
|
|
||||||
xstormy16_frame_sniffer (struct frame_info *next_frame)
|
|
||||||
{
|
|
||||||
return &xstormy16_frame_unwind;
|
|
||||||
}
|
|
||||||
|
|
||||||
static CORE_ADDR
|
static CORE_ADDR
|
||||||
xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
xstormy16_unwind_sp (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
||||||
{
|
{
|
||||||
@ -773,11 +739,10 @@ xstormy16_unwind_pc (struct gdbarch *gdbarch, struct frame_info *next_frame)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static struct frame_id
|
static struct frame_id
|
||||||
xstormy16_unwind_dummy_id (struct gdbarch *gdbarch,
|
xstormy16_dummy_id (struct gdbarch *gdbarch, struct frame_info *this_frame)
|
||||||
struct frame_info *next_frame)
|
|
||||||
{
|
{
|
||||||
return frame_id_build (xstormy16_unwind_sp (gdbarch, next_frame),
|
CORE_ADDR sp = get_frame_register_unsigned (this_frame, E_SP_REGNUM);
|
||||||
frame_pc_unwind (next_frame));
|
return frame_id_build (sp, get_frame_pc (this_frame));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -832,7 +797,7 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
*/
|
*/
|
||||||
set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp);
|
set_gdbarch_unwind_sp (gdbarch, xstormy16_unwind_sp);
|
||||||
set_gdbarch_unwind_pc (gdbarch, xstormy16_unwind_pc);
|
set_gdbarch_unwind_pc (gdbarch, xstormy16_unwind_pc);
|
||||||
set_gdbarch_unwind_dummy_id (gdbarch, xstormy16_unwind_dummy_id);
|
set_gdbarch_dummy_id (gdbarch, xstormy16_dummy_id);
|
||||||
set_gdbarch_frame_align (gdbarch, xstormy16_frame_align);
|
set_gdbarch_frame_align (gdbarch, xstormy16_frame_align);
|
||||||
frame_base_set_default (gdbarch, &xstormy16_frame_base);
|
frame_base_set_default (gdbarch, &xstormy16_frame_base);
|
||||||
|
|
||||||
@ -851,8 +816,8 @@ xstormy16_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
|
|||||||
|
|
||||||
gdbarch_init_osabi (info, gdbarch);
|
gdbarch_init_osabi (info, gdbarch);
|
||||||
|
|
||||||
frame_unwind_append_sniffer (gdbarch, dwarf2_frame_sniffer);
|
dwarf2_append_unwinders (gdbarch);
|
||||||
frame_unwind_append_sniffer (gdbarch, xstormy16_frame_sniffer);
|
frame_unwind_append_unwinder (gdbarch, &xstormy16_frame_unwind);
|
||||||
|
|
||||||
return gdbarch;
|
return gdbarch;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user