From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 14759 invoked by alias); 11 Mar 2004 17:05:13 -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 14735 invoked from network); 11 Mar 2004 17:05:11 -0000 Received: from unknown (HELO localhost.redhat.com) (216.129.200.20) by sources.redhat.com with SMTP; 11 Mar 2004 17:05:11 -0000 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id AB43F2B92; Thu, 11 Mar 2004 12:04:33 -0500 (EST) Message-ID: <40509C21.1040906@gnu.org> Date: Fri, 19 Mar 2004 00:09:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-GB; rv:1.4.1) Gecko/20040217 MIME-Version: 1.0 To: Orjan Friberg Cc: Daniel Jacobowitz , gdb-patches@sources.redhat.com Subject: Re: [CRIS] dwarf2 frame sniffer problem? References: <404F481E.9060709@axis.com> <20040310165905.GA4291@nevyn.them.org> <405072FE.1010403@axis.com> <40508BD8.10802@axis.com> In-Reply-To: <40508BD8.10802@axis.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2004-03/txt/msg00269.txt.bz2 Message-ID: <20040319000900.Tv-nu0HLPU49aTEmbHsKrPINaDmCK3_7FLCooaIqrAM@z> > I don't know if this is related to the previous suggested problem (i.e. the dwarf2 information being wrong), but I changed the test program slightly to: > > void bar(void) {} > void foo(void) > { > bar(); > } > int main () > { > foo(); > return 0; > } > > Now foo is no longer a leaf function, and thus saves the return address on the stack in its prologue. Stepping over foo ("next" in main) causes a breakpoint to be set at the first instruction in foo. After the target is stopped at that instruction (which is where the return address is pushed on the stack) dwarf2_frame_prev_register is called, which thinks that the PC is saved on the stack (case DWARF2_FRAME_REG_SAVED_OFFSET) and reads it from there. Obviously the value it reads is wrong, since the return address hasn't been pushed yet. > > What's wrong here? Is the dwarf2 debug information wrong, or should dwarf2_frame_prev_register not have been called while still in the prologue? Does this: /* NOTE: cagney/2003-09-05: CFI should specify the disposition of all debug info registers. If it doesn't, complain (but not too loudly). It turns out that GCC assumes that an unspecified register implies "same value" when CFI (draft 7) specifies nothing at all. Such a register could equally be interpreted as "undefined". Also note that this check isn't sufficient; it only checks that all registers in the range [0 .. max column] are specified, and won't detect problems when a debug info register falls outside of the table. We need a way of iterating through all the valid DWARF2 register numbers. */ if (fs->regs.reg[column].how == DWARF2_FRAME_REG_UNSPECIFIED) complaint (&symfile_complaints, "Incomplete CFI data; unspecified registers at 0x%s", paddr (fs->pc)); else cache->reg[regnum] = fs->regs.reg[column]; sound like your problem? It's possible to specify initial values of such registers with: /* Set the architecture-specific register state initialization function for GDBARCH to INIT_REG. */ extern void dwarf2_frame_set_init_reg (struct gdbarch *gdbarch, void (*init_reg) (struct gdbarch *, int, struct dwarf2_frame_state_reg *)); Andrew