From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8807 invoked by alias); 2 Jun 2006 02:40:23 -0000 Received: (qmail 8785 invoked by uid 22791); 2 Jun 2006 02:40:21 -0000 X-Spam-Check-By: sourceware.org Received: from ozlabs.org (HELO ozlabs.org) (203.10.76.45) by sourceware.org (qpsmtpd/0.31) with ESMTP; Fri, 02 Jun 2006 02:40:17 +0000 Received: by ozlabs.org (Postfix, from userid 1010) id A92F467A65; Fri, 2 Jun 2006 12:40:12 +1000 (EST) Date: Fri, 02 Jun 2006 02:40:00 -0000 From: Anton Blanchard To: gdb-patches@sourceware.org Subject: [PATCH] Fix powerpc 64bit backtrace code Message-ID: <20060602023824.GC1736@krispykreme> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.11+cvs20060403 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2006-06/txt/msg00011.txt.bz2 Hi, When backtracing a 64bit task on ppc64/Linux I notice we sometimes get garbage for the PC: #3 0xc00000006d337cd0 in ?? () #4 0x8822248200000001 in ?? () #5 0x4822248200000000 in ?? () Looking closer, it appears that gdb has missed the LR field and instead got the CR field. On 32bit the LR is at SP + wordsize, however on 64bit it is SP + 2*wordsize. Knowing this I looked through the backtrace code and it looks like the fallback is incorrect. If we fail to determine the stack layout accurately we should make a guess based on the ABI. It turns out tdep->lr_frame_offset was created for this purpose, but isnt used anywhere. Look OK? Anton --- 2006-06-02 Anton Blanchard * rs6000-tdep.c (rs6000_frame_cache): Use tdep->lr_frame_offset instead of wordsize when looking for the LR in a stack frame. --- src/gdb/rs6000-tdep.c~ 2006-06-02 09:34:44.000000000 +1000 +++ src/gdb/rs6000-tdep.c 2006-06-02 09:33:42.000000000 +1000 @@ -2988,7 +2988,7 @@ if (make_frame) { fdata.frameless = 0; - fdata.lr_offset = wordsize; + fdata.lr_offset = tdep->lr_frame_offset; } }