From: Daniel Jacobowitz <drow@false.org>
To: Mark Kettenis <mark.kettenis@xs4all.nl>, gdb-patches@sourceware.org
Subject: Re: [patch RFC] Re: Notes on a frame_unwind_address_in_block problem
Date: Tue, 02 Jan 2007 00:51:00 -0000 [thread overview]
Message-ID: <20070102005055.GA26703@nevyn.them.org> (raw)
In-Reply-To: <20070101203533.GA20094@nevyn.them.org>
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 <dan@codesourcery.com>
* 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 <signal handler called>\r\n#2 ($hex in)?main.*"
+
+gdb_test "finish" "Run till exit from \#0 func.*<signal handler called>"
next prev parent reply other threads:[~2007-01-02 0:51 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20060706222157.GA1377@nevyn.them.org>
[not found] ` <200607132020.k6DKKCSB023812@elgar.sibelius.xs4all.nl>
[not found] ` <20060718183910.GB17864@nevyn.them.org>
2007-01-01 19:19 ` Daniel Jacobowitz
2007-01-01 19:54 ` Mark Kettenis
2007-01-01 20:02 ` Daniel Jacobowitz
2007-01-01 20:27 ` Mark Kettenis
2007-01-01 20:35 ` Daniel Jacobowitz
2007-01-02 0:51 ` Daniel Jacobowitz [this message]
2007-01-02 19:16 ` Mark Kettenis
2007-01-02 19:18 ` Daniel Jacobowitz
2007-01-02 19:20 ` Daniel Jacobowitz
2007-01-02 21:32 ` Mark Kettenis
2007-01-03 11:37 ` Mark Kettenis
2007-01-03 14:43 ` Daniel Jacobowitz
2007-01-03 16:13 ` Daniel Jacobowitz
2007-01-03 20:28 ` Mark Kettenis
2007-01-03 20:30 ` Daniel Jacobowitz
2007-01-03 21:58 ` Mark Kettenis
2007-01-03 22:02 ` Daniel Jacobowitz
2007-01-03 22:23 ` Mark Kettenis
2007-01-03 22:29 ` Daniel Jacobowitz
2007-02-20 12:39 ` Daniel Jacobowitz
2007-02-20 15:31 ` Daniel Jacobowitz
2007-02-20 16:20 ` Daniel Jacobowitz
2007-02-22 21:28 ` Mark Kettenis
2007-02-22 21:32 ` Daniel Jacobowitz
2007-02-27 20:18 ` Daniel Jacobowitz
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20070102005055.GA26703@nevyn.them.org \
--to=drow@false.org \
--cc=gdb-patches@sourceware.org \
--cc=mark.kettenis@xs4all.nl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox