aboutsummaryrefslogtreecommitdiff
path: root/gdb/v850-tdep.c
diff options
context:
space:
mode:
authorStu Grossman <grossman@cygnus>1996-10-17 02:12:24 +0000
committerStu Grossman <grossman@cygnus>1996-10-17 02:12:24 +0000
commit6420594bbf94e458e25624287aeabe3418946878 (patch)
tree9f6decaa96d12acf0de26452630f8f66d219453e /gdb/v850-tdep.c
parent93ed453c68c91ee1081686a701b4a424280edc85 (diff)
downloadgdb-6420594bbf94e458e25624287aeabe3418946878.zip
gdb-6420594bbf94e458e25624287aeabe3418946878.tar.gz
gdb-6420594bbf94e458e25624287aeabe3418946878.tar.bz2
* testsuite/gdb.base/break.exp: Make backtrace from factorial
errors unique. * testsuite/gdb.base/nodebug.exp: Whack out all -g options explicitly. * v850-tdep.c (v850_init_extra_frame_info v850_frame_chain): Fix sign bugs with scanning prologues. Get a little smarter about calculating the length of uninteresting instructions.
Diffstat (limited to 'gdb/v850-tdep.c')
-rw-r--r--gdb/v850-tdep.c34
1 files changed, 13 insertions, 21 deletions
diff --git a/gdb/v850-tdep.c b/gdb/v850-tdep.c
index 1b1f5c8..25e607d 100644
--- a/gdb/v850-tdep.c
+++ b/gdb/v850-tdep.c
@@ -86,36 +86,33 @@ v850_init_extra_frame_info (fi)
{
int insn;
- insn = read_memory_integer (current_pc, 2);
+ insn = read_memory_unsigned_integer (current_pc, 2);
if ((insn & 0xffe0) == ((SP_REGNUM << 11) | 0x0240)) /* add <imm>,sp */
- frameoffset = (insn & 0x1f) | ~0x1f;
+ frameoffset = ((insn & 0x1f) ^ 0x10) - 0x10;
else if (insn == ((SP_REGNUM << 11) | 0x0600 | SP_REGNUM)) /* addi <imm>,sp,sp */
- {
- current_pc += 2;
-
- frameoffset = read_memory_integer (current_pc, 2);
- }
+ frameoffset = read_memory_integer (current_pc + 2, 2);
else if (insn == ((FP_REGNUM << 11) | 0x0000 | 12)) /* mov r12,r2 */
framereg = FP_REGNUM; /* Setting up fp */
else if ((insn & 0x07ff) == (0x0760 | SP_REGNUM)) /* st.w <reg>,<offset>[sp] */
{
reg = (insn >> 11) & 0x1f; /* Extract <reg> */
- current_pc += 2;
- insn = read_memory_integer (current_pc, 2) & ~1;
+ insn = read_memory_integer (current_pc + 2, 2) & ~1;
fi->fsr.regs[reg] = insn + frameoffset;
}
else if ((insn & 0x07ff) == (0x0760 | FP_REGNUM)) /* st.w <reg>,<offset>[fp] */
{
reg = (insn >> 11) & 0x1f; /* Extract <reg> */
- current_pc += 2;
- insn = read_memory_integer (current_pc, 2) & ~1;
+ insn = read_memory_integer (current_pc + 2, 2) & ~1;
fi->fsr.regs[reg] = insn;
}
+
+ if ((insn & 0x0780) >= 0x0600) /* Four byte instruction? */
+ current_pc += 2;
}
if (PC_IN_CALL_DUMMY (fi->pc, NULL, NULL))
@@ -208,21 +205,16 @@ v850_frame_chain (fi)
{
int insn;
- insn = read_memory_integer (current_pc, 2);
+ insn = read_memory_unsigned_integer (current_pc, 2);
if ((insn & 0xffe0) == ((SP_REGNUM << 11) | 0x0240)) /* add <imm>,sp */
- frameoffset = (insn & 0x1f) | ~0x1f;
+ frameoffset = ((insn & 0x1f) ^ 0x10) - 0x10;
else if (insn == ((SP_REGNUM << 11) | 0x0600 | SP_REGNUM)) /* addi <imm>,sp,sp */
- {
- current_pc += 2;
-
- frameoffset = read_memory_integer (current_pc, 2);
- }
+ frameoffset = read_memory_integer (current_pc + 2, 2);
else if (insn == ((FP_REGNUM << 11) | 0x0000 | 12)) /* mov r12,r2 */
return v850_find_callers_reg (fi, FP_REGNUM); /* It's using a frame pointer reg */
- else if ((insn & 0x07ff) == (0x0760 | SP_REGNUM)) /* st.w <reg>,<offset>[sp] */
- current_pc += 2;
- else if ((insn & 0x07ff) == (0x0760 | FP_REGNUM)) /* st.w <reg>,<offset>[fp] */
+
+ if ((insn & 0x0780) >= 0x0600) /* Four byte instruction? */
current_pc += 2;
}