Reviewed and approved by ezannoni@redhat.com

2004-02-19  Fred Fish  <fnf@redhat.com>
	Fix for PR breakpoint/1558.
	* sh-tdep.c (IS_JSR): New macro.
	(sh_analyze_prologue): Use IS_JSR to terminate prologue scan.
This commit is contained in:
Fred Fish 2004-02-19 23:05:07 +00:00
parent 441abf5c92
commit 5f883eddb2
2 changed files with 23 additions and 0 deletions

View File

@ -1,3 +1,9 @@
2004-02-19 Fred Fish <fnf@redhat.com>
Fix for PR breakpoint/1558.
* sh-tdep.c (IS_JSR): New macro.
(sh_analyze_prologue): Use IS_JSR to terminate prologue scan.
2004-02-19 Jim Blandy <jimb@redhat.com>
* findvar.c (value_from_register): Doc fix.

View File

@ -311,6 +311,9 @@ sh_breakpoint_from_pc (CORE_ADDR *pcptr, int *lenptr)
#define GET_SOURCE_REG(x) (((x) >> 4) & 0xf)
#define GET_TARGET_REG(x) (((x) >> 8) & 0xf)
/* JSR @Rm 0100mmmm00001011 */
#define IS_JSR(x) (((x) & 0xf0ff) == 0x400b)
/* STS.L PR,@-r15 0100111100100010
r15-4-->r15, PR-->(r15) */
#define IS_STS(x) ((x) == 0x4f22)
@ -510,6 +513,20 @@ sh_analyze_prologue (CORE_ADDR pc, CORE_ADDR current_pc,
}
break;
}
else if (IS_JSR (inst))
{
/* We have found a jsr that has been scheduled into the prologue.
If we continue the scan and return a pc someplace after this,
then setting a breakpoint on this function will cause it to
appear to be called after the function it is calling via the
jsr, which will be very confusing. Most likely the next
instruction is going to be IS_MOV_SP_FP in the delay slot. If
so, note that before returning the current pc. */
inst = read_memory_integer (pc + 2, 2);
if (IS_MOV_SP_FP (inst))
cache->uses_fp = 1;
break;
}
#if 0 /* This used to just stop when it found an instruction that
was not considered part of the prologue. Now, we just
keep going looking for likely instructions. */