* sparc-tdep.c (skip_prologue): Don't skip anything unless there

is a "save" instruction in there somewhere.
This commit is contained in:
Jim Kingdon 1991-04-22 21:40:42 +00:00
parent 8683547484
commit 192cbba944
2 changed files with 19 additions and 8 deletions

View File

@ -1,5 +1,8 @@
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.

View File

@ -268,13 +268,10 @@ do_restore_insn ()
}
/* 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
{
@ -298,6 +295,9 @@ skip_prologue (pc)
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);
@ -311,7 +311,10 @@ skip_prologue (pc)
/* 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;
@ -323,6 +326,7 @@ skip_prologue (pc)
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);
}
@ -342,7 +346,11 @@ skip_prologue (pc)
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.