diff options
author | Jim Kingdon <jkingdon@engr.sgi.com> | 1991-04-22 21:40:42 +0000 |
---|---|---|
committer | Jim Kingdon <jkingdon@engr.sgi.com> | 1991-04-22 21:40:42 +0000 |
commit | 192cbba9440ddf2171363ae74028d3f279c83b1c (patch) | |
tree | 0df4df5d05d1aa49916bcb42b2c7c7bf95cb31d4 /gdb/sparc-tdep.c | |
parent | 8683547484e61137ce6e716dc637e90814bd48d5 (diff) | |
download | gdb-192cbba9440ddf2171363ae74028d3f279c83b1c.zip gdb-192cbba9440ddf2171363ae74028d3f279c83b1c.tar.gz gdb-192cbba9440ddf2171363ae74028d3f279c83b1c.tar.bz2 |
* sparc-tdep.c (skip_prologue): Don't skip anything unless there
is a "save" instruction in there somewhere.
Diffstat (limited to 'gdb/sparc-tdep.c')
-rw-r--r-- | gdb/sparc-tdep.c | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/gdb/sparc-tdep.c b/gdb/sparc-tdep.c index e0fb8ba..2954497 100644 --- a/gdb/sparc-tdep.c +++ b/gdb/sparc-tdep.c @@ -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. |