This commit is contained in:
parent
c65218ab8e
commit
a842e07fa8
@ -1,49 +0,0 @@
|
|||||||
On Wed, 13 May 2009, Sami Wagiaalla wrote:
|
|
||||||
|
|
||||||
> This problem is due to the fact that in Archer we are using
|
|
||||||
> dwarf2_full_name instead of dwarf2_linkage_name.
|
|
||||||
>
|
|
||||||
> I am trying your patch but it does not seem to have solved the problem
|
|
||||||
> for me. Are you testing against the Archer fedora branch (
|
|
||||||
> archer-jankratochvil-fedora-merge ) ?
|
|
||||||
|
|
||||||
Meh, wrong patch, sorry. I must have had traces of my other approach
|
|
||||||
still in dwarf2read.c that this worked when I checked before sending. It
|
|
||||||
actually fixes only the partial DIEs and I'm not even sure if that's
|
|
||||||
necessary. It certainly does not fix the problem for reading full DIEs.
|
|
||||||
As it's a rather generic tree reader (read_die_and_children_1 and friends)
|
|
||||||
it seems a bit clumsy to special case bogus namespace dies there, which
|
|
||||||
brings me back to my other option (that's the one I started and tested
|
|
||||||
with), hacking determine_prefix, like below. That fixes the problem.
|
|
||||||
Really :-)
|
|
||||||
|
|
||||||
|
|
||||||
Ciao,
|
|
||||||
Michael.
|
|
||||||
Index: gdb-6.8.50.20090302/gdb/dwarf2read.c
|
|
||||||
===================================================================
|
|
||||||
--- gdb-6.8.50.20090302.orig/gdb/dwarf2read.c 2009-05-13 15:53:22.000000000 +0200
|
|
||||||
+++ gdb-6.8.50.20090302/gdb/dwarf2read.c 2009-05-13 23:48:52.000000000 +0200
|
|
||||||
@@ -8885,9 +8894,18 @@ determine_prefix (struct die_info *die,
|
|
||||||
switch (parent->tag)
|
|
||||||
{
|
|
||||||
case DW_TAG_namespace:
|
|
||||||
- parent_type = read_type_die (parent, cu);
|
|
||||||
- /* We give a name to even anonymous namespaces. */
|
|
||||||
- return TYPE_TAG_NAME (parent_type);
|
|
||||||
+ {
|
|
||||||
+ char *prefix;
|
|
||||||
+ parent_type = read_type_die (parent, cu);
|
|
||||||
+ /* We give a name to even anonymous namespaces. */
|
|
||||||
+ prefix = TYPE_TAG_NAME (parent_type);
|
|
||||||
+ /* Special hack for bogus global namespace that is emitted as an
|
|
||||||
+ explicit namespace with the name '::' in g++ 4.1, for
|
|
||||||
+ some decls. */
|
|
||||||
+ if (prefix[0] == ':' && prefix[1] == ':' && prefix[2] == 0)
|
|
||||||
+ return "";
|
|
||||||
+ return prefix;
|
|
||||||
+ }
|
|
||||||
case DW_TAG_class_type:
|
|
||||||
case DW_TAG_interface_type:
|
|
||||||
case DW_TAG_structure_type:
|
|
||||||
|
|
@ -1,128 +0,0 @@
|
|||||||
On Fri, 15 May 2009 21:44:43 +0200, Richard Guenther wrote:
|
|
||||||
> One more issue is that with g++ 4.1
|
|
||||||
>
|
|
||||||
> #include <stdio.h>
|
|
||||||
> const char foo_c[] = "here is foo_c";
|
|
||||||
> int main()
|
|
||||||
> {
|
|
||||||
> puts(foo_c);
|
|
||||||
> return 0;
|
|
||||||
> }
|
|
||||||
>
|
|
||||||
> foo_c at main is printed as
|
|
||||||
>
|
|
||||||
> (gdb) p foo_c
|
|
||||||
> $1 = '\0' <repeats 13 times>
|
|
||||||
> (gdb) ptype foo_c
|
|
||||||
> type = char [14]
|
|
||||||
>
|
|
||||||
> it works if I remove the puts call. It also works with g++ 4.2 and
|
|
||||||
> newer. I wonder if gdb is confused by g++ 4.1 using DW_AT_const_value
|
|
||||||
> for the string ...
|
|
||||||
|
|
||||||
Yes, it looks so. But this issue is unrelated to the Archer patches, it is
|
|
||||||
a normal FSF GDB bug.
|
|
||||||
|
|
||||||
Cross-posting and requesting commit approval.
|
|
||||||
|
|
||||||
Regression tested on x86_64-unknown-linux-gnu.
|
|
||||||
|
|
||||||
|
|
||||||
Thanks,
|
|
||||||
Jan
|
|
||||||
|
|
||||||
|
|
||||||
gdb/
|
|
||||||
2009-05-15 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
||||||
|
|
||||||
Fix parsing DW_AT_const_value using DW_FORM_string.
|
|
||||||
* dwarf2read.c (dwarf2_const_value <DW_FORM_string>): New.
|
|
||||||
|
|
||||||
gdb/testsuite/
|
|
||||||
2009-05-15 Jan Kratochvil <jan.kratochvil@redhat.com>
|
|
||||||
|
|
||||||
* gdb.dwarf2/dw2-strp.exp (p a_string2, ptype a_string2): New.
|
|
||||||
* gdb.dwarf2/dw2-strp.S (a_string2): New.
|
|
||||||
|
|
||||||
--- gdb/dwarf2read.c 1 May 2009 14:43:20 -0000 1.302
|
|
||||||
+++ gdb/dwarf2read.c 15 May 2009 20:44:44 -0000
|
|
||||||
@@ -7957,6 +7957,7 @@ dwarf2_const_value (struct attribute *at
|
|
||||||
DW_ADDR (attr));
|
|
||||||
SYMBOL_CLASS (sym) = LOC_CONST_BYTES;
|
|
||||||
break;
|
|
||||||
+ case DW_FORM_string:
|
|
||||||
case DW_FORM_strp:
|
|
||||||
/* DW_STRING is already allocated on the obstack, point directly
|
|
||||||
to it. */
|
|
||||||
--- gdb/testsuite/gdb.dwarf2/dw2-strp.S 31 Mar 2009 20:21:08 -0000 1.4
|
|
||||||
+++ gdb/testsuite/gdb.dwarf2/dw2-strp.S 15 May 2009 20:44:44 -0000
|
|
||||||
@@ -52,17 +52,23 @@
|
|
||||||
.byte 1 /* DW_AT_byte_size */
|
|
||||||
.byte 6 /* DW_AT_encoding */
|
|
||||||
|
|
||||||
- .uleb128 5 /* Abbrev: DW_TAG_variable */
|
|
||||||
+ .uleb128 5 /* Abbrev: DW_TAG_variable DW_FORM_strp */
|
|
||||||
.4byte .Lvarname /* DW_AT_name */
|
|
||||||
.4byte .Lconst_type-.Lcu1_begin/* DW_AT_type */
|
|
||||||
.4byte .Lvarcontents /* DW_AT_const_value */
|
|
||||||
.byte 1 /* DW_AT_external */
|
|
||||||
|
|
||||||
+ .uleb128 6 /* Abbrev: DW_TAG_variable DW_FORM_string */
|
|
||||||
+ .string "a_string2" /* DW_AT_name */
|
|
||||||
+ .4byte .Lconst_type-.Lcu1_begin/* DW_AT_type */
|
|
||||||
+ .string "hello world2\n" /* DW_AT_const_value */
|
|
||||||
+ .byte 1 /* DW_AT_external */
|
|
||||||
+
|
|
||||||
.Lconst_type:
|
|
||||||
- .uleb128 6 /* Abbrev: DW_TAG_const_type */
|
|
||||||
+ .uleb128 7 /* Abbrev: DW_TAG_const_type */
|
|
||||||
.4byte .Larray_type-.Lcu1_begin/* DW_AT_type */
|
|
||||||
|
|
||||||
- .uleb128 7 /* Abbrev: DW_TAG_variable (name "") */
|
|
||||||
+ .uleb128 8 /* Abbrev: DW_TAG_variable (name "") */
|
|
||||||
.4byte .Lemptyname /* DW_AT_name */
|
|
||||||
|
|
||||||
.byte 0 /* End of children of CU */
|
|
||||||
@@ -125,6 +131,20 @@
|
|
||||||
.byte 0x0 /* Terminator */
|
|
||||||
|
|
||||||
.uleb128 6 /* Abbrev code */
|
|
||||||
+ .uleb128 0x34 /* DW_TAG_variable */
|
|
||||||
+ .byte 0x0 /* no_children */
|
|
||||||
+ .uleb128 0x3 /* DW_AT_name */
|
|
||||||
+ .uleb128 0x8 /* DW_FORM_string */
|
|
||||||
+ .uleb128 0x49 /* DW_AT_type */
|
|
||||||
+ .uleb128 0x13 /* DW_FORM_ref4 */
|
|
||||||
+ .uleb128 0x1c /* DW_AT_const_value */
|
|
||||||
+ .uleb128 0x8 /* DW_FORM_string */
|
|
||||||
+ .uleb128 0x3f /* DW_AT_external */
|
|
||||||
+ .uleb128 0xc /* DW_FORM_flag */
|
|
||||||
+ .byte 0x0 /* Terminator */
|
|
||||||
+ .byte 0x0 /* Terminator */
|
|
||||||
+
|
|
||||||
+ .uleb128 7 /* Abbrev code */
|
|
||||||
.uleb128 0x26 /* DW_TAG_const_type */
|
|
||||||
.byte 0x0 /* DW_children_no */
|
|
||||||
.uleb128 0x49 /* DW_AT_type */
|
|
||||||
@@ -132,7 +152,7 @@
|
|
||||||
.byte 0x0 /* Terminator */
|
|
||||||
.byte 0x0 /* Terminator */
|
|
||||||
|
|
||||||
- .uleb128 7 /* Abbrev code */
|
|
||||||
+ .uleb128 8 /* Abbrev code */
|
|
||||||
.uleb128 0x34 /* DW_TAG_variable */
|
|
||||||
.byte 0x0 /* DW_children_no */
|
|
||||||
.uleb128 0x3 /* DW_AT_name */
|
|
||||||
--- gdb/testsuite/gdb.dwarf2/dw2-strp.exp 3 Jan 2009 05:58:04 -0000 1.2
|
|
||||||
+++ gdb/testsuite/gdb.dwarf2/dw2-strp.exp 15 May 2009 20:44:44 -0000
|
|
||||||
@@ -48,5 +48,8 @@ gdb_start
|
|
||||||
gdb_reinitialize_dir $srcdir/$subdir
|
|
||||||
gdb_load ${binfile}
|
|
||||||
|
|
||||||
-gdb_test "p a_string" "\\\$1 = \"hello world!\\\\n\""
|
|
||||||
+gdb_test "p a_string" " = \"hello world!\\\\n\""
|
|
||||||
gdb_test "ptype a_string" "type = char \\\[14\\\]"
|
|
||||||
+
|
|
||||||
+gdb_test "p a_string2" " = \"hello world2\\\\n\""
|
|
||||||
+gdb_test "ptype a_string2" "type = char \\\[14\\\]"
|
|
||||||
|
|
28
fix-symread-crash.diff
Normal file
28
fix-symread-crash.diff
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
Index: gdb-6.8.50.20090302/gdb/symfile.c
|
||||||
|
===================================================================
|
||||||
|
--- gdb-6.8.50.20090302.orig/gdb/symfile.c 2009-07-28 12:49:19.000000000 +0200
|
||||||
|
+++ gdb-6.8.50.20090302/gdb/symfile.c 2009-07-28 13:44:06.000000000 +0200
|
||||||
|
@@ -2342,8 +2342,14 @@ find_separate_debug_file (struct objfile
|
||||||
|
gdb_assert (i >= 0 && IS_DIR_SEPARATOR (dir[i]));
|
||||||
|
dir[i+1] = '\0';
|
||||||
|
|
||||||
|
+ canon_name = lrealpath (dir);
|
||||||
|
+ i = strlen (dir);
|
||||||
|
+ if (canon_name
|
||||||
|
+ && strlen (canon_name) > i)
|
||||||
|
+ i = strlen (canon_name);
|
||||||
|
+
|
||||||
|
debugfile = xmalloc (strlen (debug_file_directory) + 1
|
||||||
|
- + strlen (dir)
|
||||||
|
+ + i /* MAX (strlen (canon_name), strlen (dir)) */
|
||||||
|
+ strlen (DEBUG_SUBDIRECTORY)
|
||||||
|
+ strlen ("/")
|
||||||
|
+ strlen (basename)
|
||||||
|
@@ -2376,7 +2382,6 @@ find_separate_debug_file (struct objfile
|
||||||
|
|
||||||
|
/* If the file is in the sysroot, try using its base path in the
|
||||||
|
global debugfile directory. */
|
||||||
|
- canon_name = lrealpath (dir);
|
||||||
|
if (canon_name
|
||||||
|
&& strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0
|
||||||
|
&& IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)]))
|
@ -67,7 +67,7 @@ Index: gdb-6.8.50.20090226/gdb/gstack.sh
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||||
+++ gdb-6.8.50.20090226/gdb/gstack.sh 2009-02-26 22:10:05.000000000 +0100
|
+++ gdb-6.8.50.20090226/gdb/gstack.sh 2009-02-26 22:10:05.000000000 +0100
|
||||||
@@ -0,0 +1,45 @@
|
@@ -0,0 +1,48 @@
|
||||||
+#!/bin/sh
|
+#!/bin/sh
|
||||||
+
|
+
|
||||||
+if test $# -ne 1; then
|
+if test $# -ne 1; then
|
||||||
@ -107,6 +107,9 @@ Index: gdb-6.8.50.20090226/gdb/gstack.sh
|
|||||||
+
|
+
|
||||||
+# Run GDB, strip out unwanted noise.
|
+# Run GDB, strip out unwanted noise.
|
||||||
+$GDB --quiet $readnever -nx /proc/$1/exe $1 <<EOF 2>&1 |
|
+$GDB --quiet $readnever -nx /proc/$1/exe $1 <<EOF 2>&1 |
|
||||||
|
+set width 0
|
||||||
|
+set height 0
|
||||||
|
+set pagination no
|
||||||
+$backtrace
|
+$backtrace
|
||||||
+EOF
|
+EOF
|
||||||
+sed -n \
|
+sed -n \
|
||||||
|
@ -24,7 +24,7 @@ Index: gdb-6.3/gdb/gstack.sh
|
|||||||
if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
|
if $GDB -nx --quiet --batch --readnever > /dev/null 2>&1; then
|
||||||
readnever=--readnever
|
readnever=--readnever
|
||||||
@@ -39,7 +39,7 @@ fi
|
@@ -39,7 +39,7 @@ fi
|
||||||
$GDB --quiet $readnever -nx /proc/$1/exe $1 <<EOF 2>&1 |
|
set pagination no
|
||||||
$backtrace
|
$backtrace
|
||||||
EOF
|
EOF
|
||||||
-sed -n \
|
-sed -n \
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
--- /dev/null 2008-05-02 23:36:22.370004160 +0200
|
Index: gdb-6.8.50.20090302/gdb/testsuite/gdb.base/gcore-shmid0.exp
|
||||||
+++ gdb-6.8/gdb/testsuite/gdb.base/gcore-shmid0.exp 2008-05-03 22:36:56.000000000 +0200
|
===================================================================
|
||||||
@@ -0,0 +1,120 @@
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||||
+# Copyright 2007 Free Software Foundation, Inc.
|
+++ gdb-6.8.50.20090302/gdb/testsuite/gdb.base/gcore-shmid0.exp 2009-06-29 16:24:36.000000000 +0200
|
||||||
|
@@ -0,0 +1,96 @@
|
||||||
|
+# Copyright 2007, 2009 Free Software Foundation, Inc.
|
||||||
+
|
+
|
||||||
+# This program is free software; you can redistribute it and/or modify
|
+# 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
|
+# it under the terms of the GNU General Public License as published by
|
||||||
@ -17,43 +19,22 @@
|
|||||||
+# along with this program; if not, write to the Free Software
|
+# along with this program; if not, write to the Free Software
|
||||||
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
+
|
+
|
||||||
+# Please email any bugs, comments, and/or additions to this file to:
|
|
||||||
+# bug-gdb@prep.ai.mit.edu
|
|
||||||
+
|
|
||||||
+# Test GDB's handling of gcore for mapping with a name but zero inode.
|
+# Test GDB's handling of gcore for mapping with a name but zero inode.
|
||||||
+
|
+
|
||||||
+set testfile "gcore-shmid0"
|
+if { [prepare_for_testing gcore-shmid0.exp gcore-shmid0] } {
|
||||||
+set srcfile ${testfile}.c
|
+ return -1
|
||||||
+set binfile ${objdir}/${subdir}/${testfile}
|
|
||||||
+
|
|
||||||
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
|
|
||||||
+ untested gcore.exp
|
|
||||||
+ return -1
|
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+# Start with a fresh gdb.
|
|
||||||
+
|
|
||||||
+gdb_exit
|
|
||||||
+gdb_start
|
|
||||||
+gdb_reinitialize_dir $srcdir/$subdir
|
|
||||||
+gdb_load ${binfile}
|
|
||||||
+
|
|
||||||
+# Does this gdb support gcore?
|
+# Does this gdb support gcore?
|
||||||
+send_gdb "help gcore\n"
|
+set test "help gcore"
|
||||||
+gdb_expect {
|
+gdb_test_multiple $test $test {
|
||||||
+ -re "Undefined command: .gcore.*$gdb_prompt $" {
|
+ -re "Undefined command: .gcore.*$gdb_prompt $" {
|
||||||
+ # gcore command not supported -- nothing to test here.
|
+ # gcore command not supported -- nothing to test here.
|
||||||
+ unsupported "gdb does not support gcore on this target"
|
+ unsupported "gdb does not support gcore on this target"
|
||||||
+ return -1;
|
+ return -1;
|
||||||
+ }
|
+ }
|
||||||
+ -re "Save a core file .*$gdb_prompt $" {
|
+ -re "Save a core file .*$gdb_prompt $" {
|
||||||
+ pass "help gcore"
|
+ pass $test
|
||||||
+ }
|
|
||||||
+ -re ".*$gdb_prompt $" {
|
|
||||||
+ fail "help gcore"
|
|
||||||
+ }
|
|
||||||
+ timeout {
|
|
||||||
+ fail "help gcore (timeout)"
|
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
@ -86,9 +67,6 @@
|
|||||||
+ -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
+ -re "Can't create a corefile\[\r\n\]+$gdb_prompt $" {
|
||||||
+ unsupported $test
|
+ unsupported $test
|
||||||
+ }
|
+ }
|
||||||
+ eof {
|
|
||||||
+ fail $test
|
|
||||||
+ }
|
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+# Be sure to remove the handle first.
|
+# Be sure to remove the handle first.
|
||||||
@ -121,10 +99,12 @@
|
|||||||
+ fail $test
|
+ fail $test
|
||||||
+ }
|
+ }
|
||||||
+}
|
+}
|
||||||
--- /dev/null 2008-05-02 23:36:22.370004160 +0200
|
Index: gdb-6.8.50.20090302/gdb/testsuite/gdb.base/gcore-shmid0.c
|
||||||
+++ gdb-6.8/gdb/testsuite/gdb.base/gcore-shmid0.c 2008-05-03 22:39:10.000000000 +0200
|
===================================================================
|
||||||
@@ -0,0 +1,95 @@
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||||
+/* Copyright 2007 Free Software Foundation, Inc.
|
+++ gdb-6.8.50.20090302/gdb/testsuite/gdb.base/gcore-shmid0.c 2009-06-29 16:22:49.000000000 +0200
|
||||||
|
@@ -0,0 +1,123 @@
|
||||||
|
+/* Copyright 2007, 2009 Free Software Foundation, Inc.
|
||||||
+
|
+
|
||||||
+ This file is part of GDB.
|
+ This file is part of GDB.
|
||||||
+
|
+
|
||||||
@ -155,7 +135,10 @@
|
|||||||
+#include <unistd.h>
|
+#include <unistd.h>
|
||||||
+#include <assert.h>
|
+#include <assert.h>
|
||||||
+
|
+
|
||||||
+/* We need a backtrace through the stack. */
|
+/* The same test running in a parallel testsuite may steal us the zero SID,
|
||||||
|
+ even if we never get any EEXIST. Just try a while. */
|
||||||
|
+
|
||||||
|
+#define TIMEOUT_SEC 10
|
||||||
+
|
+
|
||||||
+static void
|
+static void
|
||||||
+initialized (void)
|
+initialized (void)
|
||||||
@ -172,19 +155,41 @@
|
|||||||
+{
|
+{
|
||||||
+ int sid;
|
+ int sid;
|
||||||
+ unsigned int *addr = (void *) -1L;
|
+ unsigned int *addr = (void *) -1L;
|
||||||
+ int try;
|
+ int attempt, round = 0;
|
||||||
|
+ time_t ts_start, ts;
|
||||||
+
|
+
|
||||||
+ /* The generated SID will cycle with an increment of 32768, try until it
|
+ if (time (&ts_start) == (time_t) -1)
|
||||||
|
+ {
|
||||||
|
+ printf ("time (): %m\n");
|
||||||
|
+ exit (1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ /* The generated SID will cycle with an increment of 32768, attempt until it
|
||||||
+ * wraps to 0. */
|
+ * wraps to 0. */
|
||||||
+
|
+
|
||||||
+ for (try = 0; addr == (void *) -1L; try++)
|
+ for (attempt = 0; addr == (void *) -1L; attempt++)
|
||||||
+ {
|
+ {
|
||||||
+ /* At least kernel-2.6.25-8.fc9.x86_64 just never returns the value 0 by
|
+ /* kernel-2.6.25-8.fc9.x86_64 just never returns the value 0 by
|
||||||
+ shmget(2). */
|
+ shmget(2). shmget returns SID range 0..1<<31 in steps of 32768,
|
||||||
+ if (try > 0x10000)
|
+ 0x1000 should be enough but wrap the range it to be sure. */
|
||||||
|
+
|
||||||
|
+ if (attempt > 0x21000)
|
||||||
+ {
|
+ {
|
||||||
+ printf ("Problem no longer reproducible on this kernel (try %d)\n",
|
+ if (time (&ts) == (time_t) -1)
|
||||||
+ try);
|
+ {
|
||||||
|
+ printf ("time (): %m\n");
|
||||||
|
+ exit (1);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (ts >= ts_start && ts < ts_start + TIMEOUT_SEC)
|
||||||
|
+ {
|
||||||
|
+ attempt = 0;
|
||||||
|
+ round++;
|
||||||
|
+ continue;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ printf ("Problem is not reproducible on this kernel (attempt %d, "
|
||||||
|
+ "round %d))\n", attempt, round);
|
||||||
+ unresolved ();
|
+ unresolved ();
|
||||||
+ exit (1);
|
+ exit (1);
|
||||||
+ }
|
+ }
|
||||||
@ -192,6 +197,9 @@
|
|||||||
+ sid = shmget ((key_t) rand (), 0x1000, IPC_CREAT | IPC_EXCL | 0777);
|
+ sid = shmget ((key_t) rand (), 0x1000, IPC_CREAT | IPC_EXCL | 0777);
|
||||||
+ if (sid == -1)
|
+ if (sid == -1)
|
||||||
+ {
|
+ {
|
||||||
|
+ if (errno == EEXIST)
|
||||||
|
+ continue;
|
||||||
|
+
|
||||||
+ printf ("shmget (%d, 0x1000, IPC_CREAT): errno %d\n", 0, errno);
|
+ printf ("shmget (%d, 0x1000, IPC_CREAT): errno %d\n", 0, errno);
|
||||||
+ exit (1);
|
+ exit (1);
|
||||||
+ }
|
+ }
|
||||||
|
@ -276,7 +276,7 @@ Index: gdb-6.8.50.20090302/gdb/breakpoint.c
|
|||||||
+ if (((b->type == bp_breakpoint) ||
|
+ if (((b->type == bp_breakpoint) ||
|
||||||
+ (b->type == bp_hardware_breakpoint)) &&
|
+ (b->type == bp_hardware_breakpoint)) &&
|
||||||
+ b->enable_state == bp_enabled &&
|
+ b->enable_state == bp_enabled &&
|
||||||
+ !b->loc->duplicate)
|
+ b->loc != NULL && !b->loc->duplicate)
|
||||||
+ {
|
+ {
|
||||||
+ b->enable_state = bp_startup_disabled;
|
+ b->enable_state = bp_startup_disabled;
|
||||||
+ if (!silent)
|
+ if (!silent)
|
||||||
|
@ -4,10 +4,52 @@
|
|||||||
* gdb.arch/ia64-libunwind.exp: New file.
|
* gdb.arch/ia64-libunwind.exp: New file.
|
||||||
* gdb.arch/ia64-libunwind.c: New file.
|
* gdb.arch/ia64-libunwind.c: New file.
|
||||||
|
|
||||||
--- /dev/null Thu Apr 11 10:25:15 2002
|
2004-08-03 Jeff Johnston <jjohnstn@redhat.com>
|
||||||
+++ gdb+dejagnu-20040223/gdb/testsuite/gdb.arch/ia64-libunwind.exp Mon Nov 17 15:57:04 2003
|
|
||||||
@@ -0,0 +1,55 @@
|
* gdb.arch/ia64-libunwind.exp: Fix test string to match
|
||||||
+# Copyright 2003 Free Software Foundation, Inc.
|
current code base.
|
||||||
|
|
||||||
|
[ acquire_unwind_info -> ia64_find_proc_info_x ]
|
||||||
|
|
||||||
|
2009-04-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
Remove a race from send_gdb "COMMAND\n".
|
||||||
|
Cleanup.
|
||||||
|
Merge in: Patch4: gdb-6.3-rh-testlibunwind1fix-20041202.patch
|
||||||
|
|
||||||
|
--- /dev/null 2009-04-19 08:52:54.499000000 +0200
|
||||||
|
+++ gdb-6.8/gdb/testsuite/gdb.arch/ia64-libunwind.c 2009-04-30 19:15:16.000000000 +0200
|
||||||
|
@@ -0,0 +1,26 @@
|
||||||
|
+/* Copyright 2003, 2009 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 3 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, see <http://www.gnu.org/licenses/>. */
|
||||||
|
+
|
||||||
|
+#include <stdio.h>
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+main ()
|
||||||
|
+{
|
||||||
|
+ printf ("hello world\n");
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
--- /dev/null 2009-04-19 08:52:54.499000000 +0200
|
||||||
|
+++ gdb-6.8/gdb/testsuite/gdb.arch/ia64-libunwind.exp 2009-04-30 19:19:22.000000000 +0200
|
||||||
|
@@ -0,0 +1,52 @@
|
||||||
|
+# Copyright 2003, 2009 Free Software Foundation, Inc.
|
||||||
+
|
+
|
||||||
+# This program is free software; you can redistribute it and/or modify
|
+# 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
|
+# it under the terms of the GNU General Public License as published by
|
||||||
@ -28,16 +70,6 @@
|
|||||||
+
|
+
|
||||||
+# This file was written by Jeff Johnston (jjohnstn@redhat.com)
|
+# This file was written by Jeff Johnston (jjohnstn@redhat.com)
|
||||||
+
|
+
|
||||||
+if $tracelevel then {
|
|
||||||
+ strace $tracelevel
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#
|
|
||||||
+# test running programs
|
|
||||||
+#
|
|
||||||
+set prms_id 0
|
|
||||||
+set bug_id 0
|
|
||||||
+
|
|
||||||
+if ![istarget "ia64-*-*"] then {
|
+if ![istarget "ia64-*-*"] then {
|
||||||
+ return
|
+ return
|
||||||
+}
|
+}
|
||||||
@ -58,19 +90,14 @@
|
|||||||
+gdb_start
|
+gdb_start
|
||||||
+gdb_reinitialize_dir $srcdir/$subdir
|
+gdb_reinitialize_dir $srcdir/$subdir
|
||||||
+gdb_load ${binfile}
|
+gdb_load ${binfile}
|
||||||
+send_gdb "set debug arch 1\n"
|
|
||||||
+send_gdb "break main\n"
|
|
||||||
+gdb_test "run" ".*acquire_unwind_info.*"
|
|
||||||
+
|
+
|
||||||
--- /dev/null Thu Apr 11 10:25:15 2002
|
+gdb_test "set debug arch 1"
|
||||||
+++ gdb+dejagnu-20040223/gdb/testsuite/gdb.arch/ia64-libunwind.c Mon Nov 17 15:58:27 2003
|
+gdb_breakpoint "main"
|
||||||
@@ -0,0 +1,9 @@
|
+gdb_run_cmd
|
||||||
+#include <stdio.h>
|
|
||||||
+
|
+
|
||||||
+int main()
|
+set test "libunwind message"
|
||||||
+{
|
+gdb_test_multiple "" $test {
|
||||||
+ printf ("hello world\n");
|
+ -re "ia64_find_proc_info_x.*$gdb_prompt $" {
|
||||||
+
|
+ pass $test
|
||||||
+ return 0;
|
+ }
|
||||||
+}
|
+}
|
||||||
+
|
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
2004-08-03 Jeff Johnston <jjohnstn@redhat.com>
|
|
||||||
|
|
||||||
* gdb.arch/ia64-libunwind.exp: Fix test string to match
|
|
||||||
current code base.
|
|
||||||
|
|
||||||
--- gdb+dejagnu-20040607/gdb/testsuite/gdb.arch/ia64-libunwind.exp.fix Tue Aug 3 18:29:22 2004
|
|
||||||
+++ gdb+dejagnu-20040607/gdb/testsuite/gdb.arch/ia64-libunwind.exp Tue Aug 3 18:41:01 2004
|
|
||||||
@@ -51,5 +51,5 @@ gdb_reinitialize_dir $srcdir/$subdir
|
|
||||||
gdb_load ${binfile}
|
|
||||||
send_gdb "set debug arch 1\n"
|
|
||||||
send_gdb "break main\n"
|
|
||||||
-gdb_test "run" ".*acquire_unwind_info.*"
|
|
||||||
+gdb_test "run" ".*ia64_find_proc_info_x.*"
|
|
||||||
|
|
@ -873,7 +873,7 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.pie/break.exp
|
|||||||
===================================================================
|
===================================================================
|
||||||
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
|
||||||
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.pie/break.exp 2008-12-09 17:24:34.000000000 +0100
|
+++ gdb-6.8.50.20081128/gdb/testsuite/gdb.pie/break.exp 2008-12-09 17:24:34.000000000 +0100
|
||||||
@@ -0,0 +1,973 @@
|
@@ -0,0 +1,977 @@
|
||||||
+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
|
+# Copyright 1988, 1990, 1991, 1992, 1994, 1995, 1996, 1997, 1998, 1999,
|
||||||
+# 2000, 2002, 2003, 2004
|
+# 2000, 2002, 2003, 2004
|
||||||
+# Free Software Foundation, Inc.
|
+# Free Software Foundation, Inc.
|
||||||
@ -1055,6 +1055,9 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.pie/break.exp
|
|||||||
+set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
|
+set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
|
||||||
+set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
|
+set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
|
||||||
+
|
+
|
||||||
|
+# Test a pending breakpoint in PIE executable does not crash later GDB.
|
||||||
|
+gdb_breakpoint "non_existent_function" allow-pending
|
||||||
|
+
|
||||||
+gdb_test "info break" \
|
+gdb_test "info break" \
|
||||||
+ "Num\[ \]+Type\[ \]+Disp Enb Address\[ \]+What.*
|
+ "Num\[ \]+Type\[ \]+Disp Enb Address\[ \]+What.*
|
||||||
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.*
|
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$main_line.*
|
||||||
@ -1064,7 +1067,8 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.pie/break.exp
|
|||||||
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
|
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
|
||||||
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location2.*
|
+\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location2.*
|
||||||
+\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:$bp_location3.*
|
+\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_if_conditional at .*$srcfile:$bp_location3.*
|
||||||
+\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:$bp_location4" \
|
+\[0-9\]+\[\t \]+breakpoint keep y.* in multi_line_while_conditional at .*$srcfile:$bp_location4.*
|
||||||
|
+\[0-9\]+\[\t \]+breakpoint keep y.* <PENDING> *non_existent_function" \
|
||||||
+ "breakpoint info"
|
+ "breakpoint info"
|
||||||
+
|
+
|
||||||
+# FIXME: The rest of this test doesn't work with anything that can't
|
+# FIXME: The rest of this test doesn't work with anything that can't
|
||||||
@ -1490,7 +1494,7 @@ Index: gdb-6.8.50.20081128/gdb/testsuite/gdb.pie/break.exp
|
|||||||
+}
|
+}
|
||||||
+send_gdb "print marker2(99)\n"
|
+send_gdb "print marker2(99)\n"
|
||||||
+gdb_expect {
|
+gdb_expect {
|
||||||
+ -re "The program being debugged stopped while in a function called from GDB.\r\nWhen the function .marker2$proto. is done executing, GDB will silently\r\nstop .instead of continuing to evaluate the expression containing\r\nthe function call...*$gdb_prompt $"\
|
+ -re "The program being debugged stopped while in a function called from GDB.\r\nEvaluation of the expression containing the function\r\n.marker2$proto. will be abandoned.\r\nWhen the function is done executing, GDB will silently stop.\r\n$gdb_prompt $"\
|
||||||
+ {pass "hit breakpoint on called function"}
|
+ {pass "hit breakpoint on called function"}
|
||||||
+ -re "$gdb_prompt $"\
|
+ -re "$gdb_prompt $"\
|
||||||
+ {fail "hit breakpoint on called function"}
|
+ {fail "hit breakpoint on called function"}
|
||||||
|
@ -421,7 +421,7 @@ Index: gdb-6.8.50.20090302/gdb/symfile.c
|
|||||||
}
|
}
|
||||||
|
|
||||||
@@ -1802,14 +2154,33 @@ debug_print_missing (const char *binary,
|
@@ -1802,14 +2154,33 @@ debug_print_missing (const char *binary,
|
||||||
}
|
|
||||||
*slot = missing_filepair;
|
*slot = missing_filepair;
|
||||||
|
|
||||||
- /* We do not collect and flush these messages as each such message
|
- /* We do not collect and flush these messages as each such message
|
||||||
|
@ -13,7 +13,7 @@ Index: gdb-6.8.50.20090302/gdb/corelow.c
|
|||||||
|
|
||||||
|
|
||||||
#ifndef O_LARGEFILE
|
#ifndef O_LARGEFILE
|
||||||
@@ -267,6 +271,56 @@ add_to_thread_list (bfd *abfd, asection
|
@@ -267,6 +271,50 @@ add_to_thread_list (bfd *abfd, asection
|
||||||
inferior_ptid = ptid; /* Yes, make it current */
|
inferior_ptid = ptid; /* Yes, make it current */
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -26,6 +26,7 @@ Index: gdb-6.8.50.20090302/gdb/corelow.c
|
|||||||
+ struct build_id *build_id;
|
+ struct build_id *build_id;
|
||||||
+ char *exec_filename, *debug_filename;
|
+ char *exec_filename, *debug_filename;
|
||||||
+ char *build_id_filename;
|
+ char *build_id_filename;
|
||||||
|
+ struct cleanup *back_to;
|
||||||
+
|
+
|
||||||
+ if (exec_bfd != NULL)
|
+ if (exec_bfd != NULL)
|
||||||
+ return;
|
+ return;
|
||||||
@ -37,32 +38,25 @@ Index: gdb-6.8.50.20090302/gdb/corelow.c
|
|||||||
+ if (build_id == NULL)
|
+ if (build_id == NULL)
|
||||||
+ return;
|
+ return;
|
||||||
+
|
+
|
||||||
|
+ /* SYMFILE_OBJFILE should refer to the main executable (not only to its
|
||||||
|
+ separate debug info file). gcc44+ keeps .eh_frame only in the main
|
||||||
|
+ executable without its duplicate .debug_frame in the separate debug info
|
||||||
|
+ file - such .eh_frame would not be found if SYMFILE_OBJFILE would refer
|
||||||
|
+ directly to the separate debug info file. */
|
||||||
|
+
|
||||||
+ exec_filename = build_id_to_filename (build_id, &build_id_filename, 0);
|
+ exec_filename = build_id_to_filename (build_id, &build_id_filename, 0);
|
||||||
|
+ back_to = make_cleanup (xfree, build_id_filename);
|
||||||
|
+
|
||||||
+ if (exec_filename != NULL)
|
+ if (exec_filename != NULL)
|
||||||
+ exec_file_attach (exec_filename, from_tty);
|
+ {
|
||||||
|
+ make_cleanup (xfree, exec_filename);
|
||||||
|
+ exec_file_attach (exec_filename, from_tty);
|
||||||
|
+ symbol_file_add_main (exec_filename, from_tty);
|
||||||
|
+ }
|
||||||
+ else
|
+ else
|
||||||
+ debug_print_missing (_("the main executable file"), build_id_filename);
|
+ debug_print_missing (_("the main executable file"), build_id_filename);
|
||||||
+ xfree (build_id_filename);
|
|
||||||
+
|
+
|
||||||
+ /* `.note.gnu.build-id' section exists even for files without a separate
|
+ do_cleanups (back_to);
|
||||||
+ debuginfo. */
|
|
||||||
+ debug_filename = build_id_to_filename (build_id, &build_id_filename, 1);
|
|
||||||
+ if (debug_filename != NULL)
|
|
||||||
+ {
|
|
||||||
+ symbol_file_add_main (debug_filename, from_tty);
|
|
||||||
+ xfree (debug_filename);
|
|
||||||
+ }
|
|
||||||
+ else
|
|
||||||
+ {
|
|
||||||
+ if (exec_filename != NULL)
|
|
||||||
+ symbol_file_add_main (exec_filename, from_tty);
|
|
||||||
+ /* For EXEC_FILENAME NULL we were already complaining above. */
|
|
||||||
+ if (symfile_objfile == NULL && exec_filename != NULL)
|
|
||||||
+ debug_print_missing (exec_filename, build_id_filename);
|
|
||||||
+ }
|
|
||||||
+ xfree (build_id_filename);
|
|
||||||
+
|
|
||||||
+ xfree (exec_filename);
|
|
||||||
+
|
+
|
||||||
+ /* No automatic SOLIB_ADD as the libraries would get read twice. */
|
+ /* No automatic SOLIB_ADD as the libraries would get read twice. */
|
||||||
+}
|
+}
|
||||||
@ -646,7 +640,7 @@ Index: gdb-6.8.50.20090302/gdb/symfile.c
|
|||||||
|
|
||||||
if (retval != NULL && !build_id_verify (retval, build_id))
|
if (retval != NULL && !build_id_verify (retval, build_id))
|
||||||
{
|
{
|
||||||
@@ -1279,9 +1676,142 @@ build_id_to_debug_filename (struct build
|
@@ -1279,9 +1676,150 @@ build_id_to_debug_filename (struct build
|
||||||
retval = NULL;
|
retval = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -700,8 +694,8 @@ Index: gdb-6.8.50.20090302/gdb/symfile.c
|
|||||||
+ const struct missing_filepair *elem2)
|
+ const struct missing_filepair *elem2)
|
||||||
+{
|
+{
|
||||||
+ return strcmp (elem1->binary, elem2->binary) == 0
|
+ return strcmp (elem1->binary, elem2->binary) == 0
|
||||||
+ && ((elem1->debug == NULL && elem2->debug == NULL)
|
+ && ((elem1->debug == NULL) == (elem2->debug == NULL))
|
||||||
+ || strcmp (elem1->debug, elem2->debug) == 0);
|
+ && (elem1->debug == NULL || strcmp (elem1->debug, elem2->debug) == 0);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void
|
+static void
|
||||||
@ -732,6 +726,7 @@ Index: gdb-6.8.50.20090302/gdb/symfile.c
|
|||||||
+{
|
+{
|
||||||
+ size_t binary_len0 = strlen (binary) + 1;
|
+ size_t binary_len0 = strlen (binary) + 1;
|
||||||
+ size_t debug_len0 = debug ? strlen (debug) + 1 : 0;
|
+ size_t debug_len0 = debug ? strlen (debug) + 1 : 0;
|
||||||
|
+ struct missing_filepair missing_filepair_find;
|
||||||
+ struct missing_filepair *missing_filepair;
|
+ struct missing_filepair *missing_filepair;
|
||||||
+ struct missing_filepair **slot;
|
+ struct missing_filepair **slot;
|
||||||
+
|
+
|
||||||
@ -747,6 +742,27 @@ Index: gdb-6.8.50.20090302/gdb/symfile.c
|
|||||||
+ missing_filepair_xcalloc, NULL);
|
+ missing_filepair_xcalloc, NULL);
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
|
+ /* Use MISSING_FILEPAIR_FIND first instead of calling obstack_alloc with
|
||||||
|
+ obstack_free in the case of a (rare) match. The problem is ALLOC_F for
|
||||||
|
+ MISSING_FILEPAIR_HASH allocates from MISSING_FILEPAIR_OBSTACK maintenance
|
||||||
|
+ structures for MISSING_FILEPAIR_HASH. Calling obstack_free would possibly
|
||||||
|
+ not to free only MISSING_FILEPAIR but also some such structures (allocated
|
||||||
|
+ during the htab_find_slot call). */
|
||||||
|
+
|
||||||
|
+ missing_filepair_find.binary = (char *) binary;
|
||||||
|
+ missing_filepair_find.debug = (char *) debug;
|
||||||
|
+ slot = (struct missing_filepair **) htab_find_slot (missing_filepair_hash,
|
||||||
|
+ &missing_filepair_find,
|
||||||
|
+ INSERT);
|
||||||
|
+
|
||||||
|
+ /* While it may be still printed duplicitely with the missing debuginfo file
|
||||||
|
+ * it is due to once printing about the binary file build-id link and once
|
||||||
|
+ * about the .debug file build-id link as both the build-id symlinks are
|
||||||
|
+ * located in the debuginfo package. */
|
||||||
|
+
|
||||||
|
+ if (*slot != NULL)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
+ missing_filepair = obstack_alloc (&missing_filepair_obstack,
|
+ missing_filepair = obstack_alloc (&missing_filepair_obstack,
|
||||||
+ sizeof (*missing_filepair) - 1
|
+ sizeof (*missing_filepair) - 1
|
||||||
+ + binary_len0 + debug_len0);
|
+ + binary_len0 + debug_len0);
|
||||||
@ -760,20 +776,6 @@ Index: gdb-6.8.50.20090302/gdb/symfile.c
|
|||||||
+ else
|
+ else
|
||||||
+ missing_filepair->debug = NULL;
|
+ missing_filepair->debug = NULL;
|
||||||
+
|
+
|
||||||
+ slot = (struct missing_filepair **) htab_find_slot (missing_filepair_hash,
|
|
||||||
+ missing_filepair,
|
|
||||||
+ INSERT);
|
|
||||||
+
|
|
||||||
+ /* While it may be still printed duplicitely with the missing debuginfo file
|
|
||||||
+ * it is due to once printing about the binary file build-id link and once
|
|
||||||
+ * about the .debug file build-id link as both the build-id symlinks are
|
|
||||||
+ * located in the debuginfo package. */
|
|
||||||
+
|
|
||||||
+ if (*slot != NULL)
|
|
||||||
+ {
|
|
||||||
+ obstack_free (&missing_filepair_obstack, missing_filepair);
|
|
||||||
+ return;
|
|
||||||
+ }
|
|
||||||
+ *slot = missing_filepair;
|
+ *slot = missing_filepair;
|
||||||
+
|
+
|
||||||
+ /* We do not collect and flush these messages as each such message
|
+ /* We do not collect and flush these messages as each such message
|
||||||
|
105
gdb-6.8-bz457187-largefile-test.patch
Normal file
105
gdb-6.8-bz457187-largefile-test.patch
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
--- /dev/null 2009-04-19 14:49:00.974648389 +0200
|
||||||
|
+++ gdb-6.8/gdb/testsuite/gdb.arch/i386-biarch-core.exp 2009-04-19 16:30:12.000000000 +0200
|
||||||
|
@@ -0,0 +1,61 @@
|
||||||
|
+# This testcase is part of GDB, the GNU debugger.
|
||||||
|
+
|
||||||
|
+# Copyright 2009 Free Software Foundation, Inc.
|
||||||
|
+
|
||||||
|
+# 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.
|
||||||
|
+
|
||||||
|
+# Test ability to load an elf64-i386 core file. The provided core file was
|
||||||
|
+# elf64-x8664 one but it got binary patched to i386:
|
||||||
|
+# Elf32_Ehdr.e_machine @0x12..0x13
|
||||||
|
+# Elf64_Ehdr.e_machine @0x12..0x13
|
||||||
|
+# #define EM_386 3 /* Intel 80386 */
|
||||||
|
+# #define EM_X86_64 62 /* AMD x86-64 architecture */
|
||||||
|
+# patch @0x12: 0x3E -> 0x03
|
||||||
|
+
|
||||||
|
+if { ![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"] } then {
|
||||||
|
+ verbose "Skipping i386-biarch-core test."
|
||||||
|
+ return
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+set testfile "i386-biarch-core"
|
||||||
|
+set corebz2uufile ${srcdir}/${subdir}/${testfile}.core.bz2.uu
|
||||||
|
+set corefile ${objdir}/${subdir}/${testfile}.core
|
||||||
|
+# Entry point of the original executable.
|
||||||
|
+set address 0x400078
|
||||||
|
+
|
||||||
|
+if {[catch "system \"uudecode -o - ${corebz2uufile} | bzip2 -dc >${corefile}\""] != 0} {
|
||||||
|
+ untested "failed uudecode or bzip2"
|
||||||
|
+ return -1
|
||||||
|
+}
|
||||||
|
+file stat ${corefile} corestat
|
||||||
|
+if {$corestat(size) != 102400} {
|
||||||
|
+ untested "uudecode or bzip2 produce invalid result"
|
||||||
|
+ return -1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+gdb_exit
|
||||||
|
+gdb_start
|
||||||
|
+gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
+
|
||||||
|
+# Wrongly built GDB complains by:
|
||||||
|
+# "..." is not a core dump: File format not recognized
|
||||||
|
+# As the provided test core has 64bit PRSTATUS i386 built GDB cannot parse it.
|
||||||
|
+# This is just a problem of the test care, real-world elf64-i386 file will have
|
||||||
|
+# 32bit PRSTATUS. One cannot prepare elf64-i386 core file from elf32-i386 by
|
||||||
|
+# objcopy as it corrupts the core file beyond all recognition.
|
||||||
|
+# "\r\nCore was generated by `\[^\r\n\]*'\\.\r\nProgram terminated with signal 11, Segmentation fault\\.\r\n.*"
|
||||||
|
+gdb_test "core-file ${corefile}"
|
||||||
|
+
|
||||||
|
+gdb_test "x/i $address" "\r\n$address:\[ \t\]*hlt\[ \t\]*" ".text is readable"
|
||||||
|
--- /dev/null 2009-04-19 14:49:00.974648389 +0200
|
||||||
|
+++ gdb-6.8/gdb/testsuite/gdb.arch/i386-biarch-core.S 2009-04-19 14:52:28.000000000 +0200
|
||||||
|
@@ -0,0 +1,22 @@
|
||||||
|
+/* This testcase is part of GDB, the GNU debugger.
|
||||||
|
+
|
||||||
|
+ Copyright 2009 Free Software Foundation, Inc.
|
||||||
|
+
|
||||||
|
+ 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.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+ .globl _start
|
||||||
|
+_start:
|
||||||
|
+ hlt
|
||||||
|
--- /dev/null 2009-04-19 14:49:00.974648389 +0200
|
||||||
|
+++ gdb-6.8/gdb/testsuite/gdb.arch/i386-biarch-core.core.bz2.uu 2009-04-19 15:02:12.000000000 +0200
|
||||||
|
@@ -0,0 +1,13 @@
|
||||||
|
+begin 600 i386-biarch-core.core.bz2
|
||||||
|
+M0EIH.3%!629361`P1\P`!)?_____\9'@"8Q)6P380'9@'&#`0D@``"``%(``
|
||||||
|
+M@`#`"!<(L`%F"(:$GH13::F-)M&D&U,AD:`--#)M0&FT0XR9--,)D9`P(Q-&
|
||||||
|
+M",(-&F``02)%38HT]0T`&AH```'H@``T^>9T*(,("&)SE`>`9@+GP=[,N)KB
|
||||||
|
+M'I8BL(L]N5TCY\%V]/?DB.BN*UZ'U@]TN7-]UJ5\_%0QTT<*086#%MHT7XVJ
|
||||||
|
+M9D"+C!"2*L:8D1XPD!`--M@*XT1H5RFYN&)(!0P0#:`I:;2;$5M&\*9"0@%:
|
||||||
|
+MK@X[T()M)9N7`D$VA!^63)%,;@8LT`(7\K&[7G;U:"B6'!GG+46ALOZF.2F-
|
||||||
|
+M!@>C*%86X$-]C2`KE;HG)UL(913VR2G]0BD:J=Z_`G@S,`W%.8RMS-#5P:J0
|
||||||
|
+MAJ2\8&X?@DE;UF68QHM<,D`('::J65/S:PAG*R-09["8DBI)'V]Y.[(/AM*L
|
||||||
|
+M"X_O^V;%FY.S6Q]FM=D37>5F,%4-F1ZF#,CFJVU;H*^IT<(%<V`.32$`JU["
|
||||||
|
+/G`68?\7<D4X4)`0,$?,`
|
||||||
|
+`
|
||||||
|
+end
|
747
gdb-6.8.50.20090302-upstream.patch
Normal file
747
gdb-6.8.50.20090302-upstream.patch
Normal file
@ -0,0 +1,747 @@
|
|||||||
|
http://sourceware.org/ml/gdb-cvs/2009-06/msg00076.html
|
||||||
|
|
||||||
|
gdb/
|
||||||
|
2009-06-15 Phil Muldoon <pmuldoon@redhat.com>
|
||||||
|
|
||||||
|
* infcall.c (show_unwind_on_terminating_exception_p): New
|
||||||
|
function.
|
||||||
|
(call_function_by_hand): Create breakpoint and clean-up call for
|
||||||
|
std::terminate.breakpoint. Add unwind_on_terminating_exception_p
|
||||||
|
gate. Pop frame on breakpoint hit.
|
||||||
|
(_initialize_infcall): Add add_setshow_boolean_cmd for
|
||||||
|
unwind-on-terminating-exception.
|
||||||
|
|
||||||
|
gdb/doc/
|
||||||
|
2009-06-15 Phil Muldoon <pmuldoon@redhat.com>
|
||||||
|
|
||||||
|
* doc/gdb.texinfo (Calling): Document
|
||||||
|
set-unwind-on-terminating-exception usage.
|
||||||
|
|
||||||
|
gdb/testsuite/
|
||||||
|
2009-06-15 Phil Muldoon <pmuldoon@redhat.com>
|
||||||
|
|
||||||
|
* gdb.cp/gdb2495.cc: New file.
|
||||||
|
* gdb.cp/gdb2495.exp: New file.
|
||||||
|
|
||||||
|
--- src/gdb/infcall.c 2009/05/28 00:53:51 1.114
|
||||||
|
+++ src/gdb/infcall.c 2009/06/15 12:11:36 1.115
|
||||||
|
@@ -98,6 +98,30 @@
|
||||||
|
value);
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* This boolean tells what gdb should do if a std::terminate call is
|
||||||
|
+ made while in a function called from gdb (call dummy).
|
||||||
|
+ As the confines of a single dummy stack prohibit out-of-frame
|
||||||
|
+ handlers from handling a raised exception, and as out-of-frame
|
||||||
|
+ handlers are common in C++, this can lead to no handler being found
|
||||||
|
+ by the unwinder, and a std::terminate call. This is a false positive.
|
||||||
|
+ If set, gdb unwinds the stack and restores the context to what it
|
||||||
|
+ was before the call.
|
||||||
|
+
|
||||||
|
+ The default is to unwind the frame if a std::terminate call is
|
||||||
|
+ made. */
|
||||||
|
+
|
||||||
|
+static int unwind_on_terminating_exception_p = 1;
|
||||||
|
+
|
||||||
|
+static void
|
||||||
|
+show_unwind_on_terminating_exception_p (struct ui_file *file, int from_tty,
|
||||||
|
+ struct cmd_list_element *c,
|
||||||
|
+ const char *value)
|
||||||
|
+
|
||||||
|
+{
|
||||||
|
+ fprintf_filtered (file, _("\
|
||||||
|
+Unwind stack if a C++ exception is unhandled while in a call dummy is %s.\n"),
|
||||||
|
+ value);
|
||||||
|
+}
|
||||||
|
|
||||||
|
/* Perform the standard coercions that are specified
|
||||||
|
for arguments to be passed to C or Ada functions.
|
||||||
|
@@ -416,6 +440,8 @@
|
||||||
|
struct cleanup *args_cleanup;
|
||||||
|
struct frame_info *frame;
|
||||||
|
struct gdbarch *gdbarch;
|
||||||
|
+ struct breakpoint *terminate_bp = NULL;
|
||||||
|
+ struct minimal_symbol *tm;
|
||||||
|
ptid_t call_thread_ptid;
|
||||||
|
struct gdb_exception e;
|
||||||
|
const char *name;
|
||||||
|
@@ -716,6 +742,27 @@
|
||||||
|
bpt->disposition = disp_del;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ /* Create a breakpoint in std::terminate.
|
||||||
|
+ If a C++ exception is raised in the dummy-frame, and the
|
||||||
|
+ exception handler is (normally, and expected to be) out-of-frame,
|
||||||
|
+ the default C++ handler will (wrongly) be called in an inferior
|
||||||
|
+ function call. This is wrong, as an exception can be normally
|
||||||
|
+ and legally handled out-of-frame. The confines of the dummy frame
|
||||||
|
+ prevent the unwinder from finding the correct handler (or any
|
||||||
|
+ handler, unless it is in-frame). The default handler calls
|
||||||
|
+ std::terminate. This will kill the inferior. Assert that
|
||||||
|
+ terminate should never be called in an inferior function
|
||||||
|
+ call. Place a momentary breakpoint in the std::terminate function
|
||||||
|
+ and if triggered in the call, rewind. */
|
||||||
|
+ if (unwind_on_terminating_exception_p)
|
||||||
|
+ {
|
||||||
|
+ struct minimal_symbol *tm = lookup_minimal_symbol ("std::terminate()",
|
||||||
|
+ NULL, NULL);
|
||||||
|
+ if (tm != NULL)
|
||||||
|
+ terminate_bp = set_momentary_breakpoint_at_pc
|
||||||
|
+ (SYMBOL_VALUE_ADDRESS (tm), bp_breakpoint);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
/* Everything's ready, push all the info needed to restore the
|
||||||
|
caller (and identify the dummy-frame) onto the dummy-frame
|
||||||
|
stack. */
|
||||||
|
@@ -726,6 +773,10 @@
|
||||||
|
or discard it. */
|
||||||
|
discard_cleanups (inf_status_cleanup);
|
||||||
|
|
||||||
|
+ /* Register a clean-up for unwind_on_terminating_exception_breakpoint. */
|
||||||
|
+ if (terminate_bp)
|
||||||
|
+ make_cleanup_delete_breakpoint (terminate_bp);
|
||||||
|
+
|
||||||
|
/* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP -
|
||||||
|
If you're looking to implement asynchronous dummy-frames, then
|
||||||
|
just below is the place to chop this function in two.. */
|
||||||
|
@@ -881,6 +932,38 @@
|
||||||
|
|
||||||
|
if (!stop_stack_dummy)
|
||||||
|
{
|
||||||
|
+
|
||||||
|
+ /* Check if unwind on terminating exception behaviour is on. */
|
||||||
|
+ if (unwind_on_terminating_exception_p)
|
||||||
|
+ {
|
||||||
|
+ /* Check that the breakpoint is our special std::terminate
|
||||||
|
+ breakpoint. If it is, we do not want to kill the inferior
|
||||||
|
+ in an inferior function call. Rewind, and warn the
|
||||||
|
+ user. */
|
||||||
|
+
|
||||||
|
+ if (terminate_bp != NULL
|
||||||
|
+ && (inferior_thread()->stop_bpstat->breakpoint_at->address
|
||||||
|
+ == terminate_bp->loc->address))
|
||||||
|
+ {
|
||||||
|
+ /* We must get back to the frame we were before the
|
||||||
|
+ dummy call. */
|
||||||
|
+ dummy_frame_pop (dummy_id);
|
||||||
|
+
|
||||||
|
+ /* We also need to restore inferior status to that before the
|
||||||
|
+ dummy call. */
|
||||||
|
+ restore_inferior_status (inf_status);
|
||||||
|
+
|
||||||
|
+ error (_("\
|
||||||
|
+The program being debugged entered a std::terminate call, most likely\n\
|
||||||
|
+caused by an unhandled C++ exception. GDB blocked this call in order\n\
|
||||||
|
+to prevent the program from being terminated, and has restored the\n\
|
||||||
|
+context to its original state before the call.\n\
|
||||||
|
+To change this behaviour use \"set unwind-on-terminating-exception off\".\n\
|
||||||
|
+Evaluation of the expression containing the function (%s)\n\
|
||||||
|
+will be abandoned."),
|
||||||
|
+ name);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
/* We hit a breakpoint inside the FUNCTION.
|
||||||
|
Keep the dummy frame, the user may want to examine its state.
|
||||||
|
Discard inferior status, we're not at the same point
|
||||||
|
@@ -989,4 +1072,19 @@
|
||||||
|
NULL,
|
||||||
|
show_unwind_on_signal_p,
|
||||||
|
&setlist, &showlist);
|
||||||
|
+
|
||||||
|
+ add_setshow_boolean_cmd ("unwind-on-terminating-exception", no_class,
|
||||||
|
+ &unwind_on_terminating_exception_p, _("\
|
||||||
|
+Set unwinding of stack if std::terminate is called while in call dummy."), _("\
|
||||||
|
+Show unwinding of stack if std::terminate() is called while in a call dummy."), _("\
|
||||||
|
+The unwind on terminating exception flag lets the user determine\n\
|
||||||
|
+what gdb should do if a std::terminate() call is made from the\n\
|
||||||
|
+default exception handler. If set, gdb unwinds the stack and restores\n\
|
||||||
|
+the context to what it was before the call. If unset, gdb allows the\n\
|
||||||
|
+std::terminate call to proceed.\n\
|
||||||
|
+The default is to unwind the frame."),
|
||||||
|
+ NULL,
|
||||||
|
+ show_unwind_on_terminating_exception_p,
|
||||||
|
+ &setlist, &showlist);
|
||||||
|
+
|
||||||
|
}
|
||||||
|
--- src/gdb/doc/gdb.texinfo 2009/06/11 11:57:46 1.599
|
||||||
|
+++ src/gdb/doc/gdb.texinfo 2009/06/15 12:11:36 1.600
|
||||||
|
@@ -12895,6 +12895,16 @@
|
||||||
|
the function, or if you passed it incorrect arguments). What happens
|
||||||
|
in that case is controlled by the @code{set unwindonsignal} command.
|
||||||
|
|
||||||
|
+Similarly, with a C@t{++} program it is possible for the function you
|
||||||
|
+call via the @code{print} or @code{call} command to generate an
|
||||||
|
+exception that is not handled due to the constraints of the dummy
|
||||||
|
+frame. In this case, any exception that is raised in the frame, but has
|
||||||
|
+an out-of-frame exception handler will not be found. GDB builds a
|
||||||
|
+dummy-frame for the inferior function call, and the unwinder cannot
|
||||||
|
+seek for exception handlers outside of this dummy-frame. What happens
|
||||||
|
+in that case is controlled by the
|
||||||
|
+@code{set unwind-on-terminating-exception} command.
|
||||||
|
+
|
||||||
|
@table @code
|
||||||
|
@item set unwindonsignal
|
||||||
|
@kindex set unwindonsignal
|
||||||
|
@@ -12911,6 +12921,23 @@
|
||||||
|
@kindex show unwindonsignal
|
||||||
|
Show the current setting of stack unwinding in the functions called by
|
||||||
|
@value{GDBN}.
|
||||||
|
+
|
||||||
|
+@item set unwind-on-terminating-exception
|
||||||
|
+@kindex set unwind-on-terminating-exception
|
||||||
|
+@cindex unwind stack in called functions with unhandled exceptions
|
||||||
|
+@cindex call dummy stack unwinding on unhandled exception.
|
||||||
|
+Set unwinding of the stack if a C@t{++} exception is raised, but left
|
||||||
|
+unhandled while in a function that @value{GDBN} called in the program being
|
||||||
|
+debugged. If set to on (the default), @value{GDBN} unwinds the stack
|
||||||
|
+it created for the call and restores the context to what it was before
|
||||||
|
+the call. If set to off, @value{GDBN} the exception is delivered to
|
||||||
|
+the default C@t{++} exception handler and the inferior terminated.
|
||||||
|
+
|
||||||
|
+@item show unwind-on-terminating-exception
|
||||||
|
+@kindex show unwind-on-terminating-exception
|
||||||
|
+Show the current setting of stack unwinding in the functions called by
|
||||||
|
+@value{GDBN}.
|
||||||
|
+
|
||||||
|
@end table
|
||||||
|
|
||||||
|
@cindex weak alias functions
|
||||||
|
--- src/gdb/testsuite/gdb.cp/gdb2495.cc
|
||||||
|
+++ src/gdb/testsuite/gdb.cp/gdb2495.cc 2009-06-16 12:49:45.874202000 +0000
|
||||||
|
@@ -0,0 +1,89 @@
|
||||||
|
+/* This testcase is part of GDB, the GNU debugger.
|
||||||
|
+
|
||||||
|
+ Copyright 2009 Free Software Foundation, Inc.
|
||||||
|
+
|
||||||
|
+ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <iostream>
|
||||||
|
+#include <signal.h>
|
||||||
|
+
|
||||||
|
+using namespace std;
|
||||||
|
+
|
||||||
|
+class SimpleException
|
||||||
|
+{
|
||||||
|
+
|
||||||
|
+public:
|
||||||
|
+
|
||||||
|
+ void raise_signal (int dummy)
|
||||||
|
+ {
|
||||||
|
+ if (dummy > 0)
|
||||||
|
+ raise(SIGABRT);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ int no_throw_function ()
|
||||||
|
+ {
|
||||||
|
+ return 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void throw_function ()
|
||||||
|
+ {
|
||||||
|
+ throw 1;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ int throw_function_with_handler ()
|
||||||
|
+ {
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ throw 1;
|
||||||
|
+ }
|
||||||
|
+ catch (...)
|
||||||
|
+ {
|
||||||
|
+ cout << "Handled" << endl;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ return 2;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void call_throw_function_no_handler ()
|
||||||
|
+ {
|
||||||
|
+ throw_function ();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ void call_throw_function_handler ()
|
||||||
|
+ {
|
||||||
|
+ throw_function_with_handler ();
|
||||||
|
+ }
|
||||||
|
+};
|
||||||
|
+SimpleException exceptions;
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+main()
|
||||||
|
+{
|
||||||
|
+ /* Have to call these functions so GCC does not optimize them
|
||||||
|
+ away. */
|
||||||
|
+ exceptions.raise_signal (-1);
|
||||||
|
+ exceptions.no_throw_function ();
|
||||||
|
+ exceptions.throw_function_with_handler ();
|
||||||
|
+ exceptions.call_throw_function_handler ();
|
||||||
|
+ try
|
||||||
|
+ {
|
||||||
|
+ exceptions.throw_function ();
|
||||||
|
+ exceptions.call_throw_function_no_handler ();
|
||||||
|
+ }
|
||||||
|
+ catch (...)
|
||||||
|
+ {
|
||||||
|
+ }
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
--- src/gdb/testsuite/gdb.cp/gdb2495.exp
|
||||||
|
+++ src/gdb/testsuite/gdb.cp/gdb2495.exp 2009-06-16 12:49:46.889492000 +0000
|
||||||
|
@@ -0,0 +1,157 @@
|
||||||
|
+# Copyright 2009 Free Software Foundation, Inc.
|
||||||
|
+
|
||||||
|
+# 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+# In gdb inferior function calls, if a C++ exception is raised in the
|
||||||
|
+# dummy-frame, and the exception handler is (normally, and expected to
|
||||||
|
+# be) out-of-frame, the default C++ handler will (wrongly) be called
|
||||||
|
+# in an inferior function call.
|
||||||
|
+# This is incorrect as an exception can normally and legally be handled
|
||||||
|
+# out-of-frame. The confines of the dummy frame prevent the unwinder
|
||||||
|
+# from finding the correct handler (or any handler, unless it is
|
||||||
|
+# in-frame). The default handler calls std::terminate. This will kill
|
||||||
|
+# the inferior. Assert that terminate should never be called in an
|
||||||
|
+# inferior function call. These tests test the functionality around
|
||||||
|
+# unwinding that sequence and also tests the flag behaviour gating this
|
||||||
|
+# functionality.
|
||||||
|
+
|
||||||
|
+# This test is largely based of gdb.base/callfuncs.exp.
|
||||||
|
+
|
||||||
|
+if $tracelevel then {
|
||||||
|
+ strace $tracelevel
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+if { [skip_cplus_tests] } { continue }
|
||||||
|
+
|
||||||
|
+set prms_id 2495
|
||||||
|
+set bug_id 0
|
||||||
|
+
|
||||||
|
+set testfile "gdb2495"
|
||||||
|
+set srcfile ${testfile}.cc
|
||||||
|
+set binfile $objdir/$subdir/$testfile
|
||||||
|
+
|
||||||
|
+# Create and source the file that provides information about the compiler
|
||||||
|
+# used to compile the test case.
|
||||||
|
+if [get_compiler_info ${binfile} "c++"] {
|
||||||
|
+ return -1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug c++}] != "" } {
|
||||||
|
+ untested gdb2495.exp
|
||||||
|
+ return -1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# Some targets can't do function calls, so don't even bother with this
|
||||||
|
+# test.
|
||||||
|
+if [target_info exists gdb,cannot_call_functions] {
|
||||||
|
+ setup_xfail "*-*-*" 2416
|
||||||
|
+ fail "This target can not call functions"
|
||||||
|
+ continue
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+gdb_exit
|
||||||
|
+gdb_start
|
||||||
|
+gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
+gdb_load ${binfile}
|
||||||
|
+
|
||||||
|
+if ![runto_main] then {
|
||||||
|
+ perror "couldn't run to main"
|
||||||
|
+ continue
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# See http://sourceware.org/gdb/bugs/2495
|
||||||
|
+
|
||||||
|
+# Test normal baseline behaviour. Call a function that
|
||||||
|
+# does not raise an exception.
|
||||||
|
+gdb_test "p exceptions.no_throw_function()" " = 1"
|
||||||
|
+# And one that does but handles it in-frame.
|
||||||
|
+gdb_test "p exceptions.throw_function_with_handler()" " = 2"
|
||||||
|
+# Both should return normally.
|
||||||
|
+
|
||||||
|
+# Test basic unwind. Call a function that raises an exception but
|
||||||
|
+# does not handle it. It should be rewound.
|
||||||
|
+gdb_test "p exceptions.throw_function()" \
|
||||||
|
+ "The program being debugged entered a std::terminate call, .*" \
|
||||||
|
+ "Call a function that raises an exception without a handler."
|
||||||
|
+
|
||||||
|
+# Make sure that after rewinding we are back at the call parent.
|
||||||
|
+gdb_test "bt" \
|
||||||
|
+ "#0 main.*" \
|
||||||
|
+ "bt after returning from a popped frame"
|
||||||
|
+
|
||||||
|
+# Make sure the only breakpoint is the one set via the runto_main
|
||||||
|
+# call and that the std::terminate breakpoint has evaporated and
|
||||||
|
+# cleaned-up.
|
||||||
|
+gdb_test "info breakpoints" \
|
||||||
|
+ "gdb.cp/gdb2495\.cc.*"
|
||||||
|
+
|
||||||
|
+# Turn off this new behaviour.
|
||||||
|
+gdb_test_multiple "set unwind-on-terminating-exception off" \
|
||||||
|
+ "Turn unwind-on-terminating-exception off" {
|
||||||
|
+ -re "$gdb_prompt $" {pass "set unwinn-on-terminating-exception off"}
|
||||||
|
+ timeout {fail "(timeout) set unwind-on-terminating-exception off"}
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# Check that it is turned off.
|
||||||
|
+gdb_test "show unwind-on-terminating-exception" \
|
||||||
|
+ "exception is unhandled while in a call dummy is off.*" \
|
||||||
|
+ "Turn off unwind on terminating exception flag"
|
||||||
|
+
|
||||||
|
+# Check that the old behaviour is restored.
|
||||||
|
+gdb_test "p exceptions.throw_function()" \
|
||||||
|
+ "The program being debugged was signaled while in a function called .*" \
|
||||||
|
+ "Call a function that raises an exception with unwinding off.."
|
||||||
|
+
|
||||||
|
+# Restart the inferior back at main.
|
||||||
|
+if ![runto_main] then {
|
||||||
|
+ perror "couldn't run to main"
|
||||||
|
+ continue
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+# Check to see if the new behaviour alters the unwind signal
|
||||||
|
+# behaviour; it should not. Test both on and off states.
|
||||||
|
+
|
||||||
|
+# Turn on unwind on signal behaviour.
|
||||||
|
+gdb_test_multiple "set unwindonsignal on" "Turn unwindonsignal on" {
|
||||||
|
+ -re "$gdb_prompt $" {pass "set unwindonsignal on"}
|
||||||
|
+ timeout {fail "(timeout) set unwindonsignal on"}
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# Check that it is turned on.
|
||||||
|
+gdb_test "show unwindonsignal" \
|
||||||
|
+ "signal is received while in a call dummy is on.*" \
|
||||||
|
+ "Turn on unwind on signal"
|
||||||
|
+
|
||||||
|
+# Check to see if new behaviour interferes with
|
||||||
|
+# normal signal handling in inferior function calls.
|
||||||
|
+gdb_test "p exceptions.raise_signal(1)" \
|
||||||
|
+ "To change this behavior use \"set unwindonsignal off\".*"
|
||||||
|
+
|
||||||
|
+# And reverse - turn off again.
|
||||||
|
+gdb_test_multiple "set unwindonsignal off" "Turn unwindonsignal off" {
|
||||||
|
+ -re "$gdb_prompt $" {pass "set unwindonsignal off"}
|
||||||
|
+ timeout {fail "(timeout) set unwindonsignal off"}
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+# Check that it is actually turned off.
|
||||||
|
+gdb_test "show unwindonsignal" \
|
||||||
|
+ "signal is received while in a call dummy is off.*" \
|
||||||
|
+ "Turn off unwind on signal"
|
||||||
|
+
|
||||||
|
+# Check to see if new behaviour interferes with
|
||||||
|
+# normal signal handling in inferior function calls.
|
||||||
|
+gdb_test "p exceptions.raise_signal(1)" \
|
||||||
|
+ "To change this behavior use \"set unwindonsignal on\".*"
|
||||||
|
--- src/gdb/testsuite/gdb.cp/Makefile.in 2009/02/03 01:09:01 1.5
|
||||||
|
+++ src/gdb/testsuite/gdb.cp/Makefile.in 2009/06/15 12:11:37 1.6
|
||||||
|
@@ -4,7 +4,7 @@
|
||||||
|
EXECUTABLES = ambiguous annota2 anon-union cplusfuncs cttiadd \
|
||||||
|
derivation inherit local member-ptr method misc \
|
||||||
|
overload ovldbreak ref-typ ref-typ2 templates userdef virtfunc namespace \
|
||||||
|
- ref-types ref-params method2 pr9594
|
||||||
|
+ ref-types ref-params method2 pr9594 gdb2495
|
||||||
|
|
||||||
|
all info install-info dvi install uninstall installcheck check:
|
||||||
|
@echo "Nothing to be done for $@..."
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
https://bugzilla.redhat.com/show_bug.cgi?id=471819
|
||||||
|
|
||||||
|
http://sourceware.org/ml/gdb-patches/2009-06/msg00837.html
|
||||||
|
http://sourceware.org/ml/gdb-cvs/2009-06/msg00194.html
|
||||||
|
|
||||||
|
gdb/
|
||||||
|
2009-06-29 Pedro Alves <pedro@codesourcery.com>
|
||||||
|
|
||||||
|
* infrun.c (handle_inferior_event): Context switch to the new
|
||||||
|
thread when resuming for a new_thread_event.
|
||||||
|
|
||||||
|
http://sourceware.org/ml/gdb-patches/2009-06/msg00841.html
|
||||||
|
http://sourceware.org/ml/gdb-cvs/2009-06/msg00195.html
|
||||||
|
|
||||||
|
gdb/testsuite/
|
||||||
|
2009-06-29 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
* gdb.threads/current-lwp-dead.exp, gdb.threads/current-lwp-dead.c: New.
|
||||||
|
|
||||||
|
--- src/gdb/infrun.c 2009/06/28 00:20:22 1.396
|
||||||
|
+++ src/gdb/infrun.c 2009/06/29 18:27:23 1.397
|
||||||
|
@@ -2746,6 +2746,8 @@
|
||||||
|
in either the OS or the native code). Therefore we need to
|
||||||
|
continue all threads in order to make progress. */
|
||||||
|
|
||||||
|
+ if (!ptid_equal (ecs->ptid, inferior_ptid))
|
||||||
|
+ context_switch (ecs->ptid);
|
||||||
|
target_resume (RESUME_ALL, 0, TARGET_SIGNAL_0);
|
||||||
|
prepare_to_wait (ecs);
|
||||||
|
return;
|
||||||
|
--- src/gdb/testsuite/gdb.threads/current-lwp-dead.c
|
||||||
|
+++ src/gdb/testsuite/gdb.threads/current-lwp-dead.c 2009-06-29 18:59:59.860807000 +0000
|
||||||
|
@@ -0,0 +1,75 @@
|
||||||
|
+/* This testcase is part of GDB, the GNU debugger.
|
||||||
|
+
|
||||||
|
+ Copyright 2009 Free Software Foundation, Inc.
|
||||||
|
+
|
||||||
|
+ 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
+
|
||||||
|
+ Do not use threads as we need to exploit a bug in LWP code masked by the
|
||||||
|
+ threads code otherwise.
|
||||||
|
+
|
||||||
|
+ INFERIOR_PTID must point to exited LWP. Here we use the initial LWP as it
|
||||||
|
+ is automatically INFERIOR_PTID for GDB.
|
||||||
|
+
|
||||||
|
+ Finally we need to call target_resume (RESUME_ALL, ...) which we invoke by
|
||||||
|
+ NEW_THREAD_EVENT (called from the new LWP as initial LWP is exited now). */
|
||||||
|
+
|
||||||
|
+#define _GNU_SOURCE
|
||||||
|
+#include <sched.h>
|
||||||
|
+#include <assert.h>
|
||||||
|
+#include <unistd.h>
|
||||||
|
+#include <stdlib.h>
|
||||||
|
+
|
||||||
|
+#define STACK_SIZE 0x1000
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+fn_return (void *unused)
|
||||||
|
+{
|
||||||
|
+ return 0; /* at-fn_return */
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+fn (void *unused)
|
||||||
|
+{
|
||||||
|
+ int i;
|
||||||
|
+ unsigned char *stack;
|
||||||
|
+ int new_pid;
|
||||||
|
+
|
||||||
|
+ i = sleep (1);
|
||||||
|
+ assert (i == 0);
|
||||||
|
+
|
||||||
|
+ stack = malloc (STACK_SIZE);
|
||||||
|
+ assert (stack != NULL);
|
||||||
|
+
|
||||||
|
+ new_pid = clone (fn_return, stack + STACK_SIZE, CLONE_FILES | CLONE_VM, NULL,
|
||||||
|
+ NULL, NULL, NULL);
|
||||||
|
+ assert (new_pid > 0);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+main (int argc, char **argv)
|
||||||
|
+{
|
||||||
|
+ unsigned char *stack;
|
||||||
|
+ int new_pid;
|
||||||
|
+
|
||||||
|
+ stack = malloc (STACK_SIZE);
|
||||||
|
+ assert (stack != NULL);
|
||||||
|
+
|
||||||
|
+ new_pid = clone (fn, stack + STACK_SIZE, CLONE_FILES | CLONE_VM, NULL, NULL,
|
||||||
|
+ NULL, NULL);
|
||||||
|
+ assert (new_pid > 0);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
--- src/gdb/testsuite/gdb.threads/current-lwp-dead.exp
|
||||||
|
+++ src/gdb/testsuite/gdb.threads/current-lwp-dead.exp 2009-06-29 19:00:01.014652000 +0000
|
||||||
|
@@ -0,0 +1,31 @@
|
||||||
|
+# This testcase is part of GDB, the GNU debugger.
|
||||||
|
+
|
||||||
|
+# Copyright 2009 Free Software Foundation, Inc.
|
||||||
|
+
|
||||||
|
+# 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||||
|
+
|
||||||
|
+# Please email any bugs, comments, and/or additions to this file to:
|
||||||
|
+# bug-gdb@gnu.org
|
||||||
|
+
|
||||||
|
+if { [prepare_for_testing current-lwp-dead.exp current-lwp-dead] } {
|
||||||
|
+ return -1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+if {[runto_main] <= 0} {
|
||||||
|
+ untested current-lwp-dead.exp
|
||||||
|
+ return -1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+gdb_breakpoint "fn_return"
|
||||||
|
+gdb_continue_to_breakpoint "fn_return" ".*at-fn_return.*"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
[patch] testsuite: Fix multiple runs in parallel on a single host
|
||||||
|
|
||||||
|
http://sourceware.org/ml/gdb-patches/2009-07/msg00008.html
|
||||||
|
http://sourceware.org/ml/gdb-cvs/2009-07/msg00051.html
|
||||||
|
|
||||||
|
2009-07-06 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
* lib/gdbserver-support.exp (gdbserver_start): Loop spawning
|
||||||
|
gdbserver increasing $portnum if "Can't bind address" has been seen.
|
||||||
|
|
||||||
|
--- src/gdb/testsuite/lib/gdbserver-support.exp 2009/01/03 05:58:08 1.14
|
||||||
|
+++ src/gdb/testsuite/lib/gdbserver-support.exp 2009/07/06 18:51:10 1.15
|
||||||
|
@@ -209,26 +209,39 @@
|
||||||
|
|
||||||
|
set gdbserver [find_gdbserver]
|
||||||
|
|
||||||
|
- # Export the host:port pair.
|
||||||
|
- set gdbport $debughost$portnum
|
||||||
|
-
|
||||||
|
- # Fire off the debug agent.
|
||||||
|
- set gdbserver_command "$gdbserver"
|
||||||
|
- if { $options != "" } {
|
||||||
|
- append gdbserver_command " $options"
|
||||||
|
- }
|
||||||
|
- append gdbserver_command " :$portnum"
|
||||||
|
- if { $arguments != "" } {
|
||||||
|
- append gdbserver_command " $arguments"
|
||||||
|
- }
|
||||||
|
+ # Loop till we find a free port.
|
||||||
|
+ while 1 {
|
||||||
|
+ # Export the host:port pair.
|
||||||
|
+ set gdbport $debughost$portnum
|
||||||
|
+
|
||||||
|
+ # Fire off the debug agent.
|
||||||
|
+ set gdbserver_command "$gdbserver"
|
||||||
|
+ if { $options != "" } {
|
||||||
|
+ append gdbserver_command " $options"
|
||||||
|
+ }
|
||||||
|
+ append gdbserver_command " :$portnum"
|
||||||
|
+ if { $arguments != "" } {
|
||||||
|
+ append gdbserver_command " $arguments"
|
||||||
|
+ }
|
||||||
|
|
||||||
|
- set server_spawn_id [remote_spawn target $gdbserver_command]
|
||||||
|
+ set server_spawn_id [remote_spawn target $gdbserver_command]
|
||||||
|
|
||||||
|
- # Wait for the server to open its TCP socket, so that GDB can connect.
|
||||||
|
- expect {
|
||||||
|
- -i $server_spawn_id
|
||||||
|
- -notransfer
|
||||||
|
- -re "Listening on" { }
|
||||||
|
+ # Wait for the server to open its TCP socket, so that GDB can connect.
|
||||||
|
+ expect {
|
||||||
|
+ -i $server_spawn_id
|
||||||
|
+ -notransfer
|
||||||
|
+ -re "Listening on" { }
|
||||||
|
+ -re "Can't bind address: Address already in use\\.\r\n" {
|
||||||
|
+ verbose -log "Port $portnum is already in use."
|
||||||
|
+ if ![target_info exists gdb,socketport] {
|
||||||
|
+ # Bump the port number to avoid the conflict.
|
||||||
|
+ wait -i $expect_out(spawn_id)
|
||||||
|
+ incr portnum
|
||||||
|
+ continue
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ break
|
||||||
|
}
|
||||||
|
|
||||||
|
# We can't just call close, because if gdbserver is local then that means
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
http://sourceware.org/ml/gdb-cvs/2009-06/msg00203.html
|
||||||
|
|
||||||
|
2009-06-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
Remove racy FAILs relying just on the timeouts.
|
||||||
|
* gdb.base/setshow.exp (set annotate 2, show annotate (2))
|
||||||
|
(annotation_level 2): Remove racy FAILs.
|
||||||
|
|
||||||
|
--- src/gdb/testsuite/gdb.base/setshow.exp 2009/01/03 05:58:03 1.10
|
||||||
|
+++ src/gdb/testsuite/gdb.base/setshow.exp 2009/06/30 18:28:12 1.11
|
||||||
|
@@ -60,7 +60,6 @@
|
||||||
|
gdb_expect {
|
||||||
|
-re ".*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \
|
||||||
|
{ pass "set annotate 2" }
|
||||||
|
- -re ".*$gdb_prompt $" { fail "set annotate 2" }
|
||||||
|
timeout { fail "(timeout) set annotate 2" }
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -68,7 +67,6 @@
|
||||||
|
gdb_expect {
|
||||||
|
-re ".*\032\032post-prompt.*Annotation_level is 2..*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \
|
||||||
|
{ pass "show annotate (2)" }
|
||||||
|
- -re ".*$gdb_prompt $" { fail "show annotate (2)" }
|
||||||
|
timeout { fail "(timeout) show annotate (2)" }
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -77,7 +75,6 @@
|
||||||
|
gdb_expect {
|
||||||
|
-re ".*\032\032post-prompt.*Line 1 of .* is at address .* but contains no code.*:1:0:beg:0x.*\032\032pre-prompt.*$gdb_prompt .*\032\032prompt.*$" \
|
||||||
|
{ pass "annotation_level 2" }
|
||||||
|
- -re ".*$gdb_prompt $" { fail "annotation_level 2" }
|
||||||
|
timeout { fail "(timeout) annotation_level 2" }
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
http://sourceware.org/ml/gdb-cvs/2009-06/msg00204.html
|
||||||
|
|
||||||
|
2009-06-30 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
* lib/mi-support.exp (mi_check_thread_states): Permit any output before
|
||||||
|
the expected result record.
|
||||||
|
|
||||||
|
--- src/gdb/testsuite/lib/mi-support.exp 2009/05/28 01:09:20 1.84
|
||||||
|
+++ src/gdb/testsuite/lib/mi-support.exp 2009/06/30 20:23:05 1.85
|
||||||
|
@@ -1808,7 +1808,7 @@
|
||||||
|
proc mi_check_thread_states { xstates test } {
|
||||||
|
global expect_out
|
||||||
|
set states [mi_reverse_list $xstates]
|
||||||
|
- set pattern "\\^done,threads=\\\["
|
||||||
|
+ set pattern ".*\\^done,threads=\\\["
|
||||||
|
foreach s $states {
|
||||||
|
set pattern "${pattern}(.*)state=\"$s\""
|
||||||
|
}
|
167
gdb-DW_OP_call_frame_cfa.patch
Normal file
167
gdb-DW_OP_call_frame_cfa.patch
Normal file
@ -0,0 +1,167 @@
|
|||||||
|
http://sourceware.org/ml/gdb-patches/2009-06/msg00191.html
|
||||||
|
|
||||||
|
GCC developers would like to change GCC to emit DW_OP_call_frame_cfa,
|
||||||
|
as this would reduce the size of the generated debuginfo.
|
||||||
|
|
||||||
|
A prerequisite to this is that GDB understand this. So, this patch
|
||||||
|
implements this feature. This is PR 10224.
|
||||||
|
|
||||||
|
I'm interested in feedback on this. I am not sure whether the
|
||||||
|
implementation of dwarf2_frame_cfa is ok.
|
||||||
|
|
||||||
|
No test case since at some point GCC will start generating this
|
||||||
|
(perhaps optionally -- but I feel certain we'll do it by default in
|
||||||
|
Fedora), and since it therefore seemed like a lot of work for little
|
||||||
|
payoff.
|
||||||
|
|
||||||
|
Tom
|
||||||
|
|
||||||
|
2009-06-08 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
PR gdb/10224:
|
||||||
|
* dwarf2loc.c: Include dwarf2-frame.h.
|
||||||
|
(dwarf_expr_frame_cfa): New function.
|
||||||
|
(dwarf2_evaluate_loc_desc): Initialize new field.
|
||||||
|
(needs_frame_frame_cfa): New function.
|
||||||
|
(dwarf2_loc_desc_needs_frame): Initialize new field.
|
||||||
|
* dwarf2expr.h (struct dwarf_expr_context) <get_frame_cfa>: New
|
||||||
|
field.
|
||||||
|
* dwarf2expr.c (execute_stack_op) <DW_OP_call_frame_cfa>: New
|
||||||
|
case.
|
||||||
|
* dwarf2-frame.h (dwarf2_frame_cfa): Declare.
|
||||||
|
* dwarf2-frame.c (no_get_frame_cfa): New function.
|
||||||
|
(execute_stack_op): Initialize new field.
|
||||||
|
(dwarf2_frame_cfa): New function.
|
||||||
|
|
||||||
|
[ Backported for Fedora Rawhide. ]
|
||||||
|
|
||||||
|
--- ./gdb/dwarf2-frame.c 2009-06-12 11:12:51.000000000 +0200
|
||||||
|
+++ ./gdb/dwarf2-frame.c 2009-06-12 11:13:30.000000000 +0200
|
||||||
|
@@ -306,6 +306,13 @@ no_get_frame_base (void *baton, gdb_byte
|
||||||
|
}
|
||||||
|
|
||||||
|
static CORE_ADDR
|
||||||
|
+no_get_frame_cfa (void *baton)
|
||||||
|
+{
|
||||||
|
+ internal_error (__FILE__, __LINE__,
|
||||||
|
+ _("Support for DW_OP_call_frame_cfa is unimplemented"));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static CORE_ADDR
|
||||||
|
no_get_tls_address (void *baton, CORE_ADDR offset)
|
||||||
|
{
|
||||||
|
internal_error (__FILE__, __LINE__,
|
||||||
|
@@ -356,6 +363,7 @@ execute_stack_op (gdb_byte *exp, ULONGES
|
||||||
|
ctx->read_reg = read_reg;
|
||||||
|
ctx->read_mem = read_mem;
|
||||||
|
ctx->get_frame_base = no_get_frame_base;
|
||||||
|
+ ctx->get_frame_cfa = no_get_frame_cfa;
|
||||||
|
ctx->get_tls_address = no_get_tls_address;
|
||||||
|
|
||||||
|
dwarf_expr_push (ctx, initial);
|
||||||
|
@@ -1221,6 +1229,13 @@ dwarf2_frame_base_address (struct frame_
|
||||||
|
return cache->cfa;
|
||||||
|
}
|
||||||
|
|
||||||
|
+CORE_ADDR
|
||||||
|
+dwarf2_frame_cfa (struct frame_info *this_frame)
|
||||||
|
+{
|
||||||
|
+ void *cache = NULL;
|
||||||
|
+ return dwarf2_frame_base_address (this_frame, &cache);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static const struct frame_base dwarf2_frame_base =
|
||||||
|
{
|
||||||
|
&dwarf2_frame_unwind,
|
||||||
|
--- ./gdb/dwarf2-frame.h 2009-01-03 06:57:51.000000000 +0100
|
||||||
|
+++ ./gdb/dwarf2-frame.h 2009-06-12 11:13:30.000000000 +0200
|
||||||
|
@@ -118,4 +118,8 @@ extern const struct frame_base *
|
||||||
|
|
||||||
|
void dwarf2_frame_build_info (struct objfile *objfile);
|
||||||
|
|
||||||
|
+/* Compute the DWARF CFA for a frame. */
|
||||||
|
+
|
||||||
|
+CORE_ADDR dwarf2_frame_cfa (struct frame_info *this_frame);
|
||||||
|
+
|
||||||
|
#endif /* dwarf2-frame.h */
|
||||||
|
--- ./gdb/dwarf2expr.c 2009-06-12 11:12:51.000000000 +0200
|
||||||
|
+++ ./gdb/dwarf2expr.c 2009-06-12 11:13:44.000000000 +0200
|
||||||
|
@@ -697,6 +697,10 @@ execute_stack_op (struct dwarf_expr_cont
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
+ case DW_OP_call_frame_cfa:
|
||||||
|
+ result = (ctx->get_frame_cfa) (ctx->baton);
|
||||||
|
+ break;
|
||||||
|
+
|
||||||
|
case DW_OP_GNU_push_tls_address:
|
||||||
|
/* Variable is at a constant offset in the thread-local
|
||||||
|
storage block into the objfile for the current thread and
|
||||||
|
--- ./gdb/dwarf2expr.h 2009-06-12 11:12:51.000000000 +0200
|
||||||
|
+++ ./gdb/dwarf2expr.h 2009-06-12 11:15:36.000000000 +0200
|
||||||
|
@@ -55,6 +55,9 @@ struct dwarf_expr_context
|
||||||
|
expression evaluation is complete. */
|
||||||
|
void (*get_frame_base) (void *baton, gdb_byte **start, size_t *length);
|
||||||
|
|
||||||
|
+ /* Return the CFA for the frame. */
|
||||||
|
+ CORE_ADDR (*get_frame_cfa) (void *baton);
|
||||||
|
+
|
||||||
|
/* Return the thread-local storage address for
|
||||||
|
DW_OP_GNU_push_tls_address. */
|
||||||
|
CORE_ADDR (*get_tls_address) (void *baton, CORE_ADDR offset);
|
||||||
|
--- ./gdb/dwarf2loc.c 2009-06-12 11:12:55.000000000 +0200
|
||||||
|
+++ ./gdb/dwarf2loc.c 2009-06-12 11:15:07.000000000 +0200
|
||||||
|
@@ -32,6 +32,7 @@
|
||||||
|
#include "objfiles.h"
|
||||||
|
#include "exceptions.h"
|
||||||
|
#include "block.h"
|
||||||
|
+#include "dwarf2-frame.h"
|
||||||
|
|
||||||
|
#include "elf/dwarf2.h"
|
||||||
|
#include "dwarf2expr.h"
|
||||||
|
@@ -200,6 +201,13 @@ dwarf_expr_frame_base (void *baton, gdb_
|
||||||
|
SYMBOL_PRINT_NAME (framefunc));
|
||||||
|
}
|
||||||
|
|
||||||
|
+static CORE_ADDR
|
||||||
|
+dwarf_expr_frame_cfa (void *baton)
|
||||||
|
+{
|
||||||
|
+ struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
|
||||||
|
+ return dwarf2_frame_cfa (debaton->frame);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Using the objfile specified in BATON, find the address for the
|
||||||
|
current thread's thread-local storage with offset OFFSET. */
|
||||||
|
static CORE_ADDR
|
||||||
|
@@ -286,6 +294,7 @@ dwarf_expr_prep_ctx (struct frame_info *
|
||||||
|
ctx->read_reg = dwarf_expr_read_reg;
|
||||||
|
ctx->read_mem = dwarf_expr_read_mem;
|
||||||
|
ctx->get_frame_base = dwarf_expr_frame_base;
|
||||||
|
+ ctx->get_frame_cfa = dwarf_expr_frame_cfa;
|
||||||
|
ctx->get_tls_address = dwarf_expr_tls_address;
|
||||||
|
ctx->get_object_address = dwarf_expr_object_address;
|
||||||
|
|
||||||
|
@@ -439,6 +448,15 @@ needs_frame_frame_base (void *baton, gdb
|
||||||
|
nf_baton->needs_frame = 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* CFA accesses require a frame. */
|
||||||
|
+static CORE_ADDR
|
||||||
|
+needs_frame_frame_cfa (void *baton)
|
||||||
|
+{
|
||||||
|
+ struct needs_frame_baton *nf_baton = baton;
|
||||||
|
+ nf_baton->needs_frame = 1;
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Thread-local accesses do require a frame. */
|
||||||
|
static CORE_ADDR
|
||||||
|
needs_frame_tls_address (void *baton, CORE_ADDR offset)
|
||||||
|
@@ -468,6 +486,7 @@ dwarf2_loc_desc_needs_frame (gdb_byte *d
|
||||||
|
ctx->read_reg = needs_frame_read_reg;
|
||||||
|
ctx->read_mem = needs_frame_read_mem;
|
||||||
|
ctx->get_frame_base = needs_frame_frame_base;
|
||||||
|
+ ctx->get_frame_cfa = needs_frame_frame_cfa;
|
||||||
|
ctx->get_tls_address = needs_frame_tls_address;
|
||||||
|
|
||||||
|
dwarf_expr_eval (ctx, data, size);
|
1065
gdb-archer.patch
1065
gdb-archer.patch
File diff suppressed because it is too large
Load Diff
76
gdb-bz507267-block-sort-fast.patch
Normal file
76
gdb-bz507267-block-sort-fast.patch
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
https://bugzilla.redhat.com/show_bug.cgi?id=507267
|
||||||
|
|
||||||
|
--- gdb-6.8.50.20090302/gdb/buildsym.c-orig 2009-06-22 15:20:39.000000000 +0200
|
||||||
|
+++ gdb-6.8.50.20090302/gdb/buildsym.c 2009-06-22 17:50:54.000000000 +0200
|
||||||
|
@@ -900,6 +900,19 @@ watch_main_source_file_lossage (void)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
+/* Helper function for qsort. Parametes are `struct block *' pointers,
|
||||||
|
+ function sorts them in descending order by their BLOCK_START. */
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+block_compar (const void *ap, const void *bp)
|
||||||
|
+{
|
||||||
|
+ const struct block *a = *(const struct block **) ap;
|
||||||
|
+ const struct block *b = *(const struct block **) bp;
|
||||||
|
+
|
||||||
|
+ return (BLOCK_START (b) > BLOCK_START (a))
|
||||||
|
+ - (BLOCK_START (b) < BLOCK_START (a));
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
/* Finish the symbol definitions for one main source file, close off
|
||||||
|
all the lexical contexts for that file (creating struct block's for
|
||||||
|
them), then make the struct symtab for that file and put it in the
|
||||||
|
@@ -953,32 +966,28 @@ end_symtab (CORE_ADDR end_addr, struct o
|
||||||
|
OBJF_REORDERED is true, then sort the pending blocks. */
|
||||||
|
if ((objfile->flags & OBJF_REORDERED) && pending_blocks)
|
||||||
|
{
|
||||||
|
- /* FIXME! Remove this horrid bubble sort and use merge sort!!! */
|
||||||
|
- int swapped;
|
||||||
|
- do
|
||||||
|
- {
|
||||||
|
- struct pending_block *pb, *pbnext;
|
||||||
|
+ unsigned count = 0;
|
||||||
|
+ struct pending_block *pb;
|
||||||
|
+ struct block **barray, **bp;
|
||||||
|
+ struct cleanup *back_to;
|
||||||
|
|
||||||
|
- pb = pending_blocks;
|
||||||
|
- pbnext = pb->next;
|
||||||
|
- swapped = 0;
|
||||||
|
+ for (pb = pending_blocks; pb != NULL; pb = pb->next)
|
||||||
|
+ count++;
|
||||||
|
|
||||||
|
- while (pbnext)
|
||||||
|
- {
|
||||||
|
- /* swap blocks if unordered! */
|
||||||
|
+ barray = xmalloc (sizeof (*barray) * count);
|
||||||
|
+ back_to = make_cleanup (xfree, barray);
|
||||||
|
|
||||||
|
- if (BLOCK_START (pb->block) < BLOCK_START (pbnext->block))
|
||||||
|
- {
|
||||||
|
- struct block *tmp = pb->block;
|
||||||
|
- pb->block = pbnext->block;
|
||||||
|
- pbnext->block = tmp;
|
||||||
|
- swapped = 1;
|
||||||
|
- }
|
||||||
|
- pb = pbnext;
|
||||||
|
- pbnext = pbnext->next;
|
||||||
|
- }
|
||||||
|
- }
|
||||||
|
- while (swapped);
|
||||||
|
+ bp = barray;
|
||||||
|
+ for (pb = pending_blocks; pb != NULL; pb = pb->next)
|
||||||
|
+ *bp++ = pb->block;
|
||||||
|
+
|
||||||
|
+ qsort (barray, count, sizeof (*barray), block_compar);
|
||||||
|
+
|
||||||
|
+ bp = barray;
|
||||||
|
+ for (pb = pending_blocks; pb != NULL; pb = pb->next)
|
||||||
|
+ pb->block = *bp++;
|
||||||
|
+
|
||||||
|
+ do_cleanups (back_to);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Cleanup any undefined types that have been left hanging around
|
@ -90,6 +90,7 @@ static int spawn (char **argv)
|
|||||||
termios.c_oflag = 0;
|
termios.c_oflag = 0;
|
||||||
termios.c_cflag = CS8 | CREAD | CLOCAL | HUPCL | B9600;
|
termios.c_cflag = CS8 | CREAD | CLOCAL | HUPCL | B9600;
|
||||||
termios.c_lflag = IEXTEN | NOFLSH;
|
termios.c_lflag = IEXTEN | NOFLSH;
|
||||||
|
termios.c_line = 0;
|
||||||
memset (termios.c_cc, _POSIX_VDISABLE, sizeof (termios.c_cc));
|
memset (termios.c_cc, _POSIX_VDISABLE, sizeof (termios.c_cc));
|
||||||
termios.c_cc[VTIME] = 0;
|
termios.c_cc[VTIME] = 0;
|
||||||
termios.c_cc[VMIN ] = 1;
|
termios.c_cc[VMIN ] = 1;
|
||||||
|
10
gdb.changes
10
gdb.changes
@ -1,3 +1,13 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Tue Jul 28 13:44:45 CEST 2009 - rguenther@suse.de
|
||||||
|
|
||||||
|
- Fix crash during debuginfo reading.
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Wed Jul 8 13:22:36 CEST 2009 - rguenther@suse.de
|
||||||
|
|
||||||
|
- Drop fixes done upstream.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Wed Jun 17 16:43:08 CEST 2009 - matz@suse.de
|
Wed Jun 17 16:43:08 CEST 2009 - matz@suse.de
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user