From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5154 invoked by alias); 28 Jul 2008 20:59:05 -0000 Received: (qmail 5146 invoked by uid 22791); 28 Jul 2008 20:59:05 -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; Mon, 28 Jul 2008 20:58:38 +0000 Received: from list by ciao.gmane.org with local (Exim 4.43) id 1KNZnc-0008A3-0w for gdb-patches@sources.redhat.com; Mon, 28 Jul 2008 20:58:32 +0000 Received: from enigma.qnx.com ([209.226.137.106]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Jul 2008 20:58:32 +0000 Received: from aristovski by enigma.qnx.com with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 28 Jul 2008 20:58:32 +0000 To: gdb-patches@sources.redhat.com From: Aleksandar Ristovski Subject: Powerpc skip prologue Date: Mon, 28 Jul 2008 20:59:00 -0000 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------030804020008090207030101" User-Agent: Thunderbird 2.0.0.16 (Windows/20080708) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2008-07/txt/msg00528.txt.bz2 This is a multi-part message in MIME format. --------------030804020008090207030101 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1015 Hello, GDB assumes the gpr registers will be saved starting from a rN register up to r31. This assumption doesn't seem to be right. See this: http://sourceware.org/ml/gdb-patches/2007-12/msg00111.html and this: http://sourceware.org/ml/gdb/2008-07/msg00279.html So I devised a micro-patch for handling the saved gprs. I based it on the Daniel's observations and my own, by disassembling several functions - they appear to have prologue that will save several general purpose registers in the ascending register index order, but not up to r31. For example, r30 only, or r28,r29 etc. Unfortunately, I can only test this on our (Neutrino) powerpc targets. (No ChangeLog since I can not claim this is a final and correct solution in compliance with the ABI. If it turns out that ABI allows for saving registers non-sequentially or out-of order, e.g. r28, r30, r29, then this is not good and we need a more thorough patch that would allow for such situations). Thanks, Aleksandar Ristovski QNX Software Systems --------------030804020008090207030101 Content-Type: text/plain; name="rs6000-tdep.c.prologueissue.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="rs6000-tdep.c.prologueissue.diff" Content-length: 1533 Index: gdb/rs6000-tdep.c =================================================================== RCS file: /cvs/src/src/gdb/rs6000-tdep.c,v retrieving revision 1.318 diff -u -p -r1.318 rs6000-tdep.c --- gdb/rs6000-tdep.c 15 Jul 2008 18:32:06 -0000 1.318 +++ gdb/rs6000-tdep.c 28 Jul 2008 20:49:24 -0000 @@ -117,6 +117,7 @@ struct rs6000_framedata by which we decrement sp to allocate the frame */ int saved_gpr; /* smallest # of saved gpr */ + int saved_gpr_max; /* Largest # of saved gpr */ int saved_fpr; /* smallest # of saved fpr */ int saved_vr; /* smallest # of saved vr */ int saved_ev; /* smallest # of saved ev */ @@ -1197,6 +1198,7 @@ skip_prologue (struct gdbarch *gdbarch, memset (fdata, 0, sizeof (struct rs6000_framedata)); fdata->saved_gpr = -1; + fdata->saved_gpr_max = -1; fdata->saved_fpr = -1; fdata->saved_vr = -1; fdata->saved_ev = -1; @@ -1282,6 +1284,8 @@ skip_prologue (struct gdbarch *gdbarch, op &= ~3UL; fdata->gpr_offset = SIGNED_SHORT (op) + offset; } + if (fdata->saved_gpr_max < reg) + fdata->saved_gpr_max = reg; continue; } @@ -2571,7 +2575,7 @@ rs6000_frame_cache (struct frame_info *t { int i; CORE_ADDR gpr_addr = cache->base + fdata.gpr_offset; - for (i = fdata.saved_gpr; i < ppc_num_gprs; i++) + for (i = fdata.saved_gpr; i <= fdata.saved_gpr_max; i++) { cache->saved_regs[tdep->ppc_gp0_regnum + i].addr = gpr_addr; gpr_addr += wordsize; --------------030804020008090207030101--