From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31914 invoked by alias); 29 Jul 2008 13:51:31 -0000 Received: (qmail 31478 invoked by uid 22791); 29 Jul 2008 13:51:27 -0000 X-Spam-Check-By: sourceware.org Received: from main.gmane.org (HELO ciao.gmane.org) (80.91.229.2) by sourceware.org (qpsmtpd/0.31) with ESMTP; Tue, 29 Jul 2008 13:51:08 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KNpbV-0005yA-IM for gdb@sources.redhat.com; Tue, 29 Jul 2008 13:51:05 +0000 Received: from entropy.qnx.com ([209.226.137.107]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 29 Jul 2008 13:51:05 +0000 Received: from aristovski by entropy.qnx.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Tue, 29 Jul 2008 13:51:05 +0000 To: gdb@sources.redhat.com From: Aleksandar Ristovski Subject: Re: PowerPC prologue analysis Date: Tue, 29 Jul 2008 14:10:00 -0000 Message-ID: <488F2040.8040202@qnx.com> References: <20080728201312.GA3911@caradoc.them.org> <20080728210800.GA7730@caradoc.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Cc: Daniel Jacobowitz User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) In-Reply-To: <20080728210800.GA7730@caradoc.them.org> X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2008-07/txt/msg00290.txt.bz2 Daniel Jacobowitz wrote: > On Mon, Jul 28, 2008 at 04:29:18PM -0400, Aleksandar Ristovski wrote: >> Thanks for the link! I briefly looked at the patch and it seems to address some of the things I am talking about (r30-r31 issue) but the comment still reads: >> >> + All gpr's from saved_gpr to gpr31 are saved (except during the >> + prologue). */ >> >> Is that in the ABI? I would think that if it is, then the code I am looking at is not according to it (gcc issue or just me not understanding powerpc assembly?). > > Sorry, I don't know which. > There seems to be no such statement in the PowerPC ABI "all gpr's from saved_gpr to gpr31 are saved" - non-volatile registers do not need to be stored in this manner. For example, a function may save r29 but not r30 and r31. However PPC prologue analysis in gdb will assume there is r31 saved as well which will make unwind_register(r31) fail (fetch bogus value). (Note: I am using gcc 4.2.3). Another assumption made in gdb code is that if multiple registers are saved by the prologue, they will be saved in the ascending index order - I am not sure this is a requirement stated in the ABI either. (Is it?) I believe there could be cases where registers are saved in different order, e.g. r30, r28, r29, etc... Hopefully this doesn't happen in practise. I think your patch with gpr_mask covers the first case (not all registers saved) but the second issue (if real issue) is still not handled.