From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31837 invoked by alias); 16 Feb 2004 20:55:56 -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 31755 invoked from network); 16 Feb 2004 20:55:53 -0000 Received: from unknown (HELO localhost.redhat.com) (216.129.200.20) by sources.redhat.com with SMTP; 16 Feb 2004 20:55:53 -0000 Received: from gnu.org (localhost [127.0.0.1]) by localhost.redhat.com (Postfix) with ESMTP id E91762B92; Mon, 16 Feb 2004 15:55:52 -0500 (EST) Message-ID: <40312E58.9020702@gnu.org> Date: Mon, 16 Feb 2004 20:55:00 -0000 From: Andrew Cagney User-Agent: Mozilla/5.0 (X11; U; NetBSD macppc; en-US; rv:1.0.2) Gecko/20030820 MIME-Version: 1.0 To: Andrew Cagney Cc: Daniel Jacobowitz , Ulrich Weigand , kettenis@chello.nl, gdb-patches@gcc.gnu.org Subject: Re: [PATCH/RFC] Per-architecture DWARF CFI register state initialization hooks References: <20040216015627.GA15870@nevyn.them.org> <200402161301.OAA17984@faui1d.informatik.uni-erlangen.de> <20040216194731.GC1819@nevyn.them.org> <40312D01.3040704@gnu.org> Content-Type: multipart/mixed; boundary="------------050003000102010407040306" X-SW-Source: 2004-02/txt/msg00431.txt.bz2 This is a multi-part message in MIME format. --------------050003000102010407040306 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-length: 673 > > Sorry, my analysis wasn't completely correct. What actually happens > is an init-order problem during the initialization of the gdbarch > in initialize_current_architecture. The problem is that I call > dwarf2_frame_set_init_reg from within the s390_gdbarch_init routine > (which I gather is the right place?), and at this point in time, > the gdbarch_data call in dwarf2_frame_set_init_reg returns NULL > because the gdbarch hasn't finished initialization yet: > > I've committed the attatched. It follows the convention described in that revised doco patch I posted: > http://sources.redhat.com/ml/gdb-patches/2004-02/msg00381.html > > Andrew with patch ... --------------050003000102010407040306 Content-Type: text/plain; name="diffs" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="diffs" Content-length: 1408 2004-02-16 Andrew Cagney * dwarf2-frame.c (dwarf2_frame_ops): New function. (dwarf2_frame_set_init_reg): Use, instead of gdbarch_data. (dwarf2_frame_init_reg): Ditto. Index: dwarf2-frame.c =================================================================== RCS file: /cvs/src/src/gdb/dwarf2-frame.c,v retrieving revision 1.30 diff -u -r1.30 dwarf2-frame.c --- dwarf2-frame.c 15 Feb 2004 21:29:26 -0000 1.30 +++ dwarf2-frame.c 16 Feb 2004 20:28:01 -0000 @@ -518,6 +518,20 @@ return ops; } +static struct dwarf2_frame_ops * +dwarf2_frame_ops (struct gdbarch *gdbarch) +{ + struct dwarf2_frame_ops *ops = gdbarch_data (gdbarch, dwarf2_frame_data); + if (ops == NULL) + { + /* ULGH, called during architecture initialization. Patch + things up. */ + ops = dwarf2_frame_init (gdbarch); + set_gdbarch_data (gdbarch, dwarf2_frame_data, ops); + } + return ops; +} + /* Set the architecture-specific register state initialization function for GDBARCH to INIT_REG. */ @@ -528,7 +542,7 @@ { struct dwarf2_frame_ops *ops; - ops = gdbarch_data (gdbarch, dwarf2_frame_data); + ops = dwarf2_frame_ops (gdbarch); ops->init_reg = init_reg; } @@ -540,7 +554,7 @@ { struct dwarf2_frame_ops *ops; - ops = gdbarch_data (gdbarch, dwarf2_frame_data); + ops = dwarf2_frame_ops (gdbarch); ops->init_reg (gdbarch, regnum, reg); } --------------050003000102010407040306--