mirror of
https://github.com/espressif/binutils-gdb.git
synced 2025-06-06 15:38:45 +08:00
2003-06-03 Andrew Cagney <cagney@redhat.com>
* frame.c (get_frame_memory_signed): New function. (get_frame_memory, get_frame_memory_unsigned): New function. (get_frame_arch): New function. * frame.h (get_frame_signed_memory, get_frame_arch): Declare. (get_frame_memory, get_frame_unsigned_memory): Declare. * d10v-tdep.c (d10v_frame_unwind_cache): Use get_frame_memory_unsigned and get_frame_arch. (d10v_frame_unwind_cache, saved_regs_unwinder): Ditto.
This commit is contained in:
@ -1,3 +1,14 @@
|
|||||||
|
2003-06-03 Andrew Cagney <cagney@redhat.com>
|
||||||
|
|
||||||
|
* frame.c (get_frame_memory_signed): New function.
|
||||||
|
(get_frame_memory, get_frame_memory_unsigned): New function.
|
||||||
|
(get_frame_arch): New function.
|
||||||
|
* frame.h (get_frame_signed_memory, get_frame_arch): Declare.
|
||||||
|
(get_frame_memory, get_frame_unsigned_memory): Declare.
|
||||||
|
* d10v-tdep.c (d10v_frame_unwind_cache): Use
|
||||||
|
get_frame_memory_unsigned and get_frame_arch.
|
||||||
|
(d10v_frame_unwind_cache, saved_regs_unwinder): Ditto.
|
||||||
|
|
||||||
2003-06-03 Raoul Gough <RaoulGough@yahoo.co.uk>
|
2003-06-03 Raoul Gough <RaoulGough@yahoo.co.uk>
|
||||||
|
|
||||||
* MAINTAINERS (write after approval): Add myself.
|
* MAINTAINERS (write after approval): Add myself.
|
||||||
|
@ -665,6 +665,7 @@ struct d10v_unwind_cache *
|
|||||||
d10v_frame_unwind_cache (struct frame_info *next_frame,
|
d10v_frame_unwind_cache (struct frame_info *next_frame,
|
||||||
void **this_prologue_cache)
|
void **this_prologue_cache)
|
||||||
{
|
{
|
||||||
|
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
||||||
CORE_ADDR pc;
|
CORE_ADDR pc;
|
||||||
ULONGEST prev_sp;
|
ULONGEST prev_sp;
|
||||||
ULONGEST this_base;
|
ULONGEST this_base;
|
||||||
@ -689,7 +690,7 @@ d10v_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
pc > 0 && pc < frame_pc_unwind (next_frame);
|
pc > 0 && pc < frame_pc_unwind (next_frame);
|
||||||
pc += 4)
|
pc += 4)
|
||||||
{
|
{
|
||||||
op = (unsigned long) read_memory_integer (pc, 4);
|
op = get_frame_memory_unsigned (next_frame, pc, 4);
|
||||||
if ((op & 0xC0000000) == 0xC0000000)
|
if ((op & 0xC0000000) == 0xC0000000)
|
||||||
{
|
{
|
||||||
/* long instruction */
|
/* long instruction */
|
||||||
@ -753,9 +754,10 @@ d10v_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
{
|
{
|
||||||
/* The SP was saved (which is very unusual), the frame base is
|
/* The SP was saved (which is very unusual), the frame base is
|
||||||
just the PREV's frame's TOP-OF-STACK. */
|
just the PREV's frame's TOP-OF-STACK. */
|
||||||
this_base = read_memory_unsigned_integer (info->saved_regs[D10V_SP_REGNUM],
|
this_base
|
||||||
register_size (current_gdbarch,
|
= get_frame_memory_unsigned (next_frame,
|
||||||
D10V_SP_REGNUM));
|
info->saved_regs[D10V_SP_REGNUM],
|
||||||
|
register_size (gdbarch, D10V_SP_REGNUM));
|
||||||
prev_sp = this_base;
|
prev_sp = this_base;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -779,9 +781,9 @@ d10v_frame_unwind_cache (struct frame_info *next_frame,
|
|||||||
|
|
||||||
if (info->saved_regs[LR_REGNUM])
|
if (info->saved_regs[LR_REGNUM])
|
||||||
{
|
{
|
||||||
CORE_ADDR return_pc
|
CORE_ADDR return_pc
|
||||||
= read_memory_unsigned_integer (info->saved_regs[LR_REGNUM],
|
= get_frame_memory_unsigned (next_frame, info->saved_regs[LR_REGNUM],
|
||||||
register_size (current_gdbarch, LR_REGNUM));
|
register_size (gdbarch, LR_REGNUM));
|
||||||
info->return_pc = d10v_make_iaddr (return_pc);
|
info->return_pc = d10v_make_iaddr (return_pc);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -873,7 +875,7 @@ d10v_print_registers_info (struct gdbarch *gdbarch, struct ui_file *file,
|
|||||||
int i;
|
int i;
|
||||||
fprintf_filtered (file, " ");
|
fprintf_filtered (file, " ");
|
||||||
frame_read_register (frame, a, num);
|
frame_read_register (frame, a, num);
|
||||||
for (i = 0; i < register_size (current_gdbarch, a); i++)
|
for (i = 0; i < register_size (gdbarch, a); i++)
|
||||||
{
|
{
|
||||||
fprintf_filtered (file, "%02x", (num[i] & 0xff));
|
fprintf_filtered (file, "%02x", (num[i] & 0xff));
|
||||||
}
|
}
|
||||||
@ -1450,6 +1452,7 @@ saved_regs_unwinder (struct frame_info *next_frame,
|
|||||||
enum lval_type *lvalp, CORE_ADDR *addrp,
|
enum lval_type *lvalp, CORE_ADDR *addrp,
|
||||||
int *realnump, void *bufferp)
|
int *realnump, void *bufferp)
|
||||||
{
|
{
|
||||||
|
struct gdbarch *gdbarch = get_frame_arch (next_frame);
|
||||||
if (this_saved_regs[regnum] != 0)
|
if (this_saved_regs[regnum] != 0)
|
||||||
{
|
{
|
||||||
if (regnum == D10V_SP_REGNUM)
|
if (regnum == D10V_SP_REGNUM)
|
||||||
@ -1461,7 +1464,7 @@ saved_regs_unwinder (struct frame_info *next_frame,
|
|||||||
*realnump = -1;
|
*realnump = -1;
|
||||||
if (bufferp != NULL)
|
if (bufferp != NULL)
|
||||||
store_unsigned_integer (bufferp,
|
store_unsigned_integer (bufferp,
|
||||||
register_size (current_gdbarch, regnum),
|
register_size (gdbarch, regnum),
|
||||||
this_saved_regs[regnum]);
|
this_saved_regs[regnum]);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1475,8 +1478,8 @@ saved_regs_unwinder (struct frame_info *next_frame,
|
|||||||
if (bufferp != NULL)
|
if (bufferp != NULL)
|
||||||
{
|
{
|
||||||
/* Read the value in from memory. */
|
/* Read the value in from memory. */
|
||||||
read_memory (this_saved_regs[regnum], bufferp,
|
get_frame_memory (next_frame, this_saved_regs[regnum], bufferp,
|
||||||
register_size (current_gdbarch, regnum));
|
register_size (gdbarch, regnum));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
31
gdb/frame.c
31
gdb/frame.c
@ -2219,6 +2219,37 @@ deprecated_frame_xmalloc_with_cleanup (long sizeof_saved_regs,
|
|||||||
return frame;
|
return frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Memory access methods. */
|
||||||
|
|
||||||
|
void
|
||||||
|
get_frame_memory (struct frame_info *this_frame, CORE_ADDR addr, void *buf,
|
||||||
|
int len)
|
||||||
|
{
|
||||||
|
read_memory (addr, buf, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
LONGEST
|
||||||
|
get_frame_memory_signed (struct frame_info *this_frame, CORE_ADDR addr,
|
||||||
|
int len)
|
||||||
|
{
|
||||||
|
return read_memory_integer (addr, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
ULONGEST
|
||||||
|
get_frame_memory_unsigned (struct frame_info *this_frame, CORE_ADDR addr,
|
||||||
|
int len)
|
||||||
|
{
|
||||||
|
return read_memory_unsigned_integer (addr, len);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Architecture method. */
|
||||||
|
|
||||||
|
struct gdbarch *
|
||||||
|
get_frame_arch (struct frame_info *this_frame)
|
||||||
|
{
|
||||||
|
return current_gdbarch;
|
||||||
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
legacy_frame_p (struct gdbarch *current_gdbarch)
|
legacy_frame_p (struct gdbarch *current_gdbarch)
|
||||||
{
|
{
|
||||||
|
25
gdb/frame.h
25
gdb/frame.h
@ -343,6 +343,31 @@ extern CORE_ADDR frame_pc_unwind (struct frame_info *frame);
|
|||||||
of the caller. */
|
of the caller. */
|
||||||
extern void frame_pop (struct frame_info *frame);
|
extern void frame_pop (struct frame_info *frame);
|
||||||
|
|
||||||
|
/* Return memory from the specified frame. A frame knows its thread /
|
||||||
|
LWP and hence can find its way down to a target. The assumption
|
||||||
|
here is that the current and previous frame share a common address
|
||||||
|
space.
|
||||||
|
|
||||||
|
If the memory read fails, these methods throw an error.
|
||||||
|
|
||||||
|
NOTE: cagney/2003-06-03: Should there be unwind versions of these
|
||||||
|
methods? That isn't clear. Can code, for instance, assume that
|
||||||
|
this and the previous frame's memory or architecture are identical?
|
||||||
|
If architecture / memory changes are always separated by special
|
||||||
|
adaptor frames this should be ok. */
|
||||||
|
|
||||||
|
extern void get_frame_memory (struct frame_info *this_frame, CORE_ADDR addr,
|
||||||
|
void *buf, int len);
|
||||||
|
extern LONGEST get_frame_memory_signed (struct frame_info *this_frame,
|
||||||
|
CORE_ADDR memaddr, int len);
|
||||||
|
extern ULONGEST get_frame_memory_unsigned (struct frame_info *this_frame,
|
||||||
|
CORE_ADDR memaddr, int len);
|
||||||
|
|
||||||
|
/* Return this frame's architecture. */
|
||||||
|
|
||||||
|
extern struct gdbarch *get_frame_arch (struct frame_info *this_frame);
|
||||||
|
|
||||||
|
|
||||||
/* Values for the source flag to be used in print_frame_info_base(). */
|
/* Values for the source flag to be used in print_frame_info_base(). */
|
||||||
enum print_what
|
enum print_what
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user