summaryrefslogtreecommitdiff
path: root/gdb/infcall.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2003-08-18 20:12:32 +0000
committerAndrew Cagney <cagney@redhat.com>2003-08-18 20:12:32 +0000
commitbc0640951f2a746daa6f4b9bb7d91f911b89c6d9 (patch)
tree25f8bc0582f4c42e92f36c9eb64c149461372a5b /gdb/infcall.c
parente5f3544e939a4275baa3105df61f8109a739c8e8 (diff)
downloadgdb-bc0640951f2a746daa6f4b9bb7d91f911b89c6d9.tar.gz
Index: ChangeLog
2003-08-18 Andrew Cagney <cagney@redhat.com> * gdbarch.sh (FRAME_RED_ZONE_SIZE): New architecture method. * gdbarch.h, gdbarch.c: Re-generate. * infcall.c (call_function_by_hand): Adjust the SP by frame_red_zone_size before allocating any stack space. * rs6000-tdep.c (rs6000_gdbarch_init): Set "frame_red_zone_size". * x86-64-tdep.c (x86_64_frame_align): New function. (x86_64_init_abi): Set "frame_red_zone_size" and "frame_align". * x86-64-tdep.c (x86_64_push_arguments): Revert 2003-08-07 change. Remove code adjusting SP so that it skips over the Red Zone. Index: doc/ChangeLog 2003-08-18 Andrew Cagney <cagney@redhat.com> * gdbint.texinfo (Target Architecture Definition): Document "frame_red_zone_size".
Diffstat (limited to 'gdb/infcall.c')
-rw-r--r--gdb/infcall.c29
1 files changed, 22 insertions, 7 deletions
diff --git a/gdb/infcall.c b/gdb/infcall.c
index 477fc0f44d6..83699591e13 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -440,6 +440,18 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
CORE_ADDR old_sp = read_sp ();
if (gdbarch_frame_align_p (current_gdbarch))
{
+ sp = gdbarch_frame_align (current_gdbarch, old_sp);
+ /* NOTE: cagney/2003-08-13: Skip the "red zone". For some
+ ABIs, a function can use memory beyond the inner most stack
+ address. AMD64 called that region the "red zone". Skip at
+ least the "red zone" size before allocating any space on
+ the stack. */
+ if (INNER_THAN (1, 2))
+ sp -= gdbarch_frame_red_zone_size (current_gdbarch);
+ else
+ sp += gdbarch_frame_red_zone_size (current_gdbarch);
+ /* Still aligned? */
+ gdb_assert (sp == gdbarch_frame_align (current_gdbarch, sp));
/* NOTE: cagney/2002-09-18:
On a RISC architecture, a void parameterless generic dummy
@@ -460,7 +472,6 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
stack. That way, two dummy frames can never be identical.
It does burn a few bytes of stack but that is a small price
to pay :-). */
- sp = gdbarch_frame_align (current_gdbarch, old_sp);
if (sp == old_sp)
{
if (INNER_THAN (1, 2))
@@ -476,12 +487,16 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
else
/* FIXME: cagney/2002-09-18: Hey, you loose!
- Who knows how badly aligned the SP is! Further, per comment
- above, if the generic dummy frame ends up empty (because
- nothing is pushed) GDB won't be able to correctly perform
- back traces. If a target is having trouble with backtraces,
- first thing to do is add FRAME_ALIGN() to the architecture
- vector. If that fails, try unwind_dummy_id(). */
+ Who knows how badly aligned the SP is!
+
+ If the generic dummy frame ends up empty (because nothing is
+ pushed) GDB won't be able to correctly perform back traces.
+ If a target is having trouble with backtraces, first thing to
+ do is add FRAME_ALIGN() to the architecture vector. If that
+ fails, try unwind_dummy_id().
+
+ If the ABI specifies a "Red Zone" (see the doco) the code
+ below will quietly trash it. */
sp = old_sp;
}