aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog18
-rw-r--r--gdb/Makefile.in4
-rw-r--r--gdb/config/frv/tm-frv.h14
-rw-r--r--gdb/frv-tdep.c88
4 files changed, 81 insertions, 43 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cd1cc76..6dc153e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,21 @@
+2003-08-20 Michael Snyder <msnyder@redhat.com>
+ Kevin Buettner <kevinb@redhat.com>
+
+ * frv-tdep.c (gdb_string.h, frame.h, trad-frame.h): Include.
+ (frv_frame_init_saved_regs): Add declaration.
+ (frame_extra_info): Add new field ``saved_regs''.
+ (frv_frame_chain, frv_frame_saved_pc, frv_analyze_prologue)
+ (frv_skip_prologue, frv_init_extra_frame_info, frv_pop_frame_regular):
+ Update frame related code.
+ (frv_extract_struct_value_address): Adjust formatting.
+ * Makefile.in (frv-tdep.o): Update dependencies.
+ * config/frv/tm-frv.h (target_insert_watchpoint)
+ (target_remove_watchpoint, target_insert_hw_breakpoint)
+ (target_remove_hw_breakpoint): Delete these macros.
+ (remote_insert_watchpoint, remote_remove_watchpoint)
+ (remote_insert_hw_watchpoint, remote_remove_hw_watchpoint): Remove
+ these declarations.
+
2003-08-20 Michael Chastain <mec@shout.net>
* defs.h (ENUM_BITFIELD): New macro.
diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index c2e3d0e..39dfab2 100644
--- a/gdb/Makefile.in
+++ b/gdb/Makefile.in
@@ -1763,8 +1763,8 @@ frame.o: frame.c $(defs_h) $(frame_h) $(target_h) $(value_h) $(inferior_h) \
$(command_h) $(gdbcmd_h)
frame-unwind.o: frame-unwind.c $(defs_h) $(frame_h) $(frame_unwind_h) \
$(gdb_assert_h) $(dummy_frame_h)
-frv-tdep.o: frv-tdep.c $(defs_h) $(inferior_h) $(symfile_h) $(gdbcore_h) \
- $(arch_utils_h) $(regcache_h)
+frv-tdep.o: frv-tdep.c $(defs_h) $(gdb_string_h) $(inferior_h) $(symfile_h) \
+ $(gdbcore_h) $(arch_utils_h) $(regcache_h)
f-typeprint.o: f-typeprint.c $(defs_h) $(gdb_obstack_h) $(bfd_h) $(symtab_h) \
$(gdbtypes_h) $(expression_h) $(value_h) $(gdbcore_h) $(target_h) \
$(f_lang_h) $(gdb_string_h)
diff --git a/gdb/config/frv/tm-frv.h b/gdb/config/frv/tm-frv.h
index 40a2480..303d1d3 100644
--- a/gdb/config/frv/tm-frv.h
+++ b/gdb/config/frv/tm-frv.h
@@ -45,18 +45,4 @@ extern int frv_check_watch_resources (int type, int cnt, int ot);
extern CORE_ADDR frv_stopped_data_address(void);
/* Use these macros for watchpoint insertion/deletion. */
-#define target_insert_watchpoint(addr, len, type) \
- remote_insert_watchpoint (addr, len, type)
-#define target_remove_watchpoint(addr, len, type) \
- remote_remove_watchpoint (addr, len, type)
-#define target_insert_hw_breakpoint(addr, shadow) \
- remote_insert_hw_breakpoint (addr, 1)
-#define target_remove_hw_breakpoint(addr, shadow) \
- remote_remove_hw_breakpoint (addr, 1)
#define target_stopped_data_address() frv_stopped_data_address()
-
-/* These declarations should be in remote.h, no? */
-extern int remote_insert_watchpoint (CORE_ADDR addr, int len, int type);
-extern int remote_remove_watchpoint (CORE_ADDR addr, int len, int type);
-extern int remote_insert_hw_breakpoint (CORE_ADDR addr, int len);
-extern int remote_remove_hw_breakpoint (CORE_ADDR addr, int len);
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 82bd7e6..9828b90 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -19,11 +19,14 @@
Boston, MA 02111-1307, USA. */
#include "defs.h"
+#include "gdb_string.h"
#include "inferior.h"
#include "symfile.h" /* for entry_point_address */
#include "gdbcore.h"
#include "arch-utils.h"
#include "regcache.h"
+#include "frame.h"
+#include "trad-frame.h"
extern void _initialize_frv_tdep (void);
@@ -37,6 +40,7 @@ static gdbarch_deprecated_extract_struct_value_address_ftype frv_extract_struct_
static gdbarch_frameless_function_invocation_ftype frv_frameless_function_invocation;
static gdbarch_deprecated_push_arguments_ftype frv_push_arguments;
static gdbarch_deprecated_saved_pc_after_call_ftype frv_saved_pc_after_call;
+static void frv_frame_init_saved_regs (struct frame_info *frame);
static void frv_pop_frame_regular (struct frame_info *frame);
@@ -92,6 +96,9 @@ struct frame_extra_info
/* Non-zero if we've saved our return address on the stack yet.
Zero if it's still sitting in the link register. */
int lr_saved_on_stack;
+
+ /* Table indicating the location of each and every register. */
+ struct trad_frame_saved_reg *saved_regs;
};
@@ -271,12 +278,16 @@ static CORE_ADDR
frv_frame_chain (struct frame_info *frame)
{
CORE_ADDR saved_fp_addr;
+ struct frame_extra_info *extra_info =
+ get_frame_extra_info (frame);
- if (frame->saved_regs && frame->saved_regs[fp_regnum] != 0)
- saved_fp_addr = frame->saved_regs[fp_regnum];
+ if (extra_info &&
+ extra_info->saved_regs &&
+ extra_info->saved_regs[fp_regnum].addr != 0)
+ saved_fp_addr = extra_info->saved_regs[fp_regnum].addr;
else
/* Just assume it was saved in the usual place. */
- saved_fp_addr = frame->frame;
+ saved_fp_addr = get_frame_base (frame);
return read_memory_integer (saved_fp_addr, 4);
}
@@ -284,28 +295,32 @@ frv_frame_chain (struct frame_info *frame)
static CORE_ADDR
frv_frame_saved_pc (struct frame_info *frame)
{
+ struct frame_extra_info *extra_info =
+ get_frame_extra_info (frame);
+
frv_frame_init_saved_regs (frame);
/* Perhaps the prologue analyzer recorded where it was stored.
(As of 14 Oct 2001, it never does.) */
- if (frame->saved_regs && frame->saved_regs[pc_regnum] != 0)
- return read_memory_integer (frame->saved_regs[pc_regnum], 4);
+ if (extra_info && extra_info->saved_regs &&
+ extra_info->saved_regs[pc_regnum].addr != 0)
+ return read_memory_integer (extra_info->saved_regs[pc_regnum].addr, 4);
/* If the prologue analyzer tells us the link register was saved on
the stack, get it from there. */
- if (frame->extra_info->lr_saved_on_stack)
- return read_memory_integer (frame->frame + 8, 4);
+ if (extra_info->lr_saved_on_stack)
+ return read_memory_integer (get_frame_base (frame) + 8, 4);
/* Otherwise, it's still in LR.
However, if FRAME isn't the youngest frame, this is kind of
suspicious --- if this frame called somebody else, then its LR
has certainly been overwritten. */
- if (! frame->next)
+ if (! get_next_frame (frame))
return read_register (lr_regnum);
/* By default, assume it's saved in the standard place, relative to
the frame pointer. */
- return read_memory_integer (frame->frame + 8, 4);
+ return read_memory_integer (get_frame_base (frame) + 8, 4);
}
@@ -390,7 +405,7 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *frame)
memset (gr_saved, 0, sizeof (gr_saved));
- while (! frame || pc < frame->pc)
+ while (! frame || pc < get_frame_pc (frame))
{
LONGEST op = read_memory_integer (pc, 4);
@@ -658,7 +673,10 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *frame)
if (frame)
{
- frame->extra_info->lr_saved_on_stack = lr_saved_on_stack;
+ struct frame_extra_info *extra_info =
+ get_frame_extra_info (frame);
+
+ extra_info->lr_saved_on_stack = lr_saved_on_stack;
/* If we know the relationship between the stack and frame
pointers, record the addresses of the registers we noticed.
@@ -667,14 +685,17 @@ frv_analyze_prologue (CORE_ADDR pc, struct frame_info *frame)
their addresses relative to the FP. */
if (fp_set)
{
+ struct trad_frame_saved_reg *saved_regs;
int i;
+ saved_regs = extra_info->saved_regs;
for (i = 0; i < 64; i++)
if (gr_saved[i])
- frame->saved_regs[i] = (frame->frame
- - fp_offset + gr_sp_offset[i]);
+ trad_frame_set_value (saved_regs, i,
+ get_frame_base (frame) - fp_offset
+ + gr_sp_offset[i]);
- frame->extra_info->fp_to_callers_sp_offset = framesize - fp_offset;
+ extra_info->fp_to_callers_sp_offset = framesize - fp_offset;
}
}
@@ -716,18 +737,23 @@ frv_skip_prologue (CORE_ADDR pc)
static void
frv_frame_init_saved_regs (struct frame_info *frame)
{
- if (frame->saved_regs)
+ struct frame_extra_info *extra_info =
+ get_frame_extra_info (frame);
+
+ if (extra_info && extra_info->saved_regs)
return;
- frame_saved_regs_zalloc (frame);
- frame->saved_regs[fp_regnum] = frame->frame;
+ extra_info->saved_regs = trad_frame_alloc_saved_regs (frame);
+ trad_frame_set_value (extra_info->saved_regs,
+ fp_regnum, get_frame_base (frame));
/* Find the beginning of this function, so we can analyze its
prologue. */
{
CORE_ADDR func_addr, func_end;
- if (find_pc_partial_function (frame->pc, NULL, &func_addr, &func_end))
+ if (find_pc_partial_function (get_frame_pc (frame),
+ NULL, &func_addr, &func_end))
frv_analyze_prologue (func_addr, frame);
}
}
@@ -744,7 +770,8 @@ frv_extract_return_value (struct type *type, char *regbuf, char *valbuf)
static CORE_ADDR
frv_extract_struct_value_address (char *regbuf)
{
- return extract_unsigned_integer (regbuf + frv_register_byte (struct_return_regnum),
+ return extract_unsigned_integer (regbuf +
+ frv_register_byte (struct_return_regnum),
4);
}
@@ -769,9 +796,12 @@ frv_saved_pc_after_call (struct frame_info *frame)
static void
frv_init_extra_frame_info (int fromleaf, struct frame_info *frame)
{
- frame_extra_info_zalloc (frame, sizeof (struct frame_extra_info));
- frame->extra_info->fp_to_callers_sp_offset = 0;
- frame->extra_info->lr_saved_on_stack = 0;
+ struct frame_extra_info *extra_info =
+ frame_extra_info_zalloc (frame, sizeof (struct frame_extra_info));
+
+ extra_info->fp_to_callers_sp_offset = 0;
+ extra_info->lr_saved_on_stack = 0;
+ extra_info->saved_regs = trad_frame_alloc_saved_regs (frame);
}
#define ROUND_UP(n,a) (((n)+(a)-1) & ~((a)-1))
@@ -897,25 +927,29 @@ frv_pop_frame (void)
static void
frv_pop_frame_regular (struct frame_info *frame)
{
+ struct frame_extra_info *extra_info;
+ struct trad_frame_saved_reg *saved_regs;
+
CORE_ADDR fp;
int regno;
- fp = frame->frame;
+ fp = get_frame_base (frame);
frv_frame_init_saved_regs (frame);
-
+ extra_info = get_frame_extra_info (frame);
+ saved_regs = extra_info->saved_regs;
write_register (pc_regnum, frv_frame_saved_pc (frame));
for (regno = 0; regno < frv_num_regs; ++regno)
{
- if (frame->saved_regs[regno]
+ if (extra_info->saved_regs[regno].addr
&& regno != pc_regnum
&& regno != sp_regnum)
{
write_register (regno,
- read_memory_integer (frame->saved_regs[regno], 4));
+ read_memory_integer (saved_regs[regno].addr, 4));
}
}
- write_register (sp_regnum, fp + frame->extra_info->fp_to_callers_sp_offset);
+ write_register (sp_regnum, fp + extra_info->fp_to_callers_sp_offset);
flush_cached_frames ();
}