aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
authorKevin Buettner <kevinb@redhat.com>2003-10-14 00:30:27 +0000
committerKevin Buettner <kevinb@redhat.com>2003-10-14 00:30:27 +0000
commit46a16dba957f0b448278b1802c780368061c27b9 (patch)
treeb4077f1816f14cac81134a280c5433871df63a02 /gdb
parent8723da3b747dfa76db897007fd9cc4a7a2c30b6b (diff)
downloadgdb-46a16dba957f0b448278b1802c780368061c27b9.zip
gdb-46a16dba957f0b448278b1802c780368061c27b9.tar.gz
gdb-46a16dba957f0b448278b1802c780368061c27b9.tar.bz2
* frv-tdep.c (max_instrs_per_bundle, frv_instr_size): New constants.
(frv_gdbarch_adjust_breakpoint_address): New function. (frv_gdbarch_init): Initialize ``gdbarch_adjust_breakpoint_address'' method.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog7
-rw-r--r--gdb/frv-tdep.c47
2 files changed, 54 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 9f12652..1a77033 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,12 @@
2003-10-13 Kevin Buettner <kevinb@redhat.com>
+ * frv-tdep.c (max_instrs_per_bundle, frv_instr_size): New constants.
+ (frv_gdbarch_adjust_breakpoint_address): New function.
+ (frv_gdbarch_init): Initialize ``gdbarch_adjust_breakpoint_address''
+ method.
+
+2003-10-13 Kevin Buettner <kevinb@redhat.com>
+
* breakpoint.h (struct breakpoint): Add new member
``requested_address''.
* breakpoint.c (breakpoint_adjustment_warning)
diff --git a/gdb/frv-tdep.c b/gdb/frv-tdep.c
index 22bac8f..055afc5 100644
--- a/gdb/frv-tdep.c
+++ b/gdb/frv-tdep.c
@@ -37,6 +37,7 @@ static gdbarch_init_ftype frv_gdbarch_init;
static gdbarch_register_name_ftype frv_register_name;
static gdbarch_breakpoint_from_pc_ftype frv_breakpoint_from_pc;
+static gdbarch_adjust_breakpoint_address_ftype frv_gdbarch_adjust_breakpoint_address;
static gdbarch_skip_prologue_ftype frv_skip_prologue;
static gdbarch_deprecated_extract_return_value_ftype frv_extract_return_value;
static gdbarch_deprecated_extract_struct_value_address_ftype frv_extract_struct_value_address;
@@ -271,6 +272,51 @@ frv_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenp)
return breakpoint;
}
+/* Define the maximum number of instructions which may be packed into a
+ bundle (VLIW instruction). */
+static const int max_instrs_per_bundle = 8;
+
+/* Define the size (in bytes) of an FR-V instruction. */
+static const int frv_instr_size = 4;
+
+/* Adjust a breakpoint's address to account for the FR-V architecture's
+ constraint that a break instruction must not appear as any but the
+ first instruction in the bundle. */
+static CORE_ADDR
+frv_gdbarch_adjust_breakpoint_address (struct gdbarch *gdbarch, CORE_ADDR bpaddr)
+{
+ int count = max_instrs_per_bundle;
+ CORE_ADDR addr = bpaddr - frv_instr_size;
+ CORE_ADDR func_start = get_pc_function_start (bpaddr);
+
+ /* Find the end of the previous packing sequence. This will be indicated
+ by either attempting to access some inaccessible memory or by finding
+ an instruction word whose packing bit is set to one. */
+ while (count-- > 0 && addr >= func_start)
+ {
+ char instr[frv_instr_size];
+ int status;
+
+ status = read_memory_nobpt (addr, instr, sizeof instr);
+
+ if (status != 0)
+ break;
+
+ /* This is a big endian architecture, so byte zero will have most
+ significant byte. The most significant bit of this byte is the
+ packing bit. */
+ if (instr[0] & 0x80)
+ break;
+
+ addr -= frv_instr_size;
+ }
+
+ if (count > 0)
+ bpaddr = addr + frv_instr_size;
+
+ return bpaddr;
+}
+
/* Return true if REG is a caller-saves ("scratch") register,
false otherwise. */
@@ -1114,6 +1160,7 @@ frv_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
set_gdbarch_skip_prologue (gdbarch, frv_skip_prologue);
set_gdbarch_breakpoint_from_pc (gdbarch, frv_breakpoint_from_pc);
+ set_gdbarch_adjust_breakpoint_address (gdbarch, frv_gdbarch_adjust_breakpoint_address);
set_gdbarch_frame_args_skip (gdbarch, 0);
set_gdbarch_frameless_function_invocation (gdbarch, frv_frameless_function_invocation);