diff options
author | Andrew Cagney <cagney@redhat.com> | 2003-08-18 20:04:56 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2003-08-18 20:04:56 +0000 |
commit | 8b148df9ac8532b4a7cd0be2fdd011d29037e435 (patch) | |
tree | cf06b7ccca66764a7a1823a25600df7a756108c8 /gdb/infcall.c | |
parent | 4091ea4e210e42c1d028e2a6143ff74d47e0aedf (diff) | |
download | gdb-8b148df9ac8532b4a7cd0be2fdd011d29037e435.zip gdb-8b148df9ac8532b4a7cd0be2fdd011d29037e435.tar.gz gdb-8b148df9ac8532b4a7cd0be2fdd011d29037e435.tar.bz2 |
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.c | 29 |
1 files changed, 22 insertions, 7 deletions
diff --git a/gdb/infcall.c b/gdb/infcall.c index 8df1114..98e7da5 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; } |