This file is part of GDB.
-GDB is free software; you can redistribute it and/or modify
+This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
-GDB is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include "defs.h"
if (func_start)
{
after_prologue = func_start;
+#ifdef SKIP_PROLOGUE_FRAMELESS_P
+ /* This is faster, since only care whether there *is* a prologue,
+ not how long it is. */
+ SKIP_PROLOGUE_FRAMELESS_P (after_prologue);
+#else
SKIP_PROLOGUE (after_prologue);
+#endif
return after_prologue == func_start;
}
else
This file is part of GDB.
-GDB is free software; you can redistribute it and/or modify
+This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 1, or (at your option)
-any later version.
+the Free Software Foundation; either version 2 of the License, or
+(at your option) any later version.
-GDB is distributed in the hope that it will be useful,
+This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
-along with GDB; see the file COPYING. If not, write to
-the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */
+along with this program; if not, write to the Free Software
+Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
#include <stdio.h>
#include "defs.h"
FRAME thisframe;
{
CORE_ADDR retval;
- read_memory ((CORE_ADDR)&(((struct rwindow *)(thisframe->frame))->rw_in[6]),
+ int err;
+ err = target_read_memory
+ ((CORE_ADDR)&(((struct rwindow *)(thisframe->frame))->rw_in[6]),
&retval,
sizeof (CORE_ADDR));
+ if (err)
+ return 0;
return retval;
}
fatal ("internal: create_new_frame returned invalid frame id");
fid->bottom = stack;
-
+ fid->pc = FRAME_SAVED_PC (fid);
return fid;
}
restore_inferior_status (&inf_status);
}
-/* This routine should be more specific in it's actions; making sure
+/* Given a pc value, skip it forward past the function prologue by
+ disassembling instructions that appear to be a prologue.
+
+ If FRAMELESS_P is set, we are only testing to see if the function
+ is frameless. This allows a quicker answer.
+
+ This routine should be more specific in its actions; making sure
that it uses the same register in the initial prologue section. */
CORE_ADDR
-skip_prologue (start_pc)
+skip_prologue (start_pc, frameless_p)
CORE_ADDR start_pc;
+ int frameless_p;
{
union
{
} 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);
as there isn't any sign extension). */
if (x.add.op == 2 && (x.add.op3 ^ 32) == 28)
{
- found_save = 1;
pc += 4;
+ if (frameless_p) /* If the save is all we care about, */
+ return pc; /* return before doing more work */
x.i = read_memory_integer (pc, 4);
}
+ else
+ {
+ /* Without a save instruction, it's not a prologue. */
+ return start_pc;
+ }
/* Now we need to recognize stores into the frame from the input
registers. This recognizes all non alternate stores of input
pc += 4;
x.i = read_memory_integer (pc, 4);
}
- if (found_save)
- return pc;
- else
- /* Without a save instruction, it's not a prologue. */
- return start_pc;
+ return pc;
}
/* Check instruction at ADDR to see if it is an annulled branch.
#define FUNCTION_START_OFFSET 0
/* Advance PC across any function entry prologue instructions
- to reach some "real" code. */
+ to reach some "real" code. SKIP_PROLOGUE_FRAMELESS_P advances
+ the PC past some of the prologue, but stops as soon as it
+ knows that the function has a frame. Its result is equal
+ to its input PC if the function is frameless, unequal otherwise. */
#define SKIP_PROLOGUE(pc) \
- { pc = skip_prologue (pc); }
+ { pc = skip_prologue (pc, 0); }
+#define SKIP_PROLOGUE_FRAMELESS_P(pc) \
+ { pc = skip_prologue (pc, 1); }
extern CORE_ADDR skip_prologue ();
/* Immediately after a function call, return the saved pc.
/* We need two arguments (in general) to the "info frame" command.
Note that the definition of this macro implies that there exists a
- function "setup_arbitrary_frame" in mach-dep.c */
+ function "setup_arbitrary_frame" in sparc-tdep.c */
#define FRAME_SPECIFICATION_DYADIC