Mon Apr 22 00:02:43 1991 Jim Kingdon (kingdon at cygint.cygnus.com)
+ * sparc-tdep.c (skip_prologue): Don't skip anything unless there
+ is a "save" instruction in there somewhere.
+
* symfile.c (symbol_file_add): Add comment.
solib.c (solib_add): Don't malloc name passed to symbol_file_add.
}
/* This routine should be more specific in it's actions; making sure
- that it uses the same register in the initial prologue section.
- Also, FIXME-SOON, it should recognize leaf functions as ones without
- a SAVE in the prologue, and pass that info back to the caller so the
- PC and arguments can be properly located. */
+ that it uses the same register in the initial prologue section. */
CORE_ADDR
-skip_prologue (pc)
- CORE_ADDR pc;
+skip_prologue (start_pc)
+ CORE_ADDR start_pc;
{
union
{
int i;
} x;
int dest = -1;
+ CORE_ADDR pc = start_pc;
+ /* Have we found a save instruction? */
+ int found_save = 0;
x.i = read_memory_integer (pc, 4);
/* Recognize an add immediate value to register to either %g1 or
the destination register recorded above. Actually, this might
- well recognize several different arithmetic operations. */
+ well recognize several different arithmetic operations.
+ It doesn't check that rs1 == rd because in theory "sub %g0, 5, %g1"
+ followed by "save %sp, %g1, %sp" is a valid prologue (Not that
+ I imagine any compiler really does that, however). */
if (x.add.op == 2 && x.add.i && (x.add.rd == 1 || x.add.rd == dest))
{
pc += 4;
as there isn't any sign extension). */
if (x.add.op == 2 && (x.add.op3 ^ 32) == 28)
{
+ found_save = 1;
pc += 4;
x.i = read_memory_integer (pc, 4);
}
pc += 4;
x.i = read_memory_integer (pc, 4);
}
- return pc;
+ if (found_save)
+ return pc;
+ else
+ /* Without a save instruction, it's not a prologue. */
+ return start_pc;
}
/* Check instruction at ADDR to see if it is an annulled branch.