From: Michal Ludvig <mludvig@suse.cz>
To: GDB Patches <gdb-patches@sources.redhat.com>
Subject: [RFA] Skip the "red zone" on AMD64
Date: Thu, 07 Aug 2003 11:05:00 -0000 [thread overview]
Message-ID: <3F323274.4020907@suse.cz> (raw)
[-- Attachment #1: Type: text/plain, Size: 550 bytes --]
Hi all,
this simple patch skips the "red zone" before pushing anything to the
stack when calling functions from the GDB prompt. If the red zone isn't
skipped than local variables, etc. could be overwritten by called
function parameters or return address.
This is pretty obvious patch that doesn't harm anything, but anyway - OK
to apply?
2003-08-07 Michal Ludvig <mludvig@suse.cz>
* x86-64-tdep.c (x86_64_push_arguments): Skip the red zone.
Michal Ludvig
--
* SuSE CR, s.r.o * mludvig@suse.cz
* (+420) 296.545.373 * http://www.suse.cz
[-- Attachment #2: redzone-1.diff --]
[-- Type: text/plain, Size: 839 bytes --]
Index: x86-64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/x86-64-tdep.c,v
retrieving revision 1.79.2.5
diff -u -p -r1.79.2.5 x86-64-tdep.c
--- x86-64-tdep.c 7 Aug 2003 08:09:22 -0000 1.79.2.5
+++ x86-64-tdep.c 7 Aug 2003 10:56:29 -0000
@@ -624,6 +624,14 @@ x86_64_push_arguments (struct regcache *
int stack_values_count = 0;
int *stack_values;
stack_values = alloca (nargs * sizeof (int));
+
+ /* Before storing anything to the stack we must skip
+ the "Red zone" (see the "Function calling sequence" section
+ of AMD64 ABI).
+ It could have already been skipped in the function's
+ prologue, but we don't care and will easily skip it once again. */
+ sp -= 128;
+
for (i = 0; i < nargs; i++)
{
enum x86_64_reg_class class[MAX_CLASSES];
next reply other threads:[~2003-08-07 11:05 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-08-07 11:05 Michal Ludvig [this message]
2003-08-07 11:18 ` Andreas Schwab
2003-08-07 11:27 ` Michal Ludvig
2003-08-07 14:10 ` Andrew Cagney
2003-08-07 14:40 ` Michal Ludvig
2003-08-07 15:04 ` Andrew Cagney
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=3F323274.4020907@suse.cz \
--to=mludvig@suse.cz \
--cc=gdb-patches@sources.redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox