From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13838 invoked by alias); 2 Jan 2007 00:51:07 -0000 Received: (qmail 13830 invoked by uid 22791); 2 Jan 2007 00:51:03 -0000 X-Spam-Check-By: sourceware.org Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.31.1) with ESMTP; Tue, 02 Jan 2007 00:50:58 +0000 Received: from drow by nevyn.them.org with local (Exim 4.63) (envelope-from ) id 1H1Xrj-0006xR-Hp; Mon, 01 Jan 2007 19:50:55 -0500 Date: Tue, 02 Jan 2007 00:51:00 -0000 From: Daniel Jacobowitz To: Mark Kettenis , gdb-patches@sourceware.org Subject: Re: [patch RFC] Re: Notes on a frame_unwind_address_in_block problem Message-ID: <20070102005055.GA26703@nevyn.them.org> Mail-Followup-To: Mark Kettenis , gdb-patches@sourceware.org References: <20060706222157.GA1377@nevyn.them.org> <200607132020.k6DKKCSB023812@elgar.sibelius.xs4all.nl> <20060718183910.GB17864@nevyn.them.org> <20070101191927.GA14930@nevyn.them.org> <200701011954.l01Js85r031019@brahms.sibelius.xs4all.nl> <20070101200248.GA19073@nevyn.them.org> <200701012026.l01KQj6h022478@brahms.sibelius.xs4all.nl> <20070101203533.GA20094@nevyn.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20070101203533.GA20094@nevyn.them.org> User-Agent: Mutt/1.5.13 (2006-08-11) 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: 2007-01/txt/msg00038.txt.bz2 On Mon, Jan 01, 2007 at 03:35:33PM -0500, Daniel Jacobowitz wrote: > > Hmm, sorry yes, a test that would work on all i386 or x86-64 target > > was what I actually meant. > > I can probably do that. I'll try this evening. Here you go. It requires binutils 2.17 or later; before committing it I would have to make sure it's quiet with an older version. I could write it without the binutils dependency, but it's a lot bigger and messier that way. This testcase should be roughly OS independent, fails without the patch, and passes with it. -- Daniel Jacobowitz CodeSourcery 2007-01-01 Daniel Jacobowitz * gdb.arch/i386-signal.c, gdb.arch/i386-signal.exp: New files. Index: testsuite/gdb.arch/i386-signal.c =================================================================== RCS file: testsuite/gdb.arch/i386-signal.c diff -N testsuite/gdb.arch/i386-signal.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.arch/i386-signal.c 2 Jan 2007 00:48:36 -0000 @@ -0,0 +1,55 @@ +/* Unwinder test program for signal frames. + + Copyright 2007 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. */ + +void sigframe (void); +void setup (void); + +void +func (void) +{ +} + +int +main (void) +{ + setup (); +} + +/* Create an imitation signal frame. This will work on any x86 or + x86-64 target which uses a version of GAS recent enough for + .cfi_signal_frame (added 2006-02-27 and included in binutils 2.17). + The default CIE created by gas suffices to unwind from an empty + function. */ + +asm(".text\n" + " .align 8\n" + " .globl setup\n" + "setup:\n" + " push $sigframe\n" + " jmp func\n" + "\n" + " .cfi_startproc\n" + " .cfi_signal_frame\n" + " nop\n" + " .globl sigframe\n" + "sigframe:\n" + " ret\n" + " .cfi_endproc"); Index: testsuite/gdb.arch/i386-signal.exp =================================================================== RCS file: testsuite/gdb.arch/i386-signal.exp diff -N testsuite/gdb.arch/i386-signal.exp --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ testsuite/gdb.arch/i386-signal.exp 2 Jan 2007 00:48:36 -0000 @@ -0,0 +1,43 @@ +# Copyright 2007 Free Software Foundation, Inc. + +# This file is part of the GDB testsuite. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then { + verbose "Skipping i386 unwinder tests." + return +} + +set testfile "i386-signal" +set srcfile ${testfile}.c +set binfile ${objdir}/${subdir}/${testfile} + +if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" \ + executable { debug }] != "" } { + untested i386-sigframe.exp + return -1 +} + +gdb_exit +gdb_start +gdb_reinitialize_dir $srcdir/$subdir +gdb_load ${binfile} + +runto func +gdb_test "backtrace 10" \ + "#0 ($hex in )?func.*\r\n#1 \r\n#2 ($hex in)?main.*" + +gdb_test "finish" "Run till exit from \#0 func.*"