From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4883 invoked by alias); 20 Nov 2002 18:37:52 -0000 Mailing-List: contact gdb-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sources.redhat.com Received: (qmail 4876 invoked from network); 20 Nov 2002 18:37:51 -0000 Received: from unknown (HELO fw-cam.cambridge.arm.com) (193.131.176.3) by sources.redhat.com with SMTP; 20 Nov 2002 18:37:51 -0000 Received: by fw-cam.cambridge.arm.com; id SAA13599; Wed, 20 Nov 2002 18:37:49 GMT Received: from unknown(172.16.1.2) by fw-cam.cambridge.arm.com via smap (V5.5) id xma013343; Wed, 20 Nov 02 18:37:33 GMT Received: from pc960.cambridge.arm.com (pc960.cambridge.arm.com [10.1.205.4]) by cam-admin0.cambridge.arm.com (8.9.3/8.9.3) with ESMTP id SAA11017; Wed, 20 Nov 2002 18:37:33 GMT Received: from pc960.cambridge.arm.com (rearnsha@localhost) by pc960.cambridge.arm.com (8.11.6/8.9.3) with ESMTP id gAKIbXv25319; Wed, 20 Nov 2002 18:37:33 GMT Message-Id: <200211201837.gAKIbXv25319@pc960.cambridge.arm.com> X-Authentication-Warning: pc960.cambridge.arm.com: rearnsha owned process doing -bs To: "Kris Warkentin" cc: Richard.Earnshaw@arm.com, gdb@sources.redhat.com Reply-To: Richard.Earnshaw@arm.com Organization: ARM Ltd. X-Telephone: +44 1223 400569 (direct+voicemail), +44 1223 400400 (switchbd) X-Fax: +44 1223 400410 X-Address: ARM Ltd., 110 Fulbourn Road, Cherry Hinton, Cambridge CB1 9NJ. Subject: Re: ARM stack alignment on hand called functions In-reply-to: Your message of "Wed, 20 Nov 2002 11:26:28 EST." <191601c290b1$942159e0$0202040a@catdog> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 20 Nov 2002 10:37:00 -0000 From: Richard Earnshaw X-SW-Source: 2002-11/txt/msg00277.txt.bz2 > The problem arises only with functions which return structures whose size is > not evenly divisible by 4. Below is what I did to solve it. > > Index: arm-tdep.c > =================================================================== > RCS file: /product/tools/gdb/gdb/arm-tdep.c,v > retrieving revision 1.9 > retrieving revision 1.10 > diff -c -r1.9 -r1.10 > *** arm-tdep.c 20 Sep 2002 17:11:31 -0000 1.9 > --- arm-tdep.c 19 Nov 2002 18:33:37 -0000 1.10 > *************** > *** 1480,1485 **** > --- 1480,1486 ---- > } > } > > + sp = (sp + 3) & ~3; > /* Return adjusted stack pointer. */ > return sp; > } > OK, but with this change the alignment is being done *after* any arguments that have to go onto the stack have been pushed. It should happen *before*. What happens if you have? struct f { char a; char b; char c;}; struct f g = {1,2,3}; struct f h (int a, int b, int c, int d, int e) { g.c = e; return g; } and then call h from within the debugger. Is g.c set correctly? My guess is that it won't, because the integer value for e will have been pushed onto the stack incorrectly. R.