From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 15394 invoked by alias); 1 Sep 2004 04:22:06 -0000 Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org Received: (qmail 15379 invoked from network); 1 Sep 2004 04:22:04 -0000 Received: from unknown (HELO modra.org) (144.136.177.39) by sourceware.org with SMTP; 1 Sep 2004 04:22:04 -0000 Received: by bubble.modra.org (Postfix, from userid 500) id 929011105BE; Wed, 1 Sep 2004 13:52:03 +0930 (CST) Date: Wed, 01 Sep 2004 04:22:00 -0000 From: Alan Modra To: Yaakov Yaari , gcc@gcc.gnu.org Subject: Re: Minimal FDE Message-ID: <20040901042203.GL26692@bubble.modra.org> Mail-Followup-To: Yaakov Yaari , gcc@gcc.gnu.org References: <20040830205258.GA2566@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040830205258.GA2566@redhat.com> User-Agent: Mutt/1.4i X-SW-Source: 2004-09/txt/msg00011.txt.bz2 On Mon, Aug 30, 2004 at 01:52:58PM -0700, Richard Henderson wrote: > On Mon, Aug 30, 2004 at 09:38:10PM +0300, Yaakov Yaari wrote: > > How critical are these instructions to the unwinding process? > > Very. > > > Is there some minimal/simplified set of instructions that will allow > > exceptions to be properly caught? > > No. Depending on exactly where you split the function, you probably just need to copy the existing FDE, removing the address advances. So, if you only split after the prologue, and given a typical existing FDE like: DW_CFA_advance_loc: 4 DW_CFA_def_cfa_offset: 48 DW_CFA_advance_loc: 12 DW_CFA_offset: r30 at cfa-8 DW_CFA_advance_loc: 16 DW_CFA_offset: r25 at cfa-28 DW_CFA_offset_extended_sf: r65 at cfa+4 DW_CFA_offset: r24 at cfa-32 DW_CFA_advance_loc: 12 DW_CFA_offset: r26 at cfa-24 DW_CFA_advance_loc: 12 DW_CFA_offset: r27 at cfa-20 DW_CFA_advance_loc: 16 DW_CFA_offset: r29 at cfa-12 DW_CFA_offset: r28 at cfa-16 DW_CFA_advance_loc: 8 DW_CFA_offset: r31 at cfa-4 Then, for the piece of function you split out, you'd write DW_CFA_def_cfa_offset: 48 DW_CFA_offset: r30 at cfa-8 DW_CFA_offset: r25 at cfa-28 DW_CFA_offset_extended_sf: r65 at cfa+4 DW_CFA_offset: r24 at cfa-32 DW_CFA_offset: r26 at cfa-24 DW_CFA_offset: r27 at cfa-20 DW_CFA_offset: r29 at cfa-12 DW_CFA_offset: r28 at cfa-16 DW_CFA_offset: r31 at cfa-4 The tedious side of this is writing a DWARF2 interpreter to parse the existing FDE, but I guess you can find a working example in the gcc sources. ;-) It's probably not a good idea to try to write an interpreter that just handles the minimal set of DWARF2 opcodes used by a particular gcc target; I've had one request from someone inside IBM for help writing .eh_frame info for some assembler code. The required .eh_frame info looked quite different to that generated by gcc. -- Alan Modra IBM OzLabs - Linux Technology Centre