aboutsummaryrefslogtreecommitdiff
path: root/gdb/mips-tdep.c
diff options
context:
space:
mode:
authorMark Alexander <marka@cygnus>1997-02-09 17:36:49 +0000
committerMark Alexander <marka@cygnus>1997-02-09 17:36:49 +0000
commit32dab6031296a0decf26d30400759c4575877935 (patch)
tree0f50cdbf48c52c6a7059ac7592e6cbb884731995 /gdb/mips-tdep.c
parent754a678408186e703d32ebd21b04af87523eb335 (diff)
downloadgdb-32dab6031296a0decf26d30400759c4575877935.zip
gdb-32dab6031296a0decf26d30400759c4575877935.tar.gz
gdb-32dab6031296a0decf26d30400759c4575877935.tar.bz2
* remote-mips.c (common_breakpoint): Prevent 64-bit addresses
from being sent to 32-bit targets by masking off upper bits. * mips-tdep.c (heuristic_proc_start): Mask off upper 32 bits of PC on 32-bit targets. (mips16_heuristic_proc_desc): Recognize 'addiu s1,sp,n' as a frame setup instruction. (mips32_heuristic_proc_desc): Fix warning found by gcc -Wall. (mips16_skip_prologue): Recognize 'addiu s1,sp,n' as a valid prologue instruction. Fix warnings and bugs found by gcc -Wall. * buildsym.c (finish_block): Improve handling of overlapping blocks; fixes problem on MIPS16 printing function arguments.
Diffstat (limited to 'gdb/mips-tdep.c')
-rw-r--r--gdb/mips-tdep.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c
index 5369259..b63bbf2 100644
--- a/gdb/mips-tdep.c
+++ b/gdb/mips-tdep.c
@@ -554,11 +554,14 @@ static CORE_ADDR
heuristic_proc_start(pc)
CORE_ADDR pc;
{
- CORE_ADDR start_pc = pc;
- CORE_ADDR fence = start_pc - heuristic_fence_post;
+ CORE_ADDR start_pc;
+ CORE_ADDR fence;
int instlen;
int seen_adjsp = 0;
+ pc = ADDR_BITS_REMOVE (pc);
+ start_pc = pc;
+ fence = start_pc - heuristic_fence_post;
if (start_pc == 0) return 0;
if (heuristic_fence_post == UINT_MAX
@@ -743,6 +746,12 @@ mips16_heuristic_proc_desc(start_pc, limit_pc, next_frame, sp)
frame_addr = read_next_frame_reg(next_frame, 30);
PROC_FRAME_REG (&temp_proc_desc) = 17;
}
+ else if ((inst & 0xff00) == 0x0100) /* addiu $s1,sp,n */
+ {
+ offset = mips16_get_imm (prev_inst, inst, 8, 4, 0);
+ frame_addr = sp + offset;
+ PROC_FRAME_REG (&temp_proc_desc) = 17;
+ }
else if ((inst & 0xFF00) == 0xd900) /* sw reg,offset($s1) */
{
offset = mips16_get_imm (prev_inst, inst, 5, 4, 0);
@@ -847,7 +856,7 @@ restart:
else if (high_word == 0x27be) /* addiu $30,$sp,size */
{
/* Old gcc frame, r30 is virtual frame pointer. */
- if (low_word != PROC_FRAME_OFFSET(&temp_proc_desc))
+ if ((long)low_word != PROC_FRAME_OFFSET(&temp_proc_desc))
frame_addr = sp + low_word;
else if (PROC_FRAME_REG (&temp_proc_desc) == SP_REGNUM)
{
@@ -1699,6 +1708,7 @@ mips16_skip_prologue (pc, lenient)
{ 0xd980, 0xff80 }, /* sw $a0-$a3,n($s1) */
{ 0x6704, 0xff1c }, /* move reg,$a0-$a3 */
{ 0xe809, 0xf81f }, /* entry pseudo-op */
+ { 0x0100, 0xff00 }, /* addiu $s1,$sp,n */
{ 0, 0 } /* end of table marker */
};
@@ -1710,7 +1720,7 @@ mips16_skip_prologue (pc, lenient)
char buf[MIPS16_INSTLEN];
int status;
unsigned short inst;
- int extend_bytes;
+ int extend_bytes = 0;
int prev_extend_bytes;
int i;
@@ -1741,7 +1751,7 @@ mips16_skip_prologue (pc, lenient)
if ((inst & table[i].mask) == table[i].inst) /* found, get out */
break;
if (table[i].mask != 0) /* it was in table? */
- continue; /* ignore it
+ continue; /* ignore it */
else /* non-prologue */
{
/* Return the current pc, adjusted backwards by 2 if
@@ -1749,6 +1759,7 @@ mips16_skip_prologue (pc, lenient)
return pc - prev_extend_bytes;
}
}
+ return pc;
}
/* To skip prologues, I use this predicate. Returns either PC itself