- Replace the PIE (Position Indepdent Executable) support patch by a new

one.
- Drop gdb-6.3-nonthreaded-wp-20050117.patch as fuzzy + redundant.
- Fix callback-mode readline-6.0 regression for CTRL-C.
- Fix syscall restarts for amd64->i386 biarch.
- Various testsuite results stability fixes.
- Fix crash on reading stabs on 64bit (BZ 537837).
- archer-jankratochvil-fedora12 commit:
    16276c1aad1366b92e687c72cab30192280e1906
- archer-jankratochvil-pie-fedora12 ct:
    2ae60b5156d43aabfe5757940eaf7b4370fb05d2
This commit is contained in:
Jan Kratochvil 2009-12-07 18:39:26 +00:00
parent e0f371ca6c
commit c5f8fe0a54
10 changed files with 3774 additions and 1481 deletions

View File

@ -1,119 +0,0 @@
[base]
2007-10-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* linux-nat.c (iterate_over_lwps): Fixed missing LWP initialization for
current INFERIOR_PTID.
2007-10-13 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/follow-child.exp, gdb.base/follow-child.c: New files.
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
2008-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.8pre.
2008-08-25 Jan Kratochvil <jan.kratochvil@redhat.com>
Remove the fix as causing an assertion failure for
gdb.base/checkpoint.exp and it is no longer needed for
gdb.base/follow-child.exp .
Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.c 2008-02-22 08:14:04.000000000 +0100
@@ -0,0 +1,29 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2007 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.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb@prep.ai.mit.edu */
+
+#include <unistd.h>
+
+int main()
+{
+ fork ();
+ sleep (60);
+ return 0;
+}
Index: gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8cvs20080219/gdb/testsuite/gdb.base/follow-child.exp 2008-02-22 08:14:17.000000000 +0100
@@ -0,0 +1,55 @@
+# Copyright 2007 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.
+
+if $tracelevel then {
+ strace $tracelevel
+}
+
+set prms_id 0
+set bug_id 0
+
+set testfile follow-child
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# For C programs, "start" should stop in main().
+
+gdb_test "set follow-fork-mode child" ""
+set test "started"
+# GDB_RUN_CMD already checks for `Starting program:'.
+gdb_run_cmd
+sleep 5
+send_gdb "\003"
+set test "break"
+gdb_test_multiple "" $test {
+ -re "Program received signal SIGINT.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "\\\[New process \[0-9\]+\\\]" {
+ fail $test
+ }
+}

File diff suppressed because it is too large Load Diff

View File

@ -436,7 +436,7 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp 2009-09-09 19:06:01.000000000 +0200
@@ -0,0 +1,432 @@
@@ -0,0 +1,433 @@
+# Copyright 1997, 1999, 2002 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
@ -817,7 +817,8 @@ Index: gdb-6.8.50.20090909/gdb/testsuite/gdb.pie/attach.exp
+ -re ".*warning: reading register.*I.*O error.*$gdb_prompt $" {
+ fail "attach call, read register 3 error"
+ }
+ -re "Attaching to.*process $testpid.*libc.*$gdb_prompt $" {
+ -re "Attaching to.*process $testpid.*$gdb_prompt $" {
+ # libc is relocated, not relocated, therefore not printed.
+ pass "attach call"
+ }
+ -re "$gdb_prompt $" {fail "attach call"}

View File

@ -262,3 +262,366 @@
## -1 +1 @@
-7.0
+7.0.0.20091030-cvs
http://sourceware.org/ml/gdb-patches/2009-11/msg00594.html
http://sourceware.org/ml/gdb-cvs/2009-11/msg00233.html
Subject: [patch] testsuite: bigcore.exp fuzzy PASS message fix
Hi,
seen needlessly fuzzy results:
-PASS: gdb.base/bigcore.exp: extract next heap (stop at 50)
-PASS: gdb.base/bigcore.exp: extract prev heap (stop at 50)
+PASS: gdb.base/bigcore.exp: extract next heap
+PASS: gdb.base/bigcore.exp: extract prev heap
but the .exp file just is not patient enough:
-Total of 4292375328 (0xffd87320) bytes bytes 53 chunks
+Total of 4292422432 (0xffd92b20) bytes bytes 41 chunks
Increased to 200. Tested on {x86_64,x86_64-m32}-fedora12-linux-gnu.
Thanks,
Jan
gdb/testsuite/
2009-11-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/bigcore.exp (extract_heap): Set $lim limit to 200.
--- a/gdb/testsuite/gdb.base/bigcore.exp
+++ b/gdb/testsuite/gdb.base/bigcore.exp
@@ -96,7 +96,7 @@ proc extract_heap { dir } {
}
-re " = \\(struct list \\*\\) (0x\[0-9a-f\]*).*$gdb_prompt $" {
set heap [concat $heap $expect_out(1,string)]
- if { $lim >= 50 } {
+ if { $lim >= 200 } {
pass "$test (stop at $lim)"
} else {
incr lim
http://sourceware.org/ml/gdb-patches/2009-11/msg00593.html
http://sourceware.org/ml/gdb-cvs/2009-12/msg00013.html
Subject: [patch] testcase: Fix spurious structs.exp FAILs
Hi,
There were some rare unreproducible fuzzy FAILs seen on i386 (32-bit) inferiors:
return foo2
The location at which to store the function's return value is unknown.
If you continue, the return value that you specified will be ignored.
Make fun2 return now? (y or n) y
#0 main () at /rpmbuild/BUILD/gdb-7.0/gdb/testsuite/gdb.base/structs.c:435
435 L2 = fun2();
(gdb) next
436 L3 = fun3();
(gdb) PASS: gdb.base/structs.exp: return foo<n>; return 2 structs-tf-td
p/c L2
-$4 = {a = -16 '\360', b = 0 '\000'}
-(gdb) PASS: gdb.base/structs.exp: value foo<n> returned; return 2 structs-tf-td
+$4 = {a = 44 ',', b = 0 '\000'}
+(gdb) FAIL: gdb.base/structs.exp: value foo<n> returned; return 2 structs-tf-td
Apparently
a = 44 ',',
does not match
a = \[^,\}\]*,
which is needed for cases where L2 (L*) remains uninitialized with random
content.
Alternative patch would just use regex `.*' and the whole new `chartest' and
`anychar_re' parts can be dropped.
Formerly 9s, now 11s, without the $first optimization it would cost 47s.
Testcase has been run on {x86_64,x86_64-m32}-fedora12-linux-gnu.
Thanks,
Jan
gdb/testsuite/
2009-11-29 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix spurious false FAILs.
* gdb.base/structs.c (chartest): New.
(main): Fill-in chartest.
* gdb.base/structs.exp (anychar_re, first): New.
(start_structs_test): Import global anychar_re and first.
New gdb_test call "set print elements 300; ${testfile}"
(start_structs_test <$first>): New block.
(any): Import global anychar_re. New variable ac. Use ${ac}.
--- a/gdb/testsuite/gdb.base/structs.c
+++ b/gdb/testsuite/gdb.base/structs.c
@@ -396,6 +396,8 @@ zed ()
L18.r = 'Z';
}
+static struct { char c; } chartest[256];
+
int main()
{
#ifdef usestubs
@@ -404,6 +406,10 @@ int main()
#endif
int i;
+ for (i = 0; i < 256; i++)
+ chartest[i].c = i;
+ chartest[0].c = 0; /* chartest-done */
+
Fun1(foo1);
Fun2(foo2);
Fun3(foo3);
--- a/gdb/testsuite/gdb.base/structs.exp
+++ b/gdb/testsuite/gdb.base/structs.exp
@@ -36,6 +36,9 @@ set testfile "structs"
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
+# Regex matching any value of `char' type like: a = 65 'A'
+set anychar_re {-?[0-9]{1,3} '(.|\\([0-7]{3}|[a-z]|\\|'))'}
+
# Create and source the file that provides information about the
# compiler used to compile the test case.
@@ -48,6 +51,7 @@ if [get_compiler_info ${binfile}] {
# the last TYPES field). Run the compmiled program up to "main".
# Also updates the global "testfile" to reflect the most recent build.
+set first 1
proc start_structs_test { types } {
global testfile
global srcfile
@@ -56,6 +60,8 @@ proc start_structs_test { types } {
global subdir
global srcdir
global gdb_prompt
+ global anychar_re
+ global first
# Create the additional flags
set flags "debug"
@@ -91,6 +97,8 @@ proc start_structs_test { types } {
"set print address off; ${testfile}"
gdb_test "set width 0" "" \
"set width 0; ${testfile}"
+ gdb_test "set print elements 300" "" \
+ "set print elements 300; ${testfile}"
# Advance to main
if { ![runto_main] } then {
@@ -100,6 +108,16 @@ proc start_structs_test { types } {
# Get the debug format
get_debug_format
+ # Limit the slow $anychar_re{256} matching for better performance.
+ if $first {
+ set first 0
+
+ # Verify $anychar_re can match all the values of `char' type.
+ gdb_breakpoint [gdb_get_line_number "chartest-done"]
+ gdb_continue_to_breakpoint "chartest-done" ".*chartest-done.*"
+ gdb_test "p chartest" "= {({c = ${anychar_re}}, ){255}{c = ${anychar_re}}}"
+ }
+
# check that at the struct containing all the relevant types is correct
set foo_t "type = struct struct[llength ${types}] \{"
for {set n 0} {$n<[llength ${types}]} {incr n} {
@@ -161,26 +179,28 @@ proc zed { n } {
}
proc any { n } {
- return [lindex {
- "{}"
- "{a = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*, n = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*, n = \[^,\}\]*, o = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*, n = \[^,\}\]*, o = \[^,\}\]*, p = \[^,\}\]*}"
- "{a = \[^,\}\]*, b = \[^,\}\]*, c = \[^,\}\]*, d = \[^,\}\]*, e = \[^,\}\]*, f = \[^,\}\]*, g = \[^,\}\]*, h = \[^,\}\]*, i = \[^,\}\]*, j = \[^,\}\]*, k = \[^,\}\]*, l = \[^,\}\]*, m = \[^,\}\]*, n = \[^,\}\]*, o = \[^,\}\]*, p = \[^,\}\]*, q = \[^,\}\]*}"
- } $n]
+ global anychar_re
+ set ac $anychar_re
+ return [lindex [list \
+ "{}" \
+ "{a = ${ac}}" \
+ "{a = ${ac}, b = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}, n = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}, n = ${ac}, o = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}, n = ${ac}, o = ${ac}, p = ${ac}}" \
+ "{a = ${ac}, b = ${ac}, c = ${ac}, d = ${ac}, e = ${ac}, f = ${ac}, g = ${ac}, h = ${ac}, i = ${ac}, j = ${ac}, k = ${ac}, l = ${ac}, m = ${ac}, n = ${ac}, o = ${ac}, p = ${ac}, q = ${ac}}" \
+ ] $n]
}
# Given N (0..25), return the corresponding alphabetic letter in lower
http://sourceware.org/ml/gdb-patches/2009-11/msg00573.html
http://sourceware.org/ml/gdb-cvs/2009-11/msg00232.html
Subject: [patch] testsuite fuzzy results fixup: foll-fork.exp
Hi,
one occasional timeout:
(gdb) PASS: gdb.base/foll-fork.exp: default show parent follow, no catchpoints
next 2
-callee: 9949
25 if (pid == 0) /* set breakpoint here */
-(gdb) PASS: gdb.base/foll-fork.exp: default parent follow, no catchpoints
+(gdb) callee: 18747
+FAIL: gdb.base/foll-fork.exp: (timeout) default parent follow, no catchpoints
Dropped the strings as there is no "callee" string expectation in
foll-fork.exp.
and with glibc-debuginfo installed one gets:
(gdb) break 39
Reading in symbols for ../nptl/sysdeps/unix/sysv/linux/fork.c...done.
Breakpoint 12 at 0x3ad22a4876: file ../nptl/sysdeps/unix/sysv/linux/fork.c, line 39.
(gdb) FAIL: gdb.base/foll-fork.exp: unpatch child, breakpoint at exit call
+
Breakpoint 12, __libc_fork () at ../nptl/sysdeps/unix/sysv/linux/fork.c:158
158 fresetlockfiles ();
(gdb) FAIL: gdb.base/foll-fork.exp: unpatch child, unpatched parent breakpoints from child (unknown output)
Thanks,
Jan
gdb/testsuite/
2009-11-26 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/foll-fork.exp (unpatch child, breakpoint at exit call):
Force $srcfile file.
* gdb.base/foll-fork.c (callee): Comment out the printf call.
--- a/gdb/testsuite/gdb.base/foll-fork.c
+++ b/gdb/testsuite/gdb.base/foll-fork.c
@@ -9,7 +9,8 @@ void callee (i)
int i;
#endif
{
- printf("callee: %d\n", i);
+ /* Any output corrupts GDB CLI expect strings.
+ printf("callee: %d\n", i); */
}
#ifdef PROTOTYPES
--- a/gdb/testsuite/gdb.base/foll-fork.exp
+++ b/gdb/testsuite/gdb.base/foll-fork.exp
@@ -240,7 +240,8 @@ proc catch_fork_unpatch_child {} {
# Delete all breakpoints and catchpoints.
delete_breakpoints
- gdb_test "break $bp_exit" \
+ # Force $srcfile as the current GDB source can be in glibc sourcetree.
+ gdb_test "break $srcfile:$bp_exit" \
"Breakpoint .*file .*$srcfile, line .*" \
"unpatch child, breakpoint at exit call"
http://sourceware.org/ml/gdb-patches/2009-11/msg00388.html
http://sourceware.org/ml/gdb-cvs/2009-11/msg00156.html
Subject: [patch] Fix crash on reading stabs
Hi,
there is a crash on reading stabs fpc binary:
https://bugzilla.redhat.com/show_bug.cgi?id=537837
Program received signal SIGSEGV, Segmentation fault.
0x000000000069db3d in read_dbx_symtab (objfile=0x1daf5f0) at dbxread.c:1369
1369 if ((namestring[0] == '-' && namestring[1] == 'l')
(gdb) p/x nlist.n_strx
$7 = 0xfffffff8
(gdb) p sizeof(nlist.n_strx)
$10 = 8
Below the patch context is:
namestring = (nlist->n_strx + file_string_table_offset
+ DBX_STRINGTAB (objfile));
so IMO the `(unsigned)' cast is excessive as it does not match the expression
below. Such cast is there since the GDB "Initial revision" (1999).
`n_strx' type:
struct internal_nlist
{
unsigned long n_strx; /* Index into string table of name. */
...
};
Regression tested on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu which does not
mean anything with the default DWARF debug info. It was hanging for stabs so
tried just a large part of gdb.base/*.exp on x86_64-m32 - `unix/-gstabs+/-m32'.
If it isn't obviously approved please feel free to drop it as one should not
use STABS in the first place.
Regards,
Jan
gdb/
2009-11-17 Jan Kratochvil <jan.kratochvil@redhat.com>
* dbxread.c (set_namestring): Remove cast to unsigned. Check N_STRX
overflow.
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -965,8 +965,9 @@ set_namestring (struct objfile *objfile, const struct internal_nlist *nlist)
{
char *namestring;
- if (((unsigned) nlist->n_strx + file_string_table_offset)
- >= DBX_STRINGTAB_SIZE (objfile))
+ if (nlist->n_strx + file_string_table_offset
+ >= DBX_STRINGTAB_SIZE (objfile)
+ || nlist->n_strx + file_string_table_offset < nlist->n_strx)
{
complaint (&symfile_complaints, _("bad string table offset in symbol %d"),
symnum);

290
gdb-archer-pie-addons.patch Normal file
View File

@ -0,0 +1,290 @@
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -5754,7 +5754,12 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
{
struct attribute *attr;
struct symbol *sym;
- CORE_ADDR base = (CORE_ADDR) 0;
+ struct objfile *objfile = cu->objfile;
+ CORE_ADDR baseaddr = ANOFFSET (objfile->section_offsets,
+ SECT_OFF_TEXT (objfile));
+ /* This is used only for DW_AT_data_member_location entries. */
+ CORE_ADDR base = 0;
+ int base_p = 0;
attr = dwarf2_attr (die, DW_AT_location, cu);
if (attr)
@@ -5763,6 +5768,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
if (attr_form_is_block (attr))
{
base = decode_locdesc (DW_BLOCK (attr), cu);
+ base_p = 1;
}
else if (attr_form_is_section_offset (attr))
{
@@ -5824,12 +5830,15 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
else
dwarf2_complex_location_expr_complaint ();
- SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset;
+ if (!base_p)
+ dwarf2_invalid_attrib_class_complaint
+ ("DW_AT_data_member_location", "common block member");
+ SYMBOL_VALUE_ADDRESS (sym) = base + byte_offset + baseaddr;
add_symbol_to_list (sym, &global_symbols);
}
if (SYMBOL_CLASS (sym) == LOC_STATIC)
- SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym));
+ SET_FIELD_PHYSADDR (*field, SYMBOL_VALUE_ADDRESS (sym) - baseaddr);
else
SET_FIELD_PHYSNAME (*field, SYMBOL_LINKAGE_NAME (sym));
FIELD_TYPE (*field) = SYMBOL_TYPE (sym);
@@ -5843,7 +5852,7 @@ read_common_block (struct die_info *die, struct dwarf2_cu *cu)
sym = new_symbol (die, type, cu);
/* SYMBOL_VALUE_ADDRESS never gets used as all its fields are static. */
- SYMBOL_VALUE_ADDRESS (sym) = base;
+ SYMBOL_VALUE_ADDRESS (sym) = base + baseaddr;
set_die_type (die, type, cu);
}
--- a/gdb/exec.c
+++ b/gdb/exec.c
@@ -32,6 +32,7 @@
#include "exec.h"
#include "observer.h"
#include "arch-utils.h"
+#include "solib.h"
#include <fcntl.h>
#include "readline/readline.h"
@@ -220,6 +221,10 @@ exec_file_attach (char *filename, int from_tty)
char *scratch_pathname;
int scratch_chan;
struct target_section *sections = NULL, *sections_end = NULL;
+ struct target_section *p;
+ int addr_bit;
+ CORE_ADDR mask = CORE_ADDR_MAX;
+ CORE_ADDR displacement;
scratch_chan = openp (getenv ("PATH"), OPF_TRY_CWD_FIRST, filename,
write_files ? O_RDWR | O_BINARY : O_RDONLY | O_BINARY,
@@ -288,12 +293,23 @@ exec_file_attach (char *filename, int from_tty)
scratch_pathname, bfd_errmsg (bfd_get_error ()));
}
+ set_gdbarch_from_file (exec_bfd);
+
+ addr_bit = gdbarch_addr_bit (target_gdbarch);
+ if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
+ mask = ((CORE_ADDR) 1 << addr_bit) - 1;
+
+ displacement = solib_exec_displacement ();
+ for (p = sections; p < sections_end; p++)
+ {
+ p->addr = (p->addr + displacement) & mask;
+ p->endaddr = (p->endaddr + displacement) & mask;
+ }
+
exec_bfd_mtime = bfd_get_mtime (exec_bfd);
validate_files ();
- set_gdbarch_from_file (exec_bfd);
-
/* Add the executable's sections to the current address spaces'
list of sections. */
add_target_sections (sections, sections_end);
--- a/gdb/gdbtypes.h
+++ b/gdb/gdbtypes.h
@@ -966,6 +966,7 @@ extern void allocate_cplus_struct_type (struct type *);
#define FIELD_LOC_KIND(thisfld) ((thisfld).loc_kind)
#define FIELD_BITPOS(thisfld) ((thisfld).loc.bitpos)
#define FIELD_STATIC_PHYSNAME(thisfld) ((thisfld).loc.physname)
+/* This address is unrelocated by the objfile's ANOFFSET. */
#define FIELD_STATIC_PHYSADDR(thisfld) ((thisfld).loc.physaddr)
#define FIELD_DWARF_BLOCK(thisfld) ((thisfld).loc.dwarf_block)
#define SET_FIELD_BITPOS(thisfld, bitpos) \
@@ -974,6 +975,7 @@ extern void allocate_cplus_struct_type (struct type *);
#define SET_FIELD_PHYSNAME(thisfld, name) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSNAME, \
FIELD_STATIC_PHYSNAME (thisfld) = (name))
+/* This address is unrelocated by the objfile's ANOFFSET. */
#define SET_FIELD_PHYSADDR(thisfld, addr) \
(FIELD_LOC_KIND (thisfld) = FIELD_LOC_KIND_PHYSADDR, \
FIELD_STATIC_PHYSADDR (thisfld) = (addr))
@@ -989,6 +991,7 @@ extern void allocate_cplus_struct_type (struct type *);
#define TYPE_FIELD_LOC_KIND(thistype, n) FIELD_LOC_KIND (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_BITPOS(thistype, n) FIELD_BITPOS (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_STATIC_PHYSNAME(thistype, n) FIELD_STATIC_PHYSNAME (TYPE_FIELD (thistype, n))
+/* This address is unrelocated by the objfile's ANOFFSET. */
#define TYPE_FIELD_STATIC_PHYSADDR(thistype, n) FIELD_STATIC_PHYSADDR (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_DWARF_BLOCK(thistype, n) FIELD_DWARF_BLOCK (TYPE_FIELD (thistype, n))
#define TYPE_FIELD_ARTIFICIAL(thistype, n) FIELD_ARTIFICIAL(TYPE_FIELD(thistype,n))
--- a/gdb/jv-lang.c
+++ b/gdb/jv-lang.c
@@ -416,7 +416,8 @@ java_link_class_type (struct gdbarch *gdbarch,
fields = NULL;
nfields--; /* First set up dummy "class" field. */
- SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas));
+ SET_FIELD_PHYSADDR (TYPE_FIELD (type, nfields), value_address (clas)
+ - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
TYPE_FIELD_NAME (type, nfields) = "class";
TYPE_FIELD_TYPE (type, nfields) = value_type (clas);
SET_TYPE_FIELD_PRIVATE (type, nfields);
@@ -462,7 +463,8 @@ java_link_class_type (struct gdbarch *gdbarch,
SET_TYPE_FIELD_PROTECTED (type, i);
}
if (accflags & 0x0008) /* ACC_STATIC */
- SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset);
+ SET_FIELD_PHYSADDR (TYPE_FIELD (type, i), boffset
+ - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
else
TYPE_FIELD_BITPOS (type, i) = 8 * boffset;
if (accflags & 0x8000) /* FIELD_UNRESOLVED_FLAG */
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1621,7 +1621,10 @@ svr4_exec_displacement (void)
if (target_auxv_search (&current_target, AT_ENTRY, &entry_point) == 1)
return entry_point - exec_entry_point (exec_bfd, &current_target);
- return svr4_static_exec_displacement ();
+ if (!ptid_equal (inferior_ptid, null_ptid))
+ return svr4_static_exec_displacement ();
+
+ return 0;
}
/* Relocate the main executable. This function should be called upon
@@ -1632,7 +1635,7 @@ svr4_exec_displacement (void)
static void
svr4_relocate_main_executable (void)
{
- CORE_ADDR displacement = svr4_exec_displacement ();
+ CORE_ADDR displacement = solib_exec_displacement ();
/* Even if DISPLACEMENT is 0 still try to relocate it as this is a new
difference of in-memory vs. in-file addresses and we could already
@@ -1975,6 +1978,7 @@ _initialize_svr4_solib (void)
svr4_so_ops.free_so = svr4_free_so;
svr4_so_ops.clear_solib = svr4_clear_solib;
svr4_so_ops.solib_create_inferior_hook = svr4_solib_create_inferior_hook;
+ svr4_so_ops.exec_displacement = svr4_exec_displacement;
svr4_so_ops.special_symbol_handling = svr4_special_symbol_handling;
svr4_so_ops.current_sos = svr4_current_sos;
svr4_so_ops.open_symbol_file_object = open_symbol_file_object;
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1014,6 +1014,19 @@ solib_create_inferior_hook (int from_tty)
ops->solib_create_inferior_hook (from_tty);
}
+/* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs. */
+
+CORE_ADDR
+solib_exec_displacement (void)
+{
+ struct target_so_ops *ops = solib_ops (target_gdbarch);
+
+ if (ops->exec_displacement != NULL)
+ return (*ops->exec_displacement) ();
+ else
+ return 0;
+}
+
/* GLOBAL FUNCTION
in_solib_dynsym_resolve_code -- check to see if an address is in
--- a/gdb/solib.h
+++ b/gdb/solib.h
@@ -43,6 +43,8 @@ extern int solib_read_symbols (struct so_list *, int);
extern void solib_create_inferior_hook (int from_tty);
+extern CORE_ADDR solib_exec_displacement (void);
+
/* If ADDR lies in a shared library, return its name. */
extern char *solib_name_from_address (CORE_ADDR);
--- a/gdb/solist.h
+++ b/gdb/solist.h
@@ -89,6 +89,9 @@ struct target_so_ops
/* Target dependent code to run after child process fork. */
void (*solib_create_inferior_hook) (int from_tty);
+ /* Query the difference of in-memory VMA addresses vs. exec_bfd VMAs. */
+ CORE_ADDR (*exec_displacement) (void);
+
/* Do additional symbol handling, lookup, etc. after symbols
for a shared object have been loaded. */
void (*special_symbol_handling) (void);
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -873,15 +873,36 @@ syms_from_objfile (struct objfile *objfile,
if an error occurs during symbol reading. */
old_chain = make_cleanup_free_objfile (objfile);
- /* If ADDRS and OFFSETS are both NULL, put together a dummy address
- list. We now establish the convention that an addr of zero means
- no load address was specified. */
+ /* If ADDRS and OFFSETS are both NULL, put together a dummy offset list. */
+
if (! addrs && ! offsets)
{
- local_addr
- = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
- make_cleanup (xfree, local_addr);
- addrs = local_addr;
+ /* Relocateble files have an exception in default_symfile_offsets which
+ applies only for ADDRS. But calling solib_exec_displacement is more
+ suitable for OFFSETS. Fortunately we never need the both
+ functionalities simultaneously and in other cases zeroed ADDRS and
+ zeroed OFFSETS are equivalent. */
+
+ if ((bfd_get_file_flags (objfile->obfd) & (EXEC_P | DYNAMIC)) == 0)
+ {
+ local_addr
+ = alloc_section_addr_info (bfd_count_sections (objfile->obfd));
+ make_cleanup (xfree, local_addr);
+ addrs = local_addr;
+ }
+ else
+ {
+ CORE_ADDR displacement = 0;
+ int i;
+
+ if (mainline)
+ displacement = solib_exec_displacement ();
+
+ num_offsets = bfd_count_sections (objfile->obfd);
+ offsets = alloca (SIZEOF_N_SECTION_OFFSETS (num_offsets));
+ for (i = 0; i < num_offsets; i++)
+ offsets->offsets[i] = displacement;
+ }
}
/* Now either addrs or offsets is non-zero. */
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1890,7 +1890,8 @@ value_static_field (struct type *type, int fieldno)
if (TYPE_FIELD_LOC_KIND (type, fieldno) == FIELD_LOC_KIND_PHYSADDR)
{
retval = value_at (TYPE_FIELD_TYPE (type, fieldno),
- TYPE_FIELD_STATIC_PHYSADDR (type, fieldno));
+ TYPE_FIELD_STATIC_PHYSADDR (type, fieldno)
+ + (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
}
else
{
@@ -1920,7 +1921,8 @@ value_static_field (struct type *type, int fieldno)
}
if (retval && VALUE_LVAL (retval) == lval_memory)
SET_FIELD_PHYSADDR (TYPE_FIELD (type, fieldno),
- value_address (retval));
+ value_address (retval)
+ - (TYPE_OBJFILE (type) == NULL ? 0 : ANOFFSET (TYPE_OBJFILE (type)->section_offsets, SECT_OFF_TEXT (TYPE_OBJFILE (type)))));
}
return retval;
}

2647
gdb-archer-pie.patch Normal file

File diff suppressed because it is too large Load Diff

View File

@ -2,7 +2,7 @@ http://sourceware.org/gdb/wiki/ProjectArcher
http://sourceware.org/gdb/wiki/ArcherBranchManagement
GIT snapshot:
commit 6817a81cd411acc9579f04dcc105e9bce72859ff
commit 16276c1aad1366b92e687c72cab30192280e1906
branch `archer' - the merge of branches:
archer-tromey-call-frame-cfa
@ -12245,10 +12245,22 @@ index a84003f..924c1c5 100644
default_symfile_offsets, /* sym_offsets: dummy FIXME til implem sym reloc */
default_symfile_segments, /* sym_segments: Get segment information from
diff --git a/gdb/objfiles.c b/gdb/objfiles.c
index 8dcca70..4b25a5a 100644
index 8dcca70..e5442ca 100644
--- a/gdb/objfiles.c
+++ b/gdb/objfiles.c
@@ -731,6 +731,20 @@ have_partial_symbols (void)
@@ -634,6 +634,11 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
}
}
+ /* Alread QUICK_ADDRMAP tiself assumes all sections have the same offset. */
+ if (objfile->quick_addrmap)
+ addrmap_relocate (objfile->quick_addrmap,
+ ANOFFSET (delta, SECT_OFF_TEXT (objfile)));
+
{
struct partial_symbol **psym;
@@ -731,6 +736,20 @@ have_partial_symbols (void)
if (objfile_has_partial_symbols (ofp))
return 1;
}

View File

@ -0,0 +1,312 @@
http://sourceware.org/ml/gdb-patches/2009-11/msg00596.html
Subject: [gdb FYI-patch] callback-mode readline-6.0 regression
Hi Chet,
FSF GDB currently ships bundled with readline-5.2 which works fine.
But using --with-system-readline and readline-6.0-patchlevel4 has
a regression:
readline-5.2: Run `gdb -nx -q' and type CTRL-C:
(gdb) Quit
(gdb) _
readline-6.0: Run `gdb -nx -q' and type CTRL-C:
(gdb) _
= nothing happens (it gets buffered and executed later)
(It does also FAIL on gdb.gdb/selftest.exp.)
It is because GDB waits in its own poll() mainloop and readline uses via
rl_callback_handler_install and rl_callback_handler_remove. This way the
readline internal variable _rl_interrupt_immediately remains 0 and CTRL-C gets
only stored to _rl_caught_signal but not executed.
Seen in rl_signal_handler even if _rl_interrupt_immediately is set and
_rl_handle_signal is called then the signal is still stored to
_rl_caught_signal. In the _rl_interrupt_immediately case it should not be
stored when it was already processed.
rl_signal_handler does `_rl_interrupt_immediately = 0;' - while I am not aware
of its meaning it breaks the nest-counting of other routines which do
`_rl_interrupt_immediately++;' and `_rl_interrupt_immediately--;' possibly
creating problematic `_rl_interrupt_immediately == -1'.
`_rl_interrupt_immediately' is an internal variable, how it could be accessed
by a readline application? (OK, maybe it should not be used.)
Attaching a current GDB-side patch but it must access readline internal
variable _rl_caught_signal and it is generally just a workaround. Could you
please include support for signals in this asynchronous mode in readline-6.1?
I find it would be enough to make RL_CHECK_SIGNALS public?
GDB: No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
But this is not a patch intended to be accepted.
Thanks,
Jan
gdb/
2009-11-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* config.in, configure: Regenerate.
* configure.ac (for readline_echoing_p): Move inside $LIBS change.
(for _rl_caught_signal): New.
* event-loop.c: Include readline/readline.h.
(gdb_do_one_event) [HAVE_READLINE_CAUGHT_SIGNAL]: New.
gdb/testsuite/
2009-11-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.gdb/selftest.exp (backtrace through signal handler): Move before
SIGINT pass, drop the timeout case.
(send SIGINT signal to child process): Use gdb_test.
(backtrace through readline handler): New.
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -351,6 +351,9 @@
/* Define if Python interpreter is being linked in. */
#undef HAVE_PYTHON
+/* readline-6.0 workaround of blocked signals. */
+#undef HAVE_READLINE_CAUGHT_SIGNAL
+
/* Define to 1 if you have the `realpath' function. */
#undef HAVE_REALPATH
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -539,17 +539,25 @@ if test "$with_system_readline" = yes; then
# readline-6.0 started to use the name `_rl_echoing_p'.
# `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
- AC_MSG_CHECKING([for readline_echoing_p])
save_LIBS=$LIBS
LIBS="$LIBS $READLINE"
+ AC_MSG_CHECKING([for readline_echoing_p])
AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int readline_echoing_p;
return readline_echoing_p;]]),
[READLINE_ECHOING_P=yes],
[READLINE_ECHOING_P=no
AC_DEFINE([readline_echoing_p], [_rl_echoing_p],
[readline-6.0 started to use different name.])])
- LIBS="$save_LIBS"
AC_MSG_RESULT([$READLINE_ECHOING_P])
+ AC_MSG_CHECKING([for _rl_caught_signal])
+ AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int volatile _rl_caught_signal;
+ return _rl_caught_signal;]]),
+ [READLINE_CAUGHT_SIGNAL=yes
+ AC_DEFINE([HAVE_READLINE_CAUGHT_SIGNAL],,
+ [readline-6.0 workaround of blocked signals.])],
+ [READLINE_CAUGHT_SIGNAL=no])
+ AC_MSG_RESULT([$READLINE_CAUGHT_SIGNAL])
+ LIBS="$save_LIBS"
else
READLINE='$(READLINE_DIR)/libreadline.a'
READLINE_DEPS='$(READLINE)'
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -37,6 +37,7 @@
#include "exceptions.h"
#include "gdb_assert.h"
#include "gdb_select.h"
+#include "readline/readline.h"
/* Data point to pass to the event handler. */
typedef union event_data
@@ -411,6 +412,9 @@ gdb_do_one_event (void *data)
static int event_source_head = 0;
const int number_of_sources = 3;
int current = 0;
+#ifdef HAVE_READLINE_CAUGHT_SIGNAL
+ extern int volatile _rl_caught_signal;
+#endif
/* Any events already waiting in the queue? */
if (process_event ())
@@ -455,6 +459,16 @@ gdb_do_one_event (void *data)
if (gdb_wait_for_event (1) < 0)
return -1;
+#ifdef HAVE_READLINE_CAUGHT_SIGNAL
+ if (async_command_editing_p && RL_ISSTATE (RL_STATE_CALLBACK)
+ && _rl_caught_signal)
+ {
+ /* Call RL_CHECK_SIGNALS this way. */
+ rl_callback_handler_remove ();
+ rl_callback_handler_install (NULL, input_handler);
+ }
+#endif
+
/* Handle any new events occurred while waiting. */
if (process_event ())
return 1;
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -464,31 +464,42 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\
fail "$description (timeout)"
}
}
-
- set description "send SIGINT signal to child process"
- send_gdb "signal SIGINT\n"
- gdb_expect {
- -re "Continuing with signal SIGINT.*$gdb_prompt $" {
+
+ # get a stack trace with the poll function
+ #
+ # This fails on some linux systems for unknown reasons. On the
+ # systems where it fails, sometimes it works fine when run manually.
+ # The testsuite failures may not be limited to just aout systems.
+ setup_xfail "i*86-pc-linuxaout-gnu"
+ set description "backtrace through signal handler"
+ gdb_test_multiple "backtrace" $description {
+ -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
pass "$description"
}
-re ".*$gdb_prompt $" {
+ # On the alpha, we hit the infamous problem about gdb
+ # being unable to get the frame pointer (mentioned in
+ # gdb/README). As it is intermittent, there is no way to
+ # XFAIL it which will give us an XPASS if the problem goes
+ # away.
+ setup_xfail "alpha*-*-osf*"
fail "$description"
}
- timeout {
- fail "$description (timeout)"
- }
}
- # get a stack trace
+ gdb_test "signal SIGINT" "Continuing with signal SIGINT.*" \
+ "send SIGINT signal to child process"
+
+ # get a stack trace being redelivered by readline
#
# This fails on some linux systems for unknown reasons. On the
# systems where it fails, sometimes it works fine when run manually.
# The testsuite failures may not be limited to just aout systems.
+ # Optional system readline may not have symbols to be shown.
setup_xfail "i*86-pc-linuxaout-gnu"
- set description "backtrace through signal handler"
- send_gdb "backtrace\n"
- gdb_expect {
- -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
+ set description "backtrace through readline handler"
+ gdb_test_multiple "backtrace" $description {
+ -re "#0.*gdb_do_one_event.*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
pass "$description"
}
-re ".*$gdb_prompt $" {
@@ -500,9 +510,6 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\
setup_xfail "alpha*-*-osf*"
fail "$description"
}
- timeout {
- fail "$description (timeout)"
- }
}
--- gdb-7.0/gdb/configure 2009-12-07 18:53:30.000000000 +0100
+++ gdb-7.0-x/gdb/configure 2009-12-07 18:53:14.000000000 +0100
@@ -9201,15 +9201,11 @@ if test "$with_system_readline" = yes; t
# readline-6.0 started to use the name `_rl_echoing_p'.
# `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
- echo "$as_me:$LINENO: checking for readline_echoing_p" >&5
-echo $ECHO_N "checking for readline_echoing_p... $ECHO_C" >&6
save_LIBS=$LIBS
LIBS="$LIBS $READLINE"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5
+$as_echo_n "checking for readline_echoing_p... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -9221,45 +9217,45 @@ extern int readline_echoing_p;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"; then :
READLINE_ECHOING_P=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ READLINE_ECHOING_P=no
-READLINE_ECHOING_P=no
+$as_echo "#define readline_echoing_p _rl_echoing_p" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_ECHOING_P" >&5
+$as_echo "$READLINE_ECHOING_P" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _rl_caught_signal" >&5
+$as_echo_n "checking for _rl_caught_signal... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
-cat >>confdefs.h <<\_ACEOF
-#define readline_echoing_p _rl_echoing_p
+int
+main ()
+{
+extern int volatile _rl_caught_signal;
+ return _rl_caught_signal;
+ ;
+ return 0;
+}
_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ READLINE_CAUGHT_SIGNAL=yes
+
+$as_echo "#define HAVE_READLINE_CAUGHT_SIGNAL /**/" >>confdefs.h
+else
+ READLINE_CAUGHT_SIGNAL=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_CAUGHT_SIGNAL" >&5
+$as_echo "$READLINE_CAUGHT_SIGNAL" >&6; }
LIBS="$save_LIBS"
- echo "$as_me:$LINENO: result: $READLINE_ECHOING_P" >&5
-echo "${ECHO_T}$READLINE_ECHOING_P" >&6
else
READLINE='$(READLINE_DIR)/libreadline.a'
READLINE_DEPS='$(READLINE)'

View File

@ -0,0 +1,121 @@
http://sourceware.org/ml/gdb-patches/2009-11/msg00592.html
Subject: [patch] Fix syscall restarts for amd64->i386 biarch
Hi,
tested only on recent Linux kernels, it should apply also on vanilla ones.
There were various changes of the kernels behavior in the past.
FSF GDB HEAD state:
kernel debugger inferior state
x86_64 x86_64 x86_64 PASS
x86_64 x86_64 i386 FAIL without this patch, PASS with this patch
x86_64 i386 i386 PASS on recent kernels
(FAIL: kernel-2.6.31.5-127.fc12.x86_64 - Fedora 12)
(PASS: kernel-2.6.32-0.55.rc8.git1.fc13.x86_64)
i386 i386 i386 PASS
Currently gdb.base/interrupt.exp fails on amd64 host running under
--target_board unix/-m32 with:
continue
Continuing.
Unknown error 512
<linux/errno.h>:
/*
* These should never be seen by user programs. To return one of ERESTART*
* codes, signal_pending() MUST be set. Note that ptrace can observe these
* at syscall exit tracing, but they will never be left for the debugged user
* process to see.
*/
#define ERESTARTSYS 512
"Unknown error 512" printed above is printed by the inferior itself, not by GDB.
It is because GDB reads it as 0xfffffffffffffe00 but writes it back as
0xfffffe00.
+ /* Sign-extend %eax as during return from a syscall it is being checked
+ for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by
+ interrupt.exp. */
Quote of Roland McGrath from IRC:
roland: in the user_regset model, there are 64-bit user_regset flavors and
32-bit user_regset flavors, so at the kabi level the (kernel) caller can say
what it means: calls on the 32-bit user_regset flavor will behave as if on
a 32-bit kernel/userland. in ptrace, there is no way for x86_64 ptrace calls
to say "i think of the inferior as being 32 bits, so act accordingly" (tho ppc
and/or sparc have ptr
roland: ace requests that do that iirc)
roland: ergo 64-bit ptrace callers must either save/restore full 64-bits so
the kernel's sign-extension choices are preserved, or else grok magic ways to
expand stored 32-bit register contents to 64-bit values to stuff via 64-bit
ptrace
[...]
roland: there is a "32-bit-flavored task", but it's not really true that it
has 32-bit registers. there is no 32-bit-only userland condition. any task
can always ljmp to the 64-bit code segment and run 64-bit insns including
a 64-bit syscall
roland: so a 64-bit debugger should see and be able to fiddle the full
registers. it can even change cs via ptrace to force the inferior into
running 32 or 64 bit code.
Saving whole 64bits for i386 targets on x86_64 hosts does not much match the
GDB architecture as `struct type' for these registers still should be 32bit
etc. Therefore provided just this exception.
The problem is reproducible only if one does an inferior call during the
interruption to do full inferior save/restore from GDB regcache.
Regression tested on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/
2009-11-29 Jan Kratochvil <jan.kratochvil@redhat.com>
* amd64-nat.c (amd64_collect_native_gregset): Do not pre-clear %eax.
Sign extend it afterwards.
--- a/gdb/amd64-nat.c
+++ b/gdb/amd64-nat.c
@@ -131,9 +131,9 @@ amd64_collect_native_gregset (const struct regcache *regcache,
{
num_regs = amd64_native_gregset32_num_regs;
- /* Make sure %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and
+ /* Make sure %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and
%eip get zero-extended to 64 bits. */
- for (i = 0; i <= I386_EIP_REGNUM; i++)
+ for (i = I386_ECX_REGNUM; i <= I386_EIP_REGNUM; i++)
{
if (regnum == -1 || regnum == i)
memset (regs + amd64_native_gregset_reg_offset (gdbarch, i), 0, 8);
@@ -159,4 +159,20 @@ amd64_collect_native_gregset (const struct regcache *regcache,
regcache_raw_collect (regcache, i, regs + offset);
}
}
+
+ if (gdbarch_ptr_bit (gdbarch) == 32)
+ {
+ /* Sign-extend %eax as during return from a syscall it is being checked
+ for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by
+ interrupt.exp. */
+
+ int i = I386_EAX_REGNUM;
+
+ if (regnum == -1 || regnum == i)
+ {
+ void *ptr = regs + amd64_native_gregset_reg_offset (gdbarch, i);
+
+ *(int64_t *) ptr = *(int32_t *) ptr;
+ }
+ }
}

View File

@ -14,7 +14,7 @@ Version: 7.0
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 8%{?_with_upstream:.upstream}%{?dist}
Release: 9%{?_with_upstream:.upstream}%{?dist}
License: GPLv3+
Group: Development/Debuggers
@ -92,14 +92,12 @@ Patch118: gdb-6.3-gstack-20050411.patch
# VSYSCALL and PIE
Patch122: gdb-6.3-test-pie-20050107.patch
Patch124: gdb-6.3-pie-20050110.patch
Patch124: gdb-archer-pie.patch
Patch389: gdb-archer-pie-addons.patch
# Get selftest working with sep-debug-info
Patch125: gdb-6.3-test-self-20050110.patch
# Fix for non-threaded watchpoints.
Patch128: gdb-6.3-nonthreaded-wp-20050117.patch
# Test support of multiple destructors just like multiple constructors
Patch133: gdb-6.3-test-dtorfix-20050121.patch
@ -377,6 +375,12 @@ Patch387: gdb-bz539590-gnu-ifunc.patch
# Fix bp conditionals [bp_location-accel] regression (Phil Muldoon, BZ 538626).
Patch388: gdb-bz538626-bp_location-accel-bp-cond.patch
# Fix callback-mode readline-6.0 regression for CTRL-C.
Patch390: gdb-readline-6.0-signal.patch
# Fix syscall restarts for amd64->i386 biarch.
Patch391: gdb-x86_64-i386-syscall-restart.patch
BuildRequires: ncurses-devel texinfo gettext flex bison expat-devel
Requires: readline
BuildRequires: readline-devel
@ -475,6 +479,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch383 -p1
%patch384 -p1
%patch385 -p1
%patch124 -p1
%patch1 -p1
%patch3 -p1
@ -486,7 +491,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch118 -p1
%patch122 -p1
%patch125 -p1
%patch128 -p1
%patch133 -p1
%patch136 -p1
%patch140 -p1
@ -579,7 +583,9 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch382 -p1
%patch387 -p1
%patch388 -p1
%patch124 -p1
%patch389 -p1
%patch390 -p1
%patch391 -p1
find -name "*.orig" | xargs rm -f
! find -name "*.rej" # Should not happen.
@ -884,6 +890,16 @@ fi
%endif
%changelog
* Mon Dec 7 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0-9.fc12
- Replace the PIE (Position Indepdent Executable) support patch by a new one.
- Drop gdb-6.3-nonthreaded-wp-20050117.patch as fuzzy + redundant.
- Fix callback-mode readline-6.0 regression for CTRL-C.
- Fix syscall restarts for amd64->i386 biarch.
- Various testsuite results stability fixes.
- Fix crash on reading stabs on 64bit (BZ 537837).
- archer-jankratochvil-fedora12 commit: 16276c1aad1366b92e687c72cab30192280e1906
- archer-jankratochvil-pie-fedora12 ct: 2ae60b5156d43aabfe5757940eaf7b4370fb05d2
* Thu Dec 3 2009 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.0-8.fc12
- Fix slowness/hang when printing some variables (Sami Wagiaalla, BZ 541093).
- archer-jankratochvil-fedora12 commit: 6817a81cd411acc9579f04dcc105e9bce72859ff