From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18692 invoked by alias); 7 Aug 2003 11:05:02 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 18682 invoked from network); 7 Aug 2003 11:05:00 -0000 Received: from unknown (HELO maxipes.logix.cz) (81.0.234.97) by sources.redhat.com with SMTP; 7 Aug 2003 11:05:00 -0000 Received: from suse.cz (styx.suse.cz [213.210.157.162]) (using TLSv1 with cipher RC4-MD5 (128/128 bits)) (Client CN "Michal Ludvig", Issuer "Personal Freemail RSA 2000.8.30" (verified OK)) by maxipes.logix.cz (Postfix) with ESMTP id 89DFF299E1 for ; Thu, 7 Aug 2003 13:04:59 +0200 (CEST) Message-ID: <3F323274.4020907@suse.cz> Date: Thu, 07 Aug 2003 11:05:00 -0000 From: Michal Ludvig Organization: SuSE CR, s.r.o. User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.5a) Gecko/20030718 X-Accept-Language: cs, cz, en MIME-Version: 1.0 To: GDB Patches Subject: [RFA] Skip the "red zone" on AMD64 Content-Type: multipart/mixed; boundary="------------080300050607030003080406" X-SW-Source: 2003-08/txt/msg00092.txt.bz2 This is a multi-part message in MIME format. --------------080300050607030003080406 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 550 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 * 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 --------------080300050607030003080406 Content-Type: text/plain; name="redzone-1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="redzone-1.diff" Content-length: 839 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]; --------------080300050607030003080406--