diff options
author | Kevin Buettner <kevinb@redhat.com> | 2000-02-26 09:30:30 +0000 |
---|---|---|
committer | Kevin Buettner <kevinb@redhat.com> | 2000-02-26 09:30:30 +0000 |
commit | ddb20c56a388ad7aa2909f8c1115e2cee1138eb9 (patch) | |
tree | ca10e1fea5ab653904ab9d11ba1bed29ad9c6765 /gdb/rs6000-tdep.c | |
parent | 122a33de975a7ed826a11950c1984bd2ceaa80a6 (diff) | |
download | gdb-ddb20c56a388ad7aa2909f8c1115e2cee1138eb9.zip gdb-ddb20c56a388ad7aa2909f8c1115e2cee1138eb9.tar.gz gdb-ddb20c56a388ad7aa2909f8c1115e2cee1138eb9.tar.bz2 |
Changes to skip_prologue for PPC architecture.
Diffstat (limited to 'gdb/rs6000-tdep.c')
-rw-r--r-- | gdb/rs6000-tdep.c | 38 |
1 files changed, 27 insertions, 11 deletions
diff --git a/gdb/rs6000-tdep.c b/gdb/rs6000-tdep.c index ca094c7..c3cd31b 100644 --- a/gdb/rs6000-tdep.c +++ b/gdb/rs6000-tdep.c @@ -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 */ @@ -375,6 +381,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 for >= 32k frames */ @@ -564,7 +580,7 @@ skip_prologue (pc, fdata) #endif /* 0 */ fdata->offset = -fdata->offset; - return pc; + return last_prologue_pc; } |