From: Mark Alexander Date: Sun, 9 Feb 1997 17:36:49 +0000 (+0000) Subject: * remote-mips.c (common_breakpoint): Prevent 64-bit addresses X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=32dab6031296a0decf26d30400759c4575877935;p=binutils-gdb.git * 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. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 91ad292950e..81a040ef02e 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,17 @@ +Sun Feb 09 09:23:26 1997 Mark Alexander + + * 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. + Sat Feb 8 01:14:43 1997 Peter Schauer (pes@regent.e-technik.tu-muenchen.de) * dwarf2read.c (dwarf2_linkage_name): New function to get diff --git a/gdb/buildsym.c b/gdb/buildsym.c index a80a8ffb76d..be8f787b471 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -388,8 +388,10 @@ finish_block (symbol, listhead, old_blocks, start, end, objfile) BLOCK_END (pblock->block), BLOCK_START (block), BLOCK_END (block)); } - BLOCK_START (pblock->block) = BLOCK_START (block); - BLOCK_END (pblock->block) = BLOCK_END (block); + if (BLOCK_START (pblock->block) < BLOCK_START (block)) + BLOCK_START (pblock->block) = BLOCK_START (block); + if (BLOCK_END (pblock->block) > BLOCK_END (block)) + BLOCK_END (pblock->block) = BLOCK_END (block); } #endif BLOCK_SUPERBLOCK (pblock->block) = block; diff --git a/gdb/mips-tdep.c b/gdb/mips-tdep.c index 5369259a1a6..b63bbf2354c 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 diff --git a/gdb/remote-mips.c b/gdb/remote-mips.c index 11d0e2b428f..9d905bdeab4 100644 --- a/gdb/remote-mips.c +++ b/gdb/remote-mips.c @@ -2477,6 +2477,7 @@ common_breakpoint (cmd, addr, mask, flags) int rpid, rerrflg, rresponse; int nfields; + addr = ADDR_BITS_REMOVE (addr); if (flags) sprintf (buf, "0x0 %c 0x%s 0x%s %s", cmd, paddr_nz (addr), paddr_nz (mask), flags);