Changes to skip_prologue for PPC architecture.

This commit is contained in:
Kevin Buettner 2000-02-26 09:30:30 +00:00
parent 122a33de97
commit ddb20c56a3
2 changed files with 40 additions and 11 deletions

View File

@ -1,3 +1,16 @@
2000-02-26 Kevin Buettner <kevinb@redhat.com>
* ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint): Add
comment explaining motivation behind this function and why
the generic facilities won't work for this platform.
* rs6000-tdep.c (skip_prologue): Always test to make sure
that an instruction is read successfully from the target's
memory. Introduce notion of instructions which may appear in
the prologue, but may not end the prologue. Added explicit
check for nop instruction. Use memset() to zero the frame
data instead of assignment from a statically allocated,
uninitialized structure.
Sat Feb 26 17:15:16 2000 Andrew Cagney <cagney@b1.cygnus.com>
* MAINTAINERS: Chris Faylor is responsible for all MS Windows

View File

@ -305,11 +305,10 @@ rs6000_software_single_step (signal, insert_breakpoints_p)
#define GET_SRC_REG(x) (((x) >> 21) & 0x1f)
CORE_ADDR
skip_prologue (pc, fdata)
CORE_ADDR pc;
struct rs6000_framedata *fdata;
skip_prologue (CORE_ADDR pc, struct rs6000_framedata *fdata)
{
CORE_ADDR orig_pc = pc;
CORE_ADDR last_prologue_pc;
char buf[4];
unsigned long op;
long offset = 0;
@ -318,24 +317,31 @@ skip_prologue (pc, fdata)
int reg;
int framep = 0;
int minimal_toc_loaded = 0;
static struct rs6000_framedata zero_frame;
int prev_insn_was_prologue_insn = 1;
*fdata = zero_frame;
memset (fdata, 0, sizeof (struct rs6000_framedata));
fdata->saved_gpr = -1;
fdata->saved_fpr = -1;
fdata->alloca_reg = -1;
fdata->frameless = 1;
fdata->nosavedpc = 1;
if (target_read_memory (pc, buf, 4))
return pc; /* Can't access it -- assume no prologue. */
/* Assume that subsequent fetches can fail with low probability. */
pc -= 4;
for (;;)
{
pc += 4;
op = read_memory_integer (pc, 4);
/* Sometimes it isn't clear if an instruction is a prologue
instruction or not. When we encounter one of these ambiguous
cases, we'll set prev_insn_was_prologue_insn to 0 (false).
Otherwise, we'll assume that it really is a prologue instruction. */
if (prev_insn_was_prologue_insn)
last_prologue_pc = pc;
prev_insn_was_prologue_insn = 1;
if (target_read_memory (pc, buf, 4))
break;
op = extract_signed_integer (buf, 4);
if ((op & 0xfc1fffff) == 0x7c0802a6)
{ /* mflr Rx */
@ -374,6 +380,16 @@ skip_prologue (pc, fdata)
}
continue;
}
else if ((op & 0xffff0000) == 0x60000000)
{
/* nop */
/* Allow nops in the prologue, but do not consider them to
be part of the prologue unless followed by other prologue
instructions. */
prev_insn_was_prologue_insn = 0;
continue;
}
else if ((op & 0xffff0000) == 0x3c000000)
{ /* addis 0,0,NUM, used
@ -564,7 +580,7 @@ skip_prologue (pc, fdata)
#endif /* 0 */
fdata->offset = -fdata->offset;
return pc;
return last_prologue_pc;
}